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

Commit e21363e9 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: xhci-plat: Add runtime autosuspend delay"

parents 1bfdbc66 dc281958
Loading
Loading
Loading
Loading
+19 −3
Original line number Diff line number Diff line
@@ -135,6 +135,8 @@ static int xhci_plat_probe(struct platform_device *pdev)
	if (pdev->dev.parent)
		pm_runtime_resume(pdev->dev.parent);

	pm_runtime_use_autosuspend(&pdev->dev);
	pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
	pm_runtime_get_sync(&pdev->dev);
@@ -174,7 +176,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
	if (ret)
		goto put_usb3_hcd;

	pm_runtime_put(&pdev->dev);
	pm_runtime_put_autosuspend(&pdev->dev);

	return 0;

@@ -240,6 +242,16 @@ static int xhci_plat_resume(struct device *dev)
}

#ifdef CONFIG_PM_RUNTIME
static int xhci_plat_runtime_idle(struct device *dev)
{
	if (pm_runtime_autosuspend_expiration(dev)) {
		pm_runtime_autosuspend(dev);
		return -EAGAIN;
	}

	return 0;
}

static int xhci_plat_runtime_suspend(struct device *dev)
{
	struct usb_hcd *hcd = dev_get_drvdata(dev);
@@ -257,20 +269,24 @@ static int xhci_plat_runtime_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 runtime resume\n");

	return xhci_resume(xhci, false);
	ret = xhci_resume(xhci, false);
	pm_runtime_mark_last_busy(dev);

	return ret;
}
#endif

static const struct dev_pm_ops xhci_plat_pm_ops = {
	SET_SYSTEM_SLEEP_PM_OPS(xhci_plat_suspend, xhci_plat_resume)
	SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume,
			   NULL)
			   xhci_plat_runtime_idle)
};
#define DEV_PM_OPS	(&xhci_plat_pm_ops)
#else