Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: wm97xx - drop out of range inputs

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.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Markus Pargmann and committed by
Dmitry Torokhov
cfd5d096 b4a034da

+11
+11
drivers/input/touchscreen/wm97xx-core.c
··· 442 442 "pen down: x=%x:%d, y=%x:%d, pressure=%x:%d\n", 443 443 data.x >> 12, data.x & 0xfff, data.y >> 12, 444 444 data.y & 0xfff, data.p >> 12, data.p & 0xfff); 445 + 446 + if (abs_x[0] > (data.x & 0xfff) || 447 + abs_x[1] < (data.x & 0xfff) || 448 + abs_y[0] > (data.y & 0xfff) || 449 + abs_y[1] < (data.y & 0xfff)) { 450 + dev_dbg(wm->dev, "Measurement out of range, dropping it\n"); 451 + rc = RC_AGAIN; 452 + goto out; 453 + } 454 + 445 455 input_report_abs(wm->input_dev, ABS_X, data.x & 0xfff); 446 456 input_report_abs(wm->input_dev, ABS_Y, data.y & 0xfff); 447 457 input_report_abs(wm->input_dev, ABS_PRESSURE, data.p & 0xfff); ··· 465 455 wm->ts_reader_interval = wm->ts_reader_min_interval; 466 456 } 467 457 458 + out: 468 459 mutex_unlock(&wm->codec_mutex); 469 460 return rc; 470 461 }