himax_v2_mmi: Add suspend resume mutex

TP:
Add a mutex to lock suspend and resume function
This is used by touch virtual sensor

Change-Id: If7cc2dab9a5b1550a46ee4b5679d4451b1d944cd
Signed-off-by: haojl2 <haojl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1411821
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Jun Weng <wengjun1@motorola.com>
Reviewed-by: Guobin Zhang <zhanggb@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
haojl2 2019-08-28 14:39:14 +08:00 • committed by Jialei Hao
commit beb3720917
2 changed files with 24 additions and 2 deletions

View file

@ -3479,6 +3479,7 @@ FW_force_upgrade:
pdata->cable_config[1] = 0x00;
#endif
ts->suspended = false;
mutex_init(&ts->suspend_resume_mutex);
#if defined(HX_USB_DETECT_CALLBACK) || defined(HX_USB_DETECT_GLOBAL)
ts->usb_connected = 0x00;
ts->cable_config = pdata->cable_config;
@ -3688,7 +3689,7 @@ void himax_chip_common_deinit(void)
I("%s: Common section deinited!\n", __func__);
}
int himax_chip_common_suspend(struct himax_ts_data *ts)
int _himax_chip_common_suspend(struct himax_ts_data *ts)
{
if (ts->suspended) {
I("%s: Already suspended. Skipped.\n", __func__);
@ -3764,7 +3765,17 @@ END:
return 0;
}
int himax_chip_common_resume(struct himax_ts_data *ts)
int himax_chip_common_suspend(struct himax_ts_data *ts)
{
int ret = 0;
mutex_lock(&ts->suspend_resume_mutex);
ret = _himax_chip_common_suspend(ts);
mutex_unlock(&ts->suspend_resume_mutex);
return ret;
}
int _himax_chip_common_resume(struct himax_ts_data *ts)
{
#if defined(HX_ZERO_FLASH) && defined(HX_RESUME_SET_FW)
int result = 0;
@ -3847,3 +3858,13 @@ END:
return 0;
}
int himax_chip_common_resume(struct himax_ts_data *ts)
{
int ret = 0;
mutex_lock(&ts->suspend_resume_mutex);
ret = _himax_chip_common_resume(ts);
mutex_unlock(&ts->suspend_resume_mutex);
return ret;
}

View file

@ -344,6 +344,7 @@ struct himax_ts_data {
bool initialized;
bool suspended;
atomic_t suspend_mode;
struct mutex suspend_resume_mutex;
uint8_t x_channel;
uint8_t y_channel;
uint8_t useScreenRes;