This driver will be used for all generic PCI based 8255 digital i/o boards. Rename the driver accordingly.. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/Kconfig | 28 ++-- drivers/staging/comedi/drivers/8255_pci.c | 191 +++++++++++++++++++++++++++ drivers/staging/comedi/drivers/Makefile | 2 +- drivers/staging/comedi/drivers/adl_pci7296.c | 191 --------------------------- 4 files changed, 207 insertions(+), 205 deletions(-) create mode 100644 drivers/staging/comedi/drivers/8255_pci.c delete mode 100644 drivers/staging/comedi/drivers/adl_pci7296.c diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index d36486e..1ecf213 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -549,6 +549,19 @@ menuconfig COMEDI_PCI_DRIVERS if COMEDI_PCI_DRIVERS +config COMEDI_8255_PCI + tristate "Generic PCI based 8255 digital i/o board support" + select COMEDI_8255 + ---help--- + Enable support for PCI based 8255 digital i/o boards. This driver + provides a PCI wrapper around the generic 8255 driver. + + Supported boards: + ADlink - PCI-7224, PCI-7248, and PCI-7296 + + To compile this driver as a module, choose M here: the module will + be called 8255_pci. + config COMEDI_ADDI_APCI_035 tristate "ADDI-DATA APCI_035 support" depends on VIRT_TO_BUS @@ -687,17 +700,6 @@ config COMEDI_ADL_PCI7X3X To compile this driver as a module, choose M here: the module will be called adl_pci7x3x. -config COMEDI_ADL_PCI7296 - tristate "ADLink PCI-72xx opto-22 compatible digital i/o board support" - select COMEDI_8255 - ---help--- - Enable support for ADlink PCI-72xx opto-22 compatible digital i/o - boards. Supported boards include the 24-channel PCI-7224, 48-channel - PCI-7248, and 96-channel PCI-7296. - - To compile this driver as a module, choose M here: the module will be - called adl_pci7296. - config COMEDI_ADL_PCI8164 tristate "ADLink PCI-8164 4 Axes Motion Control board support" ---help--- @@ -1259,8 +1261,8 @@ config COMEDI_8255 that has an 8255 chip. For multifunction boards, the main driver will configure the 8255 subdevice automatically. - Note that most PCI 8255 boards do NOT work with this driver, and - need a separate driver as a wrapper. + Note that most PCI based 8255 boards use the 8255_pci driver as a + wrapper around this driver. To compile this driver as a module, choose M here: the module will be called 8255. diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c new file mode 100644 index 0000000..96cfc9c --- /dev/null +++ b/drivers/staging/comedi/drivers/8255_pci.c @@ -0,0 +1,191 @@ +/* + * COMEDI driver for the ADLINK PCI-72xx series boards. + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2000 David A. Schleef <ds@xxxxxxxxxxx> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* +Driver: adl_pci7296 +Description: 24/48/96-Channel Opto-22 Compatible Digital I/O Boards +Devices: (ADLink) PCI-7224 [adl_pci7224] - 24 channels + (ADLink) PCI-7248 [adl_pci7248] - 48 channels + (ADLink) PCI-7296 [adl_pci7296] - 96 channels +Author: Jon Grierson <jd@xxxxxxxxxxx> +Updated: Mon, 14 Apr 2008 15:05:56 +0100 +Status: testing + +This driver only attaches using the PCI PnP auto config support +in the comedi core. The module parameter 'comedi_autoconfig' +must be 1 (default) to enable this feature. The COMEDI_DEVCONFIG +ioctl, used by the comedi_config utility, is not supported by +this driver. + +These boards also have an 8254 programmable timer/counter chip. +This chip is not currently supported by this driver. + +Interrupt support for these boards is also not currently supported. + +Configuration Options: not applicable +*/ + +#include "../comedidev.h" + +#include "8255.h" + +/* + * PCI Device ID's supported by this driver + */ +#define PCI_DEVICE_ID_PCI7224 0x7224 +#define PCI_DEVICE_ID_PCI7248 0x7248 +#define PCI_DEVICE_ID_PCI7296 0x7296 + +struct adl_pci7296_boardinfo { + const char *name; + unsigned short device; + int nsubdevs; +}; + +static const struct adl_pci7296_boardinfo adl_pci7296_boards[] = { + { + .name = "adl_pci7224", + .device = PCI_DEVICE_ID_PCI7224, + .nsubdevs = 1, + }, { + .name = "adl_pci7248", + .device = PCI_DEVICE_ID_PCI7248, + .nsubdevs = 2, + }, { + .name = "adl_pci7296", + .device = PCI_DEVICE_ID_PCI7296, + .nsubdevs = 4, + }, +}; + +static const void *adl_pci7296_find_boardinfo(struct comedi_device *dev, + struct pci_dev *pcidev) +{ + const struct adl_pci7296_boardinfo *board; + int i; + + for (i = 0; i < ARRAY_SIZE(adl_pci7296_boards); i++) { + board = &adl_pci7296_boards[i]; + if (pcidev->device == board->device) + return board; + } + return NULL; +} + +static int adl_pci7296_attach_pci(struct comedi_device *dev, + struct pci_dev *pcidev) +{ + const struct adl_pci7296_boardinfo *board; + struct comedi_subdevice *s; + int ret; + int i; + + comedi_set_hw_dev(dev, &pcidev->dev); + + board = adl_pci7296_find_boardinfo(dev, pcidev); + if (!board) + return -ENODEV; + dev->board_ptr = board; + dev->board_name = board->name; + + ret = comedi_pci_enable(pcidev, dev->board_name); + if (ret) + return ret; + dev->iobase = pci_resource_start(pcidev, 2); + + /* + * One, two, or four subdevices are setup by this driver depending + * on the number of channels provided by the board. Each subdevice + * has 24 channels supported by the 8255 module. + */ + ret = comedi_alloc_subdevices(dev, board->nsubdevs); + if (ret) + return ret; + + for (i = 0; i < board->nsubdevs; i++) { + s = &dev->subdevices[i]; + ret = subdev_8255_init(dev, s, NULL, dev->iobase + (i * 4)); + if (ret) + return ret; + } + + dev_info(dev->class_dev, "%s attached (%d digital i/o channels)\n", + dev->board_name, board->nsubdevs * 24); + + return 0; +} + +static void adl_pci7296_detach(struct comedi_device *dev) +{ + struct pci_dev *pcidev = comedi_to_pci_dev(dev); + const struct adl_pci7296_boardinfo *board = comedi_board(dev); + struct comedi_subdevice *s; + int i; + + if (dev->subdevices) { + for (i = 0; i < board->nsubdevs; i++) { + s = &dev->subdevices[i]; + subdev_8255_cleanup(dev, s); + } + } + if (pcidev) { + if (dev->iobase) + comedi_pci_disable(pcidev); + } +} + +static struct comedi_driver adl_pci7296_driver = { + .driver_name = "adl_pci7296", + .module = THIS_MODULE, + .attach_pci = adl_pci7296_attach_pci, + .detach = adl_pci7296_detach, +}; + +static int __devinit adl_pci7296_pci_probe(struct pci_dev *dev, + const struct pci_device_id *ent) +{ + return comedi_pci_auto_config(dev, &adl_pci7296_driver); +} + +static void __devexit adl_pci7296_pci_remove(struct pci_dev *dev) +{ + comedi_pci_auto_unconfig(dev); +} + +static DEFINE_PCI_DEVICE_TABLE(adl_pci7296_pci_table) = { + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7224) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7248) }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296) }, + { 0 } +}; +MODULE_DEVICE_TABLE(pci, adl_pci7296_pci_table); + +static struct pci_driver adl_pci7296_pci_driver = { + .name = "adl_pci7296", + .id_table = adl_pci7296_pci_table, + .probe = adl_pci7296_pci_probe, + .remove = __devexit_p(adl_pci7296_pci_remove), +}; +module_comedi_pci_driver(adl_pci7296_driver, adl_pci7296_pci_driver); + +MODULE_DESCRIPTION("ADLINK PCI-72xx Opto-22 Compatible Digital I/O Boards"); +MODULE_AUTHOR("Comedi http://www.comedi.org"); +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 849ea7f..7798cdc5 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -55,6 +55,7 @@ obj-$(CONFIG_COMEDI_MULTIQ3) += multiq3.o obj-$(CONFIG_COMEDI_POC) += poc.o # Comedi PCI drivers +obj-$(CONFIG_COMEDI_8255_PCI) += 8255_pci.o obj-$(CONFIG_COMEDI_ADDI_APCI_035) += addi_apci_035.o obj-$(CONFIG_COMEDI_ADDI_APCI_1032) += addi_apci_1032.o obj-$(CONFIG_COMEDI_ADDI_APCI_1500) += addi_apci_1500.o @@ -70,7 +71,6 @@ obj-$(CONFIG_COMEDI_ADDI_APCI_3501) += addi_apci_3501.o obj-$(CONFIG_COMEDI_ADDI_APCI_3XXX) += addi_apci_3xxx.o obj-$(CONFIG_COMEDI_ADL_PCI6208) += adl_pci6208.o obj-$(CONFIG_COMEDI_ADL_PCI7X3X) += adl_pci7x3x.o -obj-$(CONFIG_COMEDI_ADL_PCI7296) += adl_pci7296.o obj-$(CONFIG_COMEDI_ADL_PCI8164) += adl_pci8164.o obj-$(CONFIG_COMEDI_ADL_PCI9111) += adl_pci9111.o obj-$(CONFIG_COMEDI_ADL_PCI9118) += adl_pci9118.o diff --git a/drivers/staging/comedi/drivers/adl_pci7296.c b/drivers/staging/comedi/drivers/adl_pci7296.c deleted file mode 100644 index 96cfc9c..0000000 --- a/drivers/staging/comedi/drivers/adl_pci7296.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * COMEDI driver for the ADLINK PCI-72xx series boards. - * - * COMEDI - Linux Control and Measurement Device Interface - * Copyright (C) 2000 David A. Schleef <ds@xxxxxxxxxxx> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/* -Driver: adl_pci7296 -Description: 24/48/96-Channel Opto-22 Compatible Digital I/O Boards -Devices: (ADLink) PCI-7224 [adl_pci7224] - 24 channels - (ADLink) PCI-7248 [adl_pci7248] - 48 channels - (ADLink) PCI-7296 [adl_pci7296] - 96 channels -Author: Jon Grierson <jd@xxxxxxxxxxx> -Updated: Mon, 14 Apr 2008 15:05:56 +0100 -Status: testing - -This driver only attaches using the PCI PnP auto config support -in the comedi core. The module parameter 'comedi_autoconfig' -must be 1 (default) to enable this feature. The COMEDI_DEVCONFIG -ioctl, used by the comedi_config utility, is not supported by -this driver. - -These boards also have an 8254 programmable timer/counter chip. -This chip is not currently supported by this driver. - -Interrupt support for these boards is also not currently supported. - -Configuration Options: not applicable -*/ - -#include "../comedidev.h" - -#include "8255.h" - -/* - * PCI Device ID's supported by this driver - */ -#define PCI_DEVICE_ID_PCI7224 0x7224 -#define PCI_DEVICE_ID_PCI7248 0x7248 -#define PCI_DEVICE_ID_PCI7296 0x7296 - -struct adl_pci7296_boardinfo { - const char *name; - unsigned short device; - int nsubdevs; -}; - -static const struct adl_pci7296_boardinfo adl_pci7296_boards[] = { - { - .name = "adl_pci7224", - .device = PCI_DEVICE_ID_PCI7224, - .nsubdevs = 1, - }, { - .name = "adl_pci7248", - .device = PCI_DEVICE_ID_PCI7248, - .nsubdevs = 2, - }, { - .name = "adl_pci7296", - .device = PCI_DEVICE_ID_PCI7296, - .nsubdevs = 4, - }, -}; - -static const void *adl_pci7296_find_boardinfo(struct comedi_device *dev, - struct pci_dev *pcidev) -{ - const struct adl_pci7296_boardinfo *board; - int i; - - for (i = 0; i < ARRAY_SIZE(adl_pci7296_boards); i++) { - board = &adl_pci7296_boards[i]; - if (pcidev->device == board->device) - return board; - } - return NULL; -} - -static int adl_pci7296_attach_pci(struct comedi_device *dev, - struct pci_dev *pcidev) -{ - const struct adl_pci7296_boardinfo *board; - struct comedi_subdevice *s; - int ret; - int i; - - comedi_set_hw_dev(dev, &pcidev->dev); - - board = adl_pci7296_find_boardinfo(dev, pcidev); - if (!board) - return -ENODEV; - dev->board_ptr = board; - dev->board_name = board->name; - - ret = comedi_pci_enable(pcidev, dev->board_name); - if (ret) - return ret; - dev->iobase = pci_resource_start(pcidev, 2); - - /* - * One, two, or four subdevices are setup by this driver depending - * on the number of channels provided by the board. Each subdevice - * has 24 channels supported by the 8255 module. - */ - ret = comedi_alloc_subdevices(dev, board->nsubdevs); - if (ret) - return ret; - - for (i = 0; i < board->nsubdevs; i++) { - s = &dev->subdevices[i]; - ret = subdev_8255_init(dev, s, NULL, dev->iobase + (i * 4)); - if (ret) - return ret; - } - - dev_info(dev->class_dev, "%s attached (%d digital i/o channels)\n", - dev->board_name, board->nsubdevs * 24); - - return 0; -} - -static void adl_pci7296_detach(struct comedi_device *dev) -{ - struct pci_dev *pcidev = comedi_to_pci_dev(dev); - const struct adl_pci7296_boardinfo *board = comedi_board(dev); - struct comedi_subdevice *s; - int i; - - if (dev->subdevices) { - for (i = 0; i < board->nsubdevs; i++) { - s = &dev->subdevices[i]; - subdev_8255_cleanup(dev, s); - } - } - if (pcidev) { - if (dev->iobase) - comedi_pci_disable(pcidev); - } -} - -static struct comedi_driver adl_pci7296_driver = { - .driver_name = "adl_pci7296", - .module = THIS_MODULE, - .attach_pci = adl_pci7296_attach_pci, - .detach = adl_pci7296_detach, -}; - -static int __devinit adl_pci7296_pci_probe(struct pci_dev *dev, - const struct pci_device_id *ent) -{ - return comedi_pci_auto_config(dev, &adl_pci7296_driver); -} - -static void __devexit adl_pci7296_pci_remove(struct pci_dev *dev) -{ - comedi_pci_auto_unconfig(dev); -} - -static DEFINE_PCI_DEVICE_TABLE(adl_pci7296_pci_table) = { - { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7224) }, - { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7248) }, - { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, PCI_DEVICE_ID_PCI7296) }, - { 0 } -}; -MODULE_DEVICE_TABLE(pci, adl_pci7296_pci_table); - -static struct pci_driver adl_pci7296_pci_driver = { - .name = "adl_pci7296", - .id_table = adl_pci7296_pci_table, - .probe = adl_pci7296_pci_probe, - .remove = __devexit_p(adl_pci7296_pci_remove), -}; -module_comedi_pci_driver(adl_pci7296_driver, adl_pci7296_pci_driver); - -MODULE_DESCRIPTION("ADLINK PCI-72xx Opto-22 Compatible Digital I/O Boards"); -MODULE_AUTHOR("Comedi http://www.comedi.org"); -MODULE_LICENSE("GPL"); -- 1.7.11 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel