[PATCH 3.16.y-ckt 045/165] iio: mxs-lradc: only update the buffer when its conversions have finished

Luis Henriques luis.henriques at canonical.com
Wed Mar 25 14:00:18 UTC 2015

3.16.7-ckt9 -stable review patch.  If anyone has any objections, please let me know.


From: =?UTF-8?q?Kristina=20Mart=C5=A1enko?= <kristina.martsenko at gmail.com>

commit 89bb35e200bee745c539a96666e0792301ca40f1 upstream.

Using the touchscreen while running buffered capture results in the
buffer reporting lots of wrong values, often just zeros. This is because
we push readings to the buffer every time a touchscreen interrupt
arrives, including when the buffer's own conversions have not yet
finished. So let's only push to the buffer when its conversions are

Signed-off-by: Kristina Martšenko <kristina.martsenko at gmail.com>
Reviewed-by: Marek Vasut <marex at denx.de>
Signed-off-by: Jonathan Cameron <jic23 at kernel.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
 drivers/staging/iio/adc/mxs-lradc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 565366fcfe3e..4907efaf5e3d 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1157,10 +1157,12 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
-	if (iio_buffer_enabled(iio))
-		iio_trigger_poll(iio->trig, iio_get_time_ns());
-	else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
+	if (iio_buffer_enabled(iio)) {
+		if (reg & lradc->buffer_vchans)
+			iio_trigger_poll(iio->trig, iio_get_time_ns());
+	} else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) {
+	}
 	mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1);

More information about the kernel-team mailing list