diff mbox

drm/i915: check whether we actually received an edid in detect_ddc

Message ID 1342000071-25057-1-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter July 11, 2012, 9:47 a.m. UTC
Somehow detect_ddc manages to fall through all checks when we think
that something responds on the ddc i2c address, but the edid read
failed. Fix this up by explicitly checking for this case.

This fixes a regression on newer chips because since

commit aaa377302b2994fcc2c66741b47da33feb489dca
Author: Daniel Vetter <daniel.vetter@ffwll.ch>
Date:   Sat Jun 16 15:30:32 2012 +0200

    drm/i915/crt: Do not rely upon the HPD presence pin

we use ddc detection also on hotplug capable platforms. And one of
these reads all 0s for any i2c transaction if nothing is connected to
the vga port.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=51900
Tested-by: Yang Guang <guang.a.yang@intel.com>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_crt.c |    3 +++
 1 file changed, 3 insertions(+)

Comments

Chris Wilson July 11, 2012, 9:58 a.m. UTC | #1
On Wed, 11 Jul 2012 11:47:51 +0200, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Somehow detect_ddc manages to fall through all checks when we think
> that something responds on the ddc i2c address, but the edid read
> failed. Fix this up by explicitly checking for this case.

I'd prefer if we flatten the control flow in that function, state that the
intention is to only return a definite positive result and if in any doubt
we return false. Note that the ddc probe is implicit in drm_get_edid()
and that we then have a stale comment about handling a broken EDID!.

So intel_crtc_detect_ddc() {
  BUG_ON(crt->type != ANALOG);

   ret = false;
   if ((edid = drm_get_edid()) {
     ret = edid_is_analog(edid);
     kfree(edid);
  }
  return ret;
 }
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 61d55d3..540561c 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -353,6 +353,9 @@  static bool intel_crt_detect_ddc(struct drm_connector *connector)
 			is_digital = edid->input & DRM_EDID_INPUT_DIGITAL;
 			connector->display_info.raw_edid = NULL;
 			kfree(edid);
+		} else {
+			DRM_DEBUG_KMS("CRT not detected via DDC:0x50 [no valid EDID found]\n");
+			return false;
 		}
 
 		if (!is_digital) {