UPSTREAM: phy: rockchip-typec: add pm runtime support
authorChris Zhong <zyw@rock-chips.com>
Wed, 7 Sep 2016 18:17:25 +0000 (11:17 -0700)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 8 Nov 2016 07:58:29 +0000 (15:58 +0800)
Adds pm_runtime support for rockchip Type-C, so that power domain is
enabled only when there is a transaction going on to help save power.

BUG=chrome-os-partner:52872
TEST=Check DP display and USB3

Change-Id: I072fd06eaa4dfc4b4f598c4a6a3972ee458b833f
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
(cherry picked from git.kernel.org kishon/linux-phy.git next
 commit 15ab5499bd837b1d70287da747dc3d9762ab320a)
Reviewed-on: https://chromium-review.googlesource.com/382113
Reviewed-by: Brian Norris <briannorris@chromium.org>
drivers/phy/phy-rockchip-typec.c

index 9599cb7ff4cadde2077d219dfb232110766623ef..3f747ff094e80affba30c5c058ddd5e6b40f2b5a 100644 (file)
@@ -998,6 +998,8 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
                }
        }
 
+       pm_runtime_enable(dev);
+
        for_each_available_child_of_node(np, child_np) {
                struct phy *phy;
 
@@ -1028,6 +1030,13 @@ static int rockchip_typec_phy_probe(struct platform_device *pdev)
        return 0;
 }
 
+static int rockchip_typec_phy_remove(struct platform_device *pdev)
+{
+       pm_runtime_disable(&pdev->dev);
+
+       return 0;
+}
+
 static const struct of_device_id rockchip_typec_phy_dt_ids[] = {
        { .compatible = "rockchip,rk3399-typec-phy" },
        {}
@@ -1037,6 +1046,7 @@ MODULE_DEVICE_TABLE(of, rockchip_typec_phy_dt_ids);
 
 static struct platform_driver rockchip_typec_phy_driver = {
        .probe          = rockchip_typec_phy_probe,
+       .remove         = rockchip_typec_phy_remove,
        .driver         = {
                .name   = "rockchip-typec-phy",
                .of_match_table = rockchip_typec_phy_dt_ids,