summaryrefslogtreecommitdiff
path: root/ft3658
diff options
context:
space:
mode:
authorMason Wang <masonwang@google.com>2022-03-03 19:44:26 +0800
committerMason Wang <masonwang@google.com>2022-03-03 19:55:04 +0800
commit3de25d9af3a6f96a478895b43b1a2b07275d61b7 (patch)
tree7c9e4b39af1fefe52fa27d26caa43ac30b9dc084 /ft3658
parent098e1ebe659584c03c132c780b73cde894956b1a (diff)
downloadfocaltech_touch-3de25d9af3a6f96a478895b43b1a2b07275d61b7.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: I16fa872a4955c3bfdd0b81fd2cf9e6ea07991098
Diffstat (limited to 'ft3658')
-rw-r--r--ft3658/focaltech_common.h10
-rw-r--r--ft3658/focaltech_core.c30
-rw-r--r--ft3658/focaltech_ex_fun.c47
-rw-r--r--ft3658/focaltech_gesture.c2
4 files changed, 49 insertions, 40 deletions
diff --git a/ft3658/focaltech_common.h b/ft3658/focaltech_common.h
index db1d0da..301948f 100644
--- a/ft3658/focaltech_common.h
+++ b/ft3658/focaltech_common.h
@@ -67,8 +67,12 @@
#define FTS_MAX_CHIP_IDS 8
-#define FTS_CHIP_TYPE_MAPPING {{0x88, 0x56, 0x52, 0x00, 0x00, 0x00, 0x00, 0x56, 0xB2}}
+#define FTS_CHIP_TYPE_MAPPING {{0x88, 0x56, 0x52, 0x00, 0x00, 0x00, 0x00, 0x56, 0xB2}}
+#define FTS_STTW_E3_BUF_LEN 13
+#define FTS_LPTW_E2_BUF_LEN 13
+#define FTS_LPTW_E1_BUF_LEN 12
+#define FTS_LPTW_BUF_LEN (max(FTS_LPTW_E1_BUF_LEN, FTS_LPTW_E2_BUF_LEN))
#define FILE_NAME_LENGTH 128
#define ENABLE 1
@@ -127,10 +131,6 @@
#define FTS_STTW_REG_SET_E3 0xE3
#define FTS_GESTURE_MAJOR_MINOR 0xE5
-#define FTS_STTW_E3_BUF_LEN 13
-#define FTS_LPTW_E2_BUF_LEN 11
-#define FTS_LPTW_E1_BUF_LEN 12
-
#define FTS_REG_CUSTOMER_STATUS 0xB2 // follow FTS_CUSTOMER_STATUS.
// bit 0~1 : HOPPING
// bit 2 : PALM
diff --git a/ft3658/focaltech_core.c b/ft3658/focaltech_core.c
index afb1466..b0557e3 100644
--- a/ft3658/focaltech_core.c
+++ b/ft3658/focaltech_core.c
@@ -568,10 +568,13 @@ static int fts_input_report_b(struct fts_ts_data *data)
#endif
if ((data->log_level >= 2) ||
((1 == data->log_level) && (FTS_TOUCH_DOWN == events[i].flag))) {
- FTS_DEBUG("[B]P%d(%d, %d)[p:%d,tm:%d] DOWN!",
+ FTS_DEBUG("[B]P%d(%d, %d)[ma:%d,mi:%d,p:%d] DOWN!",
events[i].id,
- events[i].x, events[i].y,
- events[i].p, events[i].area);
+ events[i].x,
+ events[i].y,
+ events[i].major,
+ events[i].minor,
+ events[i].p);
}
} else { //EVENT_UP
#if IS_ENABLED(CONFIG_TOUCHSCREEN_OFFLOAD)
@@ -659,10 +662,13 @@ static int fts_input_report_a(struct fts_ts_data *data)
if ((data->log_level >= 2) ||
((1 == data->log_level) && (FTS_TOUCH_DOWN == events[i].flag))) {
- FTS_DEBUG("[A]P%d(%d, %d)[p:%d,tm:%d] DOWN!",
+ FTS_DEBUG("[A]P%d(%d, %d)[ma:%d,mi:%d,p:%d] DOWN!",
events[i].id,
- events[i].x, events[i].y,
- events[i].p, events[i].area);
+ events[i].x,
+ events[i].y,
+ events[i].major,
+ events[i].minor,
+ events[i].p);
}
touchs++;
}
@@ -937,10 +943,10 @@ static int fts_read_parse_touchdata(struct fts_ts_data *data)
(buf[FTS_TOUCH_Y_L_POS + base] & 0xFF);
events[i].flag = buf[FTS_TOUCH_EVENT_POS + base] >> 6;
events[i].id = buf[FTS_TOUCH_ID_POS + base] >> 4;
- events[i].p = buf[FTS_TOUCH_PRE_POS + base] & 0x1F;
- events[i].minor = ((buf[FTS_TOUCH_PRE_POS + base] >> 3) & 0x1C) +
- (buf[FTS_TOUCH_AREA_POS + base] & 0x03);
- events[i].major = (buf[FTS_TOUCH_AREA_POS + base] >> 2) & 0x3F;
+ events[i].p = ((buf[FTS_TOUCH_AREA_POS + base] << 1) & 0x02) +
+ (buf[FTS_TOUCH_PRE_POS + base] & 0x01);
+ events[i].minor = (buf[FTS_TOUCH_PRE_POS + base] >> 1) & 0x7F;
+ events[i].major = (buf[FTS_TOUCH_AREA_POS + base] >> 1) & 0x7F;
if (EVENT_DOWN(events[i].flag) && (data->point_num == 0)) {
FTS_INFO("abnormal touch data from fw");
@@ -1737,9 +1743,9 @@ static int fts_input_init(struct fts_ts_data *ts_data)
input_set_abs_params(input_dev, ABS_MT_POSITION_X, pdata->x_min, pdata->x_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_POSITION_Y, pdata->y_min, pdata->y_max, 0, 0);
input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 0x3F, 0, 0);
- input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, 0x1F, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR, 0, 0x3F, 0, 0);
#if FTS_REPORT_PRESSURE_EN
- input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0x1F, 0, 0);
+ input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0x03, 0, 0);
#endif
ret = input_register_device(input_dev);
diff --git a/ft3658/focaltech_ex_fun.c b/ft3658/focaltech_ex_fun.c
index 17ce0a5..4316ee1 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
@@ -2162,14 +2162,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;
@@ -2188,11 +2189,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;
@@ -2205,9 +2206,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;
}
}
@@ -2216,7 +2217,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;
@@ -2248,15 +2250,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",
@@ -2272,14 +2272,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,
@@ -2299,7 +2298,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");
@@ -2335,7 +2335,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};
@@ -2380,7 +2381,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;
@@ -2412,13 +2414,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,
diff --git a/ft3658/focaltech_gesture.c b/ft3658/focaltech_gesture.c
index 93559cd..36e1565 100644
--- a/ft3658/focaltech_gesture.c
+++ b/ft3658/focaltech_gesture.c
@@ -346,7 +346,7 @@ int fts_gesture_readdata(struct fts_ts_data *ts_data, u8 *data)
gesture->Gesture_major[i] = majorminor_buf[8 * i + 4];
gesture->Gesture_minor[i] = majorminor_buf[8 * i + 5];
- FTS_DEBUG("x=%d ,y=%d, major=%d, minor=%d\n",
+ FTS_DEBUG("x=%d, y=%d, major=%d, minor=%d\n",
gesture->coordinate_x[i], gesture->coordinate_y[i],
gesture->Gesture_major[i], gesture->Gesture_minor[i]);
}