mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
drm/display: hdmi-state-helper: Pass acquire ctx to hotplug helpers
In preparation for supporting SCDC status synchronization on hotplug events, extend drm_atomic_helper_connector_hdmi_hotplug() and drm_atomic_helper_connector_hdmi_update() to take a struct drm_modeset_acquire_ctx argument. This will be used when a CRTC reset is required. Additionally, change their return type from void to int to allow propagation of errors such as -EDEADLK caused by lock contention. Update existing callers accordingly. Note that in the VC4 case, the return code is ignored, as it cannot fail: being in the .detect_ctx() call path, the connection mutex is already held through ctx, and it bails out early because the driver relies on a local SCDC state-management implementation, and therefore does not yet expose the scrambler capability through the common helpers. Tested-by: Diederik de Haas <diederik@cknow-tech.com> # NanoPC-T6 LTS, Rock 5B Reviewed-by: Maxime Ripard <mripard@kernel.org> Tested-by: Igor Paunovic <royalnet026@gmail.com> # RK3588 Orange Pi 5 Plus, dual HDMI Tested-by: Robin Räber <robin.raebi@gmail.com> Link: https://patch.msgid.link/20260901-dw-hdmi-qp-scramb-v11-21-bc12954a0688@collabora.com Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
This commit is contained in:
parent
0f7bb8f4d2
commit
43c92f4c88
|
|
@ -300,12 +300,16 @@ static int drm_bridge_connector_detect_ctx(struct drm_connector *connector,
|
|||
struct drm_bridge *detect = bridge_connector->bridge_detect;
|
||||
struct drm_bridge *hdmi = bridge_connector->bridge_hdmi;
|
||||
enum drm_connector_status status;
|
||||
int ret;
|
||||
|
||||
if (detect) {
|
||||
status = detect->funcs->detect(detect, connector);
|
||||
|
||||
if (hdmi)
|
||||
drm_atomic_helper_connector_hdmi_hotplug(connector, status);
|
||||
if (hdmi) {
|
||||
ret = drm_atomic_helper_connector_hdmi_hotplug(connector, ctx, status);
|
||||
if (ret == -EDEADLK)
|
||||
return ret;
|
||||
}
|
||||
|
||||
drm_bridge_connector_hpd_notify(connector, status);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1356,8 +1356,9 @@ drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector *con
|
|||
}
|
||||
EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_clear_audio_infoframe);
|
||||
|
||||
static void
|
||||
static int
|
||||
drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector,
|
||||
struct drm_modeset_acquire_ctx *ctx,
|
||||
enum drm_connector_status status)
|
||||
{
|
||||
const struct drm_edid *drm_edid;
|
||||
|
|
@ -1367,7 +1368,7 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector,
|
|||
drm_connector_hdmi_audio_plugged_notify(connector, false);
|
||||
drm_edid_connector_update(connector, NULL);
|
||||
drm_connector_cec_phys_addr_invalidate(connector);
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (connector->hdmi.funcs->read_edid)
|
||||
|
|
@ -1384,20 +1385,28 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector,
|
|||
drm_connector_hdmi_audio_plugged_notify(connector, true);
|
||||
drm_connector_cec_phys_addr_set(connector);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_atomic_helper_connector_hdmi_hotplug - Handle the hotplug event for the HDMI connector
|
||||
* @connector: A pointer to the HDMI connector
|
||||
* @ctx: Lock acquisition context to be used for resetting CRTC
|
||||
* @status: Connection status
|
||||
*
|
||||
* This function should be called as a part of the .detect() / .detect_ctx()
|
||||
* callbacks for all status changes.
|
||||
*
|
||||
* Returns:
|
||||
* Zero on success, error code on failure.
|
||||
* If @ctx is set, it might also return -EDEADLK.
|
||||
*/
|
||||
void drm_atomic_helper_connector_hdmi_hotplug(struct drm_connector *connector,
|
||||
enum drm_connector_status status)
|
||||
int drm_atomic_helper_connector_hdmi_hotplug(struct drm_connector *connector,
|
||||
struct drm_modeset_acquire_ctx *ctx,
|
||||
enum drm_connector_status status)
|
||||
{
|
||||
drm_atomic_helper_connector_hdmi_update(connector, status);
|
||||
return drm_atomic_helper_connector_hdmi_update(connector, ctx, status);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_hotplug);
|
||||
|
||||
|
|
@ -1412,6 +1421,6 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_hotplug);
|
|||
*/
|
||||
void drm_atomic_helper_connector_hdmi_force(struct drm_connector *connector)
|
||||
{
|
||||
drm_atomic_helper_connector_hdmi_update(connector, connector->status);
|
||||
drm_atomic_helper_connector_hdmi_update(connector, NULL, connector->status);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_force);
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
|
|||
* the lock for now.
|
||||
*/
|
||||
|
||||
drm_atomic_helper_connector_hdmi_hotplug(connector, status);
|
||||
drm_atomic_helper_connector_hdmi_hotplug(connector, ctx, status);
|
||||
|
||||
if (status != connector_status_connected)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ struct drm_atomic_commit;
|
|||
struct drm_connector;
|
||||
struct drm_connector_state;
|
||||
struct drm_display_mode;
|
||||
struct drm_modeset_acquire_ctx;
|
||||
struct hdmi_audio_infoframe;
|
||||
|
||||
enum drm_connector_status;
|
||||
|
|
@ -23,8 +24,9 @@ int drm_atomic_helper_connector_hdmi_update_audio_infoframe(struct drm_connector
|
|||
int drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector *connector);
|
||||
int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *connector,
|
||||
struct drm_atomic_commit *state);
|
||||
void drm_atomic_helper_connector_hdmi_hotplug(struct drm_connector *connector,
|
||||
enum drm_connector_status status);
|
||||
int drm_atomic_helper_connector_hdmi_hotplug(struct drm_connector *connector,
|
||||
struct drm_modeset_acquire_ctx *ctx,
|
||||
enum drm_connector_status status);
|
||||
void drm_atomic_helper_connector_hdmi_force(struct drm_connector *connector);
|
||||
|
||||
enum drm_mode_status
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user