From: Chris Zhong Date: Wed, 7 Sep 2016 18:17:25 +0000 (-0700) Subject: UPSTREAM: phy: rockchip-typec: add pm runtime support X-Git-Tag: firefly_0821_release~1301 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c0fb43a77ecc78dbf3f9057db1c0ed0e1fb44beb;p=firefly-linux-kernel-4.4.55.git UPSTREAM: phy: rockchip-typec: add pm runtime support 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 Signed-off-by: Kishon Vijay Abraham I (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 --- diff --git a/drivers/phy/phy-rockchip-typec.c b/drivers/phy/phy-rockchip-typec.c index 9599cb7ff4ca..3f747ff094e8 100644 --- a/drivers/phy/phy-rockchip-typec.c +++ b/drivers/phy/phy-rockchip-typec.c @@ -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,