diff options
author | Mason Wang <masonwang@google.com> | 2022-04-07 14:39:10 +0800 |
---|---|---|
committer | Mason Wang <masonwang@google.com> | 2022-04-07 14:47:22 +0800 |
commit | e2c958f6388d3b519a03f84a36b25da454c8580c (patch) | |
tree | d28d9c0a6b61b318574270bc876e82a1648ed734 /ft3658 | |
parent | 9bf2772a5eb1764069a4e9544613b23b45dcabad (diff) | |
download | focaltech_touch-e2c958f6388d3b519a03f84a36b25da454c8580c.tar.gz |
touch/focaltech: Map pressure from 2bits to 8bits.
The P10 touch pressure of touch firmware is two bits limit, so the
pressure needs to be mapped form 2 bits to 8 bits, i.e:
Map the value(0~3) to (0~255).
Bug: 227525323
Test: Verify pass reporting the value of pressure.
Signed-off-by: Mason Wang <masonwang@google.com>
Change-Id: Ibef2ca8fe7c4b1a52de0a399e4d2bcfdf1c70ba9
Diffstat (limited to 'ft3658')
-rw-r--r-- | ft3658/focaltech_common.h | 1 | ||||
-rw-r--r-- | ft3658/focaltech_core.c | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/ft3658/focaltech_common.h b/ft3658/focaltech_common.h index 1b3af7c..11352d7 100644 --- a/ft3658/focaltech_common.h +++ b/ft3658/focaltech_common.h @@ -142,6 +142,7 @@ // bit 7 : LPWG #define FTS_CAP_DATA_OFFSET 91 #define FTS_SELF_DATA_LEN 68 +#define FTS_PRESSURE_SCALE 85 // 255 / 3 #define FTS_SYSFS_ECHO_ON(buf) (buf[0] == '1') #define FTS_SYSFS_ECHO_OFF(buf) (buf[0] == '0') diff --git a/ft3658/focaltech_core.c b/ft3658/focaltech_core.c index 676e485..8415a0d 100644 --- a/ft3658/focaltech_core.c +++ b/ft3658/focaltech_core.c @@ -956,8 +956,9 @@ 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_AREA_POS + base] << 1) & 0x02) + - (buf[FTS_TOUCH_PRE_POS + base] & 0x01); + events[i].p = (((buf[FTS_TOUCH_AREA_POS + base] << 1) & 0x02) + + (buf[FTS_TOUCH_PRE_POS + base] & 0x01)) * + FTS_PRESSURE_SCALE; events[i].minor = ((buf[FTS_TOUCH_PRE_POS + base] >> 1) & 0x7F) * data->pdata->mm2px; events[i].major = @@ -1841,7 +1842,7 @@ static int fts_input_init(struct fts_ts_data *ts_data) 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, 0x3F, 0, 0); #if FTS_REPORT_PRESSURE_EN - input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0x03, 0, 0); + input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 0xFF, 0, 0); #endif ret = input_register_device(input_dev); |