summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Jain <raviajain@google.com>2022-12-01 13:14:26 +0800
committerRavi Jain <raviajain@google.com>2022-12-05 14:10:30 +0800
commitb8701900bbc56e52f8c1f381aecbd53017174881 (patch)
tree1a7ff776f83cfc7d287e11ea652a0076f55d4e72
parentc9caff69d8254154342af935eca1501af123f53c (diff)
downloadgoodix_touch-b8701900bbc56e52f8c1f381aecbd53017174881.tar.gz
touch: goodix: Fix deadlock between irq and wakelock
1. Use of disable_irq_nosync instead of disable_irq. 2. Add Error handling while obtaining irq_wakelock. Test: Flashed locally to test resume/suspend operations. Bug: 230827813 Change-Id: Icf0e6ce80c9b5e9e3b95c9f8d4debf1163b69843 Signed-off-by: Ravi Jain <raviajain@google.com>
-rw-r--r--goodix_brl_hw.c2
-rw-r--r--goodix_ts_core.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/goodix_brl_hw.c b/goodix_brl_hw.c
index 5ff8e77..0023a0f 100644
--- a/goodix_brl_hw.c
+++ b/goodix_brl_hw.c
@@ -343,7 +343,7 @@ static int brl_irq_enable(struct goodix_ts_core *cd, bool enable)
}
if (!enable && atomic_cmpxchg(&cd->irq_enabled, 1, 0)) {
- disable_irq(cd->irq);
+ disable_irq_nosync(cd->irq);
ts_debug("Irq disabled");
return 0;
}
diff --git a/goodix_ts_core.c b/goodix_ts_core.c
index 323b32d..04239cc 100644
--- a/goodix_ts_core.c
+++ b/goodix_ts_core.c
@@ -1754,7 +1754,11 @@ static irqreturn_t goodix_ts_threadirq_func(int irq, void *data)
int ret;
#if IS_ENABLED(CONFIG_GOOG_TOUCH_INTERFACE) && IS_ENABLED(CONFIG_GTI_PM)
- goog_pm_wake_lock(core_data->gti, GTI_PM_WAKELOCK_TYPE_IRQ, true);
+ ret = goog_pm_wake_lock(core_data->gti, GTI_PM_WAKELOCK_TYPE_IRQ, true);
+ if(ret < 0) {
+ GOOG_INFO("Error while obtaing IRQ wakelock: %d!\n", ret);
+ return IRQ_HANDLED;
+ }
#endif
ts_esd->irq_status = true;
@@ -1769,7 +1773,7 @@ static irqreturn_t goodix_ts_threadirq_func(int irq, void *data)
if (ret == EVT_CANCEL_IRQEVT) {
mutex_unlock(&goodix_modules.mutex);
#if IS_ENABLED(CONFIG_GOOG_TOUCH_INTERFACE) && IS_ENABLED(CONFIG_GTI_PM)
- goog_pm_wake_unlock(core_data->gti, GTI_PM_WAKELOCK_TYPE_IRQ);
+ goog_pm_wake_unlock_nosync(core_data->gti, GTI_PM_WAKELOCK_TYPE_IRQ);
#endif
return IRQ_HANDLED;
}
@@ -1808,7 +1812,7 @@ static irqreturn_t goodix_ts_threadirq_func(int irq, void *data)
}
#if IS_ENABLED(CONFIG_GOOG_TOUCH_INTERFACE) && IS_ENABLED(CONFIG_GTI_PM)
- goog_pm_wake_unlock(core_data->gti, GTI_PM_WAKELOCK_TYPE_IRQ);
+ goog_pm_wake_unlock_nosync(core_data->gti, GTI_PM_WAKELOCK_TYPE_IRQ);
#endif
return IRQ_HANDLED;