1 From 4c2cec3cfad183400f191413e4867f3f07273ed6 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Fri, 19 May 2023 18:16:58 +0100
4 Subject: [PATCH] input: edt-ft5x06: Only read data for number of
7 Rather than always reading the maximum number of points supported
8 by the chip (which may be as high as 10), read the number of
9 active points first, and read data for just those.
10 In most cases this will result in less data on the I2C bus,
11 with only the maximum touch points taking more due to a second
12 read that has to configure the start address.
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
16 drivers/input/touchscreen/edt-ft5x06.c | 10 +++++++++-
17 1 file changed, 9 insertions(+), 1 deletion(-)
19 --- a/drivers/input/touchscreen/edt-ft5x06.c
20 +++ b/drivers/input/touchscreen/edt-ft5x06.c
21 @@ -220,6 +220,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int
22 offset = 5; /* where the actual touch data starts */
23 tplen = 4; /* data comes in so called frames */
24 crclen = 1; /* length of the crc data */
25 + datalen = tplen * tsdata->max_support_points + offset + crclen;
29 @@ -230,6 +231,7 @@ static irqreturn_t edt_ft5x06_ts_isr(int
37 @@ -237,7 +239,6 @@ static irqreturn_t edt_ft5x06_ts_isr(int
40 memset(rdbuf, 0, sizeof(rdbuf));
41 - datalen = tplen * tsdata->max_support_points + offset + crclen;
43 error = edt_ft5x06_ts_readwrite(tsdata->client,
45 @@ -267,6 +268,13 @@ static irqreturn_t edt_ft5x06_ts_isr(int
48 num_points = min(rdbuf[2] & 0xf, tsdata->max_support_points);
50 + datalen = tplen * num_points + crclen;
52 + error = edt_ft5x06_ts_readwrite(tsdata->client,
54 + datalen, &rdbuf[offset]);
58 for (i = 0; i < num_points; i++) {