diff options
author | davidycchen <davidycchen@google.com> | 2022-03-31 09:35:09 +0800 |
---|---|---|
committer | davidycchen <davidycchen@google.com> | 2022-03-31 09:47:19 +0800 |
commit | f9a5c3b12e28273368f1521ce1e4bd0645c47e17 (patch) | |
tree | 6cb31e60fda8afa7e8184cfabb6eb32feaa6ceab | |
parent | 6d9f8215a27ba4e5879acb13575e62c54969641b (diff) | |
download | synaptics_touch-f9a5c3b12e28273368f1521ce1e4bd0645c47e17.tar.gz |
synaptics: trigger reset and retry when the suspend process fails
Trigger reset and retry when the suspend process fails to make sure
touch can enter low power mode.
Bug: 227139770
Test: Suspend successfully after reset.
Signed-off-by: davidycchen <davidycchen@google.com>
Change-Id: Ib13b7483272ea10e4589417ce6f0561f3d66de6a
-rw-r--r-- | syna_tcm2.c | 19 | ||||
-rw-r--r-- | syna_tcm2_platform_spi.c | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/syna_tcm2.c b/syna_tcm2.c index c1ab34e..8330701 100644 --- a/syna_tcm2.c +++ b/syna_tcm2.c @@ -2016,6 +2016,7 @@ static int syna_dev_suspend(struct device *dev) struct syna_tcm *tcm = dev_get_drvdata(dev); struct syna_hw_interface *hw_if = tcm->hw_if; bool irq_disabled = true; + unsigned char status; /* exit directly if device is already in suspend state */ if (tcm->pwr_state != PWR_ON) @@ -2032,8 +2033,22 @@ static int syna_dev_suspend(struct device *dev) /* enter power saved mode if power is not off */ retval = syna_dev_enter_lowpwr_sensing(tcm); if (retval < 0) { - LOGE("Fail to enter suspended power mode\n"); - return retval; + LOGE("Fail to enter suspended power mode, reset and retry.\n"); + if (hw_if->ops_hw_reset) { + hw_if->ops_hw_reset(hw_if); + retval = syna_tcm_get_event_data(tcm->tcm_dev, + &status, NULL); + if ((retval < 0) || (status != REPORT_IDENTIFY)) { + LOGE("Fail to complete hw reset, ret = %d, status = %d\n", + retval, status); + } + return retval; + } + retval = syna_dev_enter_lowpwr_sensing(tcm); + if (retval < 0) { + LOGE("Fail to enter suspended power mode after reset.\n"); + return retval; + } } tcm->pwr_state = LOW_PWR; #else diff --git a/syna_tcm2_platform_spi.c b/syna_tcm2_platform_spi.c index a247fcc..b8ac888 100644 --- a/syna_tcm2_platform_spi.c +++ b/syna_tcm2_platform_spi.c @@ -89,6 +89,8 @@ static void syna_spi_hw_reset(struct syna_hw_interface *hw_if) { struct syna_hw_rst_data *rst = &hw_if->bdata_rst; + LOGI("Trigger hardware reset.\n"); + if (rst->reset_gpio >= 0) { gpio_set_value(rst->reset_gpio, rst->reset_on_state); syna_pal_sleep_ms(rst->reset_active_ms); |