aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_edid.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r--drivers/gpu/drm/drm_edid.c802
1 files changed, 549 insertions, 253 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 18f41d7061f0..f569ae88ab38 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2,6 +2,7 @@
2 * Copyright (c) 2006 Luc Verhaegen (quirks list) 2 * Copyright (c) 2006 Luc Verhaegen (quirks list)
3 * Copyright (c) 2007-2008 Intel Corporation 3 * Copyright (c) 2007-2008 Intel Corporation
4 * Jesse Barnes <jesse.barnes@intel.com> 4 * Jesse Barnes <jesse.barnes@intel.com>
5 * Copyright 2010 Red Hat, Inc.
5 * 6 *
6 * DDC probing routines (drm_ddc_read & drm_do_probe_ddc_edid) originally from 7 * DDC probing routines (drm_ddc_read & drm_do_probe_ddc_edid) originally from
7 * FB layer. 8 * FB layer.
@@ -33,10 +34,9 @@
33#include "drmP.h" 34#include "drmP.h"
34#include "drm_edid.h" 35#include "drm_edid.h"
35 36
36/* 37#define EDID_EST_TIMINGS 16
37 * TODO: 38#define EDID_STD_TIMINGS 8
38 * - support EDID 1.4 (incl. CE blocks) 39#define EDID_DETAILED_TIMINGS 4
39 */
40 40
41/* 41/*
42 * EDID blocks out in the wild have a variety of bugs, try to collect 42 * EDID blocks out in the wild have a variety of bugs, try to collect
@@ -65,7 +65,8 @@
65 65
66#define LEVEL_DMT 0 66#define LEVEL_DMT 0
67#define LEVEL_GTF 1 67#define LEVEL_GTF 1
68#define LEVEL_CVT 2 68#define LEVEL_GTF2 2
69#define LEVEL_CVT 3
69 70
70static struct edid_quirk { 71static struct edid_quirk {
71 char *vendor; 72 char *vendor;
@@ -109,36 +110,38 @@ static struct edid_quirk {
109 { "SAM", 638, EDID_QUIRK_PREFER_LARGE_60 }, 110 { "SAM", 638, EDID_QUIRK_PREFER_LARGE_60 },
110}; 111};
111 112
113/*** DDC fetch and block validation ***/
112 114
113/* Valid EDID header has these bytes */
114static const u8 edid_header[] = { 115static const u8 edid_header[] = {
115 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 116 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
116}; 117};
117 118
118/** 119/*
119 * drm_edid_is_valid - sanity check EDID data 120 * Sanity check the EDID block (base or extension). Return 0 if the block
120 * @edid: EDID data 121 * doesn't check out, or 1 if it's valid.
121 *
122 * Sanity check the EDID block by looking at the header, the version number
123 * and the checksum. Return 0 if the EDID doesn't check out, or 1 if it's
124 * valid.
125 */ 122 */
126bool drm_edid_is_valid(struct edid *edid) 123static bool
124drm_edid_block_valid(u8 *raw_edid)
127{ 125{
128 int i, score = 0; 126 int i;
129 u8 csum = 0; 127 u8 csum = 0;
130 u8 *raw_edid = (u8 *)edid; 128 struct edid *edid = (struct edid *)raw_edid;
131 129
132 for (i = 0; i < sizeof(edid_header); i++) 130 if (raw_edid[0] == 0x00) {
133 if (raw_edid[i] == edid_header[i]) 131 int score = 0;
134 score++;
135 132
136 if (score == 8) ; 133 for (i = 0; i < sizeof(edid_header); i++)
137 else if (score >= 6) { 134 if (raw_edid[i] == edid_header[i])
138 DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); 135 score++;
139 memcpy(raw_edid, edid_header, sizeof(edid_header)); 136
140 } else 137 if (score == 8) ;
141 goto bad; 138 else if (score >= 6) {
139 DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
140 memcpy(raw_edid, edid_header, sizeof(edid_header));
141 } else {
142 goto bad;
143 }
144 }
142 145
143 for (i = 0; i < EDID_LENGTH; i++) 146 for (i = 0; i < EDID_LENGTH; i++)
144 csum += raw_edid[i]; 147 csum += raw_edid[i];
@@ -147,13 +150,21 @@ bool drm_edid_is_valid(struct edid *edid)
147 goto bad; 150 goto bad;
148 } 151 }
149 152
150 if (edid->version != 1) { 153 /* per-block-type checks */
151 DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version); 154 switch (raw_edid[0]) {
152 goto bad; 155 case 0: /* base */
153 } 156 if (edid->version != 1) {
157 DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version);
158 goto bad;
159 }
154 160
155 if (edid->revision > 4) 161 if (edid->revision > 4)
156 DRM_DEBUG("EDID minor > 4, assuming backward compatibility\n"); 162 DRM_DEBUG("EDID minor > 4, assuming backward compatibility\n");
163 break;
164
165 default:
166 break;
167 }
157 168
158 return 1; 169 return 1;
159 170
@@ -165,8 +176,158 @@ bad:
165 } 176 }
166 return 0; 177 return 0;
167} 178}
179
180/**
181 * drm_edid_is_valid - sanity check EDID data
182 * @edid: EDID data
183 *
184 * Sanity-check an entire EDID record (including extensions)
185 */
186bool drm_edid_is_valid(struct edid *edid)
187{
188 int i;
189 u8 *raw = (u8 *)edid;
190
191 if (!edid)
192 return false;
193
194 for (i = 0; i <= edid->extensions; i++)
195 if (!drm_edid_block_valid(raw + i * EDID_LENGTH))
196 return false;
197
198 return true;
199}
168EXPORT_SYMBOL(drm_edid_is_valid); 200EXPORT_SYMBOL(drm_edid_is_valid);
169 201
202#define DDC_ADDR 0x50
203#define DDC_SEGMENT_ADDR 0x30
204/**
205 * Get EDID information via I2C.
206 *
207 * \param adapter : i2c device adaptor
208 * \param buf : EDID data buffer to be filled
209 * \param len : EDID data buffer length
210 * \return 0 on success or -1 on failure.
211 *
212 * Try to fetch EDID information by calling i2c driver function.
213 */
214static int
215drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
216 int block, int len)
217{
218 unsigned char start = block * EDID_LENGTH;
219 struct i2c_msg msgs[] = {
220 {
221 .addr = DDC_ADDR,
222 .flags = 0,
223 .len = 1,
224 .buf = &start,
225 }, {
226 .addr = DDC_ADDR,
227 .flags = I2C_M_RD,
228 .len = len,
229 .buf = buf + start,
230 }
231 };
232
233 if (i2c_transfer(adapter, msgs, 2) == 2)
234 return 0;
235
236 return -1;
237}
238
239static u8 *
240drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
241{
242 int i, j = 0;
243 u8 *block, *new;
244
245 if ((block = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
246 return NULL;
247
248 /* base block fetch */
249 for (i = 0; i < 4; i++) {
250 if (drm_do_probe_ddc_edid(adapter, block, 0, EDID_LENGTH))
251 goto out;
252 if (drm_edid_block_valid(block))
253 break;
254 }
255 if (i == 4)
256 goto carp;
257
258 /* if there's no extensions, we're done */
259 if (block[0x7e] == 0)
260 return block;
261
262 new = krealloc(block, (block[0x7e] + 1) * EDID_LENGTH, GFP_KERNEL);
263 if (!new)
264 goto out;
265 block = new;
266
267 for (j = 1; j <= block[0x7e]; j++) {
268 for (i = 0; i < 4; i++) {
269 if (drm_do_probe_ddc_edid(adapter, block, j,
270 EDID_LENGTH))
271 goto out;
272 if (drm_edid_block_valid(block + j * EDID_LENGTH))
273 break;
274 }
275 if (i == 4)
276 goto carp;
277 }
278
279 return block;
280
281carp:
282 dev_warn(&connector->dev->pdev->dev, "%s: EDID block %d invalid.\n",
283 drm_get_connector_name(connector), j);
284
285out:
286 kfree(block);
287 return NULL;
288}
289
290/**
291 * Probe DDC presence.
292 *
293 * \param adapter : i2c device adaptor
294 * \return 1 on success
295 */
296static bool
297drm_probe_ddc(struct i2c_adapter *adapter)
298{
299 unsigned char out;
300
301 return (drm_do_probe_ddc_edid(adapter, &out, 0, 1) == 0);
302}
303
304/**
305 * drm_get_edid - get EDID data, if available
306 * @connector: connector we're probing
307 * @adapter: i2c adapter to use for DDC
308 *
309 * Poke the given i2c channel to grab EDID data if possible. If found,
310 * attach it to the connector.
311 *
312 * Return edid data or NULL if we couldn't find any.
313 */
314struct edid *drm_get_edid(struct drm_connector *connector,
315 struct i2c_adapter *adapter)
316{
317 struct edid *edid = NULL;
318
319 if (drm_probe_ddc(adapter))
320 edid = (struct edid *)drm_do_get_edid(connector, adapter);
321
322 connector->display_info.raw_edid = (char *)edid;
323
324 return edid;
325
326}
327EXPORT_SYMBOL(drm_get_edid);
328
329/*** EDID parsing ***/
330
170/** 331/**
171 * edid_vendor - match a string against EDID's obfuscated vendor field 332 * edid_vendor - match a string against EDID's obfuscated vendor field
172 * @edid: EDID to match 333 * @edid: EDID to match
@@ -335,7 +496,7 @@ static struct drm_display_mode drm_dmt_modes[] = {
335 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, 496 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
336 /* 1024x768@85Hz */ 497 /* 1024x768@85Hz */
337 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 94500, 1024, 1072, 498 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 94500, 1024, 1072,
338 1072, 1376, 0, 768, 769, 772, 808, 0, 499 1168, 1376, 0, 768, 769, 772, 808, 0,
339 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, 500 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
340 /* 1152x864@75Hz */ 501 /* 1152x864@75Hz */
341 { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216, 502 { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216,
@@ -426,7 +587,7 @@ static struct drm_display_mode drm_dmt_modes[] = {
426 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, 587 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
427 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, 588 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
428 /* 1600x1200@75Hz */ 589 /* 1600x1200@75Hz */
429 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 2025000, 1600, 1664, 590 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 202500, 1600, 1664,
430 1856, 2160, 0, 1200, 1201, 1204, 1250, 0, 591 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
431 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, 592 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
432 /* 1600x1200@85Hz */ 593 /* 1600x1200@85Hz */
@@ -497,8 +658,8 @@ static struct drm_display_mode drm_dmt_modes[] = {
497static const int drm_num_dmt_modes = 658static const int drm_num_dmt_modes =
498 sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode); 659 sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode);
499 660
500static struct drm_display_mode *drm_find_dmt(struct drm_device *dev, 661struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
501 int hsize, int vsize, int fresh) 662 int hsize, int vsize, int fresh)
502{ 663{
503 int i; 664 int i;
504 struct drm_display_mode *ptr, *mode; 665 struct drm_display_mode *ptr, *mode;
@@ -516,6 +677,111 @@ static struct drm_display_mode *drm_find_dmt(struct drm_device *dev,
516 } 677 }
517 return mode; 678 return mode;
518} 679}
680EXPORT_SYMBOL(drm_mode_find_dmt);
681
682typedef void detailed_cb(struct detailed_timing *timing, void *closure);
683
684static void
685drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)
686{
687 int i;
688 struct edid *edid = (struct edid *)raw_edid;
689
690 if (edid == NULL)
691 return;
692
693 for (i = 0; i < EDID_DETAILED_TIMINGS; i++)
694 cb(&(edid->detailed_timings[i]), closure);
695
696 /* XXX extension block walk */
697}
698
699static void
700is_rb(struct detailed_timing *t, void *data)
701{
702 u8 *r = (u8 *)t;
703 if (r[3] == EDID_DETAIL_MONITOR_RANGE)
704 if (r[15] & 0x10)
705 *(bool *)data = true;
706}
707
708/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */
709static bool
710drm_monitor_supports_rb(struct edid *edid)
711{
712 if (edid->revision >= 4) {
713 bool ret;
714 drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
715 return ret;
716 }
717
718 return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0);
719}
720
721static void
722find_gtf2(struct detailed_timing *t, void *data)
723{
724 u8 *r = (u8 *)t;
725 if (r[3] == EDID_DETAIL_MONITOR_RANGE && r[10] == 0x02)
726 *(u8 **)data = r;
727}
728
729/* Secondary GTF curve kicks in above some break frequency */
730static int
731drm_gtf2_hbreak(struct edid *edid)
732{
733 u8 *r = NULL;
734 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
735 return r ? (r[12] * 2) : 0;
736}
737
738static int
739drm_gtf2_2c(struct edid *edid)
740{
741 u8 *r = NULL;
742 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
743 return r ? r[13] : 0;
744}
745
746static int
747drm_gtf2_m(struct edid *edid)
748{
749 u8 *r = NULL;
750 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
751 return r ? (r[15] << 8) + r[14] : 0;
752}
753
754static int
755drm_gtf2_k(struct edid *edid)
756{
757 u8 *r = NULL;
758 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
759 return r ? r[16] : 0;
760}
761
762static int
763drm_gtf2_2j(struct edid *edid)
764{
765 u8 *r = NULL;
766 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
767 return r ? r[17] : 0;
768}
769
770/**
771 * standard_timing_level - get std. timing level(CVT/GTF/DMT)
772 * @edid: EDID block to scan
773 */
774static int standard_timing_level(struct edid *edid)
775{
776 if (edid->revision >= 2) {
777 if (edid->revision >= 4 && (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF))
778 return LEVEL_CVT;
779 if (drm_gtf2_hbreak(edid))
780 return LEVEL_GTF2;
781 return LEVEL_GTF;
782 }
783 return LEVEL_DMT;
784}
519 785
520/* 786/*
521 * 0 is reserved. The spec says 0x01 fill for unused timings. Some old 787 * 0 is reserved. The spec says 0x01 fill for unused timings. Some old
@@ -536,22 +802,20 @@ bad_std_timing(u8 a, u8 b)
536 * 802 *
537 * Take the standard timing params (in this case width, aspect, and refresh) 803 * Take the standard timing params (in this case width, aspect, and refresh)
538 * and convert them into a real mode using CVT/GTF/DMT. 804 * and convert them into a real mode using CVT/GTF/DMT.
539 *
540 * Punts for now, but should eventually use the FB layer's CVT based mode
541 * generation code.
542 */ 805 */
543struct drm_display_mode *drm_mode_std(struct drm_device *dev, 806static struct drm_display_mode *
544 struct std_timing *t, 807drm_mode_std(struct drm_connector *connector, struct edid *edid,
545 int revision, 808 struct std_timing *t, int revision)
546 int timing_level)
547{ 809{
548 struct drm_display_mode *mode; 810 struct drm_device *dev = connector->dev;
811 struct drm_display_mode *m, *mode = NULL;
549 int hsize, vsize; 812 int hsize, vsize;
550 int vrefresh_rate; 813 int vrefresh_rate;
551 unsigned aspect_ratio = (t->vfreq_aspect & EDID_TIMING_ASPECT_MASK) 814 unsigned aspect_ratio = (t->vfreq_aspect & EDID_TIMING_ASPECT_MASK)
552 >> EDID_TIMING_ASPECT_SHIFT; 815 >> EDID_TIMING_ASPECT_SHIFT;
553 unsigned vfreq = (t->vfreq_aspect & EDID_TIMING_VFREQ_MASK) 816 unsigned vfreq = (t->vfreq_aspect & EDID_TIMING_VFREQ_MASK)
554 >> EDID_TIMING_VFREQ_SHIFT; 817 >> EDID_TIMING_VFREQ_SHIFT;
818 int timing_level = standard_timing_level(edid);
555 819
556 if (bad_std_timing(t->hsize, t->vfreq_aspect)) 820 if (bad_std_timing(t->hsize, t->vfreq_aspect))
557 return NULL; 821 return NULL;
@@ -572,18 +836,38 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev,
572 vsize = (hsize * 4) / 5; 836 vsize = (hsize * 4) / 5;
573 else 837 else
574 vsize = (hsize * 9) / 16; 838 vsize = (hsize * 9) / 16;
575 /* HDTV hack */ 839
576 if (hsize == 1360 && vsize == 765 && vrefresh_rate == 60) { 840 /* HDTV hack, part 1 */
577 mode = drm_cvt_mode(dev, hsize, vsize, vrefresh_rate, 0, 0, 841 if (vrefresh_rate == 60 &&
842 ((hsize == 1360 && vsize == 765) ||
843 (hsize == 1368 && vsize == 769))) {
844 hsize = 1366;
845 vsize = 768;
846 }
847
848 /*
849 * If this connector already has a mode for this size and refresh
850 * rate (because it came from detailed or CVT info), use that
851 * instead. This way we don't have to guess at interlace or
852 * reduced blanking.
853 */
854 list_for_each_entry(m, &connector->probed_modes, head)
855 if (m->hdisplay == hsize && m->vdisplay == vsize &&
856 drm_mode_vrefresh(m) == vrefresh_rate)
857 return NULL;
858
859 /* HDTV hack, part 2 */
860 if (hsize == 1366 && vsize == 768 && vrefresh_rate == 60) {
861 mode = drm_cvt_mode(dev, 1366, 768, vrefresh_rate, 0, 0,
578 false); 862 false);
579 mode->hdisplay = 1366; 863 mode->hdisplay = 1366;
580 mode->vsync_start = mode->vsync_start - 1; 864 mode->vsync_start = mode->vsync_start - 1;
581 mode->vsync_end = mode->vsync_end - 1; 865 mode->vsync_end = mode->vsync_end - 1;
582 return mode; 866 return mode;
583 } 867 }
584 mode = NULL; 868
585 /* check whether it can be found in default mode table */ 869 /* check whether it can be found in default mode table */
586 mode = drm_find_dmt(dev, hsize, vsize, vrefresh_rate); 870 mode = drm_mode_find_dmt(dev, hsize, vsize, vrefresh_rate);
587 if (mode) 871 if (mode)
588 return mode; 872 return mode;
589 873
@@ -593,6 +877,23 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev,
593 case LEVEL_GTF: 877 case LEVEL_GTF:
594 mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0); 878 mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0);
595 break; 879 break;
880 case LEVEL_GTF2:
881 /*
882 * This is potentially wrong if there's ever a monitor with
883 * more than one ranges section, each claiming a different
884 * secondary GTF curve. Please don't do that.
885 */
886 mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0);
887 if (drm_mode_hsync(mode) > drm_gtf2_hbreak(edid)) {
888 kfree(mode);
889 mode = drm_gtf_mode_complex(dev, hsize, vsize,
890 vrefresh_rate, 0, 0,
891 drm_gtf2_m(edid),
892 drm_gtf2_2c(edid),
893 drm_gtf2_k(edid),
894 drm_gtf2_2j(edid));
895 }
896 break;
596 case LEVEL_CVT: 897 case LEVEL_CVT:
597 mode = drm_cvt_mode(dev, hsize, vsize, vrefresh_rate, 0, 0, 898 mode = drm_cvt_mode(dev, hsize, vsize, vrefresh_rate, 0, 0,
598 false); 899 false);
@@ -716,10 +1017,10 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
716 if (mode->vsync_end > mode->vtotal) 1017 if (mode->vsync_end > mode->vtotal)
717 mode->vtotal = mode->vsync_end + 1; 1018 mode->vtotal = mode->vsync_end + 1;
718 1019
719 drm_mode_set_name(mode);
720
721 drm_mode_do_interlace_quirk(mode, pt); 1020 drm_mode_do_interlace_quirk(mode, pt);
722 1021
1022 drm_mode_set_name(mode);
1023
723 if (quirks & EDID_QUIRK_DETAILED_SYNC_PP) { 1024 if (quirks & EDID_QUIRK_DETAILED_SYNC_PP) {
724 pt->misc |= DRM_EDID_PT_HSYNC_POSITIVE | DRM_EDID_PT_VSYNC_POSITIVE; 1025 pt->misc |= DRM_EDID_PT_HSYNC_POSITIVE | DRM_EDID_PT_VSYNC_POSITIVE;
725 } 1026 }
@@ -802,10 +1103,6 @@ static struct drm_display_mode edid_est_modes[] = {
802 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1152x864@75Hz */ 1103 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1152x864@75Hz */
803}; 1104};
804 1105
805#define EDID_EST_TIMINGS 16
806#define EDID_STD_TIMINGS 8
807#define EDID_DETAILED_TIMINGS 4
808
809/** 1106/**
810 * add_established_modes - get est. modes from EDID and add them 1107 * add_established_modes - get est. modes from EDID and add them
811 * @edid: EDID block to scan 1108 * @edid: EDID block to scan
@@ -833,19 +1130,6 @@ static int add_established_modes(struct drm_connector *connector, struct edid *e
833 1130
834 return modes; 1131 return modes;
835} 1132}
836/**
837 * stanard_timing_level - get std. timing level(CVT/GTF/DMT)
838 * @edid: EDID block to scan
839 */
840static int standard_timing_level(struct edid *edid)
841{
842 if (edid->revision >= 2) {
843 if (edid->revision >= 4 && (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF))
844 return LEVEL_CVT;
845 return LEVEL_GTF;
846 }
847 return LEVEL_DMT;
848}
849 1133
850/** 1134/**
851 * add_standard_modes - get std. modes from EDID and add them 1135 * add_standard_modes - get std. modes from EDID and add them
@@ -856,22 +1140,14 @@ static int standard_timing_level(struct edid *edid)
856 */ 1140 */
857static int add_standard_modes(struct drm_connector *connector, struct edid *edid) 1141static int add_standard_modes(struct drm_connector *connector, struct edid *edid)
858{ 1142{
859 struct drm_device *dev = connector->dev;
860 int i, modes = 0; 1143 int i, modes = 0;
861 int timing_level;
862
863 timing_level = standard_timing_level(edid);
864 1144
865 for (i = 0; i < EDID_STD_TIMINGS; i++) { 1145 for (i = 0; i < EDID_STD_TIMINGS; i++) {
866 struct std_timing *t = &edid->standard_timings[i];
867 struct drm_display_mode *newmode; 1146 struct drm_display_mode *newmode;
868 1147
869 /* If std timings bytes are 1, 1 it's empty */ 1148 newmode = drm_mode_std(connector, edid,
870 if (t->hsize == 1 && t->vfreq_aspect == 1) 1149 &edid->standard_timings[i],
871 continue; 1150 edid->revision);
872
873 newmode = drm_mode_std(dev, &edid->standard_timings[i],
874 edid->revision, timing_level);
875 if (newmode) { 1151 if (newmode) {
876 drm_mode_probed_add(connector, newmode); 1152 drm_mode_probed_add(connector, newmode);
877 modes++; 1153 modes++;
@@ -881,36 +1157,86 @@ static int add_standard_modes(struct drm_connector *connector, struct edid *edid
881 return modes; 1157 return modes;
882} 1158}
883 1159
884/*
885 * XXX fix this for:
886 * - GTF secondary curve formula
887 * - EDID 1.4 range offsets
888 * - CVT extended bits
889 */
890static bool 1160static bool
891mode_in_range(struct drm_display_mode *mode, struct detailed_timing *timing) 1161mode_is_rb(struct drm_display_mode *mode)
892{ 1162{
893 struct detailed_data_monitor_range *range; 1163 return (mode->htotal - mode->hdisplay == 160) &&
894 int hsync, vrefresh; 1164 (mode->hsync_end - mode->hdisplay == 80) &&
895 1165 (mode->hsync_end - mode->hsync_start == 32) &&
896 range = &timing->data.other_data.data.range; 1166 (mode->vsync_start - mode->vdisplay == 3);
1167}
897 1168
1169static bool
1170mode_in_hsync_range(struct drm_display_mode *mode, struct edid *edid, u8 *t)
1171{
1172 int hsync, hmin, hmax;
1173
1174 hmin = t[7];
1175 if (edid->revision >= 4)
1176 hmin += ((t[4] & 0x04) ? 255 : 0);
1177 hmax = t[8];
1178 if (edid->revision >= 4)
1179 hmax += ((t[4] & 0x08) ? 255 : 0);
898 hsync = drm_mode_hsync(mode); 1180 hsync = drm_mode_hsync(mode);
899 vrefresh = drm_mode_vrefresh(mode);
900 1181
901 if (hsync < range->min_hfreq_khz || hsync > range->max_hfreq_khz) 1182 return (hsync <= hmax && hsync >= hmin);
1183}
1184
1185static bool
1186mode_in_vsync_range(struct drm_display_mode *mode, struct edid *edid, u8 *t)
1187{
1188 int vsync, vmin, vmax;
1189
1190 vmin = t[5];
1191 if (edid->revision >= 4)
1192 vmin += ((t[4] & 0x01) ? 255 : 0);
1193 vmax = t[6];
1194 if (edid->revision >= 4)
1195 vmax += ((t[4] & 0x02) ? 255 : 0);
1196 vsync = drm_mode_vrefresh(mode);
1197
1198 return (vsync <= vmax && vsync >= vmin);
1199}
1200
1201static u32
1202range_pixel_clock(struct edid *edid, u8 *t)
1203{
1204 /* unspecified */
1205 if (t[9] == 0 || t[9] == 255)
1206 return 0;
1207
1208 /* 1.4 with CVT support gives us real precision, yay */
1209 if (edid->revision >= 4 && t[10] == 0x04)
1210 return (t[9] * 10000) - ((t[12] >> 2) * 250);
1211
1212 /* 1.3 is pathetic, so fuzz up a bit */
1213 return t[9] * 10000 + 5001;
1214}
1215
1216static bool
1217mode_in_range(struct drm_display_mode *mode, struct edid *edid,
1218 struct detailed_timing *timing)
1219{
1220 u32 max_clock;
1221 u8 *t = (u8 *)timing;
1222
1223 if (!mode_in_hsync_range(mode, edid, t))
902 return false; 1224 return false;
903 1225
904 if (vrefresh < range->min_vfreq || vrefresh > range->max_vfreq) 1226 if (!mode_in_vsync_range(mode, edid, t))
905 return false; 1227 return false;
906 1228
907 if (range->pixel_clock_mhz && range->pixel_clock_mhz != 0xff) { 1229 if ((max_clock = range_pixel_clock(edid, t)))
908 /* be forgiving since it's in units of 10MHz */
909 int max_clock = range->pixel_clock_mhz * 10 + 9;
910 max_clock *= 1000;
911 if (mode->clock > max_clock) 1230 if (mode->clock > max_clock)
912 return false; 1231 return false;
913 } 1232
1233 /* 1.4 max horizontal check */
1234 if (edid->revision >= 4 && t[10] == 0x04)
1235 if (t[13] && mode->hdisplay > 8 * (t[13] + (256 * (t[12]&0x3))))
1236 return false;
1237
1238 if (mode_is_rb(mode) && !drm_monitor_supports_rb(edid))
1239 return false;
914 1240
915 return true; 1241 return true;
916} 1242}
@@ -919,15 +1245,16 @@ mode_in_range(struct drm_display_mode *mode, struct detailed_timing *timing)
919 * XXX If drm_dmt_modes ever regrows the CVT-R modes (and it will) this will 1245 * XXX If drm_dmt_modes ever regrows the CVT-R modes (and it will) this will
920 * need to account for them. 1246 * need to account for them.
921 */ 1247 */
922static int drm_gtf_modes_for_range(struct drm_connector *connector, 1248static int
923 struct detailed_timing *timing) 1249drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
1250 struct detailed_timing *timing)
924{ 1251{
925 int i, modes = 0; 1252 int i, modes = 0;
926 struct drm_display_mode *newmode; 1253 struct drm_display_mode *newmode;
927 struct drm_device *dev = connector->dev; 1254 struct drm_device *dev = connector->dev;
928 1255
929 for (i = 0; i < drm_num_dmt_modes; i++) { 1256 for (i = 0; i < drm_num_dmt_modes; i++) {
930 if (mode_in_range(drm_dmt_modes + i, timing)) { 1257 if (mode_in_range(drm_dmt_modes + i, edid, timing)) {
931 newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); 1258 newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]);
932 if (newmode) { 1259 if (newmode) {
933 drm_mode_probed_add(connector, newmode); 1260 drm_mode_probed_add(connector, newmode);
@@ -988,13 +1315,100 @@ static int drm_cvt_modes(struct drm_connector *connector,
988 return modes; 1315 return modes;
989} 1316}
990 1317
1318static const struct {
1319 short w;
1320 short h;
1321 short r;
1322 short rb;
1323} est3_modes[] = {
1324 /* byte 6 */
1325 { 640, 350, 85, 0 },
1326 { 640, 400, 85, 0 },
1327 { 720, 400, 85, 0 },
1328 { 640, 480, 85, 0 },
1329 { 848, 480, 60, 0 },
1330 { 800, 600, 85, 0 },
1331 { 1024, 768, 85, 0 },
1332 { 1152, 864, 75, 0 },
1333 /* byte 7 */
1334 { 1280, 768, 60, 1 },
1335 { 1280, 768, 60, 0 },
1336 { 1280, 768, 75, 0 },
1337 { 1280, 768, 85, 0 },
1338 { 1280, 960, 60, 0 },
1339 { 1280, 960, 85, 0 },
1340 { 1280, 1024, 60, 0 },
1341 { 1280, 1024, 85, 0 },
1342 /* byte 8 */
1343 { 1360, 768, 60, 0 },
1344 { 1440, 900, 60, 1 },
1345 { 1440, 900, 60, 0 },
1346 { 1440, 900, 75, 0 },
1347 { 1440, 900, 85, 0 },
1348 { 1400, 1050, 60, 1 },
1349 { 1400, 1050, 60, 0 },
1350 { 1400, 1050, 75, 0 },
1351 /* byte 9 */
1352 { 1400, 1050, 85, 0 },
1353 { 1680, 1050, 60, 1 },
1354 { 1680, 1050, 60, 0 },
1355 { 1680, 1050, 75, 0 },
1356 { 1680, 1050, 85, 0 },
1357 { 1600, 1200, 60, 0 },
1358 { 1600, 1200, 65, 0 },
1359 { 1600, 1200, 70, 0 },
1360 /* byte 10 */
1361 { 1600, 1200, 75, 0 },
1362 { 1600, 1200, 85, 0 },
1363 { 1792, 1344, 60, 0 },
1364 { 1792, 1344, 85, 0 },
1365 { 1856, 1392, 60, 0 },
1366 { 1856, 1392, 75, 0 },
1367 { 1920, 1200, 60, 1 },
1368 { 1920, 1200, 60, 0 },
1369 /* byte 11 */
1370 { 1920, 1200, 75, 0 },
1371 { 1920, 1200, 85, 0 },
1372 { 1920, 1440, 60, 0 },
1373 { 1920, 1440, 75, 0 },
1374};
1375static const int num_est3_modes = sizeof(est3_modes) / sizeof(est3_modes[0]);
1376
1377static int
1378drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing)
1379{
1380 int i, j, m, modes = 0;
1381 struct drm_display_mode *mode;
1382 u8 *est = ((u8 *)timing) + 5;
1383
1384 for (i = 0; i < 6; i++) {
1385 for (j = 7; j > 0; j--) {
1386 m = (i * 8) + (7 - j);
1387 if (m >= num_est3_modes)
1388 break;
1389 if (est[i] & (1 << j)) {
1390 mode = drm_mode_find_dmt(connector->dev,
1391 est3_modes[m].w,
1392 est3_modes[m].h,
1393 est3_modes[m].r
1394 /*, est3_modes[m].rb */);
1395 if (mode) {
1396 drm_mode_probed_add(connector, mode);
1397 modes++;
1398 }
1399 }
1400 }
1401 }
1402
1403 return modes;
1404}
1405
991static int add_detailed_modes(struct drm_connector *connector, 1406static int add_detailed_modes(struct drm_connector *connector,
992 struct detailed_timing *timing, 1407 struct detailed_timing *timing,
993 struct edid *edid, u32 quirks, int preferred) 1408 struct edid *edid, u32 quirks, int preferred)
994{ 1409{
995 int i, modes = 0; 1410 int i, modes = 0;
996 struct detailed_non_pixel *data = &timing->data.other_data; 1411 struct detailed_non_pixel *data = &timing->data.other_data;
997 int timing_level = standard_timing_level(edid);
998 int gtf = (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF); 1412 int gtf = (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF);
999 struct drm_display_mode *newmode; 1413 struct drm_display_mode *newmode;
1000 struct drm_device *dev = connector->dev; 1414 struct drm_device *dev = connector->dev;
@@ -1015,7 +1429,8 @@ static int add_detailed_modes(struct drm_connector *connector,
1015 switch (data->type) { 1429 switch (data->type) {
1016 case EDID_DETAIL_MONITOR_RANGE: 1430 case EDID_DETAIL_MONITOR_RANGE:
1017 if (gtf) 1431 if (gtf)
1018 modes += drm_gtf_modes_for_range(connector, timing); 1432 modes += drm_gtf_modes_for_range(connector, edid,
1433 timing);
1019 break; 1434 break;
1020 case EDID_DETAIL_STD_MODES: 1435 case EDID_DETAIL_STD_MODES:
1021 /* Six modes per detailed section */ 1436 /* Six modes per detailed section */
@@ -1024,8 +1439,8 @@ static int add_detailed_modes(struct drm_connector *connector,
1024 struct drm_display_mode *newmode; 1439 struct drm_display_mode *newmode;
1025 1440
1026 std = &data->data.timings[i]; 1441 std = &data->data.timings[i];
1027 newmode = drm_mode_std(dev, std, edid->revision, 1442 newmode = drm_mode_std(connector, edid, std,
1028 timing_level); 1443 edid->revision);
1029 if (newmode) { 1444 if (newmode) {
1030 drm_mode_probed_add(connector, newmode); 1445 drm_mode_probed_add(connector, newmode);
1031 modes++; 1446 modes++;
@@ -1035,6 +1450,9 @@ static int add_detailed_modes(struct drm_connector *connector,
1035 case EDID_DETAIL_CVT_3BYTE: 1450 case EDID_DETAIL_CVT_3BYTE:
1036 modes += drm_cvt_modes(connector, timing); 1451 modes += drm_cvt_modes(connector, timing);
1037 break; 1452 break;
1453 case EDID_DETAIL_EST_TIMINGS:
1454 modes += drm_est3_modes(connector, timing);
1455 break;
1038 default: 1456 default:
1039 break; 1457 break;
1040 } 1458 }
@@ -1058,7 +1476,10 @@ static int add_detailed_info(struct drm_connector *connector,
1058 1476
1059 for (i = 0; i < EDID_DETAILED_TIMINGS; i++) { 1477 for (i = 0; i < EDID_DETAILED_TIMINGS; i++) {
1060 struct detailed_timing *timing = &edid->detailed_timings[i]; 1478 struct detailed_timing *timing = &edid->detailed_timings[i];
1061 int preferred = (i == 0) && (edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING); 1479 int preferred = (i == 0);
1480
1481 if (preferred && edid->version == 1 && edid->revision < 4)
1482 preferred = (edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING);
1062 1483
1063 /* In 1.0, only timings are allowed */ 1484 /* In 1.0, only timings are allowed */
1064 if (!timing->pixel_clock && edid->version == 1 && 1485 if (!timing->pixel_clock && edid->version == 1 &&
@@ -1088,39 +1509,22 @@ static int add_detailed_info_eedid(struct drm_connector *connector,
1088 int i, modes = 0; 1509 int i, modes = 0;
1089 char *edid_ext = NULL; 1510 char *edid_ext = NULL;
1090 struct detailed_timing *timing; 1511 struct detailed_timing *timing;
1091 int edid_ext_num;
1092 int start_offset, end_offset; 1512 int start_offset, end_offset;
1093 int timing_level;
1094 1513
1095 if (edid->version == 1 && edid->revision < 3) { 1514 if (edid->version == 1 && edid->revision < 3)
1096 /* If the EDID version is less than 1.3, there is no
1097 * extension EDID.
1098 */
1099 return 0; 1515 return 0;
1100 } 1516 if (!edid->extensions)
1101 if (!edid->extensions) {
1102 /* if there is no extension EDID, it is unnecessary to
1103 * parse the E-EDID to get detailed info
1104 */
1105 return 0; 1517 return 0;
1106 }
1107
1108 /* Chose real EDID extension number */
1109 edid_ext_num = edid->extensions > DRM_MAX_EDID_EXT_NUM ?
1110 DRM_MAX_EDID_EXT_NUM : edid->extensions;
1111 1518
1112 /* Find CEA extension */ 1519 /* Find CEA extension */
1113 for (i = 0; i < edid_ext_num; i++) { 1520 for (i = 0; i < edid->extensions; i++) {
1114 edid_ext = (char *)edid + EDID_LENGTH * (i + 1); 1521 edid_ext = (char *)edid + EDID_LENGTH * (i + 1);
1115 /* This block is CEA extension */
1116 if (edid_ext[0] == 0x02) 1522 if (edid_ext[0] == 0x02)
1117 break; 1523 break;
1118 } 1524 }
1119 1525
1120 if (i == edid_ext_num) { 1526 if (i == edid->extensions)
1121 /* if there is no additional timing EDID block, return */
1122 return 0; 1527 return 0;
1123 }
1124 1528
1125 /* Get the start offset of detailed timing block */ 1529 /* Get the start offset of detailed timing block */
1126 start_offset = edid_ext[2]; 1530 start_offset = edid_ext[2];
@@ -1132,7 +1536,6 @@ static int add_detailed_info_eedid(struct drm_connector *connector,
1132 return 0; 1536 return 0;
1133 } 1537 }
1134 1538
1135 timing_level = standard_timing_level(edid);
1136 end_offset = EDID_LENGTH; 1539 end_offset = EDID_LENGTH;
1137 end_offset -= sizeof(struct detailed_timing); 1540 end_offset -= sizeof(struct detailed_timing);
1138 for (i = start_offset; i < end_offset; 1541 for (i = start_offset; i < end_offset;
@@ -1144,123 +1547,6 @@ static int add_detailed_info_eedid(struct drm_connector *connector,
1144 return modes; 1547 return modes;
1145} 1548}
1146 1549
1147#define DDC_ADDR 0x50
1148/**
1149 * Get EDID information via I2C.
1150 *
1151 * \param adapter : i2c device adaptor
1152 * \param buf : EDID data buffer to be filled
1153 * \param len : EDID data buffer length
1154 * \return 0 on success or -1 on failure.
1155 *
1156 * Try to fetch EDID information by calling i2c driver function.
1157 */
1158int drm_do_probe_ddc_edid(struct i2c_adapter *adapter,
1159 unsigned char *buf, int len)
1160{
1161 unsigned char start = 0x0;
1162 struct i2c_msg msgs[] = {
1163 {
1164 .addr = DDC_ADDR,
1165 .flags = 0,
1166 .len = 1,
1167 .buf = &start,
1168 }, {
1169 .addr = DDC_ADDR,
1170 .flags = I2C_M_RD,
1171 .len = len,
1172 .buf = buf,
1173 }
1174 };
1175
1176 if (i2c_transfer(adapter, msgs, 2) == 2)
1177 return 0;
1178
1179 return -1;
1180}
1181EXPORT_SYMBOL(drm_do_probe_ddc_edid);
1182
1183static int drm_ddc_read_edid(struct drm_connector *connector,
1184 struct i2c_adapter *adapter,
1185 char *buf, int len)
1186{
1187 int i;
1188
1189 for (i = 0; i < 4; i++) {
1190 if (drm_do_probe_ddc_edid(adapter, buf, len))
1191 return -1;
1192 if (drm_edid_is_valid((struct edid *)buf))
1193 return 0;
1194 }
1195
1196 /* repeated checksum failures; warn, but carry on */
1197 dev_warn(&connector->dev->pdev->dev, "%s: EDID invalid.\n",
1198 drm_get_connector_name(connector));
1199 return -1;
1200}
1201
1202/**
1203 * drm_get_edid - get EDID data, if available
1204 * @connector: connector we're probing
1205 * @adapter: i2c adapter to use for DDC
1206 *
1207 * Poke the given connector's i2c channel to grab EDID data if possible.
1208 *
1209 * Return edid data or NULL if we couldn't find any.
1210 */
1211struct edid *drm_get_edid(struct drm_connector *connector,
1212 struct i2c_adapter *adapter)
1213{
1214 int ret;
1215 struct edid *edid;
1216
1217 edid = kmalloc(EDID_LENGTH * (DRM_MAX_EDID_EXT_NUM + 1),
1218 GFP_KERNEL);
1219 if (edid == NULL) {
1220 dev_warn(&connector->dev->pdev->dev,
1221 "Failed to allocate EDID\n");
1222 goto end;
1223 }
1224
1225 /* Read first EDID block */
1226 ret = drm_ddc_read_edid(connector, adapter,
1227 (unsigned char *)edid, EDID_LENGTH);
1228 if (ret != 0)
1229 goto clean_up;
1230
1231 /* There are EDID extensions to be read */
1232 if (edid->extensions != 0) {
1233 int edid_ext_num = edid->extensions;
1234
1235 if (edid_ext_num > DRM_MAX_EDID_EXT_NUM) {
1236 dev_warn(&connector->dev->pdev->dev,
1237 "The number of extension(%d) is "
1238 "over max (%d), actually read number (%d)\n",
1239 edid_ext_num, DRM_MAX_EDID_EXT_NUM,
1240 DRM_MAX_EDID_EXT_NUM);
1241 /* Reset EDID extension number to be read */
1242 edid_ext_num = DRM_MAX_EDID_EXT_NUM;
1243 }
1244 /* Read EDID including extensions too */
1245 ret = drm_ddc_read_edid(connector, adapter, (char *)edid,
1246 EDID_LENGTH * (edid_ext_num + 1));
1247 if (ret != 0)
1248 goto clean_up;
1249
1250 }
1251
1252 connector->display_info.raw_edid = (char *)edid;
1253 goto end;
1254
1255clean_up:
1256 kfree(edid);
1257 edid = NULL;
1258end:
1259 return edid;
1260
1261}
1262EXPORT_SYMBOL(drm_get_edid);
1263
1264#define HDMI_IDENTIFIER 0x000C03 1550#define HDMI_IDENTIFIER 0x000C03
1265#define VENDOR_BLOCK 0x03 1551#define VENDOR_BLOCK 0x03
1266/** 1552/**
@@ -1273,7 +1559,7 @@ EXPORT_SYMBOL(drm_get_edid);
1273bool drm_detect_hdmi_monitor(struct edid *edid) 1559bool drm_detect_hdmi_monitor(struct edid *edid)
1274{ 1560{
1275 char *edid_ext = NULL; 1561 char *edid_ext = NULL;
1276 int i, hdmi_id, edid_ext_num; 1562 int i, hdmi_id;
1277 int start_offset, end_offset; 1563 int start_offset, end_offset;
1278 bool is_hdmi = false; 1564 bool is_hdmi = false;
1279 1565
@@ -1281,19 +1567,15 @@ bool drm_detect_hdmi_monitor(struct edid *edid)
1281 if (edid == NULL || edid->extensions == 0) 1567 if (edid == NULL || edid->extensions == 0)
1282 goto end; 1568 goto end;
1283 1569
1284 /* Chose real EDID extension number */
1285 edid_ext_num = edid->extensions > DRM_MAX_EDID_EXT_NUM ?
1286 DRM_MAX_EDID_EXT_NUM : edid->extensions;
1287
1288 /* Find CEA extension */ 1570 /* Find CEA extension */
1289 for (i = 0; i < edid_ext_num; i++) { 1571 for (i = 0; i < edid->extensions; i++) {
1290 edid_ext = (char *)edid + EDID_LENGTH * (i + 1); 1572 edid_ext = (char *)edid + EDID_LENGTH * (i + 1);
1291 /* This block is CEA extension */ 1573 /* This block is CEA extension */
1292 if (edid_ext[0] == 0x02) 1574 if (edid_ext[0] == 0x02)
1293 break; 1575 break;
1294 } 1576 }
1295 1577
1296 if (i == edid_ext_num) 1578 if (i == edid->extensions)
1297 goto end; 1579 goto end;
1298 1580
1299 /* Data block offset in CEA extension block */ 1581 /* Data block offset in CEA extension block */
@@ -1348,10 +1630,24 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
1348 1630
1349 quirks = edid_get_quirks(edid); 1631 quirks = edid_get_quirks(edid);
1350 1632
1351 num_modes += add_established_modes(connector, edid); 1633 /*
1352 num_modes += add_standard_modes(connector, edid); 1634 * EDID spec says modes should be preferred in this order:
1635 * - preferred detailed mode
1636 * - other detailed modes from base block
1637 * - detailed modes from extension blocks
1638 * - CVT 3-byte code modes
1639 * - standard timing codes
1640 * - established timing codes
1641 * - modes inferred from GTF or CVT range information
1642 *
1643 * We don't quite implement this yet, but we're close.
1644 *
1645 * XXX order for additional mode types in extension blocks?
1646 */
1353 num_modes += add_detailed_info(connector, edid, quirks); 1647 num_modes += add_detailed_info(connector, edid, quirks);
1354 num_modes += add_detailed_info_eedid(connector, edid, quirks); 1648 num_modes += add_detailed_info_eedid(connector, edid, quirks);
1649 num_modes += add_standard_modes(connector, edid);
1650 num_modes += add_established_modes(connector, edid);
1355 1651
1356 if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75)) 1652 if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
1357 edid_fixup_preferred(connector, quirks); 1653 edid_fixup_preferred(connector, quirks);