summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavidycchen <davidycchen@google.com>2022-06-10 09:13:04 +0800
committerdavidycchen <davidycchen@google.com>2022-06-10 09:13:04 +0800
commit1ae90fa9c4db5a427e821d4d19123969387a9f2c (patch)
tree735672fe45f76db689a2cc5cf0bfadf3ef860725
parent0a858201a6e0eab282b1c70133a876aa44c6096d (diff)
downloadsynaptics_touch-1ae90fa9c4db5a427e821d4d19123969387a9f2c.tar.gz
synaptics: support dynamic grip configuration
Bug: 235176060 Test: Touch is working fine. Signed-off-by: davidycchen <davidycchen@google.com> Change-Id: I8a5d2403db297cbf4c30655d64066c477c0b244f
-rw-r--r--syna_tcm2.c24
-rw-r--r--syna_tcm2_platform.h2
-rw-r--r--syna_tcm2_platform_spi.c34
-rw-r--r--tcm/synaptics_touchcom_core_dev.h2
4 files changed, 58 insertions, 4 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c
index 5191f01..f610c6e 100644
--- a/syna_tcm2.c
+++ b/syna_tcm2.c
@@ -237,6 +237,16 @@ static void syna_dev_restore_feature_setting(struct syna_tcm *tcm, unsigned int
tcm->hw_if->compression_threhsold,
delay_ms_resp);
+ syna_tcm_set_dynamic_config(tcm->tcm_dev,
+ DC_GRIP_DELTA_THRESHOLD,
+ tcm->hw_if->grip_delta_threshold,
+ delay_ms_resp);
+
+ syna_tcm_set_dynamic_config(tcm->tcm_dev,
+ DC_GRIP_BORDER_THRESHOLD,
+ tcm->hw_if->grip_border_threshold,
+ delay_ms_resp);
+
if (tcm->hw_if->dynamic_report_rate) {
syna_tcm_set_dynamic_config(tcm->tcm_dev,
DC_REPORT_RATE_SWITCH,
@@ -1062,11 +1072,17 @@ static void syna_offload_set_running(struct syna_tcm *tcm, bool running)
}
/*
- * Disable firmware grip_suppression/palm_rejection when offload is running and
- * upper layer grip_suppression/palm_rejection is enabled.
+ * 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)) ? 0 : 1;
- next_enable_fw_palm = (running && (tcm->offload.config.filter_palm == 1)) ? 0 : 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;
diff --git a/syna_tcm2_platform.h b/syna_tcm2_platform.h
index 8242d95..f411f65 100644
--- a/syna_tcm2_platform.h
+++ b/syna_tcm2_platform.h
@@ -148,6 +148,8 @@ struct syna_hw_interface {
const char *fw_name;
int pixels_per_mm;
u16 compression_threhsold;
+ u16 grip_delta_threshold;
+ u16 grip_border_threshold;
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
u32 offload_id;
#endif
diff --git a/syna_tcm2_platform_spi.c b/syna_tcm2_platform_spi.c
index d0a4098..202efec 100644
--- a/syna_tcm2_platform_spi.c
+++ b/syna_tcm2_platform_spi.c
@@ -696,6 +696,40 @@ static int syna_spi_parse_dt(struct syna_hw_interface *hw_if,
hw_if->compression_threhsold = 15;
}
+ prop = of_find_property(np, "synaptics,grip-delta-threshold", NULL);
+ if (prop && prop->length) {
+ retval = of_property_read_u32(np, "synaptics,grip-delta-threshold",
+ &value);
+ if (retval < 0) {
+ LOGE("Fail to read synaptics,grip-delta-threshold\n");
+ return retval;
+ }
+
+ hw_if->grip_delta_threshold = value;
+ } else {
+ /*
+ * Set default as 50.
+ */
+ hw_if->grip_delta_threshold = 50;
+ }
+
+ prop = of_find_property(np, "synaptics,grip-border-threshold", NULL);
+ if (prop && prop->length) {
+ retval = of_property_read_u32(np, "synaptics,grip-border-threshold",
+ &value);
+ if (retval < 0) {
+ LOGE("Fail to read synaptics,grip-border-threshold\n");
+ return retval;
+ }
+
+ hw_if->grip_border_threshold = value;
+ } else {
+ /*
+ * Set default as 50.
+ */
+ hw_if->grip_border_threshold = 50;
+ }
+
hw_if->dynamic_report_rate = of_property_read_bool(np,"synaptics,dynamic-report-rate");
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
diff --git a/tcm/synaptics_touchcom_core_dev.h b/tcm/synaptics_touchcom_core_dev.h
index c42607d..2031e49 100644
--- a/tcm/synaptics_touchcom_core_dev.h
+++ b/tcm/synaptics_touchcom_core_dev.h
@@ -231,6 +231,8 @@ enum dynamic_tcm_config_id {
DC_TOUCH_SCAN_MODE = 0xF2,
DC_ENABLE_PALM_REJECTION = 0xF3,
DC_CONTINUOUSLY_REPORT = 0xF5,
+ DC_GRIP_DELTA_THRESHOLD = 0xF6,
+ DC_GRIP_BORDER_THRESHOLD = 0xF7,
};
/**