Thread (5 messages) 5 messages, 3 authors, 2025-05-21

Re: [PATCH] input: goodix: add poll mode for goodix touchscreen

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2025-05-19 16:23:06
Also in: lkml

Hi Joseph,

On Mon, May 19, 2025 at 05:57:43PM +0900, Joseph Guo wrote:
quoted hunk ↗ jump to hunk
goodix touchscreen only support interrupt mode by default.
Some panels like waveshare panel which is widely used on raspeberry pi
don't have interrupt pins and only work on i2c poll mode.
The waveshare panel 7inch panel use goodix gt911 touchscreen chip.

Update goodix touchscreen to support both interrupt and poll mode.

Signed-off-by: Joseph Guo <redacted>
---
 drivers/input/touchscreen/goodix.c | 69 +++++++++++++++++++++++++++---
 drivers/input/touchscreen/goodix.h |  4 ++
 2 files changed, 67 insertions(+), 6 deletions(-)
diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index aaf79ac50004..87991b56494d 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -47,6 +47,7 @@
 #define RESOLUTION_LOC		1
 #define MAX_CONTACTS_LOC	5
 #define TRIGGER_LOC		6
+#define POLL_INTERVAL_MS		17	/* 17ms = 60fps */

 /* Our special handling for GPIO accesses through ACPI is x86 specific */
 #if defined CONFIG_X86 && defined CONFIG_ACPI
@@ -497,6 +498,23 @@ static void goodix_process_events(struct goodix_ts_data *ts)
 	input_sync(ts->input_dev);
 }

+static void goodix_ts_irq_poll_timer(struct timer_list *t)
+{
+	struct goodix_ts_data *ts = from_timer(ts, t, timer);
+
+	schedule_work(&ts->work_i2c_poll);
+	mod_timer(&ts->timer, jiffies + msecs_to_jiffies(POLL_INTERVAL_MS));
+}
Why are you not suing the existing polling infrastructure
(input_setup_polling())?

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help