Commit 6835a17a authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6a3734af
...@@ -61,10 +61,10 @@ static unsigned int ui_InterruptStatus; ...@@ -61,10 +61,10 @@ static unsigned int ui_InterruptStatus;
* data[2] : Interrupt mask for the mode 1 * data[2] : Interrupt mask for the mode 1
* data[3] : Interrupt mask for the mode 2 * data[3] : Interrupt mask for the mode 2
*/ */
static int i_APCI1032_ConfigDigitalInput(struct comedi_device *dev, static int apci1032_intr_insn_config(struct comedi_device *dev,
struct comedi_subdevice *s, struct comedi_subdevice *s,
struct comedi_insn *insn, struct comedi_insn *insn,
unsigned int *data) unsigned int *data)
{ {
struct addi_private *devpriv = dev->private; struct addi_private *devpriv = dev->private;
unsigned int ui_TmpValue; unsigned int ui_TmpValue;
...@@ -175,7 +175,7 @@ static int apci1032_attach_pci(struct comedi_device *dev, ...@@ -175,7 +175,7 @@ static int apci1032_attach_pci(struct comedi_device *dev,
dev->irq = pcidev->irq; dev->irq = pcidev->irq;
} }
ret = comedi_alloc_subdevices(dev, 1); ret = comedi_alloc_subdevices(dev, 2);
if (ret) if (ret)
return ret; return ret;
...@@ -187,9 +187,18 @@ static int apci1032_attach_pci(struct comedi_device *dev, ...@@ -187,9 +187,18 @@ static int apci1032_attach_pci(struct comedi_device *dev,
s->maxdata = 1; s->maxdata = 1;
s->len_chanlist = 32; s->len_chanlist = 32;
s->range_table = &range_digital; s->range_table = &range_digital;
s->insn_config = i_APCI1032_ConfigDigitalInput;
s->insn_bits = apci1032_di_insn_bits; 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); apci1032_reset(dev);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment