summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Pfetsch <spfetsch@google.com>2020-06-05 16:36:49 -0700
committerSteve Pfetsch <spfetsch@google.com>2020-07-10 04:06:51 -0700
commita28c78c2ecb09ad1d1e5bb0045c2c649dcce423c (patch)
tree5f512cbf06c1c06e18ff602e8caa0be407a717ae
parent814261b34f2f54bd4dedf6035f5ca1998f8ca1d7 (diff)
downloadfts_touch-a28c78c2ecb09ad1d1e5bb0045c2c649dcce423c.tar.gz
Upon resume, issue command to disable grip suppression when the filter_grip config flag is clear. Schedule with a 100ms delay during resume to ensure the command is not missed. Bug: 143723547 Bug: 139955910 Signed-off-by: Steve Pfetsch <spfetsch@google.com> Change-Id: I1db9c9053aa45a655b5322153ab4ccd85a47b3b5
-rw-r--r--fts.c38
-rw-r--r--fts.h1
2 files changed, 39 insertions, 0 deletions
diff --git a/fts.c b/fts.c
index ad4ec05..8629758 100644
--- a/fts.c
+++ b/fts.c
@@ -4075,8 +4075,31 @@ static int update_motion_filter(struct fts_ts_info *info)
return 0;
}
+int fts_disable_grip(struct fts_ts_info *info)
+{
+ uint8_t cmd[] = {0xC0, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ int res;
+
+ res = fts_write(cmd, sizeof(cmd));
+ if (res < 0)
+ pr_err("%s: fts_write failed with res=%d.\n", __func__,
+ res);
+
+ return res;
+}
+
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
+static void fts_offload_resume_work(struct work_struct *work)
+{
+ struct delayed_work *dwork = container_of(work, struct delayed_work,
+ work);
+ struct fts_ts_info *info = container_of(dwork, struct fts_ts_info,
+ offload_resume_work);
+
+ fts_disable_grip(info);
+}
+
static void fts_populate_coordinate_channel(struct fts_ts_info *info,
struct touch_offload_frame *frame,
int channel)
@@ -5315,6 +5338,19 @@ static void fts_resume_work(struct work_struct *work)
heatmap_enable();
#endif
+#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
+ /* Set touch_offload configuration */
+ if (info->offload.offload_running) {
+ pr_info("%s: applying touch_offload settings.\n", __func__);
+ if (!info->offload.config.filter_grip) {
+ /* The grip disable command will not take effect unless
+ * it is delayed ~100ms.
+ */
+ schedule_delayed_work(&info->offload_resume_work, 100);
+ }
+ }
+#endif
+
fts_enableInterrupt(true);
complete_all(&info->bus_resumed);
@@ -6276,6 +6312,8 @@ static int fts_probe(struct spi_device *client)
info->offload.caps.filter_palm = true;
info->offload.caps.num_sensitivity_settings = 1;
+ INIT_DELAYED_WORK(&info->offload_resume_work, fts_offload_resume_work);
+
info->offload.hcallback = (void *)info;
info->offload.report_cb = fts_offload_report;
touch_offload_init(&info->offload);
diff --git a/fts.h b/fts.h
index 7db9507..acf52a2 100644
--- a/fts.h
+++ b/fts.h
@@ -420,6 +420,7 @@ struct fts_ts_info {
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
struct touch_offload_context offload;
+ struct delayed_work offload_resume_work;
#endif
struct delayed_work fwu_work; /* Work for fw update */