mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 15:02:32 +00:00
59 lines
1.9 KiB
Diff
59 lines
1.9 KiB
Diff
|
From 4c2cec3cfad183400f191413e4867f3f07273ed6 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++) {
|