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

[email protected] Thu, 23 Jul 2026 01:47:58 +0000
Newsgroups dev.linux.lists.linux-sunxi,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
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 <[email protected]>

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:
>  	 *

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=11