Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8646eca authored by Bhalchandra Gajare's avatar Bhalchandra Gajare
Browse files

mfd: wcd9xxx_irq: Fix the condition to lock/unlock sleep



When codec raises interrupt and the system is suspended, the driver
waits for parent to resume. Fix the condition in wait_for_event to
prevent checking against stale value of suspend state during wait.

CRs-fixed: 554056
Change-Id: If36f366861ec28b52d621a884853e8a9467fa337
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent b4084af2
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -150,13 +150,15 @@ bool wcd9xxx_lock_sleep(
				      msm_cpuidle_get_deep_idle_latency());
	}
	mutex_unlock(&wcd9xxx_res->pm_lock);
	os = wcd9xxx_pm_cmpxchg(wcd9xxx_res,
					WCD9XXX_PM_SLEEPABLE,
					WCD9XXX_PM_AWAKE);

	if (!wait_event_timeout(wcd9xxx_res->pm_wq,
			(os  == WCD9XXX_PM_SLEEPABLE ||
			 os == WCD9XXX_PM_AWAKE),
			msecs_to_jiffies(WCD9XXX_SYSTEM_RESUME_TIMEOUT_MS))) {
				((os =  wcd9xxx_pm_cmpxchg(wcd9xxx_res,
						  WCD9XXX_PM_SLEEPABLE,
						  WCD9XXX_PM_AWAKE)) ==
							WCD9XXX_PM_SLEEPABLE ||
					(os == WCD9XXX_PM_AWAKE)),
				msecs_to_jiffies(
					WCD9XXX_SYSTEM_RESUME_TIMEOUT_MS))) {
		pr_warn("%s: system didn't resume within %dms, s %d, w %d\n",
			__func__,
			WCD9XXX_SYSTEM_RESUME_TIMEOUT_MS, wcd9xxx_res->pm_state,