]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: das6402: add (*do_cmd) for AI async commands
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 13 Nov 2014 18:41:04 +0000 (11:41 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Nov 2014 23:35:24 +0000 (15:35 -0800)
Flesh out the (*do_cmd) function to support timed analog input
acquisitions.

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/das6402.c

index 047e9737d1fbeac854160de8e8a351ba26d0e86e..780f4f646ea0ae4b22bc09cb0e8da1d3b265aa95 100644 (file)
@@ -256,7 +256,25 @@ static void das6402_ai_set_mode(struct comedi_device *dev,
 static int das6402_ai_cmd(struct comedi_device *dev,
                          struct comedi_subdevice *s)
 {
-       return -EINVAL;
+       struct das6402_private *devpriv = dev->private;
+       struct comedi_cmd *cmd = &s->async->cmd;
+       unsigned int chan_lo = CR_CHAN(cmd->chanlist[0]);
+       unsigned int chan_hi = CR_CHAN(cmd->chanlist[cmd->chanlist_len - 1]);
+
+       das6402_ai_set_mode(dev, s, cmd->chanlist[0], DAS6402_MODE_FIFONEPTY);
+
+       /* load the mux for chanlist conversion */
+       outw(DAS6402_AI_MUX_HI(chan_hi) | DAS6402_AI_MUX_LO(chan_lo),
+            dev->iobase + DAS6402_AI_MUX_REG);
+
+       das6402_enable_counter(dev, true);
+
+       /* enable interrupt and pacer trigger */
+       outb(DAS6402_CTRL_INTE |
+            DAS6402_CTRL_IRQ(devpriv->irq) |
+            DAS6402_CTRL_PACER_TRIG, dev->iobase + DAS6402_CTRL_REG);
+
+       return 0;
 }
 
 static int das6402_ai_check_chanlist(struct comedi_device *dev,