From e44ea453694b638058224e5a3bcbcab994eac861 Mon Sep 17 00:00:00 2001 From: Ritesh Kumar Date: Fri, 19 Feb 2021 12:46:20 +0530 Subject: [PATCH] input: touchscreen: nt36xxx: Use disable/enable irq wake in LA to LE Touch uses gpio as irq in LA. As per latest change from pinctrl, wakeup bit is disabled/enabled when disable_irq/enable_irq is called. During transtion from LA to LE, disable_irq is called leading to wakeup bit getting disabled and in LE Touch interrupts does not come. So, use disable_irq_wake to disable Touch interrupts while transition from LA to LE and use enable_irq_wake to enable back Touch interrupts while transition from LE to LA. Change-Id: Iad3391af40535d51daeef881c3d62b3ec893fff2 Signed-off-by: Ritesh Kumar --- drivers/input/touchscreen/nt36xxx/nt36xxx.c | 14 ++++++++++++++ drivers/input/touchscreen/nt36xxx/nt36xxx.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/input/touchscreen/nt36xxx/nt36xxx.c b/drivers/input/touchscreen/nt36xxx/nt36xxx.c index e428f3f7b559..b8c0e6c99ae1 100644 --- a/drivers/input/touchscreen/nt36xxx/nt36xxx.c +++ b/drivers/input/touchscreen/nt36xxx/nt36xxx.c @@ -725,6 +725,7 @@ static void nvt_ts_trusted_touch_abort_pvm(struct nvt_ts_data *ts) case TRUSTED_TOUCH_PVM_INIT: case PVM_I2C_RESOURCE_RELEASED: atomic_set(&ts->trusted_touch_enabled, 0); + atomic_set(&ts->trusted_touch_underway, 0); } atomic_set(&ts->trusted_touch_abort_status, 0); @@ -835,6 +836,7 @@ static void nvt_trusted_touch_pvm_vm_mode_disable(struct nvt_ts_data *ts) nvt_ts_trusted_touch_set_pvm_driver_state(ts, TRUSTED_TOUCH_PVM_INIT); atomic_set(&ts->trusted_touch_enabled, 0); + atomic_set(&ts->trusted_touch_underway, 0); pr_info("trusted touch disabled\n"); return; error: @@ -973,6 +975,7 @@ static int nvt_ts_trusted_touch_pvm_vm_mode_enable(struct nvt_ts_data *ts) int rc = 0; struct trusted_touch_vm_info *vm_info = ts->vm_info; + atomic_set(&ts->trusted_touch_underway, 1); /* i2c session start and resource acquire */ if (nvt_ts_bus_get(ts) < 0) { pr_err("nvt_ts_bus_get failed\n"); @@ -1208,12 +1211,23 @@ static void nvt_irq_enable(bool enable) if (enable) { if (!ts->irq_enabled) { +#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH + /* trusted_touch_underway is set in LA only */ + if (atomic_read(&ts->trusted_touch_underway)) + enable_irq_wake(ts->client->irq); +#else enable_irq(ts->client->irq); +#endif ts->irq_enabled = true; } } else { if (ts->irq_enabled) { +#ifdef CONFIG_NOVATEK_TRUSTED_TOUCH + if (atomic_read(&ts->trusted_touch_underway)) + disable_irq_wake(ts->client->irq); +#else disable_irq(ts->client->irq); +#endif ts->irq_enabled = false; } } diff --git a/drivers/input/touchscreen/nt36xxx/nt36xxx.h b/drivers/input/touchscreen/nt36xxx/nt36xxx.h index 238a09edc341..c7ba0dc0bdd0 100644 --- a/drivers/input/touchscreen/nt36xxx/nt36xxx.h +++ b/drivers/input/touchscreen/nt36xxx/nt36xxx.h @@ -202,6 +202,7 @@ struct nvt_ts_data { struct clk *iface_clk; atomic_t trusted_touch_initialized; atomic_t trusted_touch_enabled; + atomic_t trusted_touch_underway; atomic_t trusted_touch_event; atomic_t trusted_touch_abort_status; atomic_t delayed_vm_probe_pending;