[PATCH v8 31/39] drm/vc4: hdmi: Convert to common SCDC scrambling infrastructure
Cristian Ciocaltea
cristian.ciocaltea at collabora.com
Wed Jul 8 05:53:37 PDT 2026
On 7/7/26 6:36 PM, Maxime Ripard wrote:
> Hi,
>
> On Thu, Jul 02, 2026 at 05:46:44PM +0300, Cristian Ciocaltea wrote:
>> @@ -416,10 +281,11 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,
>> status = connector_status_connected;
>> }
>>
>> - vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status);
>> + ret = drm_atomic_helper_connector_hdmi_hotplug(connector, status, ctx);
>> +
>> pm_runtime_put(&vc4_hdmi->pdev->dev);
>>
>> - return status;
>> + return ret == -EDEADLK ? ret : status;
>> }
>
> This looks like a change that should have its own patch and explanation.
Yeah, I think .detect_ctx is supposed to return -EDEADLK to allow context
owners, e.g. drm_helper_probe_detect_ctx(), to do the backoff and retry.
vc4_hdmi_handle_hotplug() instead runs its own retry loop, calling
drm_modeset_backoff() on the acquire context not owned by the driver, which
drops every lock in the context, including connection_mutex owned by the core.
This is now implicitly fixed by this patch, but you're right that we should
handle this separately, before doing the conversion, i.e. drop the local retry
logic and propagate -EDEADLK to the top level.
>> @@ -778,32 +658,14 @@ static int vc4_hdmi_write_spd_infoframe(struct drm_connector *connector,
>> buffer, len);
>> }
>>
>> -#define SCRAMBLING_POLLING_DELAY_MS 1000
>> -
>> -static void vc4_hdmi_enable_scrambling(struct drm_encoder *encoder)
>> +static int vc4_hdmi_scrambler_enable(struct drm_connector *connector)
>> {
>> - struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
>> - struct drm_connector *connector = &vc4_hdmi->connector;
>> - struct drm_device *drm = connector->dev;
>
> If you don't remove this line....
>
>> - const struct drm_display_mode *mode = &vc4_hdmi->saved_adjusted_mode;
>> + struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector);
>> unsigned long flags;
>> int idx;
>>
>> - lockdep_assert_held(&vc4_hdmi->mutex);
>> -
>> - if (!vc4_hdmi_supports_scrambling(vc4_hdmi))
>> - return;
>> -
>> - if (!drm_hdmi_mode_needs_scrambling(mode,
>> - vc4_hdmi->output_bpc,
>> - vc4_hdmi->output_format))
>> - return;
>> -
>> - if (!drm_dev_enter(drm, &idx))
>
> Then you don't need to change this one either
Ack.
Cristian
More information about the Linux-rockchip
mailing list