summaryrefslogtreecommitdiff
path: root/drivers/usb
diff options
context:
space:
mode:
authorWilliam Wu <william.wu@rock-chips.com>2018-12-06 19:40:16 +0800
committerTao Huang <huangtao@rock-chips.com>2018-12-10 20:09:34 +0800
commit747277acfeaa7bfed49031ee803efb19578dd932 (patch)
treed179c2dcc9e87f7ed4be6270772be739e4711d65 /drivers/usb
parentcf15e865dd6606b800c9916bdca2b8220780a84c (diff)
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. Change-Id: I84cbb15dd393e6af69b4cf6887f1628e2cba4999 Signed-off-by: William Wu <william.wu@rock-chips.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-platform.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index 8617096facdf..2f0fb5cd4201 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -30,6 +30,7 @@
#include <linux/of.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/usb.h>
#include <linux/usb/hcd.h>
@@ -308,6 +309,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)
@@ -341,6 +345,8 @@ err_power:
if (pdata->power_off)
pdata->power_off(dev);
err_reset:
+ pm_runtime_put_sync(&dev->dev);
+ pm_runtime_disable(&dev->dev);
if (priv->rst)
reset_control_assert(priv->rst);
err_put_clks:
@@ -375,6 +381,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;