]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
staging: comedi: addi_apci_3xxx: use comedi_subdevice 'readback'
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 25 Aug 2014 23:04:25 +0000 (16:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Aug 2014 20:22:32 +0000 (13:22 -0700)
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: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi_apci_3xxx.c

index 0f0c7fa5daa393ed76399bd025aab1eec15ddd6d..1f59f1681831e3b75b42fd37137f1e1ca83c1747 100644 (file)
@@ -628,16 +628,20 @@ static int apci3xxx_ao_insn_write(struct comedi_device *dev,
        int i;
 
        for (i = 0; i < insn->n; i++) {
+               unsigned int val = data[i];
+
                /* Set the range selection */
                writel(range, dev->mmio + 96);
 
                /* 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 */
                ret = comedi_timeout(dev, s, insn, apci3xxx_ao_eoc, 0);
                if (ret)
                        return ret;
+
+               s->readback[chan] = val;
        }
 
        return insn->n;
@@ -850,6 +854,11 @@ static int apci3xxx_auto_attach(struct comedi_device *dev,
                s->maxdata      = 0x0fff;
                s->range_table  = &apci3xxx_ao_range;
                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++;
        }