[PATCH 176/368] Staging: comedi: pcl812: Update MUX for multi-channel AI command

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Greg KH
Date: Thursday, March 4, 2010 - 1:05 pm

From: Ian Abbott <abbotti@mev.co.uk>

For multi-channel AI commands, the interrupt handler is missing code to
switch to the next channel.  Add some (untested) code to handle this.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/comedi/drivers/pcl812.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c
index aa91273..d4634c4 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -955,6 +955,7 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
 	unsigned int mask, timeout;
 	struct comedi_device *dev = d;
 	struct comedi_subdevice *s = dev->subdevices + 0;
+	unsigned int next_chan;
 
 	s->async->events = 0;
 
@@ -993,11 +994,18 @@ static irqreturn_t interrupt_pcl812_ai_int(int irq, void *d)
 		       ((inb(dev->iobase + PCL812_AD_HI) << 8) |
 			inb(dev->iobase + PCL812_AD_LO)) & mask);
 
+	/* Set up next channel. Added by abbotti 2010-01-20, but untested. */
+	next_chan = s->async->cur_chan + 1;
+	if (next_chan >= devpriv->ai_n_chan)
+		next_chan = 0;
+	if (devpriv->ai_chanlist[s->async->cur_chan] !=
+			devpriv->ai_chanlist[next_chan])
+		setup_range_channel(dev, s, devpriv->ai_chanlist[next_chan], 0);
+
 	outb(0, dev->iobase + PCL812_CLRINT);	/* clear INT request */
 
-	s->async->cur_chan++;
-	if (s->async->cur_chan >= devpriv->ai_n_chan) {	/* one scan done */
-		s->async->cur_chan = 0;
+	s->async->cur_chan = next_chan;
+	if (next_chan == 0) {	/* one scan done */
 		devpriv->ai_act_scan++;
 		if (!(devpriv->ai_neverending))
 			if (devpriv->ai_act_scan >= devpriv->ai_scans) {	/* all data sampled */
-- 
1.7.0.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 043/368] Staging: add dt3155 driver, Greg KH, (Thu Mar 4, 1:03 pm)
[PATCH 045/368] Staging: dt3155: add TODO file, Greg KH, (Thu Mar 4, 1:03 pm)
[GIT PATCH] STAGING patches for 2.6.33-git, Greg KH, (Thu Mar 4, 1:04 pm)
[PATCH 176/368] Staging: comedi: pcl812: Update MUX for mu ..., Greg KH, (Thu Mar 4, 1:05 pm)
[PATCH 190/368] Staging: et131x: kill EXP_ROM, Greg KH, (Thu Mar 4, 1:06 pm)
[PATCH 222/368] Staging: otus: fix memory leak, Greg KH, (Thu Mar 4, 1:06 pm)
[PATCH 264/368] staging: dream: Codestyle fix, Greg KH, (Thu Mar 4, 1:07 pm)
Re: [PATCH 264/368] staging: dream: Codestyle fix, Pavel Machek, (Fri Mar 5, 12:08 am)