1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-02-15 04:42:02 +00:00
openmptcprouter/6.1/target/linux/bcm27xx/patches-6.1/950-0736-input-edt-ft5x06-Only-read-data-for-number-of-points.patch
Ycarus (Yannick Chabanois) 3743692973 Fix RPI5 support
2023-11-17 17:31:36 +01:00

58 lines
1.9 KiB
Diff

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