The PCL-725 ISA board can be supported by this driver. This board has 8 isolated digital inputs and 8 isolated digital outputs. Add support for the PCL-725 board to the pcl730 driver and remove the standalone pcl725 driver. Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> Cc: Ian Abbott <abbotti@xxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/Kconfig | 21 ++++---- drivers/staging/comedi/drivers/Makefile | 1 - drivers/staging/comedi/drivers/pcl725.c | 91 --------------------------------- drivers/staging/comedi/drivers/pcl730.c | 64 +++++++++++++++-------- 4 files changed, 51 insertions(+), 126 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/pcl725.c diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index a631353..e67fd9b 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -137,14 +137,6 @@ config COMEDI_PCL724 To compile this driver as a module, choose M here: the module will be called pcl724. -config COMEDI_PCL725 - tristate "Advantech PCL-725 and compatible ISA card support" - ---help--- - Enable support for Advantech PCL-725 and compatible ISA cards. - - To compile this driver as a module, choose M here: the module will be - called pcl725. - config COMEDI_PCL726 tristate "Advantech PCL-726 and compatible ISA card support" ---help--- @@ -154,11 +146,16 @@ config COMEDI_PCL726 called pcl726. config COMEDI_PCL730 - tristate "Advantech PCL-730/PCM-3730 and compatible board support" + tristate "Simple Digital I/O board support (8-bit ports)" ---help--- - Enable support for Advantech PCL-730, ICP ISO-730 and ADlink - ACL-7130 ISA cards as well as the Advantech PCM-3730 and clone - PC/104 boards. + Enable support for various simple ISA or PC/104 Digital I/O boards. + These boards all use 8-bit I/O ports. + + Advantech PCL-730 isolated - 16 in/16 out ttl - 16 in/16 out + ICP ISO-730 isolated - 16 in/16 out ttl - 16 in/16 out + ADlink ACL-7130 isolated - 16 in/16 out ttl - 16 in/16 out + Advantech PCM-3730 isolated - 8 in/8 out ttl - 16 in/16 out + Advantech PCL-725 isolated - 8 in/8 out To compile this driver as a module, choose M here: the module will be called pcl730. diff --git a/drivers/staging/comedi/drivers/Makefile b/drivers/staging/comedi/drivers/Makefile index 30e9626..c4338e9 100644 --- a/drivers/staging/comedi/drivers/Makefile +++ b/drivers/staging/comedi/drivers/Makefile @@ -16,7 +16,6 @@ obj-$(CONFIG_COMEDI_AMPLC_DIO200_ISA) += amplc_dio200.o obj-$(CONFIG_COMEDI_AMPLC_PC263_ISA) += amplc_pc263.o obj-$(CONFIG_COMEDI_PCL711) += pcl711.o obj-$(CONFIG_COMEDI_PCL724) += pcl724.o -obj-$(CONFIG_COMEDI_PCL725) += pcl725.o obj-$(CONFIG_COMEDI_PCL726) += pcl726.o obj-$(CONFIG_COMEDI_PCL730) += pcl730.o obj-$(CONFIG_COMEDI_PCL812) += pcl812.o diff --git a/drivers/staging/comedi/drivers/pcl725.c b/drivers/staging/comedi/drivers/pcl725.c deleted file mode 100644 index 6b02f06..0000000 --- a/drivers/staging/comedi/drivers/pcl725.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * comedi/drivers/pcl725.c - * Driver for PCL725 and clones - * David A. Schleef - */ -/* -Driver: pcl725 -Description: Advantech PCL-725 (& compatibles) -Author: ds -Status: unknown -Devices: [Advantech] PCL-725 (pcl725) -*/ - -#include "../comedidev.h" - -#include <linux/ioport.h> - -#define PCL725_SIZE 2 - -#define PCL725_DO 0 -#define PCL725_DI 1 - -static int pcl725_do_insn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - if (data[0]) { - s->state &= ~data[0]; - s->state |= (data[0] & data[1]); - outb(s->state, dev->iobase + PCL725_DO); - } - - data[1] = s->state; - - return insn->n; -} - -static int pcl725_di_insn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - data[1] = inb(dev->iobase + PCL725_DI); - - return insn->n; -} - -static int pcl725_attach(struct comedi_device *dev, struct comedi_devconfig *it) -{ - struct comedi_subdevice *s; - int ret; - - ret = comedi_request_region(dev, it->options[0], PCL725_SIZE); - if (ret) - return ret; - - ret = comedi_alloc_subdevices(dev, 2); - if (ret) - return ret; - - s = &dev->subdevices[0]; - /* do */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->maxdata = 1; - s->n_chan = 8; - s->insn_bits = pcl725_do_insn; - s->range_table = &range_digital; - - s = &dev->subdevices[1]; - /* di */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->maxdata = 1; - s->n_chan = 8; - s->insn_bits = pcl725_di_insn; - s->range_table = &range_digital; - - printk(KERN_INFO "\n"); - - return 0; -} - -static struct comedi_driver pcl725_driver = { - .driver_name = "pcl725", - .module = THIS_MODULE, - .attach = pcl725_attach, - .detach = comedi_legacy_detach, -}; -module_comedi_driver(pcl725_driver); - -MODULE_AUTHOR("Comedi http://www.comedi.org"); -MODULE_DESCRIPTION("Comedi low-level driver"); -MODULE_LICENSE("GPL"); diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index 4b9a4fb..72e20a7 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -11,6 +11,7 @@ * (ICP) ISO-730 [iso730] * (Adlink) ACL-7130 [acl7130] * (Advantech) PCM-3730 [pcm3730] + * (Advantech) PCL-725 [pcl725] * Author: José Luis Sánchez (jsanchezv@xxxxxxxxxxx) * Status: untested * @@ -29,6 +30,7 @@ * Register I/O map * * The pcm3730 PC/104 board does not have the PCL730_IDIO_HI register. + * The pcl725 ISA board uses separate registers for isolated digital I/O. */ #define PCL730_IDIO_LO 0 /* Isolated Digital I/O low byte (ID0-ID7) */ #define PCL730_IDIO_HI 1 /* Isolated Digital I/O high byte (ID8-ID15) */ @@ -38,25 +40,40 @@ struct pcl730_board { const char *name; unsigned int io_range; + unsigned is_pcl725:1; + unsigned has_ttl_io:1; int n_iso_chan; + int n_ttl_chan; }; static const struct pcl730_board pcl730_boards[] = { { .name = "pcl730", .io_range = 0x04, + .has_ttl_io = 1, .n_iso_chan = 16, + .n_ttl_chan = 16, }, { .name = "iso730", .io_range = 0x04, .n_iso_chan = 16, + .n_ttl_chan = 16, }, { .name = "acl7130", .io_range = 0x08, + .has_ttl_io = 1, .n_iso_chan = 16, + .n_ttl_chan = 16, }, { .name = "pcm3730", .io_range = 0x04, + .has_ttl_io = 1, + .n_iso_chan = 8, + .n_ttl_chan = 16, + }, { + .name = "pcl725", + .io_range = 0x02, + .is_pcl725 = 1, .n_iso_chan = 8, }, }; @@ -113,7 +130,7 @@ static int pcl730_attach(struct comedi_device *dev, if (ret) return ret; - ret = comedi_alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, board->has_ttl_io ? 4 : 2); if (ret) return ret; @@ -135,27 +152,30 @@ static int pcl730_attach(struct comedi_device *dev, s->maxdata = 1; s->range_table = &range_digital; s->insn_bits = pcl730_di_insn_bits; - s->private = (void *)PCL730_IDIO_LO; - - /* TTL Digital Outputs */ - s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl730_do_insn_bits; - s->private = (void *)PCL730_DIO_LO; - - /* TTL Digital Inputs */ - s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->range_table = &range_digital; - s->insn_bits = pcl730_di_insn_bits; - s->private = (void *)PCL730_DIO_LO; + s->private = board->is_pcl725 ? (void *)PCL730_IDIO_HI + : (void *)PCL730_IDIO_LO; + + if (board->has_ttl_io) { + /* TTL Digital Outputs */ + s = &dev->subdevices[2]; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = board->n_ttl_chan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl730_do_insn_bits; + s->private = (void *)PCL730_DIO_LO; + + /* TTL Digital Inputs */ + s = &dev->subdevices[3]; + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = board->n_ttl_chan; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits = pcl730_di_insn_bits; + s->private = (void *)PCL730_DIO_LO; + } return 0; } -- 1.8.1.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel