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 <haojl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1214015
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jianqi Yang <yangj@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
haojl2 2018-07-23 17:01:20 +08:00 • committed by Jialei Hao
commit a5a0ce7608

View file

@ -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)