linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kristina Martšenko" <kristina.martsenko@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Hartmut Knaack" <knaack.h@gmx.de>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Peter Meerwald" <pmeerw@pmeerw.net>,
	"Marek Vasut" <marex@denx.de>,
	"Juergen Beisert" <jbe@pengutronix.de>,
	"Alexandre Belloni" <alexandre.belloni@free-electrons.com>,
	"Fabio Estevam" <fabio.estevam@freescale.com>,
	"Stefan Wahren" <stefan.wahren@i2se.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
	"Kristina Martšenko" <kristina.martsenko@gmail.com>
Subject: [PATCH v2 4/4] iio: mxs-lradc: only update the buffer when its conversions have finished
Date: Sun, 25 Jan 2015 18:28:22 +0200	[thread overview]
Message-ID: <1422203302-17090-5-git-send-email-kristina.martsenko@gmail.com> (raw)
In-Reply-To: <1422203302-17090-1-git-send-email-kristina.martsenko@gmail.com>

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>
---
 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 d2e0c275bf4d..ebcbd12d48b9 100644
--- a/drivers/staging/iio/adc/mxs-lradc.c
+++ b/drivers/staging/iio/adc/mxs-lradc.c
@@ -1152,10 +1152,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);
-	else if (reg & LRADC_CTRL1_LRADC_IRQ(0))
+	if (iio_buffer_enabled(iio)) {
+		if (reg & lradc->buffer_vchans)
+			iio_trigger_poll(iio->trig);
+	} else if (reg & LRADC_CTRL1_LRADC_IRQ(0)) {
 		complete(&lradc->completion);
+	}
 
 	mxs_lradc_reg_clear(lradc, reg & clr_irq, LRADC_CTRL1);
 
-- 
2.2.0


  parent reply	other threads:[~2015-01-25 16:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-25 16:28 [PATCH v2 0/4] iio: mxs-lradc: fix interactions between the touchscreen and the ADC Kristina Martšenko
2015-01-25 16:28 ` [PATCH v2 1/4] iio: mxs-lradc: separate touchscreen and buffer virtual channels Kristina Martšenko
2015-01-25 16:28 ` [PATCH v2 2/4] iio: mxs-lradc: make ADC reads not disable touchscreen interrupts Kristina Martšenko
2015-01-25 16:28 ` [PATCH v2 3/4] iio: mxs-lradc: make ADC reads not unschedule touchscreen conversions Kristina Martšenko
2015-01-25 16:28 ` Kristina Martšenko [this message]
2015-01-25 18:47 ` [PATCH v2 0/4] iio: mxs-lradc: fix interactions between the touchscreen and the ADC Marek Vasut
2015-01-26 21:01   ` Jonathan Cameron
2015-01-27 14:19     ` Kristina Martšenko
2015-01-27 17:17       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422203302-17090-5-git-send-email-kristina.martsenko@gmail.com \
    --to=kristina.martsenko@gmail.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=fabio.estevam@freescale.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbe@pengutronix.de \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=pmeerw@pmeerw.net \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).