When dw-hdmi is chained to an active protocol-converting downstream bridge (such as HDMI-to-LVDS or HDMI-to-eDP, e.g. Rockchip RK628 or Lontium LT9721), the terminal DRM connector represents the downstream panel/interface rather than an HDMI/DVI sink. Its display_info therefore never contains an HDMI VSDB, leaving connector->display_info.is_hdmi false even though the link between dw-hdmi and the downstream bridge is HDMI.
HDMI receivers such as Rockchip RK628 require HDMI TMDS framing (preambles and guard bands) to lock symbol alignment and color depth, and cannot lock to raw DVI mode. Enable HDMI framing when the terminal connector is not an HDMI or DVI connector, while keeping rgb_limited_range restricted to HDMI/DVI connectors with hdmi->sink_is_hdmi so downstream panel/bridge pipelines continue to receive full-range RGB (and HDMI TVs preserve limited-range RGB across transient RXSENSE power cycles). External HDMI/DVI connectors and passive redrivers in front of them continue to derive HDMI vs. DVI mode from connector->display_info.is_hdmi. Signed-off-by: Gianfranco Mariotti <[email protected]> --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 29 +++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index e24fd67264ce1..dc1fe449d98e8 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -2251,6 +2251,20 @@ static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi) HDMI_IH_MUTE_FC_STAT2); } +static bool dw_hdmi_connector_is_hdmi_or_dvi(const struct drm_connector *connector) +{ + switch (connector->connector_type) { + case DRM_MODE_CONNECTOR_HDMIA: + case DRM_MODE_CONNECTOR_HDMIB: + case DRM_MODE_CONNECTOR_DVII: + case DRM_MODE_CONNECTOR_DVID: + case DRM_MODE_CONNECTOR_DVIA: + return true; + default: + return false; + } +} + static int dw_hdmi_setup(struct dw_hdmi *hdmi, const struct drm_connector *connector, const struct drm_display_mode *mode) @@ -2291,7 +2305,9 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, if (hdmi->hdmi_data.enc_out_bus_format == MEDIA_BUS_FMT_FIXED) hdmi->hdmi_data.enc_out_bus_format = MEDIA_BUS_FMT_RGB888_1X24; - hdmi->hdmi_data.rgb_limited_range = hdmi->sink_is_hdmi && + hdmi->hdmi_data.rgb_limited_range = + dw_hdmi_connector_is_hdmi_or_dvi(connector) && + hdmi->sink_is_hdmi && drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED; @@ -2998,7 +3014,16 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, mutex_lock(&hdmi->mutex); hdmi->disabled = false; hdmi->curr_conn = connector; - hdmi->sink_is_hdmi = connector->display_info.is_hdmi; + /* + * When the pipeline terminates in a non-HDMI/DVI connector (e.g. LVDS, + * eDP, DisplayPort, or DSI behind a protocol-converting bridge), the + * terminal connector has no HDMI VSDB in display_info, yet the + * intermediate link out of dw-hdmi to the downstream bridge is HDMI. + */ + if (dw_hdmi_connector_is_hdmi_or_dvi(connector)) + hdmi->sink_is_hdmi = connector->display_info.is_hdmi; + else + hdmi->sink_is_hdmi = true; hdmi->sink_has_audio = connector->display_info.has_audio; dw_hdmi_update_power(hdmi); dw_hdmi_update_phy_mask(hdmi); -- 2.25.1
