mirror of
https://github.com/LibreELEC/LibreELEC.tv
synced 2025-09-24 19:46:01 +07:00
117 lines
3.8 KiB
Diff
117 lines
3.8 KiB
Diff
From 4f220bddc64a5c8688d0a0d3cd89e45794cd82c2 Mon Sep 17 00:00:00 2001
|
|
From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
|
|
Date: Tue, 8 Jul 2025 12:19:37 +0300
|
|
Subject: [PATCH 092/113] FROMLIST(v4): 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>
|
|
---
|
|
.../phy/rockchip/phy-rockchip-samsung-hdptx.c | 35 ++++++++++---------
|
|
1 file changed, 18 insertions(+), 17 deletions(-)
|
|
|
|
diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
|
|
index a44614bc73e9..58eac67cc3b2 100644
|
|
--- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
|
|
+++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c
|
|
@@ -1472,25 +1472,24 @@ static int rk_hdptx_phy_power_off(struct phy *phy)
|
|
}
|
|
|
|
static int rk_hdptx_phy_verify_hdmi_config(struct rk_hdptx_phy *hdptx,
|
|
- struct phy_configure_opts_hdmi *hdmi)
|
|
+ struct phy_configure_opts_hdmi *hdmi_in,
|
|
+ struct rk_hdptx_hdmi_cfg *hdmi_out)
|
|
{
|
|
int i;
|
|
|
|
- if (!hdmi->tmds_char_rate || hdmi->tmds_char_rate > HDMI20_MAX_RATE)
|
|
+ if (!hdmi_in->tmds_char_rate || hdmi_in->tmds_char_rate > HDMI20_MAX_RATE)
|
|
return -EINVAL;
|
|
|
|
for (i = 0; i < ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg); i++)
|
|
- if (hdmi->tmds_char_rate == rk_hdptx_tmds_ropll_cfg[i].rate)
|
|
+ if (hdmi_in->tmds_char_rate == rk_hdptx_tmds_ropll_cfg[i].rate)
|
|
break;
|
|
|
|
if (i == ARRAY_SIZE(rk_hdptx_tmds_ropll_cfg) &&
|
|
- !rk_hdptx_phy_clk_pll_calc(hdmi->tmds_char_rate, NULL))
|
|
+ !rk_hdptx_phy_clk_pll_calc(hdmi_in->tmds_char_rate, NULL))
|
|
return -EINVAL;
|
|
|
|
- if (!hdmi->bpc)
|
|
- hdmi->bpc = 8;
|
|
-
|
|
- switch (hdmi->bpc) {
|
|
+ switch (hdmi_in->bpc) {
|
|
+ case 0:
|
|
case 8:
|
|
case 10:
|
|
case 12:
|
|
@@ -1500,6 +1499,11 @@ static int rk_hdptx_phy_verify_hdmi_config(struct rk_hdptx_phy *hdptx,
|
|
return -EINVAL;
|
|
}
|
|
|
|
+ if (hdmi_out) {
|
|
+ hdmi_out->rate = hdmi_in->tmds_char_rate;
|
|
+ hdmi_out->bpc = hdmi_in->bpc ?: 8;
|
|
+ }
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -1765,17 +1769,15 @@ static int rk_hdptx_phy_configure(struct phy *phy, union phy_configure_opts *opt
|
|
int ret;
|
|
|
|
if (mode != PHY_MODE_DP) {
|
|
- ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi);
|
|
+ ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi, &hdptx->hdmi_cfg);
|
|
if (ret) {
|
|
dev_err(hdptx->dev, "invalid hdmi params for phy configure\n");
|
|
} else {
|
|
- hdptx->hdmi_cfg.rate = opts->hdmi.tmds_char_rate;
|
|
- hdptx->hdmi_cfg.bpc = opts->hdmi.bpc;
|
|
hdptx->restrict_rate_change = true;
|
|
+ dev_dbg(hdptx->dev, "%s rate=%llu bpc=%u\n", __func__,
|
|
+ hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc);
|
|
}
|
|
|
|
- dev_dbg(hdptx->dev, "%s rate=%llu bpc=%u\n", __func__,
|
|
- hdptx->hdmi_cfg.rate, hdptx->hdmi_cfg.bpc);
|
|
return ret;
|
|
}
|
|
|
|
@@ -1819,7 +1821,7 @@ static int rk_hdptx_phy_validate(struct phy *phy, enum phy_mode mode,
|
|
struct rk_hdptx_phy *hdptx = phy_get_drvdata(phy);
|
|
|
|
if (mode != PHY_MODE_DP)
|
|
- return rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi);
|
|
+ return rk_hdptx_phy_verify_hdmi_config(hdptx, &opts->hdmi, NULL);
|
|
|
|
return rk_hdptx_phy_verify_dp_config(hdptx, &opts->dp);
|
|
}
|
|
@@ -1959,12 +1961,11 @@ static long rk_hdptx_phy_clk_round_rate(struct clk_hw *hw, unsigned long rate,
|
|
struct phy_configure_opts_hdmi hdmi = {
|
|
.tmds_char_rate = rate,
|
|
};
|
|
- int ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &hdmi);
|
|
+
|
|
+ int ret = rk_hdptx_phy_verify_hdmi_config(hdptx, &hdmi, &hdptx->hdmi_cfg);
|
|
|
|
if (ret)
|
|
return ret;
|
|
-
|
|
- hdptx->hdmi_cfg.rate = rate;
|
|
}
|
|
|
|
/*
|
|
--
|
|
2.34.1
|
|
|