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

staging: comedi: addi_apci_3xxx: use comedi_subdevice 'readback'

Use the new comedi_subdevice 'readback' member and the core provided
(*insn_read) for the readback of the analog output subdevice channels.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 38f9980f
...@@ -628,16 +628,20 @@ static int apci3xxx_ao_insn_write(struct comedi_device *dev, ...@@ -628,16 +628,20 @@ static int apci3xxx_ao_insn_write(struct comedi_device *dev,
int i; int i;
for (i = 0; i < insn->n; i++) { for (i = 0; i < insn->n; i++) {
unsigned int val = data[i];
/* Set the range selection */ /* Set the range selection */
writel(range, dev->mmio + 96); writel(range, dev->mmio + 96);
/* Write the analog value to the selected channel */ /* Write the analog value to the selected channel */
writel((data[i] << 8) | chan, dev->mmio + 100); writel((val << 8) | chan, dev->mmio + 100);
/* Wait the end of transfer */ /* Wait the end of transfer */
ret = comedi_timeout(dev, s, insn, apci3xxx_ao_eoc, 0); ret = comedi_timeout(dev, s, insn, apci3xxx_ao_eoc, 0);
if (ret) if (ret)
return ret; return ret;
s->readback[chan] = val;
} }
return insn->n; return insn->n;
...@@ -850,6 +854,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev, ...@@ -850,6 +854,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
s->maxdata = 0x0fff; s->maxdata = 0x0fff;
s->range_table = &apci3xxx_ao_range; s->range_table = &apci3xxx_ao_range;
s->insn_write = apci3xxx_ao_insn_write; s->insn_write = apci3xxx_ao_insn_write;
s->insn_read = comedi_readback_insn_read;
ret = comedi_alloc_subdev_readback(s);
if (ret)
return ret;
subdev++; subdev++;
} }
......
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