If an EDID override is in effect (e.g. via debugfs edid_override or
drm.edid_firmware kernel parameter), the overriding EDID may not
advertise capabilities matching the physical connector being used.
In that case, trust the physical connector type over the EDID in
create_eml_sink() and dm_helpers_parse_edid_caps().

Signed-off-by: Johannes Wüller <[email protected]>
---
v2: rebased; create_eml_sink() now lives in amdgpu_dm_connector.c.

 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c  | 9 ++++++++-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c    | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
index ad3383169d83..2bce57b06037 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
@@ -2134,7 +2134,14 @@ VISIBLE_IF_KUNIT void create_eml_sink(struct 
amdgpu_dm_connector *aconnector)
                return;
        }
 
-       if (connector->display_info.is_hdmi)
+       /*
+        * If an EDID override is active, it may not advertise HDMI capability
+        * even though the physical connector is HDMI. Trust the connector type.
+        */
+       if (connector->display_info.is_hdmi ||
+           (connector->edid_overridden &&
+            (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
+             connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)))
                init_params.sink_signal = SIGNAL_TYPE_HDMI_TYPE_A;
 
        aconnector->drm_edid = drm_edid;
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c 
b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index 5c74f19fc33a..9f4465682088 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -223,7 +223,14 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
                                  edid_caps->display_name,
                                  AUDIO_INFO_DISPLAY_NAME_SIZE_IN_CHARS);
 
-       edid_caps->edid_hdmi = connector->display_info.is_hdmi;
+       /*
+        * If an EDID override is active, it may not advertise HDMI capability
+        * even though the physical connector is HDMI. Trust the connector type.
+        */
+       edid_caps->edid_hdmi = connector->display_info.is_hdmi ||
+               (connector->edid_overridden &&
+                (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA ||
+                 connector->connector_type == DRM_MODE_CONNECTOR_HDMIB));
 
        if (edid_caps->edid_hdmi) {
                edid_caps->qs_bit = 
connector->display_info.rgb_quant_range_selectable;
-- 
2.56.0

Reply via email to