From fa4da6317458316ecb0da5831e751fd6ddc40926 Mon Sep 17 00:00:00 2001 From: William Wu Date: Thu, 6 Dec 2018 19:40:16 +0800 Subject: [PATCH] usb: host: ehci-platform: Add basic runtime PM support Like the runtime PM support patch of ohci-platform, we add the same basic runtime PM for ehci-platform. Conflicts: drivers/usb/host/ehci-platform.c Change-Id: I84cbb15dd393e6af69b4cf6887f1628e2cba4999 Signed-off-by: William Wu Signed-off-by: Frank Wang --- drivers/usb/host/ehci-platform.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 1530b58527dd..4dcd39a6cb27 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -262,6 +263,9 @@ static int ehci_platform_probe(struct platform_device *dev) } #endif + pm_runtime_set_active(&dev->dev); + pm_runtime_enable(&dev->dev); + pm_runtime_get_sync(&dev->dev); if (pdata->power_on) { err = pdata->power_on(dev); if (err < 0) @@ -294,6 +298,8 @@ err_power: if (pdata->power_off) pdata->power_off(dev); err_reset: + pm_runtime_put_sync(&dev->dev); + pm_runtime_disable(&dev->dev); reset_control_assert(priv->rsts); err_put_clks: while (--clk >= 0) @@ -326,6 +332,9 @@ static int ehci_platform_remove(struct platform_device *dev) usb_put_hcd(hcd); + pm_runtime_put_sync(&dev->dev); + pm_runtime_disable(&dev->dev); + if (pdata == &ehci_platform_defaults) dev->dev.platform_data = NULL;