From a5a0ce7608b59e010acd2171e69ebc4507428598 Mon Sep 17 00:00:00 2001 From: haojl2 Date: Mon, 23 Jul 2018 17:01:20 +0800 Subject: [PATCH] synaptics_tcm: HW Reset IC if resume failed. If IC resume failed, reset IC and try to resume again. Change-Id: I36dfcde496c4123f23742c9f0f73ce3c5d3bea6c Signed-off-by: haojl2 Reviewed-on: https://gerrit.mot.com/1214015 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- .../synaptics_tcm_mmi/synaptics_tcm_core.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.c b/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.c index 22913c7820fd..7c7e7764c79e 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.c +++ b/drivers/input/touchscreen/synaptics_tcm_mmi/synaptics_tcm_core.c @@ -40,6 +40,8 @@ #define RESET_ON_RESUME_DELAY_MS 20 +#define RESET_IF_RESUME_FAILED + #define PREDICTIVE_READING #define MIN_READ_LENGTH 9 @@ -3072,14 +3074,22 @@ static int syna_tcm_resume(struct device *dev) if (retval < 0) { LOGE(tcm_hcd->pdev->dev.parent, "Failed to exit deep sleep\n"); +#ifdef RESET_IF_RESUME_FAILED + goto try_resume_again; +#else goto exit; +#endif } retval = syna_tcm_rezero(tcm_hcd); if (retval < 0) { LOGE(tcm_hcd->pdev->dev.parent, "Failed to rezero\n"); +#ifdef RESET_IF_RESUME_FAILED + goto try_resume_again; +#else goto exit; +#endif } goto mod_resume; @@ -3120,6 +3130,15 @@ exit: tcm_hcd->in_suspend = false; return retval; + +#ifdef RESET_IF_RESUME_FAILED +try_resume_again: + LOGN(tcm_hcd->pdev->dev.parent, + "Resume failed, reset IC and try again\n"); + tcm_hcd->reset(tcm_hcd, true, true); + queue_work(system_wq, &tcm_hcd->resume_work); + return 0; +#endif } static int syna_tcm_suspend(struct device *dev)