Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 304310
b: refs/heads/master
c: 8c287d2
h: refs/heads/master
v: v3
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Apr 10, 2012
1 parent f954135 commit 6638b34
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ac1a4f2caf7b071a56ca10a48673a37b762f7ac7
refs/heads/master: 8c287d2053c28b838de557ce5319acbd6e4bb627
25 changes: 21 additions & 4 deletions trunk/drivers/staging/comedi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,18 @@ config COMEDI_PCM3730
To compile this driver as a module, choose M here: the module will be
called pcm3730.

config COMEDI_AMPLC_DIO200_ISA
tristate "Amplicon PC212E/PC214E/PC215E/PC218E/PC272E"
select COMEDI_AMPLC_DIO200
depends on COMEDI_ISA_DRIVERS
default N
---help---
Enable support for Amplicon PC212E, PC214E, PC215E, PC218E and
PC272E ISA DIO boards

To compile this driver as a module, choose M here: the module will be
called amplc_dio200.

config COMEDI_RTI800
tristate "Analog Devices RTI-800/815 ISA card support"
default N
Expand Down Expand Up @@ -772,12 +784,12 @@ config COMEDI_ADV_PCI_DIO
To compile this driver as a module, choose M here: the module will be
called adv_pci_dio.

config COMEDI_AMPLC_DIO200
tristate "Amplicon PC272E and PCI272 DIO board support"
select COMEDI_8255
config COMEDI_AMPLC_DIO200_PCI
tristate "Amplicon PCI215 and PCI272 DIO board support"
select COMEDI_AMPLC_DIO200
default N
---help---
Enable support for Amplicon PC272E and PCI272 DIO boards
Enable support for Amplicon PCI215 and PCI272 DIO boards.

To compile this driver as a module, choose M here: the module will be
called amplc_dio200.
Expand Down Expand Up @@ -1382,3 +1394,8 @@ config COMEDI_FC

To compile this driver as a module, choose M here: the module will be
called comedi_fc.

config COMEDI_AMPLC_DIO200
def_tristate N
depends on COMEDI
select COMEDI_8255
77 changes: 53 additions & 24 deletions trunk/drivers/staging/comedi/drivers/amplc_dio200.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ order they appear in the channel list.

#define DIO200_DRIVER_NAME "amplc_dio200"

#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA_MODULE
#define CONFIG_COMEDI_AMPLC_DIO200_ISA
#endif

#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI_MODULE
#define CONFIG_COMEDI_AMPLC_DIO200_PCI
#endif

/* PCI IDs */
#define PCI_VENDOR_ID_AMPLICON 0x14dc
#define PCI_DEVICE_ID_AMPLICON_PCI272 0x000a
Expand Down Expand Up @@ -274,10 +282,14 @@ enum dio200_model {
};

enum dio200_layout {
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
pc212_layout,
pc214_layout,
#endif
pc215_layout,
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
pc218_layout,
#endif
pc272_layout
};

Expand All @@ -290,6 +302,7 @@ struct dio200_board {
};

static const struct dio200_board dio200_boards[] = {
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
{
.name = "pc212e",
.bustype = isa_bustype,
Expand All @@ -308,15 +321,6 @@ static const struct dio200_board dio200_boards[] = {
.model = pc215e_model,
.layout = pc215_layout,
},
#ifdef CONFIG_COMEDI_PCI
{
.name = "pci215",
.devid = PCI_DEVICE_ID_AMPLICON_PCI215,
.bustype = pci_bustype,
.model = pci215_model,
.layout = pc215_layout,
},
#endif
{
.name = "pc218e",
.bustype = isa_bustype,
Expand All @@ -329,16 +333,22 @@ static const struct dio200_board dio200_boards[] = {
.model = pc272e_model,
.layout = pc272_layout,
},
#ifdef CONFIG_COMEDI_PCI
#endif
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
{
.name = "pci215",
.devid = PCI_DEVICE_ID_AMPLICON_PCI215,
.bustype = pci_bustype,
.model = pci215_model,
.layout = pc215_layout,
},
{
.name = "pci272",
.devid = PCI_DEVICE_ID_AMPLICON_PCI272,
.bustype = pci_bustype,
.model = pci272_model,
.layout = pc272_layout,
},
#endif
#ifdef CONFIG_COMEDI_PCI
{
.name = DIO200_DRIVER_NAME,
.devid = PCI_DEVICE_ID_INVALID,
Expand Down Expand Up @@ -367,6 +377,7 @@ struct dio200_layout_struct {
};

static const struct dio200_layout_struct dio200_layouts[] = {
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
[pc212_layout] = {
.n_subdevs = 6,
.sdtype = {sd_8255, sd_8254, sd_8254, sd_8254,
Expand All @@ -385,6 +396,7 @@ static const struct dio200_layout_struct dio200_layouts[] = {
.has_int_sce = 0,
.has_clk_gat_sce = 0,
},
#endif
[pc215_layout] = {
.n_subdevs = 5,
.sdtype = {sd_8255, sd_8255, sd_8254,
Expand All @@ -394,6 +406,7 @@ static const struct dio200_layout_struct dio200_layouts[] = {
.has_int_sce = 1,
.has_clk_gat_sce = 1,
},
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
[pc218_layout] = {
.n_subdevs = 7,
.sdtype = {sd_8254, sd_8254, sd_8255, sd_8254,
Expand All @@ -405,6 +418,7 @@ static const struct dio200_layout_struct dio200_layouts[] = {
.has_int_sce = 1,
.has_clk_gat_sce = 1,
},
#endif
[pc272_layout] = {
.n_subdevs = 4,
.sdtype = {sd_8255, sd_8255, sd_8255,
Expand All @@ -419,15 +433,15 @@ static const struct dio200_layout_struct dio200_layouts[] = {
* PCI driver table.
*/

#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) },
{0}
};

MODULE_DEVICE_TABLE(pci, dio200_pci_table);
#endif /* CONFIG_COMEDI_PCI */
#endif /* CONFIG_COMEDI_AMPLC_DIO200_PCI */

/*
* Useful for shorthand access to the particular board structure
Expand All @@ -441,7 +455,7 @@ MODULE_DEVICE_TABLE(pci, dio200_pci_table);
feel free to suggest moving the variable to the struct comedi_device struct.
*/
struct dio200_private {
#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
struct pci_dev *pci_dev; /* PCI device */
#endif
int intr_sd;
Expand Down Expand Up @@ -490,7 +504,7 @@ static struct comedi_driver driver_amplc_dio200 = {
.num_names = ARRAY_SIZE(dio200_boards),
};

#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
static int __devinit driver_amplc_dio200_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
Expand Down Expand Up @@ -549,7 +563,7 @@ module_exit(driver_amplc_dio200_cleanup_module);
* This function looks for a PCI device matching the requested board name,
* bus and slot.
*/
#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
static int
dio200_find_pci(struct comedi_device *dev, int bus, int slot,
struct pci_dev **pci_dev_p)
Expand Down Expand Up @@ -611,6 +625,7 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot,
* This function checks and requests an I/O region, reporting an error
* if there is a conflict.
*/
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
static int
dio200_request_region(unsigned minor, unsigned long from, unsigned long extent)
{
Expand All @@ -621,6 +636,7 @@ dio200_request_region(unsigned minor, unsigned long from, unsigned long extent)
}
return 0;
}
#endif

/*
* 'insn_bits' function for an 'INTERRUPT' subdevice.
Expand Down Expand Up @@ -1332,7 +1348,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
struct comedi_subdevice *s;
unsigned long iobase = 0;
unsigned int irq = 0;
#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
struct pci_dev *pci_dev = NULL;
int bus = 0, slot = 0;
#endif
Expand All @@ -1354,12 +1370,14 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)

/* Process options. */
switch (thisboard->bustype) {
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
case isa_bustype:
iobase = it->options[0];
irq = it->options[1];
share_irq = 0;
break;
#ifdef CONFIG_COMEDI_PCI
#endif
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
case pci_bustype:
bus = it->options[0];
slot = it->options[1];
Expand All @@ -1382,7 +1400,7 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
devpriv->intr_sd = -1;

/* Enable device and reserve I/O spaces. */
#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
if (pci_dev) {
ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME);
if (ret < 0) {
Expand All @@ -1396,9 +1414,11 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
} else
#endif
{
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
ret = dio200_request_region(dev->minor, iobase, DIO200_IO_SIZE);
if (ret < 0)
return ret;
#endif
}
dev->iobase = iobase;

Expand Down Expand Up @@ -1474,12 +1494,19 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
}

printk(KERN_INFO "comedi%d: %s ", dev->minor, dev->board_name);
if (thisboard->bustype == isa_bustype) {
switch (thisboard->bustype) {
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
case isa_bustype:
printk("(base %#lx) ", iobase);
} else {
#ifdef CONFIG_COMEDI_PCI
break;
#endif
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
case pci_bustype:
printk("(pci %s) ", pci_name(pci_dev));
break;
#endif
default:
break;
}
if (irq)
printk("(irq %u%s) ", irq, (dev->irq ? "" : " UNAVAILABLE"));
Expand Down Expand Up @@ -1529,16 +1556,18 @@ static int dio200_detach(struct comedi_device *dev)
}
}
if (devpriv) {
#ifdef CONFIG_COMEDI_PCI
#ifdef CONFIG_COMEDI_AMPLC_DIO200_PCI
if (devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
} else
#endif
{
#ifdef CONFIG_COMEDI_AMPLC_DIO200_ISA
if (dev->iobase)
release_region(dev->iobase, DIO200_IO_SIZE);
#endif
}
}
if (dev->board_name)
Expand Down

0 comments on commit 6638b34

Please sign in to comment.