diff options
author | Super Liu <supercjliu@google.com> | 2020-02-12 09:57:19 +0800 |
---|---|---|
committer | Super Liu <supercjliu@google.com> | 2020-02-12 10:00:49 +0800 |
commit | cf488d3dc9891b5cafd0d4db7c9d361705d037b4 (patch) | |
tree | e9ada7c325c1b4410f29d0e2b1589d32d4c6f6ec | |
parent | 1ee579f6b5da57826cc50adbc25e5eaf4229769a (diff) | |
download | sec_touch-cf488d3dc9891b5cafd0d4db7c9d361705d037b4.tar.gz |
sec_touch: support heatmap setting from dtsi
Bug: 145788304
Change-Id: Ib21e5f18da06a851d2dc3f02b304fe7906c1b777
Signed-off-by: Super Liu <supercjliu@google.com>
-rw-r--r-- | sec_ts.c | 9 | ||||
-rw-r--r-- | sec_ts.h | 2 | ||||
-rw-r--r-- | sec_ts_fn.c | 6 |
3 files changed, 12 insertions, 5 deletions
@@ -1144,6 +1144,7 @@ static void sec_ts_reinit(struct sec_ts_data *ts) static bool read_heatmap_raw(struct v4l2_heatmap *v4l2) { struct sec_ts_data *ts = container_of(v4l2, struct sec_ts_data, v4l2); + const struct sec_ts_plat_data *pdata = ts->plat_data; int result; int max_x = v4l2->format.width; int max_y = v4l2->format.height; @@ -1155,7 +1156,7 @@ static bool read_heatmap_raw(struct v4l2_heatmap *v4l2) return false; } - if (ts->heatmap_mode == HEATMAP_PARTIAL) { + if (pdata->heatmap_mode == HEATMAP_PARTIAL) { strength_t heatmap_value; int heatmap_x, heatmap_y; /* index for through the heatmap buffer read over the bus */ @@ -1243,7 +1244,7 @@ static bool read_heatmap_raw(struct v4l2_heatmap *v4l2) frame_i = heatmap_y * max_x + heatmap_x; v4l2->frame[frame_i] = heatmap_value; } - } else if (ts->heatmap_mode == HEATMAP_FULL) { + } else if (pdata->heatmap_mode == HEATMAP_FULL) { int i, j, index = 0; int ret = 0; u8 type; @@ -2308,6 +2309,10 @@ static int sec_ts_parse_dt(struct spi_device *client) if (of_property_read_u32(np, "sec,mis_cal_check", &pdata->mis_cal_check) < 0) pdata->mis_cal_check = 0; + if (of_property_read_u32(np, "sec,heatmap_mode", + &pdata->heatmap_mode) < 0) + pdata->heatmap_mode = 0; + pdata->regulator_boot_on = of_property_read_bool(np, "sec,regulator_boot_on"); pdata->support_sidegesture = of_property_read_bool(np, "sec,support_sidegesture"); pdata->support_dex = of_property_read_bool(np, "support_dex_mode"); @@ -809,7 +809,6 @@ struct sec_ts_data { struct pm_qos_request pm_qos_req; u8 frame_type; - int heatmap_mode; #if defined(CONFIG_TOUCHSCREEN_HEATMAP) || \ defined(CONFIG_TOUCHSCREEN_HEATMAP_MODULE) struct v4l2_heatmap v4l2; @@ -949,6 +948,7 @@ struct sec_ts_plat_data { int always_lpmode; int bringup; int mis_cal_check; + int heatmap_mode; #ifdef PAT_CONTROL int pat_function; int afe_base; diff --git a/sec_ts_fn.c b/sec_ts_fn.c index c4570ce..1e8b219 100644 --- a/sec_ts_fn.c +++ b/sec_ts_fn.c @@ -935,6 +935,7 @@ static ssize_t heatmap_mode_store(struct device *dev, defined(CONFIG_TOUCHSCREEN_HEATMAP_MODULE) struct sec_cmd_data *sec = dev_get_drvdata(dev); struct sec_ts_data *ts = container_of(sec, struct sec_ts_data, sec); + struct sec_ts_plat_data *pdata = ts->plat_data; int result; int val; u8 config; @@ -946,7 +947,7 @@ static ssize_t heatmap_mode_store(struct device *dev, return -EINVAL; } - ts->heatmap_mode = val; + pdata->heatmap_mode = val; /* reset all heatmap settings when any change */ config = 0; @@ -977,9 +978,10 @@ static ssize_t heatmap_mode_show(struct device *dev, defined(CONFIG_TOUCHSCREEN_HEATMAP_MODULE) struct sec_cmd_data *sec = dev_get_drvdata(dev); struct sec_ts_data *ts = container_of(sec, struct sec_ts_data, sec); + const struct sec_ts_plat_data *pdata = ts->plat_data; return scnprintf(buf, PAGE_SIZE, "%d\n", - ts->heatmap_mode); + pdata->heatmap_mode); #else return scnprintf(buf, PAGE_SIZE, "N/A\n"); #endif |