From beb372091717cac024f3493b1cabab913b384a56 Mon Sep 17 00:00:00 2001 From: haojl2 Date: Wed, 28 Aug 2019 14:39:14 +0800 Subject: [PATCH] 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 Reviewed-on: https://gerrit.mot.com/1411821 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jun Weng Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- .../touchscreen/himax_v2_mmi/himax_common.c | 25 +++++++++++++++++-- .../touchscreen/himax_v2_mmi/himax_common.h | 1 + 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c index 01651823c831..c49ee7fdfaf6 100644 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.c +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.c @@ -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; +} + diff --git a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h index 51b02cc9a8e2..94cb19066eb4 100755 --- a/drivers/input/touchscreen/himax_v2_mmi/himax_common.h +++ b/drivers/input/touchscreen/himax_v2_mmi/himax_common.h @@ -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;