diff options
author | Yen-Chao Chen <davidycchen@google.com> | 2022-03-31 05:27:42 +0000 |
---|---|---|
committer | Android Partner Code Review <android-gerrit-partner@google.com> | 2022-03-31 05:27:42 +0000 |
commit | c152c209831eac247f060d1d16d16ec95d2530ee (patch) | |
tree | 90563e50c75217259a37fd4e256fe2794a73a0f7 | |
parent | 3b8bb17ea9c03c3bd3db8202e0190630c9375b34 (diff) | |
parent | f9a5c3b12e28273368f1521ce1e4bd0645c47e17 (diff) | |
download | synaptics_touch-c152c209831eac247f060d1d16d16ec95d2530ee.tar.gz |
Merge "synaptics: trigger reset and retry when the suspend process fails" into android13-gs-pixel-5.10
-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 4f571f4..2eb01ac 100644 --- a/syna_tcm2.c +++ b/syna_tcm2.c @@ -2025,6 +2025,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) @@ -2041,8 +2042,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); |