summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTai Kuo <taikuo@google.com>2021-03-19 17:51:23 +0800
committerTai Kuo <taikuo@google.com>2021-03-23 16:27:59 +0800
commit2d2d5cfac4d6e0c2a3793552b11e5b43aad2aba4 (patch)
treecd7726e6b6a99981e2f6a4d906d7e4bbfd6386b5
parent4d794d1ee9d43a00150bf87f10442322d2c572ff (diff)
downloadfts_touch-2d2d5cfac4d6e0c2a3793552b11e5b43aad2aba4.tar.gz
Bug: 182538797 Test: enable/disable twoshay and check with the following commands: $ adb shell "echo 01 A4 06 C3 > /proc/fts/driver_test" $ adb shell "echo 02 A7 00 00 00 1B 00 > /proc/fts/driver_test ; cat /proc/fts/driver_test" The meaning of the last 4 hex: Pure fw setting: - 0003 left and right edge grip rejection and edge palm rejection: off. After sent the grip switch and size commands: - 0000 left and right edge grip rejection and edge palm rejection: off. - FF03 left and right edge grip rejection and edge palm rejection: on. Signed-off-by: Tai Kuo <taikuo@google.com> Change-Id: I81e5ae6440d2aa56f94a33e55377a04fd8e2a7d1
-rw-r--r--fts.c23
-rw-r--r--fts.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/fts.c b/fts.c
index aa61cbe..5ee7ff3 100644
--- a/fts.c
+++ b/fts.c
@@ -4096,12 +4096,27 @@ int fts_enable_grip(struct fts_ts_info *info, bool enable)
{0xC0, 0x03, 0x10, 0xFF, 0x03, 0x00, 0x00, 0x00, 0x00};
static uint8_t disable_cmd[] =
{0xC0, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ static uint8_t left_size_cmd[] =
+ {0xC0, 0x03, 0x20, 0x00/* unit: px */, 0x00, 0x00, 0x00, 0x5F, 0x09};
+ static uint8_t right_size_cmd[] =
+ {0xC0, 0x03, 0x21, 0x00/* unit: px */, 0x00, 0x00, 0x00, 0x5F, 0x09};
int res;
- if (enable)
+ if (enable) {
+ if (info->board->fw_grip_area) {
+ left_size_cmd[3] = info->board->fw_grip_area;
+ right_size_cmd[3] = info->board->fw_grip_area;
+ res = fts_write(left_size_cmd, sizeof(left_size_cmd));
+ res = fts_write(right_size_cmd, sizeof(right_size_cmd));
+ }
res = fts_write(enable_cmd, sizeof(enable_cmd));
- else
+ } else {
+ if (info->board->fw_grip_area) {
+ res = fts_write(left_size_cmd, sizeof(left_size_cmd));
+ res = fts_write(right_size_cmd, sizeof(right_size_cmd));
+ }
res = fts_write(disable_cmd, sizeof(disable_cmd));
+ }
if (res < 0)
pr_err("%s: fts_write failed with res=%d.\n", __func__,
res);
@@ -6065,6 +6080,10 @@ static int parse_dt(struct device *dev, struct fts_hw_platform_data *bdata)
bdata->offload_id);
}
+ if (of_property_read_u8(np, "st,grip_area", &bdata->fw_grip_area))
+ bdata->fw_grip_area = 0;
+ pr_info("Firmware grip area = %u\n", bdata->fw_grip_area);
+
return OK;
}
diff --git a/fts.h b/fts.h
index aba0ef4..c2f0575 100644
--- a/fts.h
+++ b/fts.h
@@ -301,6 +301,7 @@ struct fts_hw_platform_data {
u32 initial_panel_index;
u32 *force_pi_cfg_ver;
u32 offload_id;
+ u8 fw_grip_area;
};
/* Bits for the bus reference mask */