[v9,11/61] drm/bridge: Add bridge ops for source-side HDMI 2.0 scrambling

Message ID 20260723-dw-hdmi-qp-scramb-v9-11-4fb12ea22ac9@collabora.com (mailing list archive)
State New
Headers
Series Add HDMI 2.0 support to DW HDMI QP TX |

Commit Message

Cristian Ciocaltea July 23, 2026, 1:35 a.m. UTC
Bridges advertising HDMI 2.0 must be able to enable and disable
source-side scrambling and the high TMDS clock ratio when the configured
mode exceeds 340 MHz.

Add .hdmi_scrambler_{enable|disable}() callbacks covering the
source-side programming only; sink-side SCDC negotiation remains the job
of the HDMI connector helpers.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
 include/drm/drm_bridge.h | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
  

Comments

sashiko-bot@kernel.org July 23, 2026, 1:47 a.m. UTC | #1
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing implementation of HDMI 2.0 scrambler callbacks in drm_bridge_connector causes initialization failure
--

--- Patch [11]: [PATCH v9 11/61] drm/bridge: Add bridge ops for source-side HDMI 2.0 scrambling ---
commit 449aac531f177fb10d98b7aac7653c2b23b627e6
Author: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>

drm/bridge: Add bridge ops for source-side HDMI 2.0 scrambling

This commit adds hdmi_scrambler_enable and hdmi_scrambler_disable callbacks
to drm_bridge_funcs. This enables bridges advertising HDMI 2.0 to configure
source-side scrambling for modes exceeding 340 MHz.

> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index 727eeb94119a5..348ddbe41dec5 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -561,6 +561,41 @@ struct drm_bridge_funcs {
>  				     const struct drm_display_mode *mode,
>  				     unsigned long long tmds_rate);
>  
> +	/**
> +	 * @hdmi_scrambler_enable:
> +	 *
> +	 * Enable source-side scrambling and the high TMDS clock ratio for the
> +	 * mode currently being applied.
> +	 *
> +	 * This only programs the source side. Sink-side SCDC configuration is
> +	 * handled by the HDMI connector helpers.
> +	 *
> +	 * Mandatory for bridges that set the DRM_BRIDGE_OP_HDMI flag in their
> +	 * &drm_bridge->ops and advertise HDMI_VERSION_2_0 or later via
> +	 * &drm_bridge->supported_hdmi_ver; unused otherwise.
> +	 *
> +	 * Returns:
> +	 * 0 on success, a negative error code otherwise.
> +	 */
> +	int (*hdmi_scrambler_enable)(struct drm_bridge *bridge);
> +
> +	/**
> +	 * @hdmi_scrambler_disable:

[Severity: High]
Will bridge drivers adopting these new callbacks fail to probe?

Looking at drm_bridge_connector_init(), the wrapper fails to map these
newly added bridge callbacks to the connector's hdmi_funcs before calling 
drmm_connector_hdmi_init():

	ret = drmm_connector_hdmi_init(drm, connector,
				       &drm_bridge_connector_funcs,
				       &bridge_connector->hdmi_funcs,
				       connector_type, ddc);

Because these new bridge ops are not mapped over to 
bridge_connector->hdmi_funcs, the core DRM HDMI initialization in 
drmm_connector_hdmi_init() will see them as missing and unconditionally 
fail with -EINVAL for HDMI 2.0+ devices:

	if (hdmi_funcs->supported_hdmi_ver >= HDMI_VERSION_2_0) {
		if (!hdmi_funcs->scrambler_enable || !hdmi_funcs->scrambler_disable) {
			drm_err(dev, "Scrambler callbacks missing for HDMI 2.x\n");
			return -EINVAL;
		}
	}

Should drm_bridge_connector_init() be updated to populate .scrambler_enable 
and .scrambler_disable from these new bridge ops to prevent initialization 
failures?

> +	 *
> +	 * Disable source-side scrambling and the high TMDS clock ratio.
> +	 *
> +	 * This only programs the source side. Sink-side SCDC configuration is
> +	 * handled by the HDMI connector helpers.
> +	 *
> +	 * Mandatory for bridges that set the DRM_BRIDGE_OP_HDMI flag in their
> +	 * &drm_bridge->ops and advertise HDMI_VERSION_2_0 or later via
> +	 * &drm_bridge->supported_hdmi_ver; unused otherwise.
> +	 *
> +	 * Returns:
> +	 * 0 on success, a negative error code otherwise.
> +	 */
> +	int (*hdmi_scrambler_disable)(struct drm_bridge *bridge);
> +
>  	/**
>  	 * @hdmi_clear_avi_infoframe:
>  	 *
  

Patch

diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
index 727eeb94119a..348ddbe41dec 100644
--- a/include/drm/drm_bridge.h
+++ b/include/drm/drm_bridge.h
@@ -561,6 +561,41 @@  struct drm_bridge_funcs {
 				     const struct drm_display_mode *mode,
 				     unsigned long long tmds_rate);
 
+	/**
+	 * @hdmi_scrambler_enable:
+	 *
+	 * Enable source-side scrambling and the high TMDS clock ratio for the
+	 * mode currently being applied.
+	 *
+	 * This only programs the source side. Sink-side SCDC configuration is
+	 * handled by the HDMI connector helpers.
+	 *
+	 * Mandatory for bridges that set the DRM_BRIDGE_OP_HDMI flag in their
+	 * &drm_bridge->ops and advertise HDMI_VERSION_2_0 or later via
+	 * &drm_bridge->supported_hdmi_ver; unused otherwise.
+	 *
+	 * Returns:
+	 * 0 on success, a negative error code otherwise.
+	 */
+	int (*hdmi_scrambler_enable)(struct drm_bridge *bridge);
+
+	/**
+	 * @hdmi_scrambler_disable:
+	 *
+	 * Disable source-side scrambling and the high TMDS clock ratio.
+	 *
+	 * This only programs the source side. Sink-side SCDC configuration is
+	 * handled by the HDMI connector helpers.
+	 *
+	 * Mandatory for bridges that set the DRM_BRIDGE_OP_HDMI flag in their
+	 * &drm_bridge->ops and advertise HDMI_VERSION_2_0 or later via
+	 * &drm_bridge->supported_hdmi_ver; unused otherwise.
+	 *
+	 * Returns:
+	 * 0 on success, a negative error code otherwise.
+	 */
+	int (*hdmi_scrambler_disable)(struct drm_bridge *bridge);
+
 	/**
 	 * @hdmi_clear_avi_infoframe:
 	 *