From 0a009106438cf5f1ca3bbb432a6098375c40284d Mon Sep 17 00:00:00 2001 From: Ritesh Kumar Date: Fri, 9 Apr 2021 16:55:47 +0530 Subject: [PATCH 1/2] Revert "input: touchscreen: nt36xxx: Avoid i2c transfer in LA during TUI" This reverts commit 172ca98496761325509b8834c8a8b867e9d4e6a8. Change-Id: I54886c58803b7ce05abd528414b579d8b0c8cbcf Signed-off-by: Ritesh Kumar --- drivers/input/touchscreen/nt36xxx/nt36xxx.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/nt36xxx/nt36xxx.c b/drivers/input/touchscreen/nt36xxx/nt36xxx.c index 5443b6ba4269..7670528c2e38 100644 --- a/drivers/input/touchscreen/nt36xxx/nt36xxx.c +++ b/drivers/input/touchscreen/nt36xxx/nt36xxx.c @@ -2041,14 +2041,6 @@ static irqreturn_t nvt_ts_work_func(int irq, void *data) mutex_lock(&ts->lock); -#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH -#ifndef CONFIG_ARCH_QTI_VM - if (nvt_ts_trusted_touch_get_pvm_driver_state(ts) != - TRUSTED_TOUCH_PVM_INIT) - return IRQ_HANDLED; -#endif -#endif - ret = CTP_I2C_READ(ts->client, I2C_FW_Address, point_data, POINT_DATA_LEN + 1); if (ret < 0) { NVT_ERR("CTP_I2C_READ failed.(%d)\n", ret); @@ -3131,7 +3123,7 @@ static int32_t nvt_ts_resume(struct device *dev) return 0; } -#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH +#ifdef CONFIG_ST_TRUSTED_TOUCH if (atomic_read(&ts->trusted_touch_enabled)) wait_for_completion_interruptible( &ts->trusted_touch_powerdown); From ce65d8f897bd403b79b38d3da19f43994d8baa2f Mon Sep 17 00:00:00 2001 From: Ritesh Kumar Date: Fri, 9 Apr 2021 17:16:45 +0530 Subject: [PATCH 2/2] 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 --- drivers/input/touchscreen/nt36xxx/nt36xxx.c | 25 +++++++++++++++++---- drivers/input/touchscreen/nt36xxx/nt36xxx.h | 2 ++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/nt36xxx/nt36xxx.c b/drivers/input/touchscreen/nt36xxx/nt36xxx.c index 7670528c2e38..34afa81863ad 100644 --- a/drivers/input/touchscreen/nt36xxx/nt36xxx.c +++ b/drivers/input/touchscreen/nt36xxx/nt36xxx.c @@ -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; diff --git a/drivers/input/touchscreen/nt36xxx/nt36xxx.h b/drivers/input/touchscreen/nt36xxx/nt36xxx.h index c7ba0dc0bdd0..44321ba9c2e9 100644 --- a/drivers/input/touchscreen/nt36xxx/nt36xxx.h +++ b/drivers/input/touchscreen/nt36xxx/nt36xxx.h @@ -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;