From: Markus Pargmann <mpa@pengutronix.de>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
patches@opensource.wolfsonmicro.com, linux-input@vger.kernel.org,
kernel@pengutronix.de, Markus Pargmann <mpa@pengutronix.de>,
stable@vger.kernel.org
Subject: [PATCH 1/4] Input: wm97xx: Drop out of range inputs
Date: Fri, 8 Mar 2013 17:15:06 +0100 [thread overview]
Message-ID: <1362759309-18782-2-git-send-email-mpa@pengutronix.de> (raw)
In-Reply-To: <1362759309-18782-1-git-send-email-mpa@pengutronix.de>
With fast movements, there occured some out of screen jumps with my
touchscreen. The abs_x and abs_y module parameters should fix this by
default, but the driver doesn't actively checks the x/y coordinates.
Instead it seems that the input layer was supposed to drop out of range
inputs, as described in the comments:
"These parameters are used to help the input layer discard out of
range readings and reduce jitter etc"
The input layer documentation describes that values that are not in the
absolute range are also accepted.
So this patch adds a check within the driver.
Cc: stable@vger.kernel.org
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
---
drivers/input/touchscreen/wm97xx-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index 5dbe73a..e4c286b 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -442,6 +442,17 @@ static int wm97xx_read_samples(struct wm97xx *wm)
"pen down: x=%x:%d, y=%x:%d, pressure=%x:%d\n",
data.x >> 12, data.x & 0xfff, data.y >> 12,
data.y & 0xfff, data.p >> 12, data.p & 0xfff);
+
+ if (
+ abs_x[0] > (data.x & 0xfff)
+ || abs_x[1] < (data.x & 0xfff)
+ || abs_y[0] > (data.y & 0xfff)
+ || abs_y[1] < (data.y & 0xfff)) {
+ dev_dbg(wm->dev, "Measurement out of range, dropping it\n");
+ rc = RC_AGAIN;
+ goto out;
+ }
+
input_report_abs(wm->input_dev, ABS_X, data.x & 0xfff);
input_report_abs(wm->input_dev, ABS_Y, data.y & 0xfff);
input_report_abs(wm->input_dev, ABS_PRESSURE, data.p & 0xfff);
@@ -455,6 +466,7 @@ static int wm97xx_read_samples(struct wm97xx *wm)
wm->ts_reader_interval = wm->ts_reader_min_interval;
}
+out:
mutex_unlock(&wm->codec_mutex);
return rc;
}
--
1.8.1.4
next prev parent reply other threads:[~2013-03-08 16:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-08 16:15 [PATCH 0/4] Input: wm97xx: Fix handling of wrong readings Markus Pargmann
2013-03-08 16:15 ` Markus Pargmann [this message]
2013-03-08 17:15 ` [PATCH 1/4] Input: wm97xx: Drop out of range inputs Mark Brown
2013-03-08 18:11 ` Markus Pargmann
2013-03-08 16:15 ` [PATCH 2/4] Input: wm9712: Fix returncode for wrong sample Markus Pargmann
2013-03-08 17:17 ` Mark Brown
2013-03-08 16:15 ` [PATCH 3/4] Input: wm9712: Fix wrong pen up readings Markus Pargmann
2013-03-08 17:23 ` Mark Brown
2013-03-08 16:15 ` [PATCH 4/4] Input: wm9712: Fix dev_dbg newlines Markus Pargmann
2013-03-08 17:21 ` Mark Brown
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=1362759309-18782-2-git-send-email-mpa@pengutronix.de \
--to=mpa@pengutronix.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dmitry.torokhov@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-input@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=patches@opensource.wolfsonmicro.com \
--cc=stable@vger.kernel.org \
/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).