diff mbox

drm/i915: Use fail safe mode when edid is corrupt

Message ID 1461219515-27479-1-git-send-email-shubhangi.shrivastava@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shubhangi Shrivastava April 21, 2016, 6:18 a.m. UTC
This patch forces panel to use fail safe mode when it is detected
that edid is corrupt

For now this is performed only when automated test request is
received. This is because DRM's edid parser recovers from
basic corruption in edid resulting in normal functioning.

This can be modified to be used anytime by using edid_corrupt
flag instead of checking for Automated test request flag.

Signed-off-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
Signed-off-by: Shubhangi Shrivastava <shubhangi.shrivastava@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index a3fc494..8b88161 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1494,9 +1494,11 @@  intel_dp_compute_config(struct intel_encoder *encoder,
 		      max_lane_count, common_rates[max_clock],
 		      adjusted_mode->crtc_clock);
 
-	/* Walk through all bpp values. Luckily they're all nicely spaced with 2
-	 * bpc in between. */
-	bpp = pipe_config->pipe_bpp;
+	if (intel_dp->compliance_test_data == INTEL_DP_RESOLUTION_FAILSAFE)
+		bpp = 18;
+	else
+		bpp = pipe_config->pipe_bpp;
+
 	if (is_edp(intel_dp)) {
 
 		/* Get bpp from vbt only for panels that dont have bpp in edid */
@@ -1518,6 +1520,10 @@  intel_dp_compute_config(struct intel_encoder *encoder,
 		min_clock = max_clock;
 	}
 
+	/*
+	 * Walk through all bpp values. Luckily they're all nicely spaced with
+	 * 2bpc in between.
+	 */
 	for (; bpp >= 6*3; bpp -= 2*3) {
 		mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock,
 						   bpp);
@@ -4680,6 +4686,8 @@  intel_dp_detect(struct drm_connector *connector, bool force)
 
 	intel_dp->detect_done = false;
 
+	if (intel_dp->compliance_test_data == INTEL_DP_RESOLUTION_FAILSAFE)
+		return connector_status_connected;
 	if (intel_connector->detect_edid)
 		return connector_status_connected;
 	else
@@ -4715,8 +4723,18 @@  intel_dp_force(struct drm_connector *connector)
 static int intel_dp_get_modes(struct drm_connector *connector)
 {
 	struct intel_connector *intel_connector = to_intel_connector(connector);
+	struct intel_dp *intel_dp = intel_attached_dp(connector);
 	struct edid *edid;
 
+	if (intel_dp->compliance_test_data == INTEL_DP_RESOLUTION_FAILSAFE) {
+		int count;
+
+		count = drm_add_modes_noedid(connector, 640, 480);
+		drm_set_preferred_mode(connector, 640, 480);
+		DRM_ERROR("Using fail mode since edid is corrupt\n");
+		return count;
+	}
+
 	edid = intel_connector->detect_edid;
 	if (edid) {
 		int ret = intel_connector_update_modes(connector, edid);