diff options
author | Mason Wang <masonwang@google.com> | 2022-02-27 00:23:15 +0800 |
---|---|---|
committer | Mason Wang <masonwang@google.com> | 2022-03-03 19:56:19 +0800 |
commit | 6bddecc47d26529e7dfd52ca880c9df5e7bf8d87 (patch) | |
tree | e8073644d2986759b385f111250da9f9220f6827 /ft3658 | |
parent | c1b6b74523be50719e9368a7f6a3006755a99ee0 (diff) | |
download | focaltech_touch-6bddecc47d26529e7dfd52ca880c9df5e7bf8d87.tar.gz |
focaltech/touch: transfer major/minor unit from mm to pixel.
Bug: 221383106
Test: The major/minor unit is correct.
Signed-off-by: Mason Wang <masonwang@google.com>
Change-Id: Ifcac66c2966d6f6122f3209e3e209cc66c6c54a9
Diffstat (limited to 'ft3658')
-rw-r--r-- | ft3658/focaltech_core.c | 14 | ||||
-rw-r--r-- | ft3658/focaltech_core.h | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/ft3658/focaltech_core.c b/ft3658/focaltech_core.c index 1e41e53..3a76801 100644 --- a/ft3658/focaltech_core.c +++ b/ft3658/focaltech_core.c @@ -945,8 +945,10 @@ static int fts_read_parse_touchdata(struct fts_ts_data *data) 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].minor = (buf[FTS_TOUCH_PRE_POS + base] >> 1) & 0x7F; - events[i].major = (buf[FTS_TOUCH_AREA_POS + base] >> 1) & 0x7F; + events[i].minor = + ((buf[FTS_TOUCH_PRE_POS + base] >> 1) & 0x7F) * data->pdata->mm2px; + events[i].major = + ((buf[FTS_TOUCH_AREA_POS + base] >> 1) & 0x7F) * data->pdata->mm2px; if (EVENT_DOWN(events[i].flag) && (data->point_num == 0)) { FTS_INFO("abnormal touch data from fw"); @@ -2242,6 +2244,14 @@ static int fts_parse_dt(struct device *dev, struct fts_ts_platform_data *pdata) FTS_DEBUG("rx_ch_num = %d", pdata->rx_ch_num); } + ret = of_property_read_u8(np, "focaltech,mm2px", &pdata->mm2px); + if (ret < 0) { + FTS_ERROR("Unable to get mm2px, please check dts"); + pdata->mm2px = 1; + } else { + FTS_DEBUG("mm2px = %d", pdata->mm2px); + } + pdata->irq_gpio = of_get_named_gpio_flags(np, "focaltech,irq-gpio", 0, &pdata->irq_gpio_flags); if (pdata->irq_gpio < 0) diff --git a/ft3658/focaltech_core.h b/ft3658/focaltech_core.h index ff957ab..81a840a 100644 --- a/ft3658/focaltech_core.h +++ b/ft3658/focaltech_core.h @@ -154,6 +154,8 @@ struct fts_ts_platform_data { #endif u32 tx_ch_num; u32 rx_ch_num; + /* convert mm to pixel for major and minor */ + u8 mm2px; }; struct ts_event { |