Commit 2e3c024d authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: das08: separately configure ISA and PCI

The das08 driver supports both ISA and PCI cards, but currently is
configured outside the ISA and PCI comedi driver sections.  The module
is also used by the das08_cs driver.  This patch splits the
configuration to make the ISA and PCI parts separately selectable, and
changes the driver to only include the selected ISA and/or PCI board
types.  Also, if neither the ISA or PCI parts are selected, and the
module is only needed for the das08_cs driver, don't register the driver
as a comedi driver as it doesn't have any boards to support.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3e6be97e
...@@ -272,6 +272,20 @@ config COMEDI_DAS16M1 ...@@ -272,6 +272,20 @@ config COMEDI_DAS16M1
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called das16m1. called das16m1.
config COMEDI_DAS08_ISA
tristate "DAS-08 compatible ISA and PC/104 card support"
select COMEDI_DAS08
default N
---help---
Enable support for Keithley Metrabyte/ComputerBoards DAS08
and compatible ISA and PC/104 cards:
Keithley Metrabyte/ComputerBoards DAS08, DAS08-PGM, DAS08-PGH,
DAS08-PGL, DAS08-AOH, DAS08-AOL, DAS08-AOM, DAS08/JR-AO,
DAS08/JR-16-AO, PC104-DAS08, DAS08/JR/16.
To compile this driver as a module, choose M here: the module will be
called das08.
config COMEDI_DAS16 config COMEDI_DAS16
tristate "DAS-16 compatible ISA and PC/104 card support" tristate "DAS-16 compatible ISA and PC/104 card support"
select COMEDI_8255 select COMEDI_8255
...@@ -864,6 +878,16 @@ config COMEDI_CONTEC_PCI_DIO ...@@ -864,6 +878,16 @@ config COMEDI_CONTEC_PCI_DIO
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called contec_pci_dio. called contec_pci_dio.
config COMEDI_DAS08_PCI
tristate "DAS-08 PCI support"
select COMEDI_DAS08
default N
---help---
Enable support for PCI DAS-08 cards.
To compile this driver as a module, choose M here: the module will be
called das08.
config COMEDI_DT3000 config COMEDI_DT3000
tristate "Data Translation DT3000 series support" tristate "Data Translation DT3000 series support"
default N default N
...@@ -1390,20 +1414,6 @@ config COMEDI_8255 ...@@ -1390,20 +1414,6 @@ config COMEDI_8255
To compile this driver as a module, choose M here: the module will be To compile this driver as a module, choose M here: the module will be
called 8255. called 8255.
config COMEDI_DAS08
tristate "DAS-08 compatible support"
depends on COMEDI
select COMEDI_8255
default N
---help---
Enable support for DAS08 and compatible ISA, PC/104 and PCI cards.
Note that PCMCIA DAS08 cards are not directly supported by this
driver, and need a separate driver as a wrapper.
To compile this driver as a module, choose M here: the module will be
called das08.
config COMEDI_FC config COMEDI_FC
tristate "Comedi shared functions for low-level driver support" tristate "Comedi shared functions for low-level driver support"
depends on COMEDI depends on COMEDI
...@@ -1429,3 +1439,8 @@ config COMEDI_AMPLC_PC236 ...@@ -1429,3 +1439,8 @@ config COMEDI_AMPLC_PC236
config COMEDI_AMPLC_PC263 config COMEDI_AMPLC_PC263
def_tristate N def_tristate N
depends on COMEDI depends on COMEDI
config COMEDI_DAS08
def_tristate N
depends on COMEDI
select COMEDI_8255
...@@ -61,6 +61,20 @@ ...@@ -61,6 +61,20 @@
#define DRV_NAME "das08" #define DRV_NAME "das08"
#ifdef CONFIG_COMEDI_DAS08_ISA_MODULE
#define CONFIG_COMEDI_DAS08_ISA
#endif
#ifdef CONFIG_COMEDI_DAS08_PCI_MODULE
#define CONFIG_COMEDI_DAS08_PCI
#endif
#ifdef CONFIG_COMEDI_DAS08_CS_MODULE
#define CONFIG_COMEDI_DAS08_CS
#endif
#if defined(CONFIG_COMEDI_DAS08_ISA) || defined(CONFIG_COMEDI_DAS08_PCI)
#define DO_COMEDI_DRIVER_REGISTER
#endif
#define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307 #define PCI_VENDOR_ID_COMPUTERBOARDS 0x1307
#define PCI_DEVICE_ID_PCIDAS08 0x29 #define PCI_DEVICE_ID_PCIDAS08 0x29
#define PCIDAS08_SIZE 0x54 #define PCIDAS08_SIZE 0x54
...@@ -160,6 +174,7 @@ static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -160,6 +174,7 @@ static int das08_di_rbits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data); struct comedi_insn *insn, unsigned int *data);
static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data); struct comedi_insn *insn, unsigned int *data);
#ifdef CONFIG_COMEDI_DAS08_ISA
static int das08jr_di_rbits(struct comedi_device *dev, static int das08jr_di_rbits(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data); struct comedi_insn *insn, unsigned int *data);
...@@ -172,6 +187,7 @@ static int das08jr_ao_winsn(struct comedi_device *dev, ...@@ -172,6 +187,7 @@ static int das08jr_ao_winsn(struct comedi_device *dev,
static int das08ao_ao_winsn(struct comedi_device *dev, static int das08ao_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data); struct comedi_insn *insn, unsigned int *data);
#endif
static void i8254_set_mode_low(unsigned int base, int channel, static void i8254_set_mode_low(unsigned int base, int channel,
unsigned int mode); unsigned int mode);
...@@ -253,7 +269,9 @@ static const int *const das08_gainlists[] = { ...@@ -253,7 +269,9 @@ static const int *const das08_gainlists[] = {
das08_pgm_gainlist, das08_pgm_gainlist,
}; };
#ifdef DO_COMEDI_DRIVER_REGISTER
static const struct das08_board_struct das08_boards[] = { static const struct das08_board_struct das08_boards[] = {
#ifdef CONFIG_COMEDI_DAS08_ISA
{ {
.name = "isa-das08", /* cio-das08.pdf */ .name = "isa-das08", /* cio-das08.pdf */
.bustype = isa, .bustype = isa,
...@@ -395,25 +413,6 @@ static const struct das08_board_struct das08_boards[] = { ...@@ -395,25 +413,6 @@ static const struct das08_board_struct das08_boards[] = {
.i8254_offset = 0x04, .i8254_offset = 0x04,
.iosize = 16, /* unchecked */ .iosize = 16, /* unchecked */
}, },
#ifdef CONFIG_COMEDI_PCI
{
.name = "das08", /* pci-das08 */
.id = PCI_DEVICE_ID_PCIDAS08,
.bustype = pci,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_bipolar5,
.ai_encoding = das08_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 4,
.iosize = 8,
},
#endif
{ {
.name = "pc104-das08", .name = "pc104-das08",
.bustype = pc104, .bustype = pc104,
...@@ -462,9 +461,30 @@ static const struct das08_board_struct das08_boards[] = { ...@@ -462,9 +461,30 @@ static const struct das08_board_struct das08_boards[] = {
.name = "das08-pga-g2", /* a KM board */ .name = "das08-pga-g2", /* a KM board */
}, },
#endif #endif
#endif /* CONFIG_COMEDI_DAS08_ISA */
#ifdef CONFIG_COMEDI_DAS08_PCI
{
.name = "das08", /* pci-das08 */
.id = PCI_DEVICE_ID_PCIDAS08,
.bustype = pci,
.ai = das08_ai_rinsn,
.ai_nbits = 12,
.ai_pg = das08_bipolar5,
.ai_encoding = das08_encode12,
.ao = NULL,
.ao_nbits = 0,
.di = das08_di_rbits,
.do_ = das08_do_wbits,
.do_nchan = 4,
.i8255_offset = 0,
.i8254_offset = 4,
.iosize = 8,
},
#endif /* CONFIG_COMEDI_DAS08_PCI */
}; };
#endif /* DO_COMEDI_DRIVER_REGISTER */
#ifdef CONFIG_COMEDI_PCMCIA #ifdef CONFIG_COMEDI_DAS08_CS
struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = {
{ {
.name = "pcm-das08", .name = "pcm-das08",
...@@ -504,7 +524,7 @@ struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = { ...@@ -504,7 +524,7 @@ struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS] = {
}; };
#endif #endif
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_DAS08_PCI
static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = { static DEFINE_PCI_DEVICE_TABLE(das08_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) }, { PCI_DEVICE(PCI_VENDOR_ID_COMPUTERBOARDS, PCI_DEVICE_ID_PCIDAS08) },
{0} {0}
...@@ -619,6 +639,7 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -619,6 +639,7 @@ static int das08_do_wbits(struct comedi_device *dev, struct comedi_subdevice *s,
return 2; return 2;
} }
#ifdef CONFIG_COMEDI_DAS08_ISA
static int das08jr_di_rbits(struct comedi_device *dev, static int das08jr_di_rbits(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
...@@ -628,7 +649,9 @@ static int das08jr_di_rbits(struct comedi_device *dev, ...@@ -628,7 +649,9 @@ static int das08jr_di_rbits(struct comedi_device *dev,
return 2; return 2;
} }
#endif
#ifdef CONFIG_COMEDI_DAS08_ISA
static int das08jr_do_wbits(struct comedi_device *dev, static int das08jr_do_wbits(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
...@@ -643,7 +666,9 @@ static int das08jr_do_wbits(struct comedi_device *dev, ...@@ -643,7 +666,9 @@ static int das08jr_do_wbits(struct comedi_device *dev,
return 2; return 2;
} }
#endif
#ifdef CONFIG_COMEDI_DAS08_ISA
static int das08jr_ao_winsn(struct comedi_device *dev, static int das08jr_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
...@@ -672,6 +697,7 @@ static int das08jr_ao_winsn(struct comedi_device *dev, ...@@ -672,6 +697,7 @@ static int das08jr_ao_winsn(struct comedi_device *dev,
return n; return n;
} }
#endif
/* /*
* *
...@@ -679,6 +705,7 @@ static int das08jr_ao_winsn(struct comedi_device *dev, ...@@ -679,6 +705,7 @@ static int das08jr_ao_winsn(struct comedi_device *dev,
* a different method to force an update. * a different method to force an update.
* *
*/ */
#ifdef CONFIG_COMEDI_DAS08_ISA
static int das08ao_ao_winsn(struct comedi_device *dev, static int das08ao_ao_winsn(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data) struct comedi_insn *insn, unsigned int *data)
...@@ -707,6 +734,7 @@ static int das08ao_ao_winsn(struct comedi_device *dev, ...@@ -707,6 +734,7 @@ static int das08ao_ao_winsn(struct comedi_device *dev,
return n; return n;
} }
#endif
static unsigned int i8254_read_channel_low(unsigned int base, int chan) static unsigned int i8254_read_channel_low(unsigned int base, int chan)
{ {
...@@ -842,6 +870,7 @@ static int das08_counter_config(struct comedi_device *dev, ...@@ -842,6 +870,7 @@ static int das08_counter_config(struct comedi_device *dev,
return 2; return 2;
} }
#ifdef DO_COMEDI_DRIVER_REGISTER
static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it); static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static struct comedi_driver driver_das08 = { static struct comedi_driver driver_das08 = {
...@@ -853,6 +882,7 @@ static struct comedi_driver driver_das08 = { ...@@ -853,6 +882,7 @@ static struct comedi_driver driver_das08 = {
.num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct), .num_names = sizeof(das08_boards) / sizeof(struct das08_board_struct),
.offset = sizeof(struct das08_board_struct), .offset = sizeof(struct das08_board_struct),
}; };
#endif
int das08_common_attach(struct comedi_device *dev, unsigned long iobase) int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
{ {
...@@ -972,11 +1002,12 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase) ...@@ -972,11 +1002,12 @@ int das08_common_attach(struct comedi_device *dev, unsigned long iobase)
} }
EXPORT_SYMBOL_GPL(das08_common_attach); EXPORT_SYMBOL_GPL(das08_common_attach);
#ifdef DO_COMEDI_DRIVER_REGISTER
static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{ {
int ret; int ret;
unsigned long iobase; unsigned long iobase;
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_DAS08_PCI
unsigned long pci_iobase = 0; unsigned long pci_iobase = 0;
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
#endif #endif
...@@ -986,9 +1017,9 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -986,9 +1017,9 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return ret; return ret;
printk(KERN_INFO "comedi%d: das08: ", dev->minor); printk(KERN_INFO "comedi%d: das08: ", dev->minor);
#ifdef CONFIG_COMEDI_DAS08_PCI
/* deal with a pci board */ /* deal with a pci board */
if (thisboard->bustype == pci) { if (thisboard->bustype == pci) {
#ifdef CONFIG_COMEDI_PCI
if (it->options[0] || it->options[1]) { if (it->options[0] || it->options[1]) {
printk("bus %i slot %i ", printk("bus %i slot %i ",
it->options[0], it->options[1]); it->options[0], it->options[1]);
...@@ -1037,17 +1068,16 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1037,17 +1068,16 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
/* Enable local interrupt 1 and pci interrupt */ /* Enable local interrupt 1 and pci interrupt */
outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR); outw(INTR1_ENABLE | PCI_INTR_ENABLE, pci_iobase + INTCSR);
#endif #endif
#else /* CONFIG_COMEDI_PCI */ } else
printk(KERN_ERR "this driver has not been built with PCI support.\n"); #endif /* CONFIG_COMEDI_DAS08_PCI */
return -EINVAL; {
#endif /* CONFIG_COMEDI_PCI */
} else {
iobase = it->options[0]; iobase = it->options[0];
} }
printk(KERN_INFO "\n"); printk(KERN_INFO "\n");
return das08_common_attach(dev, iobase); return das08_common_attach(dev, iobase);
} }
#endif /* DO_COMEDI_DRIVER_REGISTER */
int das08_common_detach(struct comedi_device *dev) int das08_common_detach(struct comedi_device *dev)
...@@ -1062,7 +1092,7 @@ int das08_common_detach(struct comedi_device *dev) ...@@ -1062,7 +1092,7 @@ int das08_common_detach(struct comedi_device *dev)
if (dev->iobase) if (dev->iobase)
release_region(dev->iobase, thisboard->iosize); release_region(dev->iobase, thisboard->iosize);
} }
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_DAS08_PCI
if (devpriv) { if (devpriv) {
if (devpriv->pdev) { if (devpriv->pdev) {
if (devpriv->pci_iobase) if (devpriv->pci_iobase)
...@@ -1077,7 +1107,7 @@ int das08_common_detach(struct comedi_device *dev) ...@@ -1077,7 +1107,7 @@ int das08_common_detach(struct comedi_device *dev)
} }
EXPORT_SYMBOL_GPL(das08_common_detach); EXPORT_SYMBOL_GPL(das08_common_detach);
#ifdef CONFIG_COMEDI_PCI #ifdef CONFIG_COMEDI_DAS08_PCI
static int __devinit driver_das08_pci_probe(struct pci_dev *dev, static int __devinit driver_das08_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
...@@ -1094,43 +1124,38 @@ static struct pci_driver driver_das08_pci_driver = { ...@@ -1094,43 +1124,38 @@ static struct pci_driver driver_das08_pci_driver = {
.probe = &driver_das08_pci_probe, .probe = &driver_das08_pci_probe,
.remove = __devexit_p(&driver_das08_pci_remove) .remove = __devexit_p(&driver_das08_pci_remove)
}; };
#endif /* CONFIG_COMEDI_DAS08_PCI */
static int __init driver_das08_init_module(void) static int __init driver_das08_init_module(void)
{ {
int retval; int retval = 0;
#ifdef DO_COMEDI_DRIVER_REGISTER
retval = comedi_driver_register(&driver_das08); retval = comedi_driver_register(&driver_das08);
if (retval < 0) if (retval < 0)
return retval; return retval;
#endif
#ifdef CONFIG_COMEDI_DAS08_PCI
driver_das08_pci_driver.name = (char *)driver_das08.driver_name; driver_das08_pci_driver.name = (char *)driver_das08.driver_name;
return pci_register_driver(&driver_das08_pci_driver); retval = pci_register_driver(&driver_das08_pci_driver);
#endif
return retval;
} }
static void __exit driver_das08_cleanup_module(void) static void __exit driver_das08_cleanup_module(void)
{ {
#ifdef CONFIG_COMEDI_DAS08_PCI
pci_unregister_driver(&driver_das08_pci_driver); pci_unregister_driver(&driver_das08_pci_driver);
#endif
#ifdef DO_COMEDI_DRIVER_REGISTER
comedi_driver_unregister(&driver_das08); comedi_driver_unregister(&driver_das08);
#endif
} }
module_init(driver_das08_init_module); module_init(driver_das08_init_module);
module_exit(driver_das08_cleanup_module); module_exit(driver_das08_cleanup_module);
#else
static int __init driver_das08_init_module(void)
{
return comedi_driver_register(&driver_das08);
}
static void __exit driver_das08_cleanup_module(void)
{
comedi_driver_unregister(&driver_das08);
}
module_init(driver_das08_init_module);
module_exit(driver_das08_cleanup_module);
#endif
#ifdef CONFIG_COMEDI_PCMCIA #ifdef CONFIG_COMEDI_DAS08_CS
EXPORT_SYMBOL_GPL(das08_cs_boards); EXPORT_SYMBOL_GPL(das08_cs_boards);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment