From cef2afbaffc2e85b32f8eba342b5e63e0635eed1 Mon Sep 17 00:00:00 2001 From: Super Liu Date: Thu, 3 Nov 2022 03:49:34 +0000 Subject: touch/novatek: abandon unexpected irq and invalid gesture id. Bug: 256756990 Change-Id: Ia6beaf26ae9941e969ff734bd2f889d40b9b4641 Signed-off-by: Super Liu --- nt36xxx/nt36xxx.c | 7 ++++++- nt36xxx/nt36xxx.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nt36xxx/nt36xxx.c b/nt36xxx/nt36xxx.c index 2c9a706..d19f0f1 100644 --- a/nt36xxx/nt36xxx.c +++ b/nt36xxx/nt36xxx.c @@ -1116,7 +1116,8 @@ void nvt_ts_wakeup_gesture_report(uint8_t gesture_id, uint8_t *data) return; } - keycode = gesture_keycode[gesture_id]; + if (gesture_id < GESTURE_ID_MAX) + keycode = gesture_keycode[gesture_id]; if (keycode) { NVT_LOG("Gesture: %s(%d) triggered and report keycode(%d).\n", gesture_string[gesture_id], gesture_id, keycode); @@ -1592,6 +1593,9 @@ static irqreturn_t nvt_ts_work_func(int irq, void *data) uint8_t touch_freq_index; uint8_t pen_freq_index; + if (!ts->probe_done) + return IRQ_HANDLED; + if (ts->wkg_flag && ts->bTouchIsAwake == false) pm_wakeup_event(&ts->input_dev->dev, 5 * MSEC_PER_SEC); else @@ -2579,6 +2583,7 @@ static int32_t nvt_ts_probe(struct spi_device *client) nvt_irq_enable(true); + ts->probe_done = true; return 0; #if defined(CONFIG_FB) diff --git a/nt36xxx/nt36xxx.h b/nt36xxx/nt36xxx.h index b70d650..95a8dd8 100644 --- a/nt36xxx/nt36xxx.h +++ b/nt36xxx/nt36xxx.h @@ -239,6 +239,7 @@ struct nvt_ts_data { uint8_t *xbuf; char history_buf[NVT_HISTORY_BUF_LEN]; struct mutex xbuf_lock; + bool probe_done; bool irq_enabled; bool pen_support; bool wgp_stylus; -- cgit v1.2.3