summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYen-Chao Chen <davidycchen@google.com>2023-08-09 09:59:37 +0800
committerSuper Liu <supercjliu@google.com>2023-09-20 08:46:56 +0000
commitc3e90e2c6e1d20dad416213e13765cdac94cd0ac (patch)
treed315b3b4461ae32848863750e1410749c421bdba
parent71d4428c99d88f80628cf2afe9799332e89024aa (diff)
downloadfelix-android-gs-felix-5.10-android14-qpr1-beta.tar.gz
Bug: 293907307 Test: Touch works normally. Change-Id: I73439b102ac6d6a347767b314f56fff87ba69daf Signed-off-by: Yen-Chao Chen <davidycchen@google.com>
-rw-r--r--touch/ftm5/fts.c5
-rw-r--r--touch/ftm5/fts_lib/ftsSoftware.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/touch/ftm5/fts.c b/touch/ftm5/fts.c
index 38801ab..daf8863 100644
--- a/touch/ftm5/fts.c
+++ b/touch/ftm5/fts.c
@@ -3877,6 +3877,11 @@ static irqreturn_t fts_interrupt_handler(int irq, void *handle)
for (count = 0; count < events_remaining + 1; count++) {
evt_data = &data[count * FIFO_EVENT_SIZE];
+ if (!VALID_EVENT_TYPE(evt_data[0])) {
+ dev_err(info->dev, "Got invalid event type: %*ph\n", 8, evt_data);
+ goto exit;
+ }
+
switch (GET_EVENT_TYPE(evt_data[0])) {
case EVT_ID_CONTROLLER_READY:
case EVT_ID_ERROR:
diff --git a/touch/ftm5/fts_lib/ftsSoftware.h b/touch/ftm5/fts_lib/ftsSoftware.h
index 14e45e8..8090bc0 100644
--- a/touch/ftm5/fts_lib/ftsSoftware.h
+++ b/touch/ftm5/fts_lib/ftsSoftware.h
@@ -375,6 +375,7 @@ enum {
/** @}*/
/* bit2 and bit3 are for major data so skip it. */
#define GET_EVENT_TYPE(event_data) (event_data & 0xF3)
+#define VALID_EVENT_TYPE(event_data) ((event_data & 0x03) == 0x03)
/* EVENT ID */
/** @defgroup events_group FW Event IDs and Types
* Event IDs and Types pushed by the FW into the FIFO