1 From 037324a6b9f331943f246fdf39c4ae58a6e8f287 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
7 Register 0x02 in the FT5x06 is TD_STATUS containing the number
8 of valid touch points being reported.
10 Iterate over that number of points rather than all that are
11 supported on the device.
13 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
15 drivers/input/touchscreen/edt-ft5x06.c | 9 ++++++++-
16 1 file changed, 8 insertions(+), 1 deletion(-)
18 --- a/drivers/input/touchscreen/edt-ft5x06.c
19 +++ b/drivers/input/touchscreen/edt-ft5x06.c
20 @@ -212,6 +212,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int
21 unsigned int active_ids = 0, known_ids = tsdata->known_ids;
24 + unsigned int num_points;
26 switch (tsdata->version) {
28 @@ -260,9 +261,15 @@ static irqreturn_t edt_ft5x06_ts_isr(int
30 if (!edt_ft5x06_ts_check_crc(tsdata, rdbuf, datalen))
32 + num_points = tsdata->max_support_points;
34 + /* Register 2 is TD_STATUS, containing the number of touch
37 + num_points = min(rdbuf[2] & 0xf, tsdata->max_support_points);
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];