2123041a47a5acdcab7766d33face306c827c015
[openwrt/staging/rmilecki.git] /
1 From 066255aaae527ace73f85d698a6668a752785d1c Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Tue, 30 Nov 2021 17:28:50 +0000
4 Subject: [PATCH] input: edt-ft5x06: Only look at the number of points
5 reported
6
7 Register 0x02 in the FT5x06 is TD_STATUS containing the number
8 of valid touch points being reported.
9
10 Iterate over that number of points rather than all that are
11 supported on the device.
12
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
14 ---
15 drivers/input/touchscreen/edt-ft5x06.c | 9 ++++++++-
16 1 file changed, 8 insertions(+), 1 deletion(-)
17
18 --- a/drivers/input/touchscreen/edt-ft5x06.c
19 +++ b/drivers/input/touchscreen/edt-ft5x06.c
20 @@ -205,6 +205,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int
21 unsigned int active_ids = 0, known_ids = tsdata->known_ids;
22 long released_ids;
23 int b = 0;
24 + unsigned int num_points;
25
26 switch (tsdata->version) {
27 case EDT_M06:
28 @@ -252,9 +253,15 @@ static irqreturn_t edt_ft5x06_ts_isr(int
29
30 if (!edt_ft5x06_ts_check_crc(tsdata, rdbuf, datalen))
31 goto out;
32 + num_points = tsdata->max_support_points;
33 + } else {
34 + /* Register 2 is TD_STATUS, containing the number of touch
35 + * points.
36 + */
37 + num_points = min(rdbuf[2] & 0xf, tsdata->max_support_points);
38 }
39
40 - for (i = 0; i < tsdata->max_support_points; i++) {
41 + for (i = 0; i < num_points; i++) {
42 u8 *buf = &rdbuf[i * tplen + offset];
43
44 type = buf[0] >> 6;