aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_edid.c
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2012-11-23 09:01:42 -0500
committerThierry Reding <thierry.reding@avionic-design.de>2013-02-22 02:20:00 -0500
commita6b21831772db4088bca770dc99697356e82a7e2 (patch)
tree14f91be2c87f35ec16af780a7bbd7170c874d13e /drivers/gpu/drm/drm_edid.c
parent18316c8c39a85c8b6e3db0a150b1bee5b6c4c053 (diff)
drm: Move mode tables to drm_edid.c
The modes are only used from within drm_edid.c so we move them there to avoid creating duplicates by multiple inclusion of drm_edid_modes.h. As a side-effect we can also get rid of a few variables that keep track of the number of entries in the tables and use ARRAY_SIZE() instead. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r--drivers/gpu/drm/drm_edid.c753
1 files changed, 746 insertions, 7 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 02da919f6c38..6995d2fa46cf 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -33,7 +33,6 @@
33#include <linux/module.h> 33#include <linux/module.h>
34#include <drm/drmP.h> 34#include <drm/drmP.h>
35#include <drm/drm_edid.h> 35#include <drm/drm_edid.h>
36#include "drm_edid_modes.h"
37 36
38#define version_greater(edid, maj, min) \ 37#define version_greater(edid, maj, min) \
39 (((edid)->version > (maj)) || \ 38 (((edid)->version > (maj)) || \
@@ -127,6 +126,746 @@ static struct edid_quirk {
127 { "VSC", 5020, EDID_QUIRK_FORCE_REDUCED_BLANKING }, 126 { "VSC", 5020, EDID_QUIRK_FORCE_REDUCED_BLANKING },
128}; 127};
129 128
129/*
130 * Autogenerated from the DMT spec.
131 * This table is copied from xfree86/modes/xf86EdidModes.c.
132 */
133static const struct drm_display_mode drm_dmt_modes[] = {
134 /* 640x350@85Hz */
135 { DRM_MODE("640x350", DRM_MODE_TYPE_DRIVER, 31500, 640, 672,
136 736, 832, 0, 350, 382, 385, 445, 0,
137 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
138 /* 640x400@85Hz */
139 { DRM_MODE("640x400", DRM_MODE_TYPE_DRIVER, 31500, 640, 672,
140 736, 832, 0, 400, 401, 404, 445, 0,
141 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
142 /* 720x400@85Hz */
143 { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 35500, 720, 756,
144 828, 936, 0, 400, 401, 404, 446, 0,
145 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
146 /* 640x480@60Hz */
147 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656,
148 752, 800, 0, 480, 489, 492, 525, 0,
149 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
150 /* 640x480@72Hz */
151 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 664,
152 704, 832, 0, 480, 489, 492, 520, 0,
153 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
154 /* 640x480@75Hz */
155 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 656,
156 720, 840, 0, 480, 481, 484, 500, 0,
157 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
158 /* 640x480@85Hz */
159 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 36000, 640, 696,
160 752, 832, 0, 480, 481, 484, 509, 0,
161 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
162 /* 800x600@56Hz */
163 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 36000, 800, 824,
164 896, 1024, 0, 600, 601, 603, 625, 0,
165 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
166 /* 800x600@60Hz */
167 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840,
168 968, 1056, 0, 600, 601, 605, 628, 0,
169 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
170 /* 800x600@72Hz */
171 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 50000, 800, 856,
172 976, 1040, 0, 600, 637, 643, 666, 0,
173 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
174 /* 800x600@75Hz */
175 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 49500, 800, 816,
176 896, 1056, 0, 600, 601, 604, 625, 0,
177 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
178 /* 800x600@85Hz */
179 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 56250, 800, 832,
180 896, 1048, 0, 600, 601, 604, 631, 0,
181 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
182 /* 800x600@120Hz RB */
183 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 73250, 800, 848,
184 880, 960, 0, 600, 603, 607, 636, 0,
185 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
186 /* 848x480@60Hz */
187 { DRM_MODE("848x480", DRM_MODE_TYPE_DRIVER, 33750, 848, 864,
188 976, 1088, 0, 480, 486, 494, 517, 0,
189 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
190 /* 1024x768@43Hz, interlace */
191 { DRM_MODE("1024x768i", DRM_MODE_TYPE_DRIVER, 44900, 1024, 1032,
192 1208, 1264, 0, 768, 768, 772, 817, 0,
193 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
194 DRM_MODE_FLAG_INTERLACE) },
195 /* 1024x768@60Hz */
196 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000, 1024, 1048,
197 1184, 1344, 0, 768, 771, 777, 806, 0,
198 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
199 /* 1024x768@70Hz */
200 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 75000, 1024, 1048,
201 1184, 1328, 0, 768, 771, 777, 806, 0,
202 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
203 /* 1024x768@75Hz */
204 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 78750, 1024, 1040,
205 1136, 1312, 0, 768, 769, 772, 800, 0,
206 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
207 /* 1024x768@85Hz */
208 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 94500, 1024, 1072,
209 1168, 1376, 0, 768, 769, 772, 808, 0,
210 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
211 /* 1024x768@120Hz RB */
212 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 115500, 1024, 1072,
213 1104, 1184, 0, 768, 771, 775, 813, 0,
214 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
215 /* 1152x864@75Hz */
216 { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216,
217 1344, 1600, 0, 864, 865, 868, 900, 0,
218 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
219 /* 1280x768@60Hz RB */
220 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 68250, 1280, 1328,
221 1360, 1440, 0, 768, 771, 778, 790, 0,
222 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
223 /* 1280x768@60Hz */
224 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 79500, 1280, 1344,
225 1472, 1664, 0, 768, 771, 778, 798, 0,
226 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
227 /* 1280x768@75Hz */
228 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 102250, 1280, 1360,
229 1488, 1696, 0, 768, 771, 778, 805, 0,
230 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
231 /* 1280x768@85Hz */
232 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 117500, 1280, 1360,
233 1496, 1712, 0, 768, 771, 778, 809, 0,
234 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
235 /* 1280x768@120Hz RB */
236 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER, 140250, 1280, 1328,
237 1360, 1440, 0, 768, 771, 778, 813, 0,
238 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
239 /* 1280x800@60Hz RB */
240 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 71000, 1280, 1328,
241 1360, 1440, 0, 800, 803, 809, 823, 0,
242 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
243 /* 1280x800@60Hz */
244 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 83500, 1280, 1352,
245 1480, 1680, 0, 800, 803, 809, 831, 0,
246 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
247 /* 1280x800@75Hz */
248 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 106500, 1280, 1360,
249 1488, 1696, 0, 800, 803, 809, 838, 0,
250 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
251 /* 1280x800@85Hz */
252 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 122500, 1280, 1360,
253 1496, 1712, 0, 800, 803, 809, 843, 0,
254 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
255 /* 1280x800@120Hz RB */
256 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER, 146250, 1280, 1328,
257 1360, 1440, 0, 800, 803, 809, 847, 0,
258 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
259 /* 1280x960@60Hz */
260 { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1376,
261 1488, 1800, 0, 960, 961, 964, 1000, 0,
262 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
263 /* 1280x960@85Hz */
264 { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1344,
265 1504, 1728, 0, 960, 961, 964, 1011, 0,
266 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
267 /* 1280x960@120Hz RB */
268 { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER, 175500, 1280, 1328,
269 1360, 1440, 0, 960, 963, 967, 1017, 0,
270 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
271 /* 1280x1024@60Hz */
272 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 108000, 1280, 1328,
273 1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
274 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
275 /* 1280x1024@75Hz */
276 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 135000, 1280, 1296,
277 1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
278 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
279 /* 1280x1024@85Hz */
280 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 157500, 1280, 1344,
281 1504, 1728, 0, 1024, 1025, 1028, 1072, 0,
282 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
283 /* 1280x1024@120Hz RB */
284 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 187250, 1280, 1328,
285 1360, 1440, 0, 1024, 1027, 1034, 1084, 0,
286 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
287 /* 1360x768@60Hz */
288 { DRM_MODE("1360x768", DRM_MODE_TYPE_DRIVER, 85500, 1360, 1424,
289 1536, 1792, 0, 768, 771, 777, 795, 0,
290 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
291 /* 1360x768@120Hz RB */
292 { DRM_MODE("1360x768", DRM_MODE_TYPE_DRIVER, 148250, 1360, 1408,
293 1440, 1520, 0, 768, 771, 776, 813, 0,
294 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
295 /* 1400x1050@60Hz RB */
296 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 101000, 1400, 1448,
297 1480, 1560, 0, 1050, 1053, 1057, 1080, 0,
298 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
299 /* 1400x1050@60Hz */
300 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 121750, 1400, 1488,
301 1632, 1864, 0, 1050, 1053, 1057, 1089, 0,
302 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
303 /* 1400x1050@75Hz */
304 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 156000, 1400, 1504,
305 1648, 1896, 0, 1050, 1053, 1057, 1099, 0,
306 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
307 /* 1400x1050@85Hz */
308 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 179500, 1400, 1504,
309 1656, 1912, 0, 1050, 1053, 1057, 1105, 0,
310 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
311 /* 1400x1050@120Hz RB */
312 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER, 208000, 1400, 1448,
313 1480, 1560, 0, 1050, 1053, 1057, 1112, 0,
314 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
315 /* 1440x900@60Hz RB */
316 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 88750, 1440, 1488,
317 1520, 1600, 0, 900, 903, 909, 926, 0,
318 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
319 /* 1440x900@60Hz */
320 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 106500, 1440, 1520,
321 1672, 1904, 0, 900, 903, 909, 934, 0,
322 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
323 /* 1440x900@75Hz */
324 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 136750, 1440, 1536,
325 1688, 1936, 0, 900, 903, 909, 942, 0,
326 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
327 /* 1440x900@85Hz */
328 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 157000, 1440, 1544,
329 1696, 1952, 0, 900, 903, 909, 948, 0,
330 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
331 /* 1440x900@120Hz RB */
332 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER, 182750, 1440, 1488,
333 1520, 1600, 0, 900, 903, 909, 953, 0,
334 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
335 /* 1600x1200@60Hz */
336 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 162000, 1600, 1664,
337 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
338 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
339 /* 1600x1200@65Hz */
340 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 175500, 1600, 1664,
341 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
342 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
343 /* 1600x1200@70Hz */
344 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 189000, 1600, 1664,
345 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
346 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
347 /* 1600x1200@75Hz */
348 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 202500, 1600, 1664,
349 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
350 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
351 /* 1600x1200@85Hz */
352 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 229500, 1600, 1664,
353 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
354 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
355 /* 1600x1200@120Hz RB */
356 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER, 268250, 1600, 1648,
357 1680, 1760, 0, 1200, 1203, 1207, 1271, 0,
358 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
359 /* 1680x1050@60Hz RB */
360 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 119000, 1680, 1728,
361 1760, 1840, 0, 1050, 1053, 1059, 1080, 0,
362 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
363 /* 1680x1050@60Hz */
364 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 146250, 1680, 1784,
365 1960, 2240, 0, 1050, 1053, 1059, 1089, 0,
366 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
367 /* 1680x1050@75Hz */
368 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 187000, 1680, 1800,
369 1976, 2272, 0, 1050, 1053, 1059, 1099, 0,
370 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
371 /* 1680x1050@85Hz */
372 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 214750, 1680, 1808,
373 1984, 2288, 0, 1050, 1053, 1059, 1105, 0,
374 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
375 /* 1680x1050@120Hz RB */
376 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER, 245500, 1680, 1728,
377 1760, 1840, 0, 1050, 1053, 1059, 1112, 0,
378 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
379 /* 1792x1344@60Hz */
380 { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 204750, 1792, 1920,
381 2120, 2448, 0, 1344, 1345, 1348, 1394, 0,
382 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
383 /* 1792x1344@75Hz */
384 { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 261000, 1792, 1888,
385 2104, 2456, 0, 1344, 1345, 1348, 1417, 0,
386 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
387 /* 1792x1344@120Hz RB */
388 { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER, 333250, 1792, 1840,
389 1872, 1952, 0, 1344, 1347, 1351, 1423, 0,
390 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
391 /* 1856x1392@60Hz */
392 { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 218250, 1856, 1952,
393 2176, 2528, 0, 1392, 1393, 1396, 1439, 0,
394 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
395 /* 1856x1392@75Hz */
396 { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 288000, 1856, 1984,
397 2208, 2560, 0, 1392, 1395, 1399, 1500, 0,
398 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
399 /* 1856x1392@120Hz RB */
400 { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER, 356500, 1856, 1904,
401 1936, 2016, 0, 1392, 1395, 1399, 1474, 0,
402 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
403 /* 1920x1200@60Hz RB */
404 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 154000, 1920, 1968,
405 2000, 2080, 0, 1200, 1203, 1209, 1235, 0,
406 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
407 /* 1920x1200@60Hz */
408 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 193250, 1920, 2056,
409 2256, 2592, 0, 1200, 1203, 1209, 1245, 0,
410 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
411 /* 1920x1200@75Hz */
412 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 245250, 1920, 2056,
413 2264, 2608, 0, 1200, 1203, 1209, 1255, 0,
414 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
415 /* 1920x1200@85Hz */
416 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 281250, 1920, 2064,
417 2272, 2624, 0, 1200, 1203, 1209, 1262, 0,
418 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
419 /* 1920x1200@120Hz RB */
420 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER, 317000, 1920, 1968,
421 2000, 2080, 0, 1200, 1203, 1209, 1271, 0,
422 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
423 /* 1920x1440@60Hz */
424 { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 234000, 1920, 2048,
425 2256, 2600, 0, 1440, 1441, 1444, 1500, 0,
426 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
427 /* 1920x1440@75Hz */
428 { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2064,
429 2288, 2640, 0, 1440, 1441, 1444, 1500, 0,
430 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
431 /* 1920x1440@120Hz RB */
432 { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER, 380500, 1920, 1968,
433 2000, 2080, 0, 1440, 1443, 1447, 1525, 0,
434 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
435 /* 2560x1600@60Hz RB */
436 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 268500, 2560, 2608,
437 2640, 2720, 0, 1600, 1603, 1609, 1646, 0,
438 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
439 /* 2560x1600@60Hz */
440 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 348500, 2560, 2752,
441 3032, 3504, 0, 1600, 1603, 1609, 1658, 0,
442 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
443 /* 2560x1600@75HZ */
444 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 443250, 2560, 2768,
445 3048, 3536, 0, 1600, 1603, 1609, 1672, 0,
446 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
447 /* 2560x1600@85HZ */
448 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 505250, 2560, 2768,
449 3048, 3536, 0, 1600, 1603, 1609, 1682, 0,
450 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
451 /* 2560x1600@120Hz RB */
452 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER, 552750, 2560, 2608,
453 2640, 2720, 0, 1600, 1603, 1609, 1694, 0,
454 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC) },
455};
456
457static const struct drm_display_mode edid_est_modes[] = {
458 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 40000, 800, 840,
459 968, 1056, 0, 600, 601, 605, 628, 0,
460 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@60Hz */
461 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 36000, 800, 824,
462 896, 1024, 0, 600, 601, 603, 625, 0,
463 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@56Hz */
464 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 656,
465 720, 840, 0, 480, 481, 484, 500, 0,
466 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@75Hz */
467 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 31500, 640, 664,
468 704, 832, 0, 480, 489, 491, 520, 0,
469 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@72Hz */
470 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 30240, 640, 704,
471 768, 864, 0, 480, 483, 486, 525, 0,
472 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@67Hz */
473 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25200, 640, 656,
474 752, 800, 0, 480, 490, 492, 525, 0,
475 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 640x480@60Hz */
476 { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 35500, 720, 738,
477 846, 900, 0, 400, 421, 423, 449, 0,
478 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 720x400@88Hz */
479 { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 28320, 720, 738,
480 846, 900, 0, 400, 412, 414, 449, 0,
481 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 720x400@70Hz */
482 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 135000, 1280, 1296,
483 1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
484 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1280x1024@75Hz */
485 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 78800, 1024, 1040,
486 1136, 1312, 0, 768, 769, 772, 800, 0,
487 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1024x768@75Hz */
488 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 75000, 1024, 1048,
489 1184, 1328, 0, 768, 771, 777, 806, 0,
490 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1024x768@70Hz */
491 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 65000, 1024, 1048,
492 1184, 1344, 0, 768, 771, 777, 806, 0,
493 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 1024x768@60Hz */
494 { DRM_MODE("1024x768i", DRM_MODE_TYPE_DRIVER,44900, 1024, 1032,
495 1208, 1264, 0, 768, 768, 776, 817, 0,
496 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_INTERLACE) }, /* 1024x768@43Hz */
497 { DRM_MODE("832x624", DRM_MODE_TYPE_DRIVER, 57284, 832, 864,
498 928, 1152, 0, 624, 625, 628, 667, 0,
499 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) }, /* 832x624@75Hz */
500 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 49500, 800, 816,
501 896, 1056, 0, 600, 601, 604, 625, 0,
502 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@75Hz */
503 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 50000, 800, 856,
504 976, 1040, 0, 600, 637, 643, 666, 0,
505 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 800x600@72Hz */
506 { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER, 108000, 1152, 1216,
507 1344, 1600, 0, 864, 865, 868, 900, 0,
508 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }, /* 1152x864@75Hz */
509};
510
511struct minimode {
512 short w;
513 short h;
514 short r;
515 short rb;
516};
517
518static const struct minimode est3_modes[] = {
519 /* byte 6 */
520 { 640, 350, 85, 0 },
521 { 640, 400, 85, 0 },
522 { 720, 400, 85, 0 },
523 { 640, 480, 85, 0 },
524 { 848, 480, 60, 0 },
525 { 800, 600, 85, 0 },
526 { 1024, 768, 85, 0 },
527 { 1152, 864, 75, 0 },
528 /* byte 7 */
529 { 1280, 768, 60, 1 },
530 { 1280, 768, 60, 0 },
531 { 1280, 768, 75, 0 },
532 { 1280, 768, 85, 0 },
533 { 1280, 960, 60, 0 },
534 { 1280, 960, 85, 0 },
535 { 1280, 1024, 60, 0 },
536 { 1280, 1024, 85, 0 },
537 /* byte 8 */
538 { 1360, 768, 60, 0 },
539 { 1440, 900, 60, 1 },
540 { 1440, 900, 60, 0 },
541 { 1440, 900, 75, 0 },
542 { 1440, 900, 85, 0 },
543 { 1400, 1050, 60, 1 },
544 { 1400, 1050, 60, 0 },
545 { 1400, 1050, 75, 0 },
546 /* byte 9 */
547 { 1400, 1050, 85, 0 },
548 { 1680, 1050, 60, 1 },
549 { 1680, 1050, 60, 0 },
550 { 1680, 1050, 75, 0 },
551 { 1680, 1050, 85, 0 },
552 { 1600, 1200, 60, 0 },
553 { 1600, 1200, 65, 0 },
554 { 1600, 1200, 70, 0 },
555 /* byte 10 */
556 { 1600, 1200, 75, 0 },
557 { 1600, 1200, 85, 0 },
558 { 1792, 1344, 60, 0 },
559 { 1792, 1344, 85, 0 },
560 { 1856, 1392, 60, 0 },
561 { 1856, 1392, 75, 0 },
562 { 1920, 1200, 60, 1 },
563 { 1920, 1200, 60, 0 },
564 /* byte 11 */
565 { 1920, 1200, 75, 0 },
566 { 1920, 1200, 85, 0 },
567 { 1920, 1440, 60, 0 },
568 { 1920, 1440, 75, 0 },
569};
570
571static const struct minimode extra_modes[] = {
572 { 1024, 576, 60, 0 },
573 { 1366, 768, 60, 0 },
574 { 1600, 900, 60, 0 },
575 { 1680, 945, 60, 0 },
576 { 1920, 1080, 60, 0 },
577 { 2048, 1152, 60, 0 },
578 { 2048, 1536, 60, 0 },
579};
580
581/*
582 * Probably taken from CEA-861 spec.
583 * This table is converted from xorg's hw/xfree86/modes/xf86EdidModes.c.
584 */
585static const struct drm_display_mode edid_cea_modes[] = {
586 /* 1 - 640x480@60Hz */
587 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656,
588 752, 800, 0, 480, 490, 492, 525, 0,
589 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
590 /* 2 - 720x480@60Hz */
591 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 27000, 720, 736,
592 798, 858, 0, 480, 489, 495, 525, 0,
593 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
594 /* 3 - 720x480@60Hz */
595 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 27000, 720, 736,
596 798, 858, 0, 480, 489, 495, 525, 0,
597 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
598 /* 4 - 1280x720@60Hz */
599 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1390,
600 1430, 1650, 0, 720, 725, 730, 750, 0,
601 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
602 /* 5 - 1920x1080i@60Hz */
603 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2008,
604 2052, 2200, 0, 1080, 1084, 1094, 1125, 0,
605 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
606 DRM_MODE_FLAG_INTERLACE) },
607 /* 6 - 1440x480i@60Hz */
608 { DRM_MODE("1440x480i", DRM_MODE_TYPE_DRIVER, 27000, 1440, 1478,
609 1602, 1716, 0, 480, 488, 494, 525, 0,
610 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
611 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
612 /* 7 - 1440x480i@60Hz */
613 { DRM_MODE("1440x480i", DRM_MODE_TYPE_DRIVER, 27000, 1440, 1478,
614 1602, 1716, 0, 480, 488, 494, 525, 0,
615 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
616 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
617 /* 8 - 1440x240@60Hz */
618 { DRM_MODE("1440x240", DRM_MODE_TYPE_DRIVER, 27000, 1440, 1478,
619 1602, 1716, 0, 240, 244, 247, 262, 0,
620 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
621 DRM_MODE_FLAG_DBLCLK) },
622 /* 9 - 1440x240@60Hz */
623 { DRM_MODE("1440x240", DRM_MODE_TYPE_DRIVER, 27000, 1440, 1478,
624 1602, 1716, 0, 240, 244, 247, 262, 0,
625 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
626 DRM_MODE_FLAG_DBLCLK) },
627 /* 10 - 2880x480i@60Hz */
628 { DRM_MODE("2880x480i", DRM_MODE_TYPE_DRIVER, 54000, 2880, 2956,
629 3204, 3432, 0, 480, 488, 494, 525, 0,
630 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
631 DRM_MODE_FLAG_INTERLACE) },
632 /* 11 - 2880x480i@60Hz */
633 { DRM_MODE("2880x480i", DRM_MODE_TYPE_DRIVER, 54000, 2880, 2956,
634 3204, 3432, 0, 480, 488, 494, 525, 0,
635 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
636 DRM_MODE_FLAG_INTERLACE) },
637 /* 12 - 2880x240@60Hz */
638 { DRM_MODE("2880x240", DRM_MODE_TYPE_DRIVER, 54000, 2880, 2956,
639 3204, 3432, 0, 240, 244, 247, 262, 0,
640 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
641 /* 13 - 2880x240@60Hz */
642 { DRM_MODE("2880x240", DRM_MODE_TYPE_DRIVER, 54000, 2880, 2956,
643 3204, 3432, 0, 240, 244, 247, 262, 0,
644 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
645 /* 14 - 1440x480@60Hz */
646 { DRM_MODE("1440x480", DRM_MODE_TYPE_DRIVER, 54000, 1440, 1472,
647 1596, 1716, 0, 480, 489, 495, 525, 0,
648 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
649 /* 15 - 1440x480@60Hz */
650 { DRM_MODE("1440x480", DRM_MODE_TYPE_DRIVER, 54000, 1440, 1472,
651 1596, 1716, 0, 480, 489, 495, 525, 0,
652 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
653 /* 16 - 1920x1080@60Hz */
654 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2008,
655 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
656 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
657 /* 17 - 720x576@50Hz */
658 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 27000, 720, 732,
659 796, 864, 0, 576, 581, 586, 625, 0,
660 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
661 /* 18 - 720x576@50Hz */
662 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 27000, 720, 732,
663 796, 864, 0, 576, 581, 586, 625, 0,
664 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
665 /* 19 - 1280x720@50Hz */
666 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 1720,
667 1760, 1980, 0, 720, 725, 730, 750, 0,
668 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
669 /* 20 - 1920x1080i@50Hz */
670 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2448,
671 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
672 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
673 DRM_MODE_FLAG_INTERLACE) },
674 /* 21 - 1440x576i@50Hz */
675 { DRM_MODE("1440x576i", DRM_MODE_TYPE_DRIVER, 27000, 1440, 1464,
676 1590, 1728, 0, 576, 580, 586, 625, 0,
677 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
678 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
679 /* 22 - 1440x576i@50Hz */
680 { DRM_MODE("1440x576i", DRM_MODE_TYPE_DRIVER, 27000, 1440, 1464,
681 1590, 1728, 0, 576, 580, 586, 625, 0,
682 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
683 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
684 /* 23 - 1440x288@50Hz */
685 { DRM_MODE("1440x288", DRM_MODE_TYPE_DRIVER, 27000, 1440, 1464,
686 1590, 1728, 0, 288, 290, 293, 312, 0,
687 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
688 DRM_MODE_FLAG_DBLCLK) },
689 /* 24 - 1440x288@50Hz */
690 { DRM_MODE("1440x288", DRM_MODE_TYPE_DRIVER, 27000, 1440, 1464,
691 1590, 1728, 0, 288, 290, 293, 312, 0,
692 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
693 DRM_MODE_FLAG_DBLCLK) },
694 /* 25 - 2880x576i@50Hz */
695 { DRM_MODE("2880x576i", DRM_MODE_TYPE_DRIVER, 54000, 2880, 2928,
696 3180, 3456, 0, 576, 580, 586, 625, 0,
697 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
698 DRM_MODE_FLAG_INTERLACE) },
699 /* 26 - 2880x576i@50Hz */
700 { DRM_MODE("2880x576i", DRM_MODE_TYPE_DRIVER, 54000, 2880, 2928,
701 3180, 3456, 0, 576, 580, 586, 625, 0,
702 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
703 DRM_MODE_FLAG_INTERLACE) },
704 /* 27 - 2880x288@50Hz */
705 { DRM_MODE("2880x288", DRM_MODE_TYPE_DRIVER, 54000, 2880, 2928,
706 3180, 3456, 0, 288, 290, 293, 312, 0,
707 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
708 /* 28 - 2880x288@50Hz */
709 { DRM_MODE("2880x288", DRM_MODE_TYPE_DRIVER, 54000, 2880, 2928,
710 3180, 3456, 0, 288, 290, 293, 312, 0,
711 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
712 /* 29 - 1440x576@50Hz */
713 { DRM_MODE("1440x576", DRM_MODE_TYPE_DRIVER, 54000, 1440, 1464,
714 1592, 1728, 0, 576, 581, 586, 625, 0,
715 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
716 /* 30 - 1440x576@50Hz */
717 { DRM_MODE("1440x576", DRM_MODE_TYPE_DRIVER, 54000, 1440, 1464,
718 1592, 1728, 0, 576, 581, 586, 625, 0,
719 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
720 /* 31 - 1920x1080@50Hz */
721 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2448,
722 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
723 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
724 /* 32 - 1920x1080@24Hz */
725 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2558,
726 2602, 2750, 0, 1080, 1084, 1089, 1125, 0,
727 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
728 /* 33 - 1920x1080@25Hz */
729 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2448,
730 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
731 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
732 /* 34 - 1920x1080@30Hz */
733 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 74250, 1920, 2008,
734 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
735 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
736 /* 35 - 2880x480@60Hz */
737 { DRM_MODE("2880x480", DRM_MODE_TYPE_DRIVER, 108000, 2880, 2944,
738 3192, 3432, 0, 480, 489, 495, 525, 0,
739 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
740 /* 36 - 2880x480@60Hz */
741 { DRM_MODE("2880x480", DRM_MODE_TYPE_DRIVER, 108000, 2880, 2944,
742 3192, 3432, 0, 480, 489, 495, 525, 0,
743 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
744 /* 37 - 2880x576@50Hz */
745 { DRM_MODE("2880x576", DRM_MODE_TYPE_DRIVER, 108000, 2880, 2928,
746 3184, 3456, 0, 576, 581, 586, 625, 0,
747 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
748 /* 38 - 2880x576@50Hz */
749 { DRM_MODE("2880x576", DRM_MODE_TYPE_DRIVER, 108000, 2880, 2928,
750 3184, 3456, 0, 576, 581, 586, 625, 0,
751 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
752 /* 39 - 1920x1080i@50Hz */
753 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER, 72000, 1920, 1952,
754 2120, 2304, 0, 1080, 1126, 1136, 1250, 0,
755 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC |
756 DRM_MODE_FLAG_INTERLACE) },
757 /* 40 - 1920x1080i@100Hz */
758 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2448,
759 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
760 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
761 DRM_MODE_FLAG_INTERLACE) },
762 /* 41 - 1280x720@100Hz */
763 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1720,
764 1760, 1980, 0, 720, 725, 730, 750, 0,
765 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
766 /* 42 - 720x576@100Hz */
767 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 54000, 720, 732,
768 796, 864, 0, 576, 581, 586, 625, 0,
769 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
770 /* 43 - 720x576@100Hz */
771 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 54000, 720, 732,
772 796, 864, 0, 576, 581, 586, 625, 0,
773 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
774 /* 44 - 1440x576i@100Hz */
775 { DRM_MODE("1440x576", DRM_MODE_TYPE_DRIVER, 54000, 1440, 1464,
776 1590, 1728, 0, 576, 580, 586, 625, 0,
777 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
778 DRM_MODE_FLAG_DBLCLK) },
779 /* 45 - 1440x576i@100Hz */
780 { DRM_MODE("1440x576", DRM_MODE_TYPE_DRIVER, 54000, 1440, 1464,
781 1590, 1728, 0, 576, 580, 586, 625, 0,
782 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
783 DRM_MODE_FLAG_DBLCLK) },
784 /* 46 - 1920x1080i@120Hz */
785 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER, 148500, 1920, 2008,
786 2052, 2200, 0, 1080, 1084, 1094, 1125, 0,
787 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC |
788 DRM_MODE_FLAG_INTERLACE) },
789 /* 47 - 1280x720@120Hz */
790 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 148500, 1280, 1390,
791 1430, 1650, 0, 720, 725, 730, 750, 0,
792 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
793 /* 48 - 720x480@120Hz */
794 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 54000, 720, 736,
795 798, 858, 0, 480, 489, 495, 525, 0,
796 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
797 /* 49 - 720x480@120Hz */
798 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 54000, 720, 736,
799 798, 858, 0, 480, 489, 495, 525, 0,
800 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
801 /* 50 - 1440x480i@120Hz */
802 { DRM_MODE("1440x480i", DRM_MODE_TYPE_DRIVER, 54000, 1440, 1478,
803 1602, 1716, 0, 480, 488, 494, 525, 0,
804 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
805 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
806 /* 51 - 1440x480i@120Hz */
807 { DRM_MODE("1440x480i", DRM_MODE_TYPE_DRIVER, 54000, 1440, 1478,
808 1602, 1716, 0, 480, 488, 494, 525, 0,
809 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
810 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
811 /* 52 - 720x576@200Hz */
812 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 108000, 720, 732,
813 796, 864, 0, 576, 581, 586, 625, 0,
814 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
815 /* 53 - 720x576@200Hz */
816 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 108000, 720, 732,
817 796, 864, 0, 576, 581, 586, 625, 0,
818 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
819 /* 54 - 1440x576i@200Hz */
820 { DRM_MODE("1440x576i", DRM_MODE_TYPE_DRIVER, 108000, 1440, 1464,
821 1590, 1728, 0, 576, 580, 586, 625, 0,
822 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
823 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
824 /* 55 - 1440x576i@200Hz */
825 { DRM_MODE("1440x576i", DRM_MODE_TYPE_DRIVER, 108000, 1440, 1464,
826 1590, 1728, 0, 576, 580, 586, 625, 0,
827 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
828 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
829 /* 56 - 720x480@240Hz */
830 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 108000, 720, 736,
831 798, 858, 0, 480, 489, 495, 525, 0,
832 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
833 /* 57 - 720x480@240Hz */
834 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 108000, 720, 736,
835 798, 858, 0, 480, 489, 495, 525, 0,
836 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC) },
837 /* 58 - 1440x480i@240 */
838 { DRM_MODE("1440x480i", DRM_MODE_TYPE_DRIVER, 108000, 1440, 1478,
839 1602, 1716, 0, 480, 488, 494, 525, 0,
840 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
841 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
842 /* 59 - 1440x480i@240 */
843 { DRM_MODE("1440x480i", DRM_MODE_TYPE_DRIVER, 108000, 1440, 1478,
844 1602, 1716, 0, 480, 488, 494, 525, 0,
845 DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC |
846 DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLCLK) },
847 /* 60 - 1280x720@24Hz */
848 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 59400, 1280, 3040,
849 3080, 3300, 0, 720, 725, 730, 750, 0,
850 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
851 /* 61 - 1280x720@25Hz */
852 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 3700,
853 3740, 3960, 0, 720, 725, 730, 750, 0,
854 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
855 /* 62 - 1280x720@30Hz */
856 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER, 74250, 1280, 3040,
857 3080, 3300, 0, 720, 725, 730, 750, 0,
858 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
859 /* 63 - 1920x1080@120Hz */
860 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2008,
861 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
862 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
863 /* 64 - 1920x1080@100Hz */
864 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER, 297000, 1920, 2448,
865 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
866 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
867};
868
130/*** DDC fetch and block validation ***/ 869/*** DDC fetch and block validation ***/
131 870
132static const u8 edid_header[] = { 871static const u8 edid_header[] = {
@@ -542,7 +1281,7 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
542{ 1281{
543 int i; 1282 int i;
544 1283
545 for (i = 0; i < drm_num_dmt_modes; i++) { 1284 for (i = 0; i < ARRAY_SIZE(drm_dmt_modes); i++) {
546 const struct drm_display_mode *ptr = &drm_dmt_modes[i]; 1285 const struct drm_display_mode *ptr = &drm_dmt_modes[i];
547 if (hsize != ptr->hdisplay) 1286 if (hsize != ptr->hdisplay)
548 continue; 1287 continue;
@@ -1083,7 +1822,7 @@ drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
1083 struct drm_display_mode *newmode; 1822 struct drm_display_mode *newmode;
1084 struct drm_device *dev = connector->dev; 1823 struct drm_device *dev = connector->dev;
1085 1824
1086 for (i = 0; i < drm_num_dmt_modes; i++) { 1825 for (i = 0; i < ARRAY_SIZE(drm_dmt_modes); i++) {
1087 if (mode_in_range(drm_dmt_modes + i, edid, timing) && 1826 if (mode_in_range(drm_dmt_modes + i, edid, timing) &&
1088 valid_inferred_mode(connector, drm_dmt_modes + i)) { 1827 valid_inferred_mode(connector, drm_dmt_modes + i)) {
1089 newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]); 1828 newmode = drm_mode_duplicate(dev, &drm_dmt_modes[i]);
@@ -1118,7 +1857,7 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
1118 struct drm_display_mode *newmode; 1857 struct drm_display_mode *newmode;
1119 struct drm_device *dev = connector->dev; 1858 struct drm_device *dev = connector->dev;
1120 1859
1121 for (i = 0; i < num_extra_modes; i++) { 1860 for (i = 0; i < ARRAY_SIZE(extra_modes); i++) {
1122 const struct minimode *m = &extra_modes[i]; 1861 const struct minimode *m = &extra_modes[i];
1123 newmode = drm_gtf_mode(dev, m->w, m->h, m->r, 0, 0); 1862 newmode = drm_gtf_mode(dev, m->w, m->h, m->r, 0, 0);
1124 if (!newmode) 1863 if (!newmode)
@@ -1147,7 +1886,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
1147 struct drm_device *dev = connector->dev; 1886 struct drm_device *dev = connector->dev;
1148 bool rb = drm_monitor_supports_rb(edid); 1887 bool rb = drm_monitor_supports_rb(edid);
1149 1888
1150 for (i = 0; i < num_extra_modes; i++) { 1889 for (i = 0; i < ARRAY_SIZE(extra_modes); i++) {
1151 const struct minimode *m = &extra_modes[i]; 1890 const struct minimode *m = &extra_modes[i];
1152 newmode = drm_cvt_mode(dev, m->w, m->h, m->r, rb, 0, 0); 1891 newmode = drm_cvt_mode(dev, m->w, m->h, m->r, rb, 0, 0);
1153 if (!newmode) 1892 if (!newmode)
@@ -1528,7 +2267,7 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match)
1528 struct drm_display_mode *cea_mode; 2267 struct drm_display_mode *cea_mode;
1529 u8 mode; 2268 u8 mode;
1530 2269
1531 for (mode = 0; mode < drm_num_cea_modes; mode++) { 2270 for (mode = 0; mode < ARRAY_SIZE(edid_cea_modes); mode++) {
1532 cea_mode = (struct drm_display_mode *)&edid_cea_modes[mode]; 2271 cea_mode = (struct drm_display_mode *)&edid_cea_modes[mode];
1533 2272
1534 if (drm_mode_equal(to_match, cea_mode)) 2273 if (drm_mode_equal(to_match, cea_mode))
@@ -1548,7 +2287,7 @@ do_cea_modes (struct drm_connector *connector, u8 *db, u8 len)
1548 2287
1549 for (mode = db; mode < db + len; mode++) { 2288 for (mode = db; mode < db + len; mode++) {
1550 cea_mode = (*mode & 127) - 1; /* CEA modes are numbered 1..127 */ 2289 cea_mode = (*mode & 127) - 1; /* CEA modes are numbered 1..127 */
1551 if (cea_mode < drm_num_cea_modes) { 2290 if (cea_mode < ARRAY_SIZE(edid_cea_modes)) {
1552 struct drm_display_mode *newmode; 2291 struct drm_display_mode *newmode;
1553 newmode = drm_mode_duplicate(dev, 2292 newmode = drm_mode_duplicate(dev,
1554 &edid_cea_modes[cea_mode]); 2293 &edid_cea_modes[cea_mode]);