Merge tag 'drm-misc-next-2023-01-19' of git://anongit.freedesktop.org/drm/drm-misc...
[platform/kernel/linux-starfive.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_connectors.c
index e4b99ba..6be30dc 100644 (file)
@@ -329,7 +329,6 @@ static void amdgpu_connector_free_edid(struct drm_connector *connector)
 
        kfree(amdgpu_connector->edid);
        amdgpu_connector->edid = NULL;
-       drm_connector_update_edid_property(connector, NULL);
 }
 
 static int amdgpu_connector_ddc_get_modes(struct drm_connector *connector)
@@ -999,13 +998,33 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
                }
        }
 
+       if (amdgpu_connector->detected_hpd_without_ddc) {
+               force = true;
+               amdgpu_connector->detected_hpd_without_ddc = false;
+       }
+
        if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) {
                ret = connector->status;
                goto exit;
        }
 
-       if (amdgpu_connector->ddc_bus)
+       if (amdgpu_connector->ddc_bus) {
                dret = amdgpu_display_ddc_probe(amdgpu_connector, false);
+
+               /* Sometimes the pins required for the DDC probe on DVI
+                * connectors don't make contact at the same time that the ones
+                * for HPD do. If the DDC probe fails even though we had an HPD
+                * signal, try again later
+                */
+               if (!dret && !force &&
+                   amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) {
+                       DRM_DEBUG_KMS("hpd detected without ddc, retrying in 1 second\n");
+                       amdgpu_connector->detected_hpd_without_ddc = true;
+                       schedule_delayed_work(&adev->hotplug_work,
+                                             msecs_to_jiffies(1000));
+                       goto exit;
+               }
+       }
        if (dret) {
                amdgpu_connector->detected_by_load = false;
                amdgpu_connector_free_edid(connector);