CHROMIUM: drm: Allow 5 tries when probing DDC
authorDaniel Kurtz <djkurtz@chromium.org>
Tue, 17 Jul 2012 10:26:48 +0000 (18:26 +0800)
committerGerrit <chrome-bot@google.com>
Thu, 19 Jul 2012 06:30:00 +0000 (23:30 -0700)
Some monitors consistently NAK the first EDID read request when connected
over a DVI-DP cable.  Thus, allow five NAK failures before giving up when
probing.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
BUG=chromium-os:31301
TEST=Hot plug DP/DVI cable into lumpy;
TEST=Should show display on both monitors.

Change-Id: I339dde875893bddb9fb65bcf277993493aa56f20
Reviewed-on: https://gerrit.chromium.org/gerrit/27634
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Simon Que <sque@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Ready: <marcheu@google.com>

drivers/gpu/drm/drm_edid.c

index 9e94f10..8f60db8 100644 (file)
@@ -379,8 +379,18 @@ static bool
 drm_probe_ddc(struct i2c_adapter *adapter)
 {
        unsigned char out;
+       int tries = 5;
+       int ret;
 
-       return (drm_do_probe_ddc_edid(adapter, &out, 0, 1) == 0);
+       /*
+        * Some monitors NAK the first EDID read request when connected over
+        * a DVI-DP cable, so we try 5 times before giving up.
+        */
+       do {
+               ret = drm_do_probe_ddc_edid(adapter, &out, 0, 1);
+       } while (ret && --tries);
+
+       return ret == 0;
 }
 
 /**