[Intel-gfx] [PATCH] drm: i915: Improve behavior in case of broken HDMI EDID

Ezequiel Garcia ezequiel at vanguardiasur.com.ar
Tue Apr 19 17:31:13 UTC 2016


Currently, our implementation of drm_connector_funcs.detect is
based on getting a valid EDID.

This requirement makes the driver fail to detect connected
connectors in case of EDID corruption, which in turn prevents
from falling back to modes provided by builtin or user-provided
EDIDs.

Let's fix this by calling drm_probe_ddc in drm_connector_funcs.detect,
and do the EDID full reading and parsing in
drm_connector_helper_funcs.get_modes, when it's actually needed.

This patch allows i915 to take advantage of the DRM_LOAD_EDID_FIRMWARE
infrastructure.

Without this patch, any device that fails to provide a valid
EDID will be reported as disconnected (unless the state is forced)
and thus the kernel won't allow to use such device with any mode,
either builtin, user-provided, or the 1024x768 noedid fallback.

Signed-off-by: Ezequiel Garcia <ezequiel at vanguardiasur.com.ar>
---
This patch supersedes: "drm/i915/hdmi: Fix weak connector detection",
https://patchwork.freedesktop.org/patch/79098/.

 drivers/gpu/drm/i915/intel_hdmi.c | 59 ++++++++++++++++++++++++---------------
 1 file changed, 36 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 616108c4bc3e..aa2f2271394a 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -1392,36 +1392,17 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
 	enum drm_connector_status status;
 	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
 	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-	bool live_status = false;
-	unsigned int try;
-
-	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
-		      connector->base.id, connector->name);
+	struct i2c_adapter *adap;
 
 	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
 
-	for (try = 0; !live_status && try < 9; try++) {
-		if (try)
-			msleep(10);
-		live_status = intel_digital_port_connected(dev_priv,
-				hdmi_to_dig_port(intel_hdmi));
-	}
-
-	if (!live_status)
-		DRM_DEBUG_KMS("Live status not up!");
-
-	intel_hdmi_unset_edid(connector);
-
-	if (intel_hdmi_set_edid(connector, live_status)) {
-		struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
-
-		hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
+	adap = intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
+	if (drm_probe_ddc(adap))
 		status = connector_status_connected;
-	} else
+	else
 		status = connector_status_disconnected;
 
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
-
 	return status;
 }
 
@@ -1442,10 +1423,42 @@ intel_hdmi_force(struct drm_connector *connector)
 	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
 }
 
+static void intel_hdmi_detect_edid(struct drm_connector *connector)
+{
+	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
+	struct drm_i915_private *dev_priv = to_i915(connector->dev);
+	bool live_status = false;
+	unsigned int try;
+
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
+		      connector->base.id, connector->name);
+
+	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
+
+	for (try = 0; !live_status && try < 9; try++) {
+		if (try)
+			msleep(10);
+		live_status = intel_digital_port_connected(dev_priv,
+				hdmi_to_dig_port(intel_hdmi));
+	}
+
+	if (!live_status)
+		DRM_DEBUG_KMS("Live status not up!");
+
+	intel_hdmi_unset_edid(connector);
+	if (intel_hdmi_set_edid(connector, live_status))
+		hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
+
+	intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
+}
+
 static int intel_hdmi_get_modes(struct drm_connector *connector)
 {
 	struct edid *edid;
 
+	if (!to_intel_connector(connector)->detect_edid)
+		intel_hdmi_detect_edid(connector);
+
 	edid = to_intel_connector(connector)->detect_edid;
 	if (edid == NULL)
 		return 0;
-- 
2.7.0



More information about the Intel-gfx mailing list