]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: mxs-lradc: only update the buffer when its conversions have finished
authorKristina Martšenko <kristina.martsenko@gmail.com>
Sun, 25 Jan 2015 16:28:22 +0000 (18:28 +0200)
committerLuis Henriques <luis.henriques@canonical.com>
Wed, 18 Mar 2015 14:41:42 +0000 (14:41 +0000)
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
ready.

Signed-off-by: Kristina Martšenko <kristina.martsenko@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/staging/iio/adc/mxs-lradc.c

index 565366fcfe3eaf3611b0ac71d1e05d87b4270ac3..4907efaf5e3d19c5858860b886263602343b311f 100644 (file)
@@ -1157,10 +1157,12 @@ static irqreturn_t mxs_lradc_handle_irq(int irq, void *data)
                                LRADC_CTRL1_LRADC_IRQ(TOUCHSCREEN_VCHANNEL2));
        }
 
-       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)) {
                complete(&lradc->completion);
+       }
 
        mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1);