phy: rockchip-inno-usb2: add basic runtime PM support

Adds pm_runtime support for some rockchip SoCs (e.g. rk3399)
which support power domain for USB 2.0 PHY.

Change-Id: I4c78075c884b3baf6d709e08e3464b214524d685
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
2019-04-08 09:27:14 +08:00
committed by Tao Huang
parent bc4e593a37
commit 9257a91d4d

View File

@@ -22,6 +22,7 @@
#include <linux/of_platform.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
#include <linux/mfd/syscon.h>
@@ -1814,6 +1815,10 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev)
return -EINVAL;
}
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
pm_runtime_get_sync(dev);
rphy->clk = of_clk_get_by_name(np, "phyclk");
if (!IS_ERR(rphy->clk)) {
clk_prepare_enable(rphy->clk);
@@ -1892,6 +1897,8 @@ next_child:
put_child:
of_node_put(child_np);
disable_clks:
pm_runtime_put_sync(dev);
pm_runtime_disable(dev);
if (rphy->clk) {
clk_disable_unprepare(rphy->clk);
clk_put(rphy->clk);