Skip to content

Commit 10ba847

Browse files
cristiccvinodkoul
authored andcommitted
phy: phy-rockchip-samsung-hdptx: Enable runtime PM at PHY core level
When a new PHY is created via [devm_]phy_create(), the runtime PM for it is not enabled unless the parent device (which creates the PHY) has its own runtime PM already enabled. Move the call to devm_pm_runtime_enable() before devm_phy_create() to enable runtime PM at PHY core level. With this change the ->power_on() and ->power_off() callbacks do not require explicit runtime PM management anymore, since the PHY core handles that via phy_pm_runtime_{get,put}_sync() when phy_power_on() and phy_power_off() are invoked. Hence drop the now unnecessary calls to pm_runtime_resume_and_get() and pm_runtime_put() helpers. Reviewed-by: Heiko Stuebner <[email protected]> Signed-off-by: Cristian Ciocaltea <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 1b369ff commit 10ba847

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx,
860860
static int rk_hdptx_phy_power_on(struct phy *phy)
861861
{
862862
struct rk_hdptx_phy *hdptx = phy_get_drvdata(phy);
863-
int ret, bus_width = phy_get_bus_width(hdptx->phy);
863+
int bus_width = phy_get_bus_width(hdptx->phy);
864864
/*
865865
* FIXME: Temporary workaround to pass pixel_clk_rate
866866
* from the HDMI bridge driver until phy_configure_opts_hdmi
@@ -871,17 +871,7 @@ static int rk_hdptx_phy_power_on(struct phy *phy)
871871
dev_dbg(hdptx->dev, "%s bus_width=%x rate=%u\n",
872872
__func__, bus_width, rate);
873873

874-
ret = pm_runtime_resume_and_get(hdptx->dev);
875-
if (ret) {
876-
dev_err(hdptx->dev, "Failed to resume phy: %d\n", ret);
877-
return ret;
878-
}
879-
880-
ret = rk_hdptx_ropll_tmds_mode_config(hdptx, rate);
881-
if (ret)
882-
pm_runtime_put(hdptx->dev);
883-
884-
return ret;
874+
return rk_hdptx_ropll_tmds_mode_config(hdptx, rate);
885875
}
886876

887877
static int rk_hdptx_phy_power_off(struct phy *phy)
@@ -894,8 +884,6 @@ static int rk_hdptx_phy_power_off(struct phy *phy)
894884
if (ret == 0 && (val & HDPTX_O_PLL_LOCK_DONE))
895885
rk_hdptx_phy_disable(hdptx);
896886

897-
pm_runtime_put(hdptx->dev);
898-
899887
return ret;
900888
}
901889

@@ -977,6 +965,10 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev)
977965
return dev_err_probe(dev, PTR_ERR(hdptx->grf),
978966
"Could not get GRF syscon\n");
979967

968+
ret = devm_pm_runtime_enable(dev);
969+
if (ret)
970+
return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
971+
980972
hdptx->phy = devm_phy_create(dev, NULL, &rk_hdptx_phy_ops);
981973
if (IS_ERR(hdptx->phy))
982974
return dev_err_probe(dev, PTR_ERR(hdptx->phy),
@@ -986,10 +978,6 @@ static int rk_hdptx_phy_probe(struct platform_device *pdev)
986978
phy_set_drvdata(hdptx->phy, hdptx);
987979
phy_set_bus_width(hdptx->phy, 8);
988980

989-
ret = devm_pm_runtime_enable(dev);
990-
if (ret)
991-
return dev_err_probe(dev, ret, "Failed to enable runtime PM\n");
992-
993981
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
994982
if (IS_ERR(phy_provider))
995983
return dev_err_probe(dev, PTR_ERR(phy_provider),

0 commit comments

Comments
 (0)