summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-27 18:08:21 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-27 18:08:21 +0000
commitcfd525ad930cefa0ecba93e48152f5a03463805a (patch)
tree735672fe45f76db689a2cc5cf0bfadf3ef860725
parent6fbae14567b3f856b89a1bd78b43825b56b22c29 (diff)
parent1ae90fa9c4db5a427e821d4d19123969387a9f2c (diff)
downloadsynaptics_touch-cfd525ad930cefa0ecba93e48152f5a03463805a.tar.gz
Snap for 8761892 from 1ae90fa9c4db5a427e821d4d19123969387a9f2c to android13-gs-pixel-5.10-release
Change-Id: I0ab742e589470303753181f63371f4b0ec7dd342
-rw-r--r--syna_tcm2.c75
-rw-r--r--syna_tcm2.h2
2 files changed, 39 insertions, 38 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c
index bf23c2c..f610c6e 100644
--- a/syna_tcm2.c
+++ b/syna_tcm2.c
@@ -610,7 +610,6 @@ static int syna_dev_parse_custom_gesture_cb(const unsigned char code,
return bits;
}
#endif
-
/**
* syna_tcm_free_input_events()
*
@@ -858,8 +857,6 @@ static void syna_dev_report_input_events(struct syna_tcm *tcm)
syna_update_motion_filter(tcm, touch_count);
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
- } else {
- tcm->offload_reserved_coords = true;
}
#endif
@@ -1078,8 +1075,14 @@ static void syna_offload_set_running(struct syna_tcm *tcm, bool running)
* Use the configurations set by touch service if it's running.
* Enable the firmware grip and palm if the touch service isn't running.
*/
- next_enable_fw_grip = running ? !tcm->offload.config.filter_grip : 1;
- next_enable_fw_palm = running ? !tcm->offload.config.filter_palm : 1;
+ if (running) {
+ next_enable_fw_grip = tcm->offload.config.filter_grip;
+ next_enable_fw_palm = tcm->offload.config.filter_palm;
+ } else {
+ /* Enable the firmware grip and palm when touch */
+ next_enable_fw_grip = 1;
+ next_enable_fw_palm = 1;
+ }
if (next_enable_fw_grip != tcm->enable_fw_grip && tcm->enable_fw_grip < 2) {
tcm->enable_fw_grip = next_enable_fw_grip;
@@ -1342,32 +1345,6 @@ static void syna_populate_frame(struct syna_tcm *tcm, bool has_heatmap)
}
ATRACE_END();
}
-
-static void reserve_then_queue_frame(struct syna_tcm *tcm, bool has_heatmap) {
- int retval;
-
- /* Skip if no reserved coordinates. */
- if (!tcm->offload_reserved_coords && tcm->offload.offload_running)
- return;
-
- retval = touch_offload_reserve_frame(&tcm->offload, &tcm->reserved_frame);
- if (retval != 0) {
- LOGD("Could not reserve a frame: error=%d.\n", retval);
-
- /* Stop offload when there are no buffers available. */
- syna_offload_set_running(tcm, false);
- } else {
- syna_offload_set_running(tcm, true);
-
- syna_populate_frame(tcm, has_heatmap);
-
- retval = touch_offload_queue_frame(&tcm->offload, tcm->reserved_frame);
- if (retval != 0)
- LOGE("Failed to queue reserved frame: error=%d.\n", retval);
-
- tcm->offload_reserved_coords = false;
- }
-}
#endif /* CONFIG_TOUCHSCREEN_OFFLOAD */
#if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP)
@@ -1491,13 +1468,13 @@ static irqreturn_t syna_dev_interrupt_thread(int irq, void *data)
/* report input event only when receiving a touch report */
if (code == REPORT_TOUCH) {
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
- /* Reserve and queue the frame if last reserved coordinates is pending. */
- if ((tcm->offload_reserved_coords) && (tcm->offload.offload_running)) {
- LOGW("Last reserved coordinates was not queued.\n");
- reserve_then_queue_frame(tcm, false);
+ if (tcm->reserved_frame_success) {
+ LOGW("Last reserved frame was not queued.\n");
+ syna_populate_frame(tcm, false);
+ touch_offload_queue_frame(&tcm->offload, tcm->reserved_frame);
+ tcm->reserved_frame_success = false;
}
#endif
-
/* parse touch report once received */
retval = syna_tcm_parse_touch_report(tcm->tcm_dev,
tcm->event_data.buf,
@@ -1509,6 +1486,19 @@ static irqreturn_t syna_dev_interrupt_thread(int irq, void *data)
}
tcm->coords_timestamp = tcm->isr_timestamp;
+#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
+ retval = touch_offload_reserve_frame(&tcm->offload, &tcm->reserved_frame);
+ if (retval != 0) {
+ LOGD("Could not reserve a frame: error=%d.\n", retval);
+
+ /* Stop offload when there are no buffers available. */
+ syna_offload_set_running(tcm, false);
+ } else {
+ tcm->reserved_frame_success = true;
+ syna_offload_set_running(tcm, true);
+ }
+#endif
+
/* forward the touch event to system */
ATRACE_BEGIN("report_input_events");
syna_dev_report_input_events(tcm);
@@ -1544,7 +1534,18 @@ static irqreturn_t syna_dev_interrupt_thread(int irq, void *data)
LOGD("Heat map data received, size:%d\n",
tcm->event_data.data_length);
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
- reserve_then_queue_frame(tcm, true);
+ if (tcm->offload.offload_running) {
+ syna_populate_frame(tcm, true);
+
+ retval = touch_offload_queue_frame(&tcm->offload,
+ tcm->reserved_frame);
+ if (retval != 0) {
+ LOGE("Failed to queue reserved frame: error=%d.\n",
+ retval);
+ } else {
+ tcm->reserved_frame_success = false;
+ }
+ }
#endif
#if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP)
ATRACE_BEGIN("heatmap_read");
diff --git a/syna_tcm2.h b/syna_tcm2.h
index a9c11cc..e9536e5 100644
--- a/syna_tcm2.h
+++ b/syna_tcm2.h
@@ -469,7 +469,7 @@ struct syna_tcm {
struct touch_offload_context offload;
u16 *heatmap_buff;
struct touch_offload_frame *reserved_frame;
- bool offload_reserved_coords;
+ bool reserved_frame_success;
#endif
#if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP)