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

Commit d5f12cd4 authored by ChandanaKishori Chiluveru's avatar ChandanaKishori Chiluveru Committed by Gerrit - the friendly Code Review server
Browse files

USB: PHY: msm: Fix pm_runtime race with sm_work during boot-up



If there is any ID line change during suspend, msm_otg_irq is called
for ID status and calling  msm_otg_resume to resume the HW out of LPM
from interrupt context and disable the async_irq. This may race with
another PM runtime msm_otg_resume from android_probe context and
disable async_irq again. After this as async_irq remains disable,
OTG irq handler never called on device connect/disconnect. This
results in device detection issues on bootup with host cable
connected. Fix this by improving PM runtime handling in sm_work.

Change-Id: I69609f07f09dfaa8eb3979175eacd6ff14b47547
Signed-off-by: default avatarChandanaKishori Chiluveru <cchilu@codeaurora.org>
parent ac263d37
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -2649,8 +2649,14 @@ static void msm_otg_sm_work(struct work_struct *w)

	/* Just resume h/w if reqd, pm_count is handled based on state/inputs */
	if (motg->resume_pending) {
		pm_runtime_get_noresume(otg->phy->dev);
		pm_runtime_get_sync(otg->phy->dev);
		if (atomic_read(&motg->in_lpm)) {
			dev_err(dev, "SM WORK: USB is in LPM\n");
			msm_otg_dbg_log_event(&motg->phy,
					"SM WORK: USB IS IN LPM",
					otg->phy->state, motg->inputs);
			msm_otg_resume(motg);
		}
		motg->resume_pending = false;
		pm_runtime_put_noidle(otg->phy->dev);
	}