summaryrefslogtreecommitdiff
path: root/goodix_brl_hw.c
diff options
context:
space:
mode:
authorWendly Li <wendlyli@google.com>2023-02-24 09:50:19 +0000
committerWendly Li <wendlyli@google.com>2023-03-09 09:13:56 +0000
commit43c3130d20f6553cd581c5489046f435de09d7c4 (patch)
tree7d7bc5784c481d503bda19b66e07c0012e675c22 /goodix_brl_hw.c
parentf1f49bd734cb33ed7aea62d6c71fd0e6274bbda4 (diff)
downloadgoodix_touch-43c3130d20f6553cd581c5489046f435de09d7c4.tar.gz
touch/goodix: Support coordinate filter
Bug: 269560367 Test: Check coordinate filter works properly Change-Id: I2fbf972d1d67f3c28b090a9db1569e52e407c384 Signed-off-by: Wendly Li <wendlyli@google.com>
Diffstat (limited to 'goodix_brl_hw.c')
-rw-r--r--goodix_brl_hw.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/goodix_brl_hw.c b/goodix_brl_hw.c
index 435658a..d6e2fbf 100644
--- a/goodix_brl_hw.c
+++ b/goodix_brl_hw.c
@@ -1616,6 +1616,7 @@ int brl_set_heatmap_enabled(struct goodix_ts_core *cd, bool enabled)
#define CUSTOM_MODE_MASK_PALM 0x02
#define CUSTOM_MODE_MASK_GRIP 0x04
#define CUSTOM_MODE_MASK_SCREEN_PROTECTOR 0x40
+#define CUSTOM_MODE_MASK_COORD_FILTER 0x80
int brl_set_palm_enabled(struct goodix_ts_core *cd, bool enabled)
{
struct goodix_ts_cmd cmd = { 0 };
@@ -1839,6 +1840,41 @@ exit:
return ret;
}
+#define GOODIX_CMD_SET_COORD_FILTER 0xCA
+static int brl_set_coord_filter_enabled(
+ struct goodix_ts_core *cd, bool enabled)
+{
+ struct goodix_ts_cmd cmd = { 0 };
+ int ret = 0;
+
+ cmd.cmd = GOODIX_CMD_SET_COORD_FILTER;
+ cmd.len = 5;
+ cmd.data[0] = enabled ? 0 : 1;
+
+ ret = cd->hw_ops->send_cmd(cd, &cmd);
+ if (ret != 0)
+ ts_err("failed to %s coordinate filter",
+ enabled ? "enable" : "disable");
+
+ return ret;
+}
+
+static int brl_get_coord_filter_enabled(
+ struct goodix_ts_core *cd, bool *enabled)
+{
+ int ret = 0;
+ u8 val;
+
+ ret = cd->hw_ops->read(cd, GOODIX_FEATURE_STATUS_ADDR, &val, 1);
+ if (ret != 0) {
+ ts_err("failed to get coordinate filter enabled, ret: %d", ret);
+ *enabled = false;
+ return ret;
+ }
+ *enabled = (val & CUSTOM_MODE_MASK_COORD_FILTER) == 0;
+ return ret;
+}
+
static struct goodix_ts_hw_ops brl_hw_ops = {
.power_on = brl_power_on,
.resume = brl_resume,
@@ -1874,6 +1910,8 @@ static struct goodix_ts_hw_ops brl_hw_ops = {
brl_get_screen_protector_mode_enabled,
.get_mutual_data = brl_get_mutual_data,
.get_self_sensing_data = brl_get_self_sensing_data,
+ .set_coord_filter_enabled = brl_set_coord_filter_enabled,
+ .get_coord_filter_enabled = brl_get_coord_filter_enabled,
};
struct goodix_ts_hw_ops *goodix_get_hw_ops(void)