[PATCH 05/16] Staging: comedi: drivers: adl_pci9111: Fix AI commands in TRIG_FOLLOW case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ian Abbott <abbotti@xxxxxxxxx>

I received a report that AI streaming acquisitions do not work properly
for the adl_pci9111 driver when convert_src is TRIG_TIMER and
scan_begin_src is TRIG_FOLLOW (and scan_begin_arg is therefore 0).  This
seems to be down to the incorrect setting of dev_private->scan_delay in
pci9111_ai_do_cmd().  Under the previously stated conditions,
dev_private->scan_delay ends up set to (unsigned int)-1, but it ought to
be set to 0.  The function sets it to 0 initially, and it only makes
sense to change it if both convert_src and scan_begin_src are set to
TRIG_TIMER.

Note: 'scan_delay' is the number of unwanted scans to discard after each
valid scan.  The hardware does not support 'scan' timing as such, just a
regularly paced conversion timer (with automatic channel switching
between conversions).  The driver simulates a scan period that is some
(>1) multiple of the conversion period times the scan length
(chanlist_len samples) by reading chanlist_len samples and discarding
the next scan_delay times chanlist_len samples.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/staging/comedi/drivers/adl_pci9111.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c
index 36a254c..39d112b 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -824,9 +824,12 @@ static int pci9111_ai_do_cmd(struct comedi_device *dev,
 		plx9050_interrupt_control(dev_private->lcr_io_base, true, true,
 					  false, true, true);
 
-		dev_private->scan_delay =
-		    (async_cmd->scan_begin_arg / (async_cmd->convert_arg *
-						  async_cmd->chanlist_len)) - 1;
+		if (async_cmd->scan_begin_src == TRIG_TIMER) {
+			dev_private->scan_delay =
+				(async_cmd->scan_begin_arg /
+				 (async_cmd->convert_arg *
+				  async_cmd->chanlist_len)) - 1;
+		}
 
 		break;
 
-- 
1.7.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux