summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidycchen <davidycchen@google.com>2021-06-15 10:44:40 +0800
committerdavidycchen <davidycchen@google.com>2021-06-16 10:37:37 +0800
commit5dfa25302cad5cf74c6c22f7bb951ec7030dff84 (patch)
treea08636dbcb21179b1813e6504c51ccfd77bb5ac7
parentc42c5a00a2ebd99629f775b152a12177297ea772 (diff)
downloadfts_touch-android-msm-redbull-4.19-s-v2-beta-3.tar.gz
When the release_all_touches and offload_report run at the same time, it may cause the input report conflict before input sync. bug: 190460965 Test: flash boot.img and vendor_boot.img. Signed-off-by: davidycchen <davidycchen@google.com> Change-Id: I35e5d296a762629e64d0851f5336b7de604f8e86
-rw-r--r--fts.c26
-rw-r--r--fts.h2
2 files changed, 23 insertions, 5 deletions
diff --git a/fts.c b/fts.c
index 9246bdc..69bb11d 100644
--- a/fts.c
+++ b/fts.c
@@ -163,6 +163,8 @@ void release_all_touches(struct fts_ts_info *info)
unsigned int type = MT_TOOL_FINGER;
int i;
+ mutex_lock(&info->input_report_mutex);
+
for (i = 0; i < TOUCH_ID_MAX; i++) {
#ifdef STYLUS_MODE
if (test_bit(i, &info->stylus_id))
@@ -183,6 +185,9 @@ void release_all_touches(struct fts_ts_info *info)
}
input_report_key(info->input_dev, BTN_TOUCH, 0);
input_sync(info->input_dev);
+
+ mutex_unlock(&info->input_report_mutex);
+
info->touch_id = 0;
info->palm_touch_mask = 0;
info->grip_touch_mask = 0;
@@ -191,7 +196,6 @@ void release_all_touches(struct fts_ts_info *info)
#endif
}
-
/**
* @defgroup file_nodes Driver File Nodes
* Driver publish a series of file nodes used to provide several utilities
@@ -3001,6 +3005,8 @@ static bool fts_enter_pointer_event_handler(struct fts_ts_info *info, unsigned
if (!info->resume_bit)
goto no_report;
+ mutex_lock(&info->input_report_mutex);
+
touchType = event[1] & 0x0F;
touchId = (event[1] & 0xF0) >> 4;
@@ -3085,6 +3091,7 @@ static bool fts_enter_pointer_event_handler(struct fts_ts_info *info, unsigned
break;
default:
+ mutex_unlock(&info->input_report_mutex);
pr_err("%s : Invalid touch type = %d ! No Report...\n",
__func__, touchType);
goto no_report;
@@ -3129,7 +3136,8 @@ static bool fts_enter_pointer_event_handler(struct fts_ts_info *info, unsigned
#endif
/* pr_info("%s : Event 0x%02x - ID[%d], (x, y) = (%3d, %3d)
* Size = %d\n",
- * __func__, *event, touchId, x, y, touchType); */
+ * __func__, *event, touchId, x, y, touchType); */
+ mutex_unlock(&info->input_report_mutex);
return true;
no_report:
@@ -3147,6 +3155,8 @@ static bool fts_leave_pointer_event_handler(struct fts_ts_info *info, unsigned
unsigned int tool = MT_TOOL_FINGER;
u8 touchType;
+ mutex_lock(&info->input_report_mutex);
+
touchType = event[1] & 0x0F;
touchId = (event[1] & 0xF0) >> 4;
@@ -3179,6 +3189,7 @@ static bool fts_leave_pointer_event_handler(struct fts_ts_info *info, unsigned
break;
default:
+ mutex_unlock(&info->input_report_mutex);
pr_err("%s : Invalid touch type = %d ! No Report...\n",
__func__, touchType);
return false;
@@ -3198,6 +3209,8 @@ static bool fts_leave_pointer_event_handler(struct fts_ts_info *info, unsigned
}
#endif
+ mutex_unlock(&info->input_report_mutex);
+
return true;
}
@@ -4364,11 +4377,12 @@ static irqreturn_t fts_interrupt_handler(int irq, void *handle)
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
if (!info->offload.offload_running) {
#endif
-
+ mutex_lock(&info->input_report_mutex);
if (info->touch_id == 0)
input_report_key(info->input_dev, BTN_TOUCH, 0);
input_sync(info->input_dev);
+ mutex_unlock(&info->input_report_mutex);
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
}
@@ -4420,6 +4434,8 @@ static void fts_offload_report(void *handle,
bool touch_down = 0;
int i;
+ mutex_lock(&info->input_report_mutex);
+
input_set_timestamp(info->input_dev, report->timestamp);
for (i = 0; i < MAX_COORDS; i++) {
@@ -4464,6 +4480,8 @@ static void fts_offload_report(void *handle,
input_report_key(info->input_dev, BTN_TOUCH, touch_down);
input_sync(info->input_dev);
+
+ mutex_unlock(&info->input_report_mutex);
}
#endif /* CONFIG_TOUCHSCREEN_OFFLOAD */
@@ -6276,7 +6294,7 @@ static int fts_probe(struct spi_device *client)
mutex_init(&info->diag_cmd_lock);
- mutex_init(&(info->input_report_mutex));
+ mutex_init(&info->input_report_mutex);
mutex_init(&info->bus_mutex);
/* Assume screen is on throughout probe */
diff --git a/fts.h b/fts.h
index 939dc2b..8929756 100644
--- a/fts.h
+++ b/fts.h
@@ -474,7 +474,7 @@ struct fts_ts_info {
struct wakeup_source *wakesrc; /* Wake Lock struct */
/* input lock */
- struct mutex input_report_mutex; /* Mutex for pressure report */
+ struct mutex input_report_mutex; /* Mutex for input report */
/* switches for features */
int gesture_enabled; /* Gesture during suspend */