From: H Hartley Sweeten <hsweeten@visionengravers.com>
Date: Tue, 4 Nov 2014 17:54:55 +0000 (-0700)
Subject: staging: comedi: addi_apci_3120: set scan length/start after programming chanlist
X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1022f64e7548a3bede7c671c6d52592f05954bd5;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git

staging: comedi: addi_apci_3120: set scan length/start after programming chanlist

The APCI-3120 documentation says that the PR/PA bits should be set after the
chanlist sequence is programmed.

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>
---

diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c
index 77499b473bb4..f258ceb144fb 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -286,10 +286,6 @@ static void apci3120_set_chanlist(struct comedi_device *dev,
 	struct apci3120_private *devpriv = dev->private;
 	int i;
 
-	/* set scan length (PR) and scan start (PA) */
-	devpriv->ctrl = APCI3120_CTRL_PR(n_chan - 1) | APCI3120_CTRL_PA(0);
-	outw(devpriv->ctrl, dev->iobase + APCI3120_CTRL_REG);
-
 	/* set chanlist for scan */
 	for (i = 0; i < n_chan; i++) {
 		unsigned int chan = CR_CHAN(chanlist[i]);
@@ -307,6 +303,10 @@ static void apci3120_set_chanlist(struct comedi_device *dev,
 	}
 
 	apci3120_ai_reset_fifo(dev);
+
+	/* set scan length (PR) and scan start (PA) */
+	devpriv->ctrl = APCI3120_CTRL_PR(n_chan - 1) | APCI3120_CTRL_PA(0);
+	outw(devpriv->ctrl, dev->iobase + APCI3120_CTRL_REG);
 }
 
 #include "addi-data/hwdrv_apci3120.c"