aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristina Martšenko <kristina.martsenko@gmail.com>2015-01-25 18:28:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-18 13:31:26 +0100
commite7f3db14eacaf1993a70b1517582603dfdf34988 (patch)
tree5a93208df60ec5d9e555ace0cd61d4cb26b84403
parenta1c5b58e41535564b0bce1bec2bce34b2657c98c (diff)
iio: mxs-lradc: only update the buffer when its conversions have finished
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/iio/adc/mxs-lradc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c
index 7965aceffd10..be89260c23a6 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1160,9 +1160,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)) {
complete(&lradc->completion);
+ }
mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1);