From: H Hartley Sweeten Date: Thu, 6 Jun 2013 22:38:30 +0000 (-0700) Subject: staging: comedi: pcl730: add support for the PCL-734 ISA board X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=85a17285745cf487d60c65750c0363c8531dd726;p=linux-beck.git staging: comedi: pcl730: add support for the PCL-734 ISA board The PCL-734 ISA board can be supported by this driver. This board has 32 isolated digital outputs. Add support for the PCL-734 board to the pcl730 driver and remove it from the poc driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 8f74ccdd9535..0f32d7e79bcd 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -157,6 +157,7 @@ config COMEDI_PCL730 Advantech PCM-3730 isolated - 8 in/8 out ttl - 16 in/16 out Advantech PCL-725 isolated - 8 in/8 out Advantech PCL-733 isolated - 32 in + Advantech PCL-734 isolated - 32 out To compile this driver as a module, choose M here: the module will be called pcl730. @@ -534,7 +535,7 @@ config COMEDI_POC tristate "Generic driver for very simple devices" ---help--- Enable generic support for very simple / POC (Piece of Crap) boards, - Keithley Metrabyte DAC-02 (dac02) and Advantech PCL-734 (pcl734). + Keithley Metrabyte DAC-02 (dac02). To compile this driver as a module, choose M here: the module will be called poc. diff --git a/drivers/staging/comedi/drivers/pcl730.c b/drivers/staging/comedi/drivers/pcl730.c index 2f54c1069432..64aafdaebeee 100644 --- a/drivers/staging/comedi/drivers/pcl730.c +++ b/drivers/staging/comedi/drivers/pcl730.c @@ -13,6 +13,7 @@ * (Advantech) PCM-3730 [pcm3730] * (Advantech) PCL-725 [pcl725] * (Advantech) PCL-733 [pcl733] + * (Advantech) PCL-734 [pcl734] * Author: José Luis Sánchez (jsanchezv@teleline.es) * Status: untested * @@ -33,6 +34,7 @@ * 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. * The pcl733 ISA board uses all four registers for isolated digital inputs. + * The pcl734 ISA board uses all four registers for isolated digital outputs. */ #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) */ @@ -94,6 +96,11 @@ static const struct pcl730_board pcl730_boards[] = { .io_range = 0x04, .n_subdevs = 1, .n_iso_in_chan = 32, + }, { + .name = "pcl734", + .io_range = 0x04, + .n_subdevs = 1, + .n_iso_out_chan = 32, }, }; @@ -114,6 +121,10 @@ static int pcl730_do_insn_bits(struct comedi_device *dev, outb(s->state & 0xff, dev->iobase + reg); if ((mask & 0xff00) && (s->n_chan > 8)) outb((s->state >> 8) & 0xff, dev->iobase + reg + 1); + if ((mask & 0xff0000) && (s->n_chan > 16)) + outb((s->state >> 16) & 0xff, dev->iobase + reg + 2); + if ((mask & 0xff000000) && (s->n_chan > 24)) + outb((s->state >> 24) & 0xff, dev->iobase + reg + 3); } data[1] = s->state; diff --git a/drivers/staging/comedi/drivers/poc.c b/drivers/staging/comedi/drivers/poc.c index 772e77adac4b..005fbefae295 100644 --- a/drivers/staging/comedi/drivers/poc.c +++ b/drivers/staging/comedi/drivers/poc.c @@ -19,14 +19,12 @@ Driver: poc Description: Generic driver for very simple devices Author: ds Devices: [Keithley Metrabyte] DAC-02 (dac02) - PCL-734 (pcl734) Updated: Sat, 16 Mar 2002 17:34:48 -0800 Status: unknown This driver is indended to support very simple ISA-based devices, including: dac02 - Keithley DAC-02 analog output board - pcl734 - Advantech PCL-734 Configuration options: [0] - I/O port base @@ -96,27 +94,6 @@ static int dac02_ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s, return 1; } -static int pcl734_insn_bits(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]); - if ((data[0] >> 0) & 0xff) - outb((s->state >> 0) & 0xff, dev->iobase + 0); - if ((data[0] >> 8) & 0xff) - outb((s->state >> 8) & 0xff, dev->iobase + 1); - if ((data[0] >> 16) & 0xff) - outb((s->state >> 16) & 0xff, dev->iobase + 2); - if ((data[0] >> 24) & 0xff) - outb((s->state >> 24) & 0xff, dev->iobase + 3); - } - data[1] = s->state; - - return insn->n; -} - static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct boarddef_struct *board = comedi_board(dev); @@ -163,14 +140,6 @@ static const struct boarddef_struct boards[] = { .winsn = dac02_ao_winsn, .rinsn = readback_insn, .range = &range_unknown, - }, { - .name = "pcl734", - .iosize = 4, - .type = COMEDI_SUBD_DO, - .n_chan = 32, - .n_bits = 1, - .insnbits = pcl734_insn_bits, - .range = &range_digital, }, };