aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.15/950-0581-input-edt-ft5x06-Handle-unreliable-TOUCH_UP-events.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/bcm27xx/patches-5.15/950-0581-input-edt-ft5x06-Handle-unreliable-TOUCH_UP-events.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.15/950-0581-input-edt-ft5x06-Handle-unreliable-TOUCH_UP-events.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.15/950-0581-input-edt-ft5x06-Handle-unreliable-TOUCH_UP-events.patch b/target/linux/bcm27xx/patches-5.15/950-0581-input-edt-ft5x06-Handle-unreliable-TOUCH_UP-events.patch
new file mode 100644
index 0000000000..c011caebe7
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.15/950-0581-input-edt-ft5x06-Handle-unreliable-TOUCH_UP-events.patch
@@ -0,0 +1,63 @@
+From 7b658b57d05317656fec750eca1094049de41c76 Mon Sep 17 00:00:00 2001
+From: Dave Stevenson <dave.stevenson@raspberrypi.com>
+Date: Fri, 26 Nov 2021 14:37:40 +0000
+Subject: [PATCH] input: edt-ft5x06: Handle unreliable TOUCH_UP events
+
+The ft5x06 is unreliable in sending touch up events, so some
+touch IDs can become stuck in the detected state.
+
+Ensure that IDs that are unreported by the controller are
+released.
+
+Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
+---
+ drivers/input/touchscreen/edt-ft5x06.c | 21 ++++++++++++++++++++-
+ 1 file changed, 20 insertions(+), 1 deletion(-)
+
+--- a/drivers/input/touchscreen/edt-ft5x06.c
++++ b/drivers/input/touchscreen/edt-ft5x06.c
+@@ -127,6 +127,7 @@ struct edt_ft5x06_ts_data {
+ int offset_y;
+ int report_rate;
+ int max_support_points;
++ unsigned int known_ids;
+
+ char name[EDT_NAME_LEN];
+
+@@ -201,6 +202,9 @@ static irqreturn_t edt_ft5x06_ts_isr(int
+ int i, type, x, y, id;
+ int offset, tplen, datalen, crclen;
+ int error;
++ unsigned int active_ids = 0, known_ids = tsdata->known_ids;
++ long released_ids;
++ int b = 0;
+
+ switch (tsdata->version) {
+ case EDT_M06:
+@@ -272,10 +276,25 @@ static irqreturn_t edt_ft5x06_ts_isr(int
+
+ input_mt_slot(tsdata->input, id);
+ if (input_mt_report_slot_state(tsdata->input, MT_TOOL_FINGER,
+- type != TOUCH_EVENT_UP))
++ type != TOUCH_EVENT_UP)) {
+ touchscreen_report_pos(tsdata->input, &tsdata->prop,
+ x, y, true);
++ active_ids |= BIT(id);
++ } else {
++ known_ids &= ~BIT(id);
++ }
++ }
++
++ /* One issue with the device is the TOUCH_UP message is not always
++ * returned. Instead track which ids we know about and report when they
++ * are no longer updated
++ */
++ released_ids = known_ids & ~active_ids;
++ for_each_set_bit_from(b, &released_ids, tsdata->max_support_points) {
++ input_mt_slot(tsdata->input, b);
++ input_mt_report_slot_inactive(tsdata->input);
+ }
++ tsdata->known_ids = active_ids;
+
+ input_mt_report_pointer_emulation(tsdata->input, true);
+ input_sync(tsdata->input);