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>
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
This commit is contained in:
William Wu
2018-12-06 19:40:16 +08:00
committed by Tao Huang
parent 5c7a57abc1
commit 513463e9c4

View File

@@ -28,6 +28,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <linux/sys_soc.h>
#include <linux/timer.h>
@@ -363,6 +364,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)
@@ -395,6 +399,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)
@@ -430,6 +436,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;