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

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

usb: dwc3: Fix re-enumeration of connected peripherals



When the device exits suspend/deep sleep in host mode with
peripherals connected, the peripherals and root hub failed to
resume because the xhci stack has not resumed yet, leading to
the re-enumeration of the connected peripherals.

Fix this by resuming the glue driver, core and xhci plat driver
un-conditionally as part of suspend/deep sleep exit.

Change-Id: Ie1cbe174aec04ddde5779ad4fabdf075cffa955d
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
parent 4cf5de75
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -2001,8 +2001,7 @@ static int dwc3_resume(struct device *dev)
		 * runtime PM state as active to reflect actual state of device
		 * runtime PM state as active to reflect actual state of device
		 * which is now out of LPM. This allows runtime_suspend later.
		 * which is now out of LPM. This allows runtime_suspend later.
		 */
		 */
		if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST &&
		if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST)
		    dwc->host_poweroff_in_pm_suspend)
			goto runtime_set_active;
			goto runtime_set_active;


		return 0;
		return 0;
+1 −1
Original line number Original line Diff line number Diff line
@@ -5303,7 +5303,7 @@ static int dwc3_msm_pm_resume(struct device *dev)


	atomic_set(&mdwc->pm_suspended, 0);
	atomic_set(&mdwc->pm_suspended, 0);


	if (!dwc->host_poweroff_in_pm_suspend || !mdwc->in_host_mode) {
	if (!mdwc->in_host_mode) {
		/* kick in otg state machine */
		/* kick in otg state machine */
		queue_work(mdwc->dwc3_wq, &mdwc->resume_work);
		queue_work(mdwc->dwc3_wq, &mdwc->resume_work);


+24 −1
Original line number Original line Diff line number Diff line
@@ -421,6 +421,29 @@ static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev)
	return xhci_suspend(xhci, true);
	return xhci_suspend(xhci, true);
}
}


static int xhci_plat_resume(struct device *dev)
{
	struct usb_hcd  *hcd = dev_get_drvdata(dev);
	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
	int ret;

	if (!xhci)
		return 0;

	dev_dbg(dev, "xhci-plat resume\n");

	ret = xhci_priv_resume_quirk(hcd);
	if (ret)
		return ret;

	ret = xhci_resume(xhci, false);
	pm_runtime_disable(dev);
	pm_runtime_set_active(dev);
	pm_runtime_enable(dev);

	return ret;
}

static int __maybe_unused xhci_plat_runtime_resume(struct device *dev)
static int __maybe_unused xhci_plat_runtime_resume(struct device *dev)
{
{
	struct usb_hcd  *hcd = dev_get_drvdata(dev);
	struct usb_hcd  *hcd = dev_get_drvdata(dev);
@@ -443,7 +466,7 @@ static int __maybe_unused xhci_plat_runtime_resume(struct device *dev)
}
}


static const struct dev_pm_ops xhci_plat_pm_ops = {
static const struct dev_pm_ops xhci_plat_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(NULL, NULL)
	SET_SYSTEM_SLEEP_PM_OPS(NULL, xhci_plat_resume)


	SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend,
	SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend,
			   xhci_plat_runtime_resume,
			   xhci_plat_runtime_resume,