diff options
Diffstat (limited to 'drivers/staging/comedi/drivers/adl_pci6208.c')
-rw-r--r-- | drivers/staging/comedi/drivers/adl_pci6208.c | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c index a3ea4b7..7ed3fd6 100644 --- a/drivers/staging/comedi/drivers/adl_pci6208.c +++ b/drivers/staging/comedi/drivers/adl_pci6208.c @@ -19,19 +19,22 @@ /* * Driver: adl_pci6208 * Description: ADLink PCI-6208/6216 Series Multi-channel Analog Output Cards - * Devices: [ADLink] PCI-6208 (adl_pci6208), PCI-6216 (adl_pci6216) + * Devices: [ADLink] PCI-6208 (adl_pci6208), PCI-6216 * Author: nsyeow <nsyeow@pd.jaring.my> - * Updated: Fri, 30 Jan 2004 14:44:27 +0800 + * Updated: Wed, 11 Feb 2015 11:37:18 +0000 * Status: untested * * Configuration Options: not applicable, uses PCI auto config + * + * All supported devices share the same PCI device ID and are treated as a + * PCI-6216 with 16 analog output channels. On a PCI-6208, the upper 8 + * channels exist in registers, but don't go to DAC chips. */ #include <linux/module.h> #include <linux/delay.h> -#include <linux/pci.h> -#include "../comedidev.h" +#include "../comedi_pci.h" /* * PCI-6208/6216-GL register map @@ -45,27 +48,6 @@ #define PCI6208_DIO_DI_MASK (0xf0) #define PCI6208_DIO_DI_SHIFT (4) -enum pci6208_boardid { - BOARD_PCI6208, - BOARD_PCI6216, -}; - -struct pci6208_board { - const char *name; - int ao_chans; -}; - -static const struct pci6208_board pci6208_boards[] = { - [BOARD_PCI6208] = { - .name = "adl_pci6208", - .ao_chans = 8, - }, - [BOARD_PCI6216] = { - .name = "adl_pci6216", - .ao_chans = 16, - }, -}; - static int pci6208_ao_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -136,21 +118,13 @@ static int pci6208_do_insn_bits(struct comedi_device *dev, } static int pci6208_auto_attach(struct comedi_device *dev, - unsigned long context) + unsigned long context_unused) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - const struct pci6208_board *boardinfo = NULL; struct comedi_subdevice *s; unsigned int val; int ret; - if (context < ARRAY_SIZE(pci6208_boards)) - boardinfo = &pci6208_boards[context]; - if (!boardinfo) - return -ENODEV; - dev->board_ptr = boardinfo; - dev->board_name = boardinfo->name; - ret = comedi_pci_enable(dev); if (ret) return ret; @@ -164,7 +138,7 @@ static int pci6208_auto_attach(struct comedi_device *dev, /* analog output subdevice */ s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITABLE; - s->n_chan = boardinfo->ao_chans; + s->n_chan = 16; /* Only 8 usable on PCI-6208 */ s->maxdata = 0xffff; s->range_table = &range_bipolar10; s->insn_write = pci6208_ao_insn_write; @@ -217,8 +191,9 @@ static int adl_pci6208_pci_probe(struct pci_dev *dev, } static const struct pci_device_id adl_pci6208_pci_table[] = { - { PCI_VDEVICE(ADLINK, 0x6208), BOARD_PCI6208 }, - { PCI_VDEVICE(ADLINK, 0x6216), BOARD_PCI6216 }, + { PCI_DEVICE(PCI_VENDOR_ID_ADLINK, 0x6208) }, + { PCI_DEVICE_SUB(PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + 0x9999, 0x6208) }, { 0 } }; MODULE_DEVICE_TABLE(pci, adl_pci6208_pci_table); |