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

Commit 8d4d03e3 authored by Bar Weiner's avatar Bar Weiner
Browse files

usb: dwc3: msm: initiate resume sequence in threaded irq handler



Since going out of low power mode(LPM) requires enabling
USB clocks, it cannot be done in interrupt context.

This change moves LPM-exit sequence to the threaded
irq handler and is now done synchronously, this is
done to ensure that enabling the clocks happens as
soon as possible.

Change-Id: I908df91e2cb5a1ae64c748a8006b5dad2c1d026f
Signed-off-by: default avatarBar Weiner <bweiner@codeaurora.org>
parent bb59a2c0
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -1964,8 +1964,12 @@ static void dwc3_pwr_event_handler(struct dwc3_msm *mdwc)
static irqreturn_t msm_dwc3_pwr_irq_thread(int irq, void *_mdwc)
{
	struct dwc3_msm *mdwc = _mdwc;
	struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);

	dev_dbg(mdwc->dev, "%s\n", __func__);
	if (atomic_read(&dwc->in_lpm))
		pm_runtime_get_sync(&mdwc->dwc3->dev);
	else
		dwc3_pwr_event_handler(mdwc);
	return IRQ_HANDLED;
}
@@ -2095,11 +2099,12 @@ static irqreturn_t msm_dwc3_pwr_irq(int irq, void *data)
		 * msm_resume after the clocks are enabled.
		 */
		atomic_set(&mdwc->in_p3, 0);
		/* bail out if system resume in process, else initiate RESUME */
		if (atomic_read(&mdwc->pm_suspended))

		/* Initate resume if system resume is not in process */
		if (!atomic_read(&mdwc->pm_suspended))
				return IRQ_WAKE_THREAD;

		mdwc->resume_pending = true;
		else
			pm_runtime_get(&mdwc->dwc3->dev);

		return IRQ_HANDLED;
	}