diff --git a/drivers/phy/rockchip/phy-rockchip-inno-video-phy.c b/drivers/phy/rockchip/phy-rockchip-inno-video-phy.c index 65b152535870..0d8269aef562 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-video-phy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-video-phy.c @@ -80,34 +80,20 @@ static const struct reg_sequence lvds_mode_dual_channel[] = { { 0x0180, 0x44 }, }; -static int inno_video_phy_power_on(struct phy *phy) +static int inno_video_phy_lvds_mode_enable(struct inno_video_phy *inno, + bool dual_channel) { - struct inno_video_phy *inno = phy_get_drvdata(phy); const struct reg_sequence *wseq; - bool dual_channel = phy_get_bus_width(phy) == 2 ? true : false; int nregs; u32 status; int ret; - clk_prepare_enable(inno->pclk); - pm_runtime_get_sync(inno->dev); - - switch (inno->mode) { - case PHY_MODE_VIDEO_LVDS: - if (dual_channel) { - wseq = lvds_mode_dual_channel; - nregs = ARRAY_SIZE(lvds_mode_dual_channel); - } else { - wseq = lvds_mode_single_channel; - nregs = ARRAY_SIZE(lvds_mode_single_channel); - } - break; - case PHY_MODE_VIDEO_TTL: - wseq = ttl_mode; - nregs = ARRAY_SIZE(ttl_mode); - break; - default: - return -EINVAL; + if (dual_channel) { + wseq = lvds_mode_dual_channel; + nregs = ARRAY_SIZE(lvds_mode_dual_channel); + } else { + wseq = lvds_mode_single_channel; + nregs = ARRAY_SIZE(lvds_mode_single_channel); } regmap_multi_reg_write(inno->regmap, wseq, nregs); @@ -125,6 +111,28 @@ static int inno_video_phy_power_on(struct phy *phy) return 0; } +static int inno_video_phy_power_on(struct phy *phy) +{ + struct inno_video_phy *inno = phy_get_drvdata(phy); + + clk_prepare_enable(inno->pclk); + pm_runtime_get_sync(inno->dev); + + switch (inno->mode) { + case PHY_MODE_VIDEO_LVDS: + return inno_video_phy_lvds_mode_enable(inno, + phy_get_bus_width(phy) == 2 ? true : false); + case PHY_MODE_VIDEO_TTL: + regmap_multi_reg_write(inno->regmap, ttl_mode, + ARRAY_SIZE(ttl_mode)); + break; + default: + return -EINVAL; + } + + return 0; +} + static int inno_video_phy_power_off(struct phy *phy) { struct inno_video_phy *inno = phy_get_drvdata(phy);