drm/bridge: synopsys: dw-hdmi: Add support for cts-manual

The current driver use HDMI hardware's auto CTS mode. We found
that at high sample rates, the auto-calculated CTS value is incorrect,
leading to silent outputs on devices that rely on n/cts to recover
the sample rate, such as TV.

Auto CTS mode was introduced in commit fdbdcc83ff ("drm/bridge: dw-hdmi:
Use automatic CTS generation mode when using non-AHB audio") to handle
cases where audio clock and TMDS clock are not sourced from the same PLL.
However, on RK platforms where both clocks are derived from the same PLL.

This patch adds a "cts-manual" property to allow manual CTS configuration
when clocks are co-sourced.

Fixes: fdbdcc83ff ("drm/bridge: dw-hdmi: Use automatic CTS generation mode when using non-AHB audio")

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I2f52499150d3e37652e21c0b863447e1a6ac5831
This commit is contained in:
Sugar Zhang
2025-02-18 16:14:33 +08:00
committed by Tao Huang
parent 4bdb54ffcb
commit 24edb38f8f

View File

@@ -335,6 +335,7 @@ struct dw_hdmi {
bool logo_plug_out; /* hdmi is plug out when kernel logo */
bool update;
bool hdr2sdr; /* from hdr to sdr */
bool cts_manual;
};
#define HDMI_IH_PHY_STAT0_RX_SENSE \
@@ -1068,7 +1069,7 @@ static void hdmi_set_clk_regenerator(struct dw_hdmi *hdmi,
config3 = hdmi_readb(hdmi, HDMI_CONFIG3_ID);
/* Compute CTS when using internal AHB audio or General Parallel audio*/
if ((config3 & HDMI_CONFIG3_AHBAUDDMA) || (config3 & HDMI_CONFIG3_GPAUD)) {
if ((config3 & HDMI_CONFIG3_AHBAUDDMA) || (config3 & HDMI_CONFIG3_GPAUD) || hdmi->cts_manual) {
/*
* Compute the CTS value from the N value. Note that CTS and N
* can be up to 20 bits in total, so we need 64-bit math. Also
@@ -5207,6 +5208,8 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
config0 = hdmi_readb(hdmi, HDMI_CONFIG0_ID);
config3 = hdmi_readb(hdmi, HDMI_CONFIG3_ID);
hdmi->cts_manual = of_property_read_bool(np, "rockchip,cts-manual");
if (iores && config3 & HDMI_CONFIG3_AHBAUDDMA) {
struct dw_hdmi_audio_data audio;