input: touchscreen: nt36xxx: complete suspend/resume before TUI

Before initiating trusted touch, wait for suspend or resume to
complete. Similarly, before starting suspend or resume, wait for
trusted touch session to complete.

Change-Id: Ic79f92545ef70a815fb63772b94274959974ea75
Signed-off-by: Ritesh Kumar <riteshk@codeaurora.org>
This commit is contained in:
Ritesh Kumar 2021-04-09 17:16:45 +05:30 • committed by Gerrit - the friendly Code Review server
commit ce65d8f897
2 changed files with 23 additions and 4 deletions

View file

@ -761,6 +761,9 @@ static int nvt_ts_bus_get(struct nvt_ts_data *ts)
{
int rc = 0;
if (atomic_read(&ts->suspend_resume_underway))
wait_for_completion_interruptible(&ts->touch_suspend_resume);
reinit_completion(&ts->trusted_touch_powerdown);
mutex_lock(&ts->nvt_clk_io_ctrl_mutex);
rc = pm_runtime_get_sync(ts->client->adapter->dev.parent);
@ -1174,6 +1177,7 @@ static void nvt_ts_trusted_touch_init(struct nvt_ts_data *ts)
return;
init_completion(&ts->trusted_touch_powerdown);
init_completion(&ts->touch_suspend_resume);
/* Get clocks */
ts->core_clk = devm_clk_get(ts->client->dev.parent,
@ -3044,9 +3048,12 @@ static int32_t nvt_ts_suspend(struct device *dev)
}
#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH
if (atomic_read(&ts->trusted_touch_enabled))
if (atomic_read(&ts->trusted_touch_underway))
wait_for_completion_interruptible(
&ts->trusted_touch_powerdown);
atomic_set(&ts->suspend_resume_underway, 1);
reinit_completion(&ts->touch_suspend_resume);
#endif
#if !WAKEUP_GESTURE
@ -3100,7 +3107,10 @@ static int32_t nvt_ts_suspend(struct device *dev)
input_sync(ts->input_dev);
msleep(50);
#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH
complete(&ts->touch_suspend_resume);
atomic_set(&ts->suspend_resume_underway, 0);
#endif
NVT_LOG("end\n");
return 0;
@ -3123,10 +3133,13 @@ static int32_t nvt_ts_resume(struct device *dev)
return 0;
}
#ifdef CONFIG_ST_TRUSTED_TOUCH
if (atomic_read(&ts->trusted_touch_enabled))
#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH
if (atomic_read(&ts->trusted_touch_underway))
wait_for_completion_interruptible(
&ts->trusted_touch_powerdown);
atomic_set(&ts->suspend_resume_underway, 1);
reinit_completion(&ts->touch_suspend_resume);
#endif
mutex_lock(&ts->lock);
@ -3157,6 +3170,10 @@ static int32_t nvt_ts_resume(struct device *dev)
mutex_unlock(&ts->lock);
#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH
complete(&ts->touch_suspend_resume);
atomic_set(&ts->suspend_resume_underway, 0);
#endif
NVT_LOG("end\n");
return 0;

View file

@ -198,11 +198,13 @@ struct nvt_ts_data {
struct mutex nvt_clk_io_ctrl_mutex;
const char *touch_environment;
struct completion trusted_touch_powerdown;
struct completion touch_suspend_resume;
struct clk *core_clk;
struct clk *iface_clk;
atomic_t trusted_touch_initialized;
atomic_t trusted_touch_enabled;
atomic_t trusted_touch_underway;
atomic_t suspend_resume_underway;
atomic_t trusted_touch_event;
atomic_t trusted_touch_abort_status;
atomic_t delayed_vm_probe_pending;