staging: comedi: addi_apci_3120: reset fifo after programming chanlist
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 4 Nov 2014 17:54:54 +0000 (10:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 7 Nov 2014 17:34:03 +0000 (09:34 -0800)
The APCI-3120 documentation says that the FIFO should be reset after the
chanlist sequence is programmed.

Reset the FIFO after programming the chanlist and remove the extra FIFO
resets in the driver.

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-data/hwdrv_apci3120.c
drivers/staging/comedi/drivers/addi_apci_3120.c

index 54c8583..95a1b7d 100644 (file)
@@ -112,7 +112,6 @@ static int apci3120_reset(struct comedi_device *dev)
        devpriv->ctrl = 0;
        outw(devpriv->ctrl, dev->iobase + APCI3120_CTRL_REG);
 
-       apci3120_ai_reset_fifo(dev);
        inw(dev->iobase + APCI3120_STATUS_REG);
 
        return 0;
@@ -143,7 +142,6 @@ static int apci3120_cancel(struct comedi_device *dev,
        devpriv->mode = 0;
        outb(devpriv->mode, dev->iobase + APCI3120_MODE_REG);
 
-       apci3120_ai_reset_fifo(dev);
        inw(dev->iobase + APCI3120_STATUS_REG);
        devpriv->ui_DmaActualBuffer = 0;
 
@@ -382,8 +380,6 @@ static int apci3120_ai_cmd(struct comedi_device *dev,
        outl(APCI3120_CLEAR_WRITE_TC_INT,
             devpriv->amcc + APCI3120_AMCC_OP_REG_INTCSR);
 
-       apci3120_ai_reset_fifo(dev);
-
        devpriv->ui_DmaActualBuffer = 0;
 
        /* load chanlist for command scan */
index 044d2c4..77499b4 100644 (file)
@@ -305,6 +305,8 @@ static void apci3120_set_chanlist(struct comedi_device *dev,
 
                outw(val, dev->iobase + APCI3120_CHANLIST_REG);
        }
+
+       apci3120_ai_reset_fifo(dev);
 }
 
 #include "addi-data/hwdrv_apci3120.c"
@@ -352,8 +354,6 @@ static int apci3120_ai_insn_read(struct comedi_device *dev,
        /* fixed conversion time of 10 us */
        divisor = apci3120_ns_to_timer(dev, 0, 10000, CMDF_ROUND_NEAREST);
 
-       apci3120_ai_reset_fifo(dev);
-
        for (i = 0; i < insn->n; i++) {
                /* trigger conversion */
                apci3120_timer_write(dev, 0, divisor);