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

Commit 81dd67d6 authored by Sriharsha Allenki's avatar Sriharsha Allenki Committed by Gerrit - the friendly Code Review server
Browse files

usb: dwc3: Prevent runtime_suspend after wakeup event



Currently the core is being suspended even after the
wakeup event because the autosuspend delay is elapsed
after the wakeup event is received but before the sm_work
is executed.
Prevent the runtime_suspend being called by marking last_busy
when the wakeup interrupt is received. Also bail out
from the dwc3_msm_suspend if a wakeup interrupt is
received.

Change-Id: I229338adbf3a6719e7e818d1da83eda9f03034b7
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
parent 504a16b6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2095,6 +2095,12 @@ static int dwc3_msm_suspend(struct dwc3_msm *mdwc)
		return -EBUSY;
	}

	if (!mdwc->in_host_mode && (mdwc->vbus_active && !mdwc->suspend)) {
		dev_dbg(mdwc->dev,
			"Received wakeup event before the core suspend\n");
		return -EBUSY;
	}

	ret = dwc3_msm_prepare_suspend(mdwc);
	if (ret)
		return ret;
+4 −1
Original line number Diff line number Diff line
@@ -3189,8 +3189,11 @@ static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc, bool remote_wakeup)

		/*
		 * In case of remote wake up dwc3_gadget_wakeup_work()
		 * is doing pm_runtime_get_sync().
		 * is doing pm_runtime_get_sync(). But mark last wakeup
		 * event here to prevent runtime_suspend happening before this
		 * wakeup event is processed.
		 */
		pm_runtime_mark_last_busy(dwc->dev);
		dev_dbg(dwc->dev, "Notify OTG from %s\n", __func__);
		dwc->b_suspend = false;
		dwc3_notify_event(dwc,