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

Commit 2f43649b authored by Mayank Rana's avatar Mayank Rana Committed by Jack Pham
Browse files

usb: host: xhci-plat: Add missing pm_runtime_mark_last_busy()



This change makes sure to use pm_runtime_mark_last_busy() at
the end of the probe() function in order to ensure that
autosuspend happens after sufficient delay. Otherwise the
controller could end up suspending too soon before a child
device has had a chance to enumerate.

In addition, fix the runtime_idle() callback to also call
mark_last_busy() as well as pm_runtime_autosuspend() directly.
This ensures that even when the child devices have suspended
that there will be an autosuspend delay enforced before allowing
the controller parent to suspend.

Change-Id: Iba58c89cf6080d828a1e28a5c152dad2df362b21
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent c9cabb7e
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -235,6 +235,8 @@ static int xhci_plat_probe(struct platform_device *pdev)
	if (ret)
		dev_err(&pdev->dev, "%s: unable to create imod sysfs entry\n",
					__func__);

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

	return 0;
@@ -280,12 +282,18 @@ static int xhci_plat_remove(struct platform_device *dev)
#ifdef CONFIG_PM_RUNTIME
static int xhci_plat_runtime_idle(struct device *dev)
{
	if (pm_runtime_autosuspend_expiration(dev)) {
	/*
	 * When pm_runtime_put_autosuspend() is called on this device,
	 * after this idle callback returns the PM core will schedule the
	 * autosuspend if there is any remaining time until expiry. However,
	 * when reaching this point because the child_count becomes 0, the
	 * core does not honor autosuspend in that case and results in
	 * idle/suspend happening immediately. In order to have a delay
	 * before suspend we have to call pm_runtime_autosuspend() manually.
	 */
	pm_runtime_mark_last_busy(dev);
	pm_runtime_autosuspend(dev);
		return -EAGAIN;
	}

	return 0;
	return -EBUSY;
}

static int xhci_plat_runtime_suspend(struct device *dev)