From b84c5d0c819a3b544738cf00a79cc496917bb767 Mon Sep 17 00:00:00 2001 From: Algea Cao Date: Tue, 4 Mar 2025 09:30:54 +0800 Subject: [PATCH] drm/bridge: synopsys: dw-hdmi-qp: Only set extcon status when hdmi plug/unplug If an extcon event is reported when hdmi is enabled/disabled while playing hdr videos, Some player app will self-destruct and restart after receiving the event. This leads to an endless loop of switching hdmi enable and disable. The extcon event is normally sent when hdmi plug. Previously, the extcon event reporting was placed in hdmi enable/disable to resolve issues related to audio transparent transmission. The current code has hdmi_codec_plugged_cb has solved the audio transmission problem, so extcon event is changed back to be called only when hdmi plug/unplug Change-Id: I613a0c99a0d33e133280cc6ba3d74760532c7f2f Signed-off-by: Algea Cao --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c index 821e671cd49a..a2533e8c33d7 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c @@ -2619,11 +2619,15 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) hdmi->force = DRM_FORCE_UNSPECIFIED; mutex_unlock(&hdmi->mutex); - if (hdmi->panel || hdmi->force_kernel_output) - return connector_status_connected; + if (hdmi->panel || hdmi->force_kernel_output) { + result = connector_status_connected; + goto out; + } - if (hdmi->next_bridge && hdmi->next_bridge->ops & DRM_BRIDGE_OP_DETECT) - return drm_bridge_detect(hdmi->next_bridge); + if (hdmi->next_bridge && hdmi->next_bridge->ops & DRM_BRIDGE_OP_DETECT) { + result = drm_bridge_detect(hdmi->next_bridge); + goto out; + } if (hdmi->plat_data->left) secondary = hdmi->plat_data->left; @@ -2641,6 +2645,12 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force) result = connector_status_disconnected; } +out: + if (result == connector_status_connected) + extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI, true); + else + extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI, false); + return result; } @@ -3497,7 +3507,6 @@ static void dw_hdmi_qp_bridge_atomic_disable(struct drm_bridge *bridge, dw_hdmi_qp_hdcp_disable(hdmi, conn_state); - extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI, false); handle_plugged_change(hdmi, false); if (hdmi->plat_data->crtc_pre_disable) hdmi->plat_data->crtc_pre_disable(data, bridge->encoder->crtc); @@ -3582,7 +3591,6 @@ static void dw_hdmi_qp_bridge_atomic_enable(struct drm_bridge *bridge, dw_hdmi_qp_audio_enable(hdmi); hdmi_clk_regenerator_update_pixel_clock(hdmi); - extcon_set_state_sync(hdmi->extcon, EXTCON_DISP_HDMI, true); handle_plugged_change(hdmi, true); if (hdmi->panel)