summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuper Liu <supercjliu@google.com>2022-11-03 03:49:34 +0000
committerSuper Liu <supercjliu@google.com>2022-11-03 04:03:45 +0000
commitcef2afbaffc2e85b32f8eba342b5e63e0635eed1 (patch)
treedb91f298b1b3644f959bb0478ca11169fc74f90a
parent9f6a34bcedb0993e5652a678c5c01781bd66a15c (diff)
downloadnovatek_touch-cef2afbaffc2e85b32f8eba342b5e63e0635eed1.tar.gz
touch/novatek: abandon unexpected irq and invalid gesture id.
Bug: 256756990 Change-Id: Ia6beaf26ae9941e969ff734bd2f889d40b9b4641 Signed-off-by: Super Liu <supercjliu@google.com>
-rw-r--r--nt36xxx/nt36xxx.c7
-rw-r--r--nt36xxx/nt36xxx.h1
2 files changed, 7 insertions, 1 deletions
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;