diff options
author | davidycchen <davidycchen@google.com> | 2021-06-15 10:44:40 +0800 |
---|---|---|
committer | davidycchen <davidycchen@google.com> | 2021-06-16 10:37:37 +0800 |
commit | 5dfa25302cad5cf74c6c22f7bb951ec7030dff84 (patch) | |
tree | a08636dbcb21179b1813e6504c51ccfd77bb5ac7 | |
parent | c42c5a00a2ebd99629f775b152a12177297ea772 (diff) | |
download | fts_touch-android-msm-redbull-4.19-s-v2-beta-3.tar.gz |
touch: fts: add mutex to protect offload reportandroid-s-v2-beta-3_r0.4android-s-v2-beta-2_r0.4android-s-v2-beta-1_r0.4android-s-qpr3-beta-3_r0.3android-s-qpr3-beta-2_r0.3android-s-qpr3-beta-1_r0.3android-s-beta-5_r0.5android-s-beta-4_r0.5android-s-beta-3_r0.5android-12.1.0_r0.4android-12.1.0_r0.33android-12.1.0_r0.26android-12.1.0_r0.20android-12.1.0_r0.14android-12.0.0_r0.6android-12.0.0_r0.40android-12.0.0_r0.34android-12.0.0_r0.24android-12.0.0_r0.14android-msm-redbull-4.19-s-v2-beta-3android-msm-redbull-4.19-s-qpr3-beta-3android-msm-redbull-4.19-s-qpr3-beta-2android-msm-redbull-4.19-s-beta-5android-msm-redbull-4.19-s-beta-4android-msm-redbull-4.19-s-beta-3android-msm-redbull-4.19-android12Landroid-msm-redbull-4.19-android12-v2-beta-2android-msm-redbull-4.19-android12-qpr3android-msm-redbull-4.19-android12-qpr1android-msm-redbull-4.19-android12android-msm-redbull--s-v2-beta-1
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.c | 26 | ||||
-rw-r--r-- | fts.h | 2 |
2 files changed, 23 insertions, 5 deletions
@@ -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 */ @@ -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 */ |