summaryrefslogtreecommitdiff
path: root/ft3658/focaltech_ex_fun.c
diff options
context:
space:
mode:
authorMason Wang <masonwang@google.com>2022-02-25 08:44:25 +0800
committerMason Wang <masonwang@google.com>2022-02-25 08:44:25 +0800
commitad8525eca67773edce621bfc9077d5186e6c2861 (patch)
treec032aac95c798ef434796c87ee43a5755dde5e19 /ft3658/focaltech_ex_fun.c
parent81444c81a573269deb9d3661a0576f8d0a887351 (diff)
downloadfocaltech_touch-ad8525eca67773edce621bfc9077d5186e6c2861.tar.gz
touch/focaltech: update major/minor/pressure format.
Change list: 1. Change the format of major/minor/pressure from 6/5/5 (bits) to 7/7/2. 2. Enlarge size of LPTW E2 configuration for the motion_tolerance_outer. This patch should be paired with touch FW V06_D02 or later. Bug: 199105018 Bug: 211940416 Bug: 219245892 Test: Verify pass by check the major/minor/pressure data. Signed-off-by: Mason Wang <masonwang@google.com> Change-Id: I18ff63837a663739e097c05994c4c75ce6f1a50c
Diffstat (limited to 'ft3658/focaltech_ex_fun.c')
-rw-r--r--ft3658/focaltech_ex_fun.c55
1 files changed, 32 insertions, 23 deletions
diff --git a/ft3658/focaltech_ex_fun.c b/ft3658/focaltech_ex_fun.c
index 3ffdcb4..ef68ce6 100644
--- a/ft3658/focaltech_ex_fun.c
+++ b/ft3658/focaltech_ex_fun.c
@@ -55,7 +55,7 @@
#define PROC_CONFIGURE 18
#define PROC_CONFIGURE_INTR 20
#define PROC_NAME "ftxxxx-debug"
-#define PROC_BUF_SIZE 256
+#define PROC_BUF_SIZE 512
/*****************************************************************************
* Private enumerations, structures and unions using typedef
@@ -1857,7 +1857,7 @@ static ssize_t proc_grip_read(struct file *filp, char __user *buff,
}
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt, "grip mode:%s\n",
- grip_mode ? "Enable" : "Disable");
+ (grip_mode == 0)? "Enable" : "Disable");
if (copy_to_user(buff, tmpbuf, cnt)) {
FTS_ERROR("copy to user error");
@@ -1893,6 +1893,12 @@ static ssize_t proc_grip_write(struct file *filp, const char __user *buff,
}
FTS_INFO("switch grip mode to %d", grip_mode);
+ if (grip_mode == 0)
+ grip_mode = 0xAA; //disable command
+
+ if (grip_mode == 1)
+ grip_mode = 0x00; //enable command
+
ret = fts_write_reg(FTS_REG_EDGE_MODE_EN, grip_mode);
if (ret < 0) {
FTS_ERROR("write reg0x8C fails");
@@ -2152,14 +2158,15 @@ static const struct file_operations proc_heatmap_onoff_fops = {
};
#endif
-static ssize_t proc_LPTW_setting_write(struct file *filp, const char __user *buff, size_t count, loff_t *ppos)
+static ssize_t proc_LPTW_setting_write(
+ struct file *filp, const char __user *buff, size_t count, loff_t *ppos)
{
int ret = 0;
char tmpbuf[PROC_BUF_SIZE] = {0};
int buflen = count;
- int lptw_write_data[FTS_LPTW_E1_BUF_LEN] = {0};
- u8 write_data[FTS_LPTW_E1_BUF_LEN] = {0};
+ int lptw_write_data[FTS_LPTW_BUF_LEN] = {0};
+ u8 write_data[FTS_LPTW_BUF_LEN] = {0};
u8 cmd[2] = {0};
u32 data_length = 0;
@@ -2178,11 +2185,11 @@ static ssize_t proc_LPTW_setting_write(struct file *filp, const char __user *buf
return -EFAULT;
}
- ret = sscanf(tmpbuf, "%x%x%x%x%x%x%x%x%x%x%x%x", &lptw_write_data[0],
+ ret = sscanf(tmpbuf, "%x%x%x%x%x%x%x%x%x%x%x%x%x", &lptw_write_data[0],
&lptw_write_data[1], &lptw_write_data[2], &lptw_write_data[3],
&lptw_write_data[4], &lptw_write_data[5], &lptw_write_data[6],
&lptw_write_data[7], &lptw_write_data[8], &lptw_write_data[9],
- &lptw_write_data[10], &lptw_write_data[11]);
+ &lptw_write_data[10], &lptw_write_data[11], &lptw_write_data[12]);
if(lptw_write_data[0] == FTS_LPTW_REG_SET_E1)
data_length = FTS_LPTW_E1_BUF_LEN;
@@ -2195,9 +2202,9 @@ static ssize_t proc_LPTW_setting_write(struct file *filp, const char __user *buf
write_data[i] = (char)lptw_write_data[i];
if (data_length != 0){
- ret=fts_write(write_data,data_length);
+ ret=fts_write(write_data, data_length);
if (ret < 0) {
- FTS_ERROR("write data to register E3/E2 fail");
+ FTS_ERROR("write data to register E1/E2 fail");
return ret;
}
}
@@ -2206,7 +2213,8 @@ static ssize_t proc_LPTW_setting_write(struct file *filp, const char __user *buf
}
/*LPTW setting read*/
-static ssize_t proc_LPTW_setting_read(struct file *filp, char __user *buff, size_t count, loff_t *ppos)
+static ssize_t proc_LPTW_setting_read(
+ struct file *filp, char __user *buff, size_t count, loff_t *ppos)
{
int cnt = 0;
int ret = 0;
@@ -2238,15 +2246,13 @@ static ssize_t proc_LPTW_setting_read(struct file *filp, char __user *buff, size
cmd[0] = FTS_LPTW_REG_SET_E1;
cmd[1] = FTS_LPTW_REG_SET_E2;
-
- ret = fts_read(&cmd[0], 1, readbuf, 11);
+ ret = fts_read(&cmd[0], 1, readbuf, FTS_LPTW_E1_BUF_LEN - 1);
if (ret < 0) {
FTS_ERROR("read reg_0xE1 fails");
goto proc_read_err;
}
-
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
- "****LPTW Gesture_part 1 setting:\n");
+ "==LPTW Gesture setting(E1)==\n");
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt, "min_x :%4d\n",
((readbuf[0] & 0x0F) << 8) + (readbuf[1] & 0xFF));
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt, "min_y :%4d\n",
@@ -2262,14 +2268,13 @@ static ssize_t proc_LPTW_setting_read(struct file *filp, char __user *buff, size
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
"max_touch_size :%3d\n\n", (readbuf[10] & 0xFF));
- ret = fts_read(&cmd[1], 1, readbuf, 10);
+ ret = fts_read(&cmd[1], 1, readbuf, FTS_LPTW_E2_BUF_LEN - 1);
if (ret < 0) {
- FTS_ERROR("read reg_0xE1 fails");
+ FTS_ERROR("read reg_0xE2 fails");
goto proc_read_err;
}
-
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
- "****LPTW Gesture_part 2 & part 3 setting:\n");
+ "==LPTW Gesture setting(E2)==\n");
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
"marginal_min_x :%2d\n", (readbuf[0] & 0xFF));
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
@@ -2289,7 +2294,8 @@ static ssize_t proc_LPTW_setting_read(struct file *filp, char __user *buff, size
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
"min_node_count :%2d\n", (readbuf[8] & 0xFF));
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
- "motion_boundary :%2d\n", (readbuf[9] & 0xFF));
+ "motion_boundary :%4d\n\n",((readbuf[10] & 0x0F) << 8) +
+ (readbuf[11] & 0xFF));
if (copy_to_user(buff, tmpbuf, cnt)) {
FTS_ERROR("copy to user error");
@@ -2325,7 +2331,8 @@ static const struct file_operations LPTW_setting_fops = {
};
#endif
-static ssize_t proc_STTW_setting_write(struct file *filp, const char __user *buff, size_t count, loff_t *ppos)
+static ssize_t proc_STTW_setting_write(
+ struct file *filp, const char __user *buff, size_t count, loff_t *ppos)
{
int ret = 0;
char tmpbuf[PROC_BUF_SIZE] = {0};
@@ -2370,7 +2377,8 @@ static ssize_t proc_STTW_setting_write(struct file *filp, const char __user *buf
}
/*STTW setting read*/
-static ssize_t proc_STTW_setting_read(struct file *filp, char __user *buff, size_t count, loff_t *ppos)
+static ssize_t proc_STTW_setting_read(
+ struct file *filp, char __user *buff, size_t count, loff_t *ppos)
{
int cnt = 0;
int ret = 0;
@@ -2402,13 +2410,14 @@ static ssize_t proc_STTW_setting_read(struct file *filp, char __user *buff, size
cmd[0] = FTS_STTW_REG_SET_E3;
- ret = fts_read(&cmd[0], 1, readbuf, 12);
+ ret = fts_read(&cmd[0], 1, readbuf, FTS_STTW_E3_BUF_LEN - 1);
if (ret < 0) {
FTS_ERROR("read reg_0xE3 fails");
goto proc_read_err;
}
- cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt, "==STTW Gesture setting:==\n");
+ cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
+ "==STTW Gesture setting(E3)==\n");
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,
"min_x :%4d\n",((readbuf[0] & 0x0F) << 8) +(readbuf[1] & 0xFF));
cnt += snprintf(tmpbuf + cnt, PROC_BUF_SIZE - cnt,