diff options
author | davidycchen <davidycchen@google.com> | 2022-08-09 16:47:25 +0800 |
---|---|---|
committer | davidycchen <davidycchen@google.com> | 2022-08-16 12:55:07 +0800 |
commit | 8423346d940ab47a4ef0f87801fd3a10a4d8799c (patch) | |
tree | 2fe991b29651180845d9b2ed877a1e8818092743 | |
parent | de5cdbcffde875f1b7ea9cc3ad391375fa8803c3 (diff) | |
download | synaptics_touch-8423346d940ab47a4ef0f87801fd3a10a4d8799c.tar.gz |
synaptics: clear touch_offload coords while release all touches
When the screen is off, touch driver releases all the input touch
events. This makes the status different from touch_offload so we
need to synchronize the status.
Bug: 238536533
Test: Touch events are cleared while suspending.
Signed-off-by: davidycchen <davidycchen@google.com>
Change-Id: I65e22a9ddc5d4366be5992afd082af390ff65f43
-rw-r--r-- | syna_tcm2.c | 36 | ||||
-rw-r--r-- | syna_tcm2.h | 1 |
2 files changed, 31 insertions, 6 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c index 727715d..06a15c7 100644 --- a/syna_tcm2.c +++ b/syna_tcm2.c @@ -103,6 +103,10 @@ static unsigned char custom_touch_format[] = { struct drm_panel *active_panel; #endif +#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD) +static void reserve_then_queue_frame(struct syna_tcm *tcm, bool has_heatmap); +#endif + /** * syna_dev_enable_lowpwr_gesture() * @@ -674,18 +678,28 @@ static void syna_dev_free_input_events(struct syna_tcm *tcm) syna_pal_mutex_lock(&tcm->tp_event_mutex); -#ifdef TYPE_B_PROTOCOL - for (idx = 0; idx < MAX_NUM_OBJECTS; idx++) { - input_mt_slot(input_dev, idx); - input_report_abs(input_dev, ABS_MT_PRESSURE, 0); - input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 0); - #if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD) + for (idx = 0; idx < MAX_NUM_OBJECTS; idx++) { tcm->offload.coords[idx].status = COORD_STATUS_INACTIVE; tcm->offload.coords[idx].major = 0; tcm->offload.coords[idx].minor = 0; tcm->offload.coords[idx].pressure = 0; + } + + /* If the previous coord_frame that was pushed to touch_offload had + * active coords (eg. there are fingers still on the screen), push an + * empty coord_frame to touch_offload for clearing coords in twoshay.*/ + if (tcm->touch_offload_active_coords && tcm->offload.offload_running) { + tcm->offload_reserved_coords = true; + LOGI("active coords %u", tcm->touch_offload_active_coords); + reserve_then_queue_frame(tcm, false); + } else { #endif +#ifdef TYPE_B_PROTOCOL + for (idx = 0; idx < MAX_NUM_OBJECTS; idx++) { + input_mt_slot(input_dev, idx); + input_report_abs(input_dev, ABS_MT_PRESSURE, 0); + input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 0); } #endif input_report_key(input_dev, BTN_TOUCH, 0); @@ -695,6 +709,9 @@ static void syna_dev_free_input_events(struct syna_tcm *tcm) #endif input_sync(input_dev); +#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD) + } +#endif syna_pal_mutex_unlock(&tcm->tp_event_mutex); } @@ -1247,6 +1264,7 @@ static void syna_populate_coordinate_channel(struct syna_tcm *tcm, int channel) { int j; + u8 active_coords = 0; struct TouchOffloadDataCoord *dc = (struct TouchOffloadDataCoord *)frame->channel_data[channel]; @@ -1261,7 +1279,11 @@ static void syna_populate_coordinate_channel(struct syna_tcm *tcm, dc->coords[j].minor = tcm->offload.coords[j].minor; dc->coords[j].pressure = tcm->offload.coords[j].pressure; dc->coords[j].status = tcm->offload.coords[j].status; + if (dc->coords[j].status != COORD_STATUS_INACTIVE) + active_coords += 1; } + + tcm->touch_offload_active_coords = active_coords; } static void syna_populate_mutual_channel(struct syna_tcm *tcm, @@ -2959,6 +2981,8 @@ static int syna_dev_probe(struct platform_device *pdev) goto err_connect; } } + + tcm->touch_offload_active_coords = 0; #endif #if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP) diff --git a/syna_tcm2.h b/syna_tcm2.h index 0aaee81..cd52b28 100644 --- a/syna_tcm2.h +++ b/syna_tcm2.h @@ -470,6 +470,7 @@ struct syna_tcm { u16 *heatmap_buff; struct touch_offload_frame *reserved_frame; bool offload_reserved_coords; + u8 touch_offload_active_coords; #endif #if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP) |