staging: comedi: addi_apci_1032: add a subdevice for the interrupt support

This board supports a single interrupt that can be generated by an AND/OR
combination of 16 of the input channels.

Create a separate subdevice, similar to the comedi_parport driver, to
handle this interrupt.

Move the i_APCI1032_ConfigDigitalInput() operation from the digital
input subdevice to this new subdevice. Rename the CamelCase function
to apci1032_intr_insn_config().

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2012-11-05 14:41:13 -07:00 • committed by Greg Kroah-Hartman
commit 6835a17a91

View file

@ -61,10 +61,10 @@ static unsigned int ui_InterruptStatus;
* data[2] : Interrupt mask for the mode 1
* data[3] : Interrupt mask for the mode 2
*/
static int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
static int apci1032_intr_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn,
unsigned int *data)
{
struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue;
@ -175,7 +175,7 @@ static int apci1032_attach_pci(struct comedi_device *dev,
dev->irq = pcidev->irq;
}
ret = comedi_alloc_subdevices(dev, 1);
ret = comedi_alloc_subdevices(dev, 2);
if (ret)
return ret;
@ -187,9 +187,18 @@ static int apci1032_attach_pci(struct comedi_device *dev,
s->maxdata = 1;
s->len_chanlist = 32;
s->range_table = &range_digital;
s->insn_config = i_APCI1032_ConfigDigitalInput;
s->insn_bits = apci1032_di_insn_bits;
if (dev->irq) {
s = &dev->subdevices[1];
s->type = COMEDI_SUBD_DI;
s->subdev_flags = SDF_READABLE;
s->n_chan = 1;
s->maxdata = 1;
s->range_table = &range_digital;
s->insn_config = apci1032_intr_insn_config;
}
apci1032_reset(dev);
return 0;
}