Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Cristian Ciocaltea and committed by
Vinod Koul
b14fec4d ac079c12

+18 -17
+18 -17
drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
··· 1439 1439 } 1440 1440 1441 1441 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) 1443 1444 { 1444 1445 int i; 1445 1446 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) 1447 1448 return -EINVAL; 1448 1449 1449 1450 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) 1451 1452 break; 1452 1453 1453 1454 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)) 1455 1456 return -EINVAL; 1456 1457 1457 - if (!hdmi->bpc) 1458 - hdmi->bpc = 8; 1459 - 1460 - switch (hdmi->bpc) { 1458 + switch (hdmi_in->bpc) { 1459 + case 0: 1461 1460 case 8: 1462 1461 case 10: 1463 1462 case 12: ··· 1464 1465 break; 1465 1466 default: 1466 1467 return -EINVAL; 1468 + } 1469 + 1470 + if (hdmi_out) { 1471 + hdmi_out->rate = hdmi_in->tmds_char_rate; 1472 + hdmi_out->bpc = hdmi_in->bpc ?: 8; 1467 1473 } 1468 1474 1469 1475 return 0; ··· 1736 1732 int ret; 1737 1733 1738 1734 if (mode != PHY_MODE_DP) { 1739 - ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi); 1735 + ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi, &hdptx->hdmi_cfg); 1740 1736 if (ret) { 1741 1737 dev_err(hdptx->dev, "invalid hdmi params for phy configure\n"); 1742 1738 } else { 1743 - hdptx->hdmi_cfg.rate = opts->hdmi.tmds_char_rate; 1744 - hdptx->hdmi_cfg.bpc = opts->hdmi.bpc; 1745 1739 hdptx->restrict_rate_change = true; 1740 + dev_dbg(hdptx->dev, "%s rate=%llu bpc=%u\n", __func__, 1741 + hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc); 1746 1742 } 1747 1743 1748 - dev_dbg(hdptx->dev, "%s rate=%llu bpc=%u\n", __func__, 1749 - hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc); 1750 1744 return ret; 1751 1745 } 1752 1746 ··· 1788 1786 struct rk_hdptx_phy *hdptx = phy_get_drvdata(phy); 1789 1787 1790 1788 if (mode != PHY_MODE_DP) 1791 - return rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi); 1789 + return rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi, NULL); 1792 1790 1793 1791 return rk_hdptx_phy_verify_dp_config(hdptx, &opts->dp); 1794 1792 } ··· 1928 1926 struct phy_configure_opts_hdmi hdmi = { 1929 1927 .tmds_char_rate = req->rate, 1930 1928 }; 1931 - int ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &hdmi); 1929 + 1930 + int ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &hdmi, &hdptx->hdmi_cfg); 1932 1931 1933 1932 if (ret) 1934 1933 return ret; 1935 - 1936 - hdptx->hdmi_cfg.rate = req->rate; 1937 1934 } 1938 1935 1939 1936 /*