diff options
author | davidycchen <davidycchen@google.com> | 2021-12-24 15:35:09 +0800 |
---|---|---|
committer | Yen-Chao Chen <davidycchen@google.com> | 2021-12-29 07:49:03 +0000 |
commit | d0253c7299bd70cd8c7d3de55da28460c5d14ae5 (patch) | |
tree | 56c9474a3082b9a3a39491387ae7f68b36d8f57c | |
parent | 37524e36ef3cecb5ae5ef03007e24e7da2b73377 (diff) | |
download | synaptics_touch-d0253c7299bd70cd8c7d3de55da28460c5d14ae5.tar.gz |
synaptics: disable heatmap when the touch suspends
Disable touch heatmap when the touch suspends otherwise the heatmap
will keep reporting heatmap when the low power gesture mode is enabled.
Bug: 199104336
Test: flash kernel image.
Signed-off-by: davidycchen <davidycchen@google.com>
Change-Id: I0922c76f7d3b2b6f1186fcc797f692b582ab5ac3
-rw-r--r-- | syna_tcm2.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c index 2a11b05..33baff6 100644 --- a/syna_tcm2.c +++ b/syna_tcm2.c @@ -238,6 +238,40 @@ static int syna_dev_enable_lowpwr_gesture(struct syna_tcm *tcm, bool en) return retval; } +/** + * syna_dev_set_heatmap_mode() + * + * Enable or disable the low power gesture mode. + * Furthermore, set up the wake-up irq. + * + * @param + * [ in] tcm: tcm driver handle + * [ in] en: '1' to enable heatmap mode; '0' to disable. + * + * @return + * on success, 0; otherwise, negative value on error. + */ +static void syna_dev_set_heatmap_mode(struct syna_tcm *tcm, bool en) +{ + int retval = 0; + struct syna_hw_attn_data *attn = &tcm->hw_if->bdata_attn; + uint8_t resp_code; + uint8_t heatmap[1] = {REPORT_HEAT_MAP}; + uint8_t command = en ? CMD_ENABLE_REPORT : CMD_DISABLE_REPORT; + uint32_t delay = attn->irq_enabled ? + RESP_IN_ATTN : tcm->tcm_dev->msg_data.default_resp_reading; + + retval = tcm->tcm_dev->write_message(tcm->tcm_dev, + command, + heatmap, + 1, + &resp_code, + delay); + if (retval < 0) { + LOGE("Fail to %s heatmap\n", en ? "enable" : "disable"); + } +} + #ifdef ENABLE_CUSTOM_TOUCH_ENTITY /** * syna_dev_parse_custom_touch_data_cb() @@ -1344,6 +1378,8 @@ static int syna_dev_resume(struct device *dev) goto exit; } + syna_dev_set_heatmap_mode(tcm, true); + retval = 0; LOGI("Device resumed (pwr_state:%d)\n", tcm->pwr_state); @@ -1415,6 +1451,8 @@ static int syna_dev_suspend(struct device *dev) if (irq_disabled && (hw_if->ops_enable_irq)) hw_if->ops_enable_irq(hw_if, false); + syna_dev_set_heatmap_mode(tcm, false); + syna_pinctrl_configure(tcm, false); LOGI("Device suspended (pwr_state:%d)\n", tcm->pwr_state); |