Commit 1d02ad43 authored by Michael Hennerich's avatar Michael Hennerich Committed by Dmitry Torokhov

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: default avatarMichael Hennerich <michael.hennerich@analog.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 47026b25
...@@ -360,6 +360,13 @@ static int ad7877_rx(struct ad7877 *ts) ...@@ -360,6 +360,13 @@ static int ad7877_rx(struct ad7877 *ts)
Rt /= z1; Rt /= z1;
Rt = (Rt + 2047) >> 12; 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)) if (!timer_pending(&ts->timer))
input_report_key(input_dev, BTN_TOUCH, 1); input_report_key(input_dev, BTN_TOUCH, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment