summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYen-Chao Chen <davidycchen@google.com>2022-03-16 03:20:10 +0000
committerAndroid Partner Code Review <android-gerrit-partner@google.com>2022-03-16 03:20:10 +0000
commitfd714df3228c66bf71209f19b5ad133c381e8efc (patch)
tree480cede5a1e143617f2a06608aa2b9f461e558f6
parentad2ea221a4594a90f9feb91bd9133997558f49d0 (diff)
parent23bd0de511e582fcc179ca7d60be80262a979d7f (diff)
downloadsynaptics_touch-fd714df3228c66bf71209f19b5ad133c381e8efc.tar.gz
Merge "synaptics: support to confiure heatmap compression threshold" into android13-gs-pixel-5.10
-rw-r--r--syna_tcm2.c17
-rw-r--r--syna_tcm2_platform.h1
-rw-r--r--syna_tcm2_platform_spi.c17
-rw-r--r--syna_tcm2_sysfs.c89
-rw-r--r--tcm/synaptics_touchcom_core_dev.h1
5 files changed, 119 insertions, 6 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c
index 742e8b6..0e6cdc1 100644
--- a/syna_tcm2.c
+++ b/syna_tcm2.c
@@ -288,14 +288,19 @@ static void syna_dev_restore_feature_setting(struct syna_tcm *tcm)
syna_dev_set_heatmap_mode(tcm, true);
syna_tcm_set_dynamic_config(tcm->tcm_dev,
- DC_ENABLE_PALM_REJECTION,
- (tcm->enable_fw_palm & 0x01),
- RESP_IN_POLLING);
+ DC_ENABLE_PALM_REJECTION,
+ (tcm->enable_fw_palm & 0x01),
+ RESP_IN_POLLING);
syna_tcm_set_dynamic_config(tcm->tcm_dev,
- DC_ENABLE_GRIP_SUPPRESSION,
- (tcm->enable_fw_grip & 0x01),
- RESP_IN_POLLING);
+ DC_ENABLE_GRIP_SUPPRESSION,
+ (tcm->enable_fw_grip & 0x01),
+ RESP_IN_POLLING);
+
+ syna_tcm_set_dynamic_config(tcm->tcm_dev,
+ DC_COMPRESSION_THRESHOLD,
+ tcm->hw_if->compression_threhsold,
+ RESP_IN_POLLING);
}
/* Update a state machine used to toggle control of the touch IC's motion
* filter.
diff --git a/syna_tcm2_platform.h b/syna_tcm2_platform.h
index 16c607d..e38e5a2 100644
--- a/syna_tcm2_platform.h
+++ b/syna_tcm2_platform.h
@@ -147,6 +147,7 @@ struct syna_hw_interface {
struct syna_hw_pwr_data bdata_pwr;
const char *fw_name;
int pixels_per_mm;
+ u16 compression_threhsold;
#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 683d6e4..a247fcc 100644
--- a/syna_tcm2_platform_spi.c
+++ b/syna_tcm2_platform_spi.c
@@ -677,6 +677,23 @@ static int syna_spi_parse_dt(struct syna_hw_interface *hw_if,
hw_if->pixels_per_mm = 1;
}
+ prop = of_find_property(np, "synaptics,compression-threshold", NULL);
+ if (prop && prop->length) {
+ retval = of_property_read_u32(np, "synaptics,compression-threshold",
+ &value);
+ if (retval < 0) {
+ LOGE("Fail to read synaptics,compression-threshold\n");
+ return retval;
+ }
+
+ hw_if->compression_threhsold = value;
+ } else {
+ /*
+ * Set default as 15.
+ */
+ hw_if->compression_threhsold = 15;
+ }
+
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
hw_if->offload_id = 0;
retval = of_property_read_u8_array(np, "synaptics,touch_offload_id",
diff --git a/syna_tcm2_sysfs.c b/syna_tcm2_sysfs.c
index 1f6aa9e..938c9fc 100644
--- a/syna_tcm2_sysfs.c
+++ b/syna_tcm2_sysfs.c
@@ -1245,6 +1245,94 @@ static struct kobj_attribute kobj_attr_mf_mode =
syna_sysfs_mf_mode_store);
/**
+ * syna_sysfs_compression_threshold_show()
+ *
+ * Attribute get the heatmap compression threshold.
+ *
+ * @param
+ * [ in] kobj: an instance of kobj
+ * [ in] attr: an instance of kobj attribute structure
+ * [out] buf: string buffer shown on console
+ *
+ * @return
+ * on success, number of characters being output;
+ * otherwise, negative value on error.
+ */
+static ssize_t syna_sysfs_compression_threshold_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ int retval = 0;
+ struct device *p_dev;
+ struct kobject *p_kobj;
+ struct syna_tcm *tcm;
+
+ p_kobj = g_sysfs_dir->parent;
+ p_dev = container_of(p_kobj, struct device, kobj);
+ tcm = dev_get_drvdata(p_dev);
+
+ syna_pal_mutex_lock(&g_extif_mutex);
+
+ retval = scnprintf(buf, PAGE_SIZE, "%u\n", tcm->hw_if->compression_threhsold);
+
+ syna_pal_mutex_unlock(&g_extif_mutex);
+ return retval;
+}
+
+/**
+ * syna_sysfs_compression_threshold_store()
+ *
+ * Attribute set the heatmap compression threshold.
+ *
+ * @param
+ * [ in] kobj: an instance of kobj
+ * [ in] attr: an instance of kobj attribute structure
+ * [ in] buf: string buffer input
+ * [ in] count: size of buffer input
+ *
+ * @return
+ * on success, return count; otherwise, return error code
+ */
+static ssize_t syna_sysfs_compression_threshold_store(struct kobject *kobj,
+ struct kobj_attribute *attr, const char *buf, size_t count)
+{
+ int retval = count;
+ u8 input;
+ struct device *p_dev;
+ struct kobject *p_kobj;
+ struct syna_tcm *tcm;
+
+ p_kobj = g_sysfs_dir->parent;
+ p_dev = container_of(p_kobj, struct device, kobj);
+ tcm = dev_get_drvdata(p_dev);
+
+ if (kstrtou8(buf, 10, &input)) {
+ LOGE("Invalid input %s", buf);
+ return -EINVAL;
+ }
+
+ syna_set_bus_ref(tcm, SYNA_BUS_REF_SYSFS, true);
+ syna_pal_mutex_lock(&g_extif_mutex);
+
+ tcm->hw_if->compression_threhsold = input;
+
+ syna_tcm_set_dynamic_config(tcm->tcm_dev,
+ DC_COMPRESSION_THRESHOLD,
+ input,
+ RESP_IN_ATTN);
+
+ LOGI("Set the heatmap compression threshold as %u.\n",
+ tcm->hw_if->compression_threhsold);
+
+ syna_pal_mutex_unlock(&g_extif_mutex);
+ syna_set_bus_ref(tcm, SYNA_BUS_REF_SYSFS, false);
+ return retval;
+}
+
+static struct kobj_attribute kobj_attr_compression_threshold =
+ __ATTR(compression_threshold, 0664, syna_sysfs_compression_threshold_show,
+ syna_sysfs_compression_threshold_store);
+
+/**
* declaration of sysfs attributes
*/
static struct attribute *attrs[] = {
@@ -1258,6 +1346,7 @@ static struct attribute *attrs[] = {
&kobj_attr_fw_grip.attr,
&kobj_attr_fw_palm.attr,
&kobj_attr_mf_mode.attr,
+ &kobj_attr_compression_threshold.attr,
NULL,
};
diff --git a/tcm/synaptics_touchcom_core_dev.h b/tcm/synaptics_touchcom_core_dev.h
index 9acfdde..9e136ba 100644
--- a/tcm/synaptics_touchcom_core_dev.h
+++ b/tcm/synaptics_touchcom_core_dev.h
@@ -222,6 +222,7 @@ enum dynamic_tcm_config_id {
DC_DISABLE_PROXIMITY = 0x10,
DC_HIGH_SENSITIVIRY_MODE = 0xCB,
DC_FORCE_DOZE_MODE = 0xF0,
+ DC_COMPRESSION_THRESHOLD = 0xF1,
DC_TOUCH_SCAN_MODE = 0xF2,
DC_ENABLE_PALM_REJECTION = 0xF3,
DC_CONTINUOUSLY_REPORT = 0xF5,