Re: [PATCH v10 22/69] drm/display: hdmi-state-helper: Sync SCDC state on hotplug

[email protected] Fri, 31 Jul 2026 19:02: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] SCDC sync fails to handle scrambler teardown on disconnect, leavin=
g the source scrambler active when swapping to a non-scrambling sink.
--

--- Patch [22]: [PATCH v10 22/69] drm/display: hdmi-state-helper: Sync SCDC=
 state on hotplug ---
commit 7cc2ce705b4793d8696717d86562fbd6c0bde231
Author: Cristian Ciocaltea <[email protected]>

drm/display: hdmi-state-helper: Sync SCDC state on hotplug

This commit hooks drm_connector_hdmi_sync_scdc() into the connect and
disconnect paths in drm_atomic_helper_connector_hdmi_update() to synchronize
the SCDC status on hotplug events.

> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gp=
u/drm/display/drm_hdmi_state_helper.c
> index 4a93c279c9a76..3377ea9361209 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> @@ -1205,13 +1205,16 @@ drm_atomic_helper_connector_hdmi_update(struct dr=
m_connector *connector,
>  					enum drm_connector_status status)
>  {
>  	const struct drm_edid *drm_edid;
> +	int ret =3D 0;
> =20
>  	if (status =3D=3D connector_status_disconnected) {
> -		// TODO: also handle scramber, HDMI sink disconnected.
> -		drm_connector_hdmi_audio_plugged_notify(connector, false);
> -		drm_edid_connector_update(connector, NULL);
> -		drm_connector_cec_phys_addr_invalidate(connector);
> -		return 0;
> +		ret =3D drm_connector_hdmi_sync_scdc(connector, false, ctx);

[Severity: High]
Does this call successfully tear down the scrambler on disconnect?

Looking at drm_connector_hdmi_sync_scdc() in drm_hdmi_helper.c, it seems
to return immediately if the plugged parameter is false:

int drm_connector_hdmi_sync_scdc(struct drm_connector *connector, bool plug=
ged,
                                 struct drm_modeset_acquire_ctx *ctx)
{
        ...
        if (!connector || !plugged || !ctx)
                return 0;

This would make the disconnect call a no-op, failing to disable the source
scrambler.

Additionally, if a non-scrambling sink is subsequently plugged in, the
connect path will call drm_connector_hdmi_sync_scdc() with plugged set to
true, which also bails out early:

        if (!connector->ddc || !drm_scdc_sink_supports_scrambling(connector=
))
                return 0;

Could this leave the source scrambler incorrectly enabled if a user swaps f=
rom
an HDMI 2.0 monitor to an older HDMI 1.4 monitor, resulting in broken displ=
ay
output due to mismatched hardware state?

> +		if (ret !=3D -EDEADLK) {
> +			drm_connector_hdmi_audio_plugged_notify(connector, false);
> +			drm_edid_connector_update(connector, NULL);
> +			drm_connector_cec_phys_addr_invalidate(connector);
> +		}
> +		return ret;
>  	}

[ ... ]

--=20
Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20260731-dw-hdmi-qp=
[email protected]?part=3D22