[PATCH 45/66] staging: comedi: pcl818: introduce pcl818_ai_soft_trig()

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

 



Introduce a helper function to start a software triggered analog input
conversion.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/pcl818.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c
index 33a78ad..ab2e6f2 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -406,6 +406,11 @@ static void pcl818_ai_clear_eoc(struct comedi_device *dev)
 	outb(0, dev->iobase + PCL818_CLRINT);
 }
 
+static void pcl818_ai_soft_trig(struct comedi_device *dev)
+{
+	/* writing any value triggers a software conversion */
+	outb(0, dev->iobase + PCL818_AD_LO);
+}
 
 static unsigned int pcl818_ai_get_fifo_sample(struct comedi_device *dev,
 					      struct comedi_subdevice *s,
@@ -915,7 +920,7 @@ static int pcl818_ai_cancel(struct comedi_device *dev,
 	     dev->iobase + PCL818_CONTROL);	/* Stop A/D */
 	udelay(1);
 	pcl818_start_pacer(dev, false);
-	outb(0, dev->iobase + PCL818_AD_LO);
+	pcl818_ai_soft_trig(dev);
 	pcl818_ai_get_sample(dev, s, NULL);
 	outb(0, dev->iobase + PCL818_CONTROL);	/* Stop A/D */
 	pcl818_ai_clear_eoc(dev);
@@ -951,8 +956,7 @@ static int pcl818_ai_insn_read(struct comedi_device *dev,
 
 	for (i = 0; i < insn->n; i++) {
 		pcl818_ai_clear_eoc(dev);
-		/* start conversion */
-		outb(0, dev->iobase + PCL818_AD_LO);
+		pcl818_ai_soft_trig(dev);
 
 		ret = comedi_timeout(dev, s, insn, pcl818_ai_eoc, 0);
 		if (ret)
-- 
1.8.5.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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