Merge branch 'bugzilla-13577-video' into release
[sfrench/cifs-2.6.git] / drivers / gpu / drm / drm_edid.c
index 5c9f79877cbf0a361111d2d16cccb6aee7b4483a..defcaf108460b59ac9e5cba023d26e6e7bef6f13 100644 (file)
@@ -911,23 +911,27 @@ static int drm_cvt_modes(struct drm_connector *connector,
        struct drm_device *dev = connector->dev;
        struct cvt_timing *cvt;
        const int rates[] = { 60, 85, 75, 60, 50 };
+       const u8 empty[3] = { 0, 0, 0 };
 
        for (i = 0; i < 4; i++) {
                int uninitialized_var(width), height;
                cvt = &(timing->data.other_data.data.cvt[i]);
 
-               height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2;
-               switch (cvt->code[1] & 0xc0) {
+               if (!memcmp(cvt->code, empty, 3))
+                       continue;
+
+               height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2;
+               switch (cvt->code[1] & 0x0c) {
                case 0x00:
                        width = height * 4 / 3;
                        break;
-               case 0x40:
+               case 0x04:
                        width = height * 16 / 9;
                        break;
-               case 0x80:
+               case 0x08:
                        width = height * 16 / 10;
                        break;
-               case 0xc0:
+               case 0x0c:
                        width = height * 15 / 9;
                        break;
                }