summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2010-10-15 16:49:08 (GMT)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-10-18 04:12:46 (GMT)
commit1d02ad436235080b8a95a2c86a66cb7b8f2e9df9 (patch)
treeb7b1e19086ce8f3df55e0eb60c1354f4fe26b37a
parent47026b25fc6cd2d7ec85d4a83c472bca20946a94 (diff)
downloadlinux-fsl-qoriq-1d02ad436235080b8a95a2c86a66cb7b8f2e9df9.tar.xz
Input: ad7877 - filter events where pressure is beyond the maximum
Suppress events where pressure > pressure_max. These events come typically along with inaccurate X and Y samples. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r--drivers/input/touchscreen/ad7877.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 96c0a0d..b7de78e 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -360,6 +360,13 @@ static int ad7877_rx(struct ad7877 *ts)
Rt /= z1;
Rt = (Rt + 2047) >> 12;
+ /*
+ * Sample found inconsistent, pressure is beyond
+ * the maximum. Don't report it to user space.
+ */
+ if (Rt > ts->pressure_max)
+ return -EINVAL;
+
if (!timer_pending(&ts->timer))
input_report_key(input_dev, BTN_TOUCH, 1);