Skip to content

Commit b14fec4

Browse files
cristiccvinodkoul
authored andcommitted
phy: rockchip: samsung-hdptx: Extend rk_hdptx_phy_verify_hdmi_config() helper
In order to facilitate introduction of HDMI 2.1 FRL support and to avoid recomputing the link rate after verifying the HDMI configuration given as input, extend rk_hdptx_phy_verify_hdmi_config() by providing an optional output parameter to store the validated configuration. For improved code readability, also rename the existing hdmi input parameter. Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Link: https://patch.msgid.link/20260113-phy-hdptx-frl-v6-10-8d5f97419c0b@collabora.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent ac079c1 commit b14fec4

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,25 +1439,24 @@ static int rk_hdptx_phy_power_off(struct phy *phy)
14391439
}
14401440

14411441
static int rk_hdptx_phy_verify_hdmi_config(struct rk_hdptx_phy *hdptx,
1442-
struct phy_configure_opts_hdmi *hdmi)
1442+
struct phy_configure_opts_hdmi *hdmi_in,
1443+
struct rk_hdptx_hdmi_cfg *hdmi_out)
14431444
{
14441445
int i;
14451446

1446-
if (!hdmi->tmds_char_rate || hdmi->tmds_char_rate > HDMI20_MAX_RATE)
1447+
if (!hdmi_in->tmds_char_rate || hdmi_in->tmds_char_rate > HDMI20_MAX_RATE)
14471448
return -EINVAL;
14481449

14491450
for (i = 0; i < ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg); i++)
1450-
if (hdmi->tmds_char_rate == rk_hdptx_tmds_ropll_cfg[i].rate)
1451+
if (hdmi_in->tmds_char_rate == rk_hdptx_tmds_ropll_cfg[i].rate)
14511452
break;
14521453

14531454
if (i == ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg) &&
1454-
!rk_hdptx_phy_clk_pll_calc(hdmi->tmds_char_rate, NULL))
1455+
!rk_hdptx_phy_clk_pll_calc(hdmi_in->tmds_char_rate, NULL))
14551456
return -EINVAL;
14561457

1457-
if (!hdmi->bpc)
1458-
hdmi->bpc = 8;
1459-
1460-
switch (hdmi->bpc) {
1458+
switch (hdmi_in->bpc) {
1459+
case 0:
14611460
case 8:
14621461
case 10:
14631462
case 12:
@@ -1467,6 +1466,11 @@ static int rk_hdptx_phy_verify_hdmi_config(struct rk_hdptx_phy *hdptx,
14671466
return -EINVAL;
14681467
}
14691468

1469+
if (hdmi_out) {
1470+
hdmi_out->rate = hdmi_in->tmds_char_rate;
1471+
hdmi_out->bpc = hdmi_in->bpc ?: 8;
1472+
}
1473+
14701474
return 0;
14711475
}
14721476

@@ -1732,17 +1736,15 @@ static int rk_hdptx_phy_configure(struct phy *phy, union phy_configure_opts *opt
17321736
int ret;
17331737

17341738
if (mode != PHY_MODE_DP) {
1735-
ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi);
1739+
ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi, &hdptx->hdmi_cfg);
17361740
if (ret) {
17371741
dev_err(hdptx->dev, "invalid hdmi params for phy configure\n");
17381742
} else {
1739-
hdptx->hdmi_cfg.rate = opts->hdmi.tmds_char_rate;
1740-
hdptx->hdmi_cfg.bpc = opts->hdmi.bpc;
17411743
hdptx->restrict_rate_change = true;
1744+
dev_dbg(hdptx->dev, "%s rate=%llu bpc=%u\n", __func__,
1745+
hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc);
17421746
}
17431747

1744-
dev_dbg(hdptx->dev, "%s rate=%llu bpc=%u\n", __func__,
1745-
hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc);
17461748
return ret;
17471749
}
17481750

@@ -1786,7 +1788,7 @@ static int rk_hdptx_phy_validate(struct phy *phy, enum phy_mode mode,
17861788
struct rk_hdptx_phy *hdptx = phy_get_drvdata(phy);
17871789

17881790
if (mode != PHY_MODE_DP)
1789-
return rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi);
1791+
return rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi, NULL);
17901792

17911793
return rk_hdptx_phy_verify_dp_config(hdptx, &opts->dp);
17921794
}
@@ -1926,12 +1928,11 @@ static int rk_hdptx_phy_clk_determine_rate(struct clk_hw *hw,
19261928
struct phy_configure_opts_hdmi hdmi = {
19271929
.tmds_char_rate = req->rate,
19281930
};
1929-
int ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &hdmi);
1931+
1932+
int ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &hdmi, &hdptx->hdmi_cfg);
19301933

19311934
if (ret)
19321935
return ret;
1933-
1934-
hdptx->hdmi_cfg.rate = req->rate;
19351936
}
19361937

19371938
/*

0 commit comments

Comments
 (0)