2 * Copyright (c) 2006 Luc Verhaegen (quirks list)
3 * Copyright (c) 2007-2008 Intel Corporation
4 * Jesse Barnes <jesse.barnes@intel.com>
5 * Copyright 2010 Red Hat, Inc.
7 * DDC probing routines (drm_ddc_read & drm_do_probe_ddc_edid) originally from
9 * Copyright (C) 2006 Dennis Munsie <dmunsie@cecropia.com>
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sub license,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice (including the
19 * next paragraph) shall be included in all copies or substantial portions
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
25 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28 * DEALINGS IN THE SOFTWARE.
35 #include <linux/kernel.h>
36 #include <linux/slab.h>
37 #include <linux/hdmi.h>
38 #include <linux/i2c.h>
39 #include <linux/module.h>
40 #include <linux/vga_switcheroo.h>
42 #include <drm/drm_edid.h>
43 #include <drm/drm_encoder.h>
44 #include <drm/drm_displayid.h>
45 #include <drm/drm_scdc_helper.h>
47 #include "drm_crtc_internal.h"
49 #define version_greater(edid, maj, min) \
50 (((edid)->version > (maj)) || \
51 ((edid)->version == (maj) && (edid)->revision > (min)))
53 #define EDID_EST_TIMINGS 16
54 #define EDID_STD_TIMINGS 8
55 #define EDID_DETAILED_TIMINGS 4
58 * EDID blocks out in the wild have a variety of bugs, try to collect
59 * them here (note that userspace may work around broken monitors first,
60 * but fixes should make their way here so that the kernel "just works"
61 * on as many displays as possible).
64 /* First detailed mode wrong, use largest 60Hz mode */
65 #define EDID_QUIRK_PREFER_LARGE_60 (1 << 0)
66 /* Reported 135MHz pixel clock is too high, needs adjustment */
67 #define EDID_QUIRK_135_CLOCK_TOO_HIGH (1 << 1)
68 /* Prefer the largest mode at 75 Hz */
69 #define EDID_QUIRK_PREFER_LARGE_75 (1 << 2)
70 /* Detail timing is in cm not mm */
71 #define EDID_QUIRK_DETAILED_IN_CM (1 << 3)
72 /* Detailed timing descriptors have bogus size values, so just take the
73 * maximum size and use that.
75 #define EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE (1 << 4)
76 /* Monitor forgot to set the first detailed is preferred bit. */
77 #define EDID_QUIRK_FIRST_DETAILED_PREFERRED (1 << 5)
78 /* use +hsync +vsync for detailed mode */
79 #define EDID_QUIRK_DETAILED_SYNC_PP (1 << 6)
80 /* Force reduced-blanking timings for detailed modes */
81 #define EDID_QUIRK_FORCE_REDUCED_BLANKING (1 << 7)
83 #define EDID_QUIRK_FORCE_8BPC (1 << 8)
85 #define EDID_QUIRK_FORCE_12BPC (1 << 9)
87 #define EDID_QUIRK_FORCE_6BPC (1 << 10)
89 #define EDID_QUIRK_FORCE_10BPC (1 << 11)
90 /* Non desktop display (i.e. HMD) */
91 #define EDID_QUIRK_NON_DESKTOP (1 << 12)
93 struct detailed_mode_closure
{
94 struct drm_connector
*connector
;
106 static const struct edid_quirk
{
110 } edid_quirk_list
[] = {
112 { "ACR", 44358, EDID_QUIRK_PREFER_LARGE_60
},
114 { "API", 0x7602, EDID_QUIRK_PREFER_LARGE_60
},
116 { "ACR", 2423, EDID_QUIRK_FIRST_DETAILED_PREFERRED
},
118 /* AEO model 0 reports 8 bpc, but is a 6 bpc panel */
119 { "AEO", 0, EDID_QUIRK_FORCE_6BPC
},
121 /* CPT panel of Asus UX303LA reports 8 bpc, but is a 6 bpc panel */
122 { "CPT", 0x17df, EDID_QUIRK_FORCE_6BPC
},
124 /* Belinea 10 15 55 */
125 { "MAX", 1516, EDID_QUIRK_PREFER_LARGE_60
},
126 { "MAX", 0x77e, EDID_QUIRK_PREFER_LARGE_60
},
128 /* Envision Peripherals, Inc. EN-7100e */
129 { "EPI", 59264, EDID_QUIRK_135_CLOCK_TOO_HIGH
},
130 /* Envision EN2028 */
131 { "EPI", 8232, EDID_QUIRK_PREFER_LARGE_60
},
133 /* Funai Electronics PM36B */
134 { "FCM", 13600, EDID_QUIRK_PREFER_LARGE_75
|
135 EDID_QUIRK_DETAILED_IN_CM
},
137 /* LGD panel of HP zBook 17 G2, eDP 10 bpc, but reports unknown bpc */
138 { "LGD", 764, EDID_QUIRK_FORCE_10BPC
},
140 /* LG Philips LCD LP154W01-A5 */
141 { "LPL", 0, EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE
},
142 { "LPL", 0x2a00, EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE
},
144 /* Philips 107p5 CRT */
145 { "PHL", 57364, EDID_QUIRK_FIRST_DETAILED_PREFERRED
},
148 { "PTS", 765, EDID_QUIRK_FIRST_DETAILED_PREFERRED
},
150 /* Samsung SyncMaster 205BW. Note: irony */
151 { "SAM", 541, EDID_QUIRK_DETAILED_SYNC_PP
},
152 /* Samsung SyncMaster 22[5-6]BW */
153 { "SAM", 596, EDID_QUIRK_PREFER_LARGE_60
},
154 { "SAM", 638, EDID_QUIRK_PREFER_LARGE_60
},
156 /* Sony PVM-2541A does up to 12 bpc, but only reports max 8 bpc */
157 { "SNY", 0x2541, EDID_QUIRK_FORCE_12BPC
},
159 /* ViewSonic VA2026w */
160 { "VSC", 5020, EDID_QUIRK_FORCE_REDUCED_BLANKING
},
162 /* Medion MD 30217 PG */
163 { "MED", 0x7b8, EDID_QUIRK_PREFER_LARGE_75
},
165 /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
166 { "SEC", 0xd033, EDID_QUIRK_FORCE_8BPC
},
168 /* Rotel RSX-1058 forwards sink's EDID but only does HDMI 1.1*/
169 { "ETR", 13896, EDID_QUIRK_FORCE_8BPC
},
171 /* HTC Vive VR Headset */
172 { "HVR", 0xaa01, EDID_QUIRK_NON_DESKTOP
},
176 * Autogenerated from the DMT spec.
177 * This table is copied from xfree86/modes/xf86EdidModes.c.
179 static const struct drm_display_mode drm_dmt_modes
[] = {
180 /* 0x01 - 640x350@85Hz */
181 { DRM_MODE("640x350", DRM_MODE_TYPE_DRIVER
, 31500, 640, 672,
182 736, 832, 0, 350, 382, 385, 445, 0,
183 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
184 /* 0x02 - 640x400@85Hz */
185 { DRM_MODE("640x400", DRM_MODE_TYPE_DRIVER
, 31500, 640, 672,
186 736, 832, 0, 400, 401, 404, 445, 0,
187 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
188 /* 0x03 - 720x400@85Hz */
189 { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER
, 35500, 720, 756,
190 828, 936, 0, 400, 401, 404, 446, 0,
191 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
192 /* 0x04 - 640x480@60Hz */
193 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 25175, 640, 656,
194 752, 800, 0, 480, 490, 492, 525, 0,
195 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
196 /* 0x05 - 640x480@72Hz */
197 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 31500, 640, 664,
198 704, 832, 0, 480, 489, 492, 520, 0,
199 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
200 /* 0x06 - 640x480@75Hz */
201 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 31500, 640, 656,
202 720, 840, 0, 480, 481, 484, 500, 0,
203 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
204 /* 0x07 - 640x480@85Hz */
205 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 36000, 640, 696,
206 752, 832, 0, 480, 481, 484, 509, 0,
207 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
208 /* 0x08 - 800x600@56Hz */
209 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 36000, 800, 824,
210 896, 1024, 0, 600, 601, 603, 625, 0,
211 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
212 /* 0x09 - 800x600@60Hz */
213 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 40000, 800, 840,
214 968, 1056, 0, 600, 601, 605, 628, 0,
215 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
216 /* 0x0a - 800x600@72Hz */
217 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 50000, 800, 856,
218 976, 1040, 0, 600, 637, 643, 666, 0,
219 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
220 /* 0x0b - 800x600@75Hz */
221 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 49500, 800, 816,
222 896, 1056, 0, 600, 601, 604, 625, 0,
223 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
224 /* 0x0c - 800x600@85Hz */
225 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 56250, 800, 832,
226 896, 1048, 0, 600, 601, 604, 631, 0,
227 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
228 /* 0x0d - 800x600@120Hz RB */
229 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 73250, 800, 848,
230 880, 960, 0, 600, 603, 607, 636, 0,
231 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
232 /* 0x0e - 848x480@60Hz */
233 { DRM_MODE("848x480", DRM_MODE_TYPE_DRIVER
, 33750, 848, 864,
234 976, 1088, 0, 480, 486, 494, 517, 0,
235 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
236 /* 0x0f - 1024x768@43Hz, interlace */
237 { DRM_MODE("1024x768i", DRM_MODE_TYPE_DRIVER
, 44900, 1024, 1032,
238 1208, 1264, 0, 768, 768, 776, 817, 0,
239 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
|
240 DRM_MODE_FLAG_INTERLACE
) },
241 /* 0x10 - 1024x768@60Hz */
242 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER
, 65000, 1024, 1048,
243 1184, 1344, 0, 768, 771, 777, 806, 0,
244 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
245 /* 0x11 - 1024x768@70Hz */
246 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER
, 75000, 1024, 1048,
247 1184, 1328, 0, 768, 771, 777, 806, 0,
248 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
249 /* 0x12 - 1024x768@75Hz */
250 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER
, 78750, 1024, 1040,
251 1136, 1312, 0, 768, 769, 772, 800, 0,
252 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
253 /* 0x13 - 1024x768@85Hz */
254 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER
, 94500, 1024, 1072,
255 1168, 1376, 0, 768, 769, 772, 808, 0,
256 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
257 /* 0x14 - 1024x768@120Hz RB */
258 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER
, 115500, 1024, 1072,
259 1104, 1184, 0, 768, 771, 775, 813, 0,
260 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
261 /* 0x15 - 1152x864@75Hz */
262 { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER
, 108000, 1152, 1216,
263 1344, 1600, 0, 864, 865, 868, 900, 0,
264 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
265 /* 0x55 - 1280x720@60Hz */
266 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 1390,
267 1430, 1650, 0, 720, 725, 730, 750, 0,
268 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
269 /* 0x16 - 1280x768@60Hz RB */
270 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER
, 68250, 1280, 1328,
271 1360, 1440, 0, 768, 771, 778, 790, 0,
272 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
273 /* 0x17 - 1280x768@60Hz */
274 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER
, 79500, 1280, 1344,
275 1472, 1664, 0, 768, 771, 778, 798, 0,
276 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
277 /* 0x18 - 1280x768@75Hz */
278 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER
, 102250, 1280, 1360,
279 1488, 1696, 0, 768, 771, 778, 805, 0,
280 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
281 /* 0x19 - 1280x768@85Hz */
282 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER
, 117500, 1280, 1360,
283 1496, 1712, 0, 768, 771, 778, 809, 0,
284 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
285 /* 0x1a - 1280x768@120Hz RB */
286 { DRM_MODE("1280x768", DRM_MODE_TYPE_DRIVER
, 140250, 1280, 1328,
287 1360, 1440, 0, 768, 771, 778, 813, 0,
288 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
289 /* 0x1b - 1280x800@60Hz RB */
290 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER
, 71000, 1280, 1328,
291 1360, 1440, 0, 800, 803, 809, 823, 0,
292 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
293 /* 0x1c - 1280x800@60Hz */
294 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER
, 83500, 1280, 1352,
295 1480, 1680, 0, 800, 803, 809, 831, 0,
296 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
297 /* 0x1d - 1280x800@75Hz */
298 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER
, 106500, 1280, 1360,
299 1488, 1696, 0, 800, 803, 809, 838, 0,
300 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
301 /* 0x1e - 1280x800@85Hz */
302 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER
, 122500, 1280, 1360,
303 1496, 1712, 0, 800, 803, 809, 843, 0,
304 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
305 /* 0x1f - 1280x800@120Hz RB */
306 { DRM_MODE("1280x800", DRM_MODE_TYPE_DRIVER
, 146250, 1280, 1328,
307 1360, 1440, 0, 800, 803, 809, 847, 0,
308 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
309 /* 0x20 - 1280x960@60Hz */
310 { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER
, 108000, 1280, 1376,
311 1488, 1800, 0, 960, 961, 964, 1000, 0,
312 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
313 /* 0x21 - 1280x960@85Hz */
314 { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER
, 148500, 1280, 1344,
315 1504, 1728, 0, 960, 961, 964, 1011, 0,
316 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
317 /* 0x22 - 1280x960@120Hz RB */
318 { DRM_MODE("1280x960", DRM_MODE_TYPE_DRIVER
, 175500, 1280, 1328,
319 1360, 1440, 0, 960, 963, 967, 1017, 0,
320 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
321 /* 0x23 - 1280x1024@60Hz */
322 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER
, 108000, 1280, 1328,
323 1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
324 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
325 /* 0x24 - 1280x1024@75Hz */
326 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER
, 135000, 1280, 1296,
327 1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
328 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
329 /* 0x25 - 1280x1024@85Hz */
330 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER
, 157500, 1280, 1344,
331 1504, 1728, 0, 1024, 1025, 1028, 1072, 0,
332 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
333 /* 0x26 - 1280x1024@120Hz RB */
334 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER
, 187250, 1280, 1328,
335 1360, 1440, 0, 1024, 1027, 1034, 1084, 0,
336 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
337 /* 0x27 - 1360x768@60Hz */
338 { DRM_MODE("1360x768", DRM_MODE_TYPE_DRIVER
, 85500, 1360, 1424,
339 1536, 1792, 0, 768, 771, 777, 795, 0,
340 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
341 /* 0x28 - 1360x768@120Hz RB */
342 { DRM_MODE("1360x768", DRM_MODE_TYPE_DRIVER
, 148250, 1360, 1408,
343 1440, 1520, 0, 768, 771, 776, 813, 0,
344 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
345 /* 0x51 - 1366x768@60Hz */
346 { DRM_MODE("1366x768", DRM_MODE_TYPE_DRIVER
, 85500, 1366, 1436,
347 1579, 1792, 0, 768, 771, 774, 798, 0,
348 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
349 /* 0x56 - 1366x768@60Hz */
350 { DRM_MODE("1366x768", DRM_MODE_TYPE_DRIVER
, 72000, 1366, 1380,
351 1436, 1500, 0, 768, 769, 772, 800, 0,
352 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
353 /* 0x29 - 1400x1050@60Hz RB */
354 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER
, 101000, 1400, 1448,
355 1480, 1560, 0, 1050, 1053, 1057, 1080, 0,
356 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
357 /* 0x2a - 1400x1050@60Hz */
358 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER
, 121750, 1400, 1488,
359 1632, 1864, 0, 1050, 1053, 1057, 1089, 0,
360 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
361 /* 0x2b - 1400x1050@75Hz */
362 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER
, 156000, 1400, 1504,
363 1648, 1896, 0, 1050, 1053, 1057, 1099, 0,
364 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
365 /* 0x2c - 1400x1050@85Hz */
366 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER
, 179500, 1400, 1504,
367 1656, 1912, 0, 1050, 1053, 1057, 1105, 0,
368 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
369 /* 0x2d - 1400x1050@120Hz RB */
370 { DRM_MODE("1400x1050", DRM_MODE_TYPE_DRIVER
, 208000, 1400, 1448,
371 1480, 1560, 0, 1050, 1053, 1057, 1112, 0,
372 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
373 /* 0x2e - 1440x900@60Hz RB */
374 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER
, 88750, 1440, 1488,
375 1520, 1600, 0, 900, 903, 909, 926, 0,
376 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
377 /* 0x2f - 1440x900@60Hz */
378 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER
, 106500, 1440, 1520,
379 1672, 1904, 0, 900, 903, 909, 934, 0,
380 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
381 /* 0x30 - 1440x900@75Hz */
382 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER
, 136750, 1440, 1536,
383 1688, 1936, 0, 900, 903, 909, 942, 0,
384 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
385 /* 0x31 - 1440x900@85Hz */
386 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER
, 157000, 1440, 1544,
387 1696, 1952, 0, 900, 903, 909, 948, 0,
388 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
389 /* 0x32 - 1440x900@120Hz RB */
390 { DRM_MODE("1440x900", DRM_MODE_TYPE_DRIVER
, 182750, 1440, 1488,
391 1520, 1600, 0, 900, 903, 909, 953, 0,
392 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
393 /* 0x53 - 1600x900@60Hz */
394 { DRM_MODE("1600x900", DRM_MODE_TYPE_DRIVER
, 108000, 1600, 1624,
395 1704, 1800, 0, 900, 901, 904, 1000, 0,
396 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
397 /* 0x33 - 1600x1200@60Hz */
398 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER
, 162000, 1600, 1664,
399 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
400 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
401 /* 0x34 - 1600x1200@65Hz */
402 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER
, 175500, 1600, 1664,
403 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
404 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
405 /* 0x35 - 1600x1200@70Hz */
406 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER
, 189000, 1600, 1664,
407 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
408 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
409 /* 0x36 - 1600x1200@75Hz */
410 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER
, 202500, 1600, 1664,
411 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
412 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
413 /* 0x37 - 1600x1200@85Hz */
414 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER
, 229500, 1600, 1664,
415 1856, 2160, 0, 1200, 1201, 1204, 1250, 0,
416 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
417 /* 0x38 - 1600x1200@120Hz RB */
418 { DRM_MODE("1600x1200", DRM_MODE_TYPE_DRIVER
, 268250, 1600, 1648,
419 1680, 1760, 0, 1200, 1203, 1207, 1271, 0,
420 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
421 /* 0x39 - 1680x1050@60Hz RB */
422 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER
, 119000, 1680, 1728,
423 1760, 1840, 0, 1050, 1053, 1059, 1080, 0,
424 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
425 /* 0x3a - 1680x1050@60Hz */
426 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER
, 146250, 1680, 1784,
427 1960, 2240, 0, 1050, 1053, 1059, 1089, 0,
428 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
429 /* 0x3b - 1680x1050@75Hz */
430 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER
, 187000, 1680, 1800,
431 1976, 2272, 0, 1050, 1053, 1059, 1099, 0,
432 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
433 /* 0x3c - 1680x1050@85Hz */
434 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER
, 214750, 1680, 1808,
435 1984, 2288, 0, 1050, 1053, 1059, 1105, 0,
436 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
437 /* 0x3d - 1680x1050@120Hz RB */
438 { DRM_MODE("1680x1050", DRM_MODE_TYPE_DRIVER
, 245500, 1680, 1728,
439 1760, 1840, 0, 1050, 1053, 1059, 1112, 0,
440 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
441 /* 0x3e - 1792x1344@60Hz */
442 { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER
, 204750, 1792, 1920,
443 2120, 2448, 0, 1344, 1345, 1348, 1394, 0,
444 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
445 /* 0x3f - 1792x1344@75Hz */
446 { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER
, 261000, 1792, 1888,
447 2104, 2456, 0, 1344, 1345, 1348, 1417, 0,
448 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
449 /* 0x40 - 1792x1344@120Hz RB */
450 { DRM_MODE("1792x1344", DRM_MODE_TYPE_DRIVER
, 333250, 1792, 1840,
451 1872, 1952, 0, 1344, 1347, 1351, 1423, 0,
452 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
453 /* 0x41 - 1856x1392@60Hz */
454 { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER
, 218250, 1856, 1952,
455 2176, 2528, 0, 1392, 1393, 1396, 1439, 0,
456 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
457 /* 0x42 - 1856x1392@75Hz */
458 { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER
, 288000, 1856, 1984,
459 2208, 2560, 0, 1392, 1393, 1396, 1500, 0,
460 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
461 /* 0x43 - 1856x1392@120Hz RB */
462 { DRM_MODE("1856x1392", DRM_MODE_TYPE_DRIVER
, 356500, 1856, 1904,
463 1936, 2016, 0, 1392, 1395, 1399, 1474, 0,
464 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
465 /* 0x52 - 1920x1080@60Hz */
466 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 148500, 1920, 2008,
467 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
468 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
469 /* 0x44 - 1920x1200@60Hz RB */
470 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER
, 154000, 1920, 1968,
471 2000, 2080, 0, 1200, 1203, 1209, 1235, 0,
472 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
473 /* 0x45 - 1920x1200@60Hz */
474 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER
, 193250, 1920, 2056,
475 2256, 2592, 0, 1200, 1203, 1209, 1245, 0,
476 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
477 /* 0x46 - 1920x1200@75Hz */
478 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER
, 245250, 1920, 2056,
479 2264, 2608, 0, 1200, 1203, 1209, 1255, 0,
480 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
481 /* 0x47 - 1920x1200@85Hz */
482 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER
, 281250, 1920, 2064,
483 2272, 2624, 0, 1200, 1203, 1209, 1262, 0,
484 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
485 /* 0x48 - 1920x1200@120Hz RB */
486 { DRM_MODE("1920x1200", DRM_MODE_TYPE_DRIVER
, 317000, 1920, 1968,
487 2000, 2080, 0, 1200, 1203, 1209, 1271, 0,
488 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
489 /* 0x49 - 1920x1440@60Hz */
490 { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER
, 234000, 1920, 2048,
491 2256, 2600, 0, 1440, 1441, 1444, 1500, 0,
492 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
493 /* 0x4a - 1920x1440@75Hz */
494 { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER
, 297000, 1920, 2064,
495 2288, 2640, 0, 1440, 1441, 1444, 1500, 0,
496 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
497 /* 0x4b - 1920x1440@120Hz RB */
498 { DRM_MODE("1920x1440", DRM_MODE_TYPE_DRIVER
, 380500, 1920, 1968,
499 2000, 2080, 0, 1440, 1443, 1447, 1525, 0,
500 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
501 /* 0x54 - 2048x1152@60Hz */
502 { DRM_MODE("2048x1152", DRM_MODE_TYPE_DRIVER
, 162000, 2048, 2074,
503 2154, 2250, 0, 1152, 1153, 1156, 1200, 0,
504 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
505 /* 0x4c - 2560x1600@60Hz RB */
506 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER
, 268500, 2560, 2608,
507 2640, 2720, 0, 1600, 1603, 1609, 1646, 0,
508 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
509 /* 0x4d - 2560x1600@60Hz */
510 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER
, 348500, 2560, 2752,
511 3032, 3504, 0, 1600, 1603, 1609, 1658, 0,
512 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
513 /* 0x4e - 2560x1600@75Hz */
514 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER
, 443250, 2560, 2768,
515 3048, 3536, 0, 1600, 1603, 1609, 1672, 0,
516 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
517 /* 0x4f - 2560x1600@85Hz */
518 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER
, 505250, 2560, 2768,
519 3048, 3536, 0, 1600, 1603, 1609, 1682, 0,
520 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) },
521 /* 0x50 - 2560x1600@120Hz RB */
522 { DRM_MODE("2560x1600", DRM_MODE_TYPE_DRIVER
, 552750, 2560, 2608,
523 2640, 2720, 0, 1600, 1603, 1609, 1694, 0,
524 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
525 /* 0x57 - 4096x2160@60Hz RB */
526 { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER
, 556744, 4096, 4104,
527 4136, 4176, 0, 2160, 2208, 2216, 2222, 0,
528 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
529 /* 0x58 - 4096x2160@59.94Hz RB */
530 { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER
, 556188, 4096, 4104,
531 4136, 4176, 0, 2160, 2208, 2216, 2222, 0,
532 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
) },
536 * These more or less come from the DMT spec. The 720x400 modes are
537 * inferred from historical 80x25 practice. The 640x480@67 and 832x624@75
538 * modes are old-school Mac modes. The EDID spec says the 1152x864@75 mode
539 * should be 1152x870, again for the Mac, but instead we use the x864 DMT
542 * The DMT modes have been fact-checked; the rest are mild guesses.
544 static const struct drm_display_mode edid_est_modes
[] = {
545 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 40000, 800, 840,
546 968, 1056, 0, 600, 601, 605, 628, 0,
547 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) }, /* 800x600@60Hz */
548 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 36000, 800, 824,
549 896, 1024, 0, 600, 601, 603, 625, 0,
550 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) }, /* 800x600@56Hz */
551 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 31500, 640, 656,
552 720, 840, 0, 480, 481, 484, 500, 0,
553 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) }, /* 640x480@75Hz */
554 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 31500, 640, 664,
555 704, 832, 0, 480, 489, 492, 520, 0,
556 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) }, /* 640x480@72Hz */
557 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 30240, 640, 704,
558 768, 864, 0, 480, 483, 486, 525, 0,
559 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) }, /* 640x480@67Hz */
560 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 25175, 640, 656,
561 752, 800, 0, 480, 490, 492, 525, 0,
562 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) }, /* 640x480@60Hz */
563 { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER
, 35500, 720, 738,
564 846, 900, 0, 400, 421, 423, 449, 0,
565 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) }, /* 720x400@88Hz */
566 { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER
, 28320, 720, 738,
567 846, 900, 0, 400, 412, 414, 449, 0,
568 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_PVSYNC
) }, /* 720x400@70Hz */
569 { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER
, 135000, 1280, 1296,
570 1440, 1688, 0, 1024, 1025, 1028, 1066, 0,
571 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) }, /* 1280x1024@75Hz */
572 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER
, 78750, 1024, 1040,
573 1136, 1312, 0, 768, 769, 772, 800, 0,
574 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) }, /* 1024x768@75Hz */
575 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER
, 75000, 1024, 1048,
576 1184, 1328, 0, 768, 771, 777, 806, 0,
577 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) }, /* 1024x768@70Hz */
578 { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER
, 65000, 1024, 1048,
579 1184, 1344, 0, 768, 771, 777, 806, 0,
580 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) }, /* 1024x768@60Hz */
581 { DRM_MODE("1024x768i", DRM_MODE_TYPE_DRIVER
,44900, 1024, 1032,
582 1208, 1264, 0, 768, 768, 776, 817, 0,
583 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
| DRM_MODE_FLAG_INTERLACE
) }, /* 1024x768@43Hz */
584 { DRM_MODE("832x624", DRM_MODE_TYPE_DRIVER
, 57284, 832, 864,
585 928, 1152, 0, 624, 625, 628, 667, 0,
586 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
) }, /* 832x624@75Hz */
587 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 49500, 800, 816,
588 896, 1056, 0, 600, 601, 604, 625, 0,
589 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) }, /* 800x600@75Hz */
590 { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER
, 50000, 800, 856,
591 976, 1040, 0, 600, 637, 643, 666, 0,
592 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) }, /* 800x600@72Hz */
593 { DRM_MODE("1152x864", DRM_MODE_TYPE_DRIVER
, 108000, 1152, 1216,
594 1344, 1600, 0, 864, 865, 868, 900, 0,
595 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
) }, /* 1152x864@75Hz */
605 static const struct minimode est3_modes
[] = {
613 { 1024, 768, 85, 0 },
614 { 1152, 864, 75, 0 },
616 { 1280, 768, 60, 1 },
617 { 1280, 768, 60, 0 },
618 { 1280, 768, 75, 0 },
619 { 1280, 768, 85, 0 },
620 { 1280, 960, 60, 0 },
621 { 1280, 960, 85, 0 },
622 { 1280, 1024, 60, 0 },
623 { 1280, 1024, 85, 0 },
625 { 1360, 768, 60, 0 },
626 { 1440, 900, 60, 1 },
627 { 1440, 900, 60, 0 },
628 { 1440, 900, 75, 0 },
629 { 1440, 900, 85, 0 },
630 { 1400, 1050, 60, 1 },
631 { 1400, 1050, 60, 0 },
632 { 1400, 1050, 75, 0 },
634 { 1400, 1050, 85, 0 },
635 { 1680, 1050, 60, 1 },
636 { 1680, 1050, 60, 0 },
637 { 1680, 1050, 75, 0 },
638 { 1680, 1050, 85, 0 },
639 { 1600, 1200, 60, 0 },
640 { 1600, 1200, 65, 0 },
641 { 1600, 1200, 70, 0 },
643 { 1600, 1200, 75, 0 },
644 { 1600, 1200, 85, 0 },
645 { 1792, 1344, 60, 0 },
646 { 1792, 1344, 75, 0 },
647 { 1856, 1392, 60, 0 },
648 { 1856, 1392, 75, 0 },
649 { 1920, 1200, 60, 1 },
650 { 1920, 1200, 60, 0 },
652 { 1920, 1200, 75, 0 },
653 { 1920, 1200, 85, 0 },
654 { 1920, 1440, 60, 0 },
655 { 1920, 1440, 75, 0 },
658 static const struct minimode extra_modes
[] = {
659 { 1024, 576, 60, 0 },
660 { 1366, 768, 60, 0 },
661 { 1600, 900, 60, 0 },
662 { 1680, 945, 60, 0 },
663 { 1920, 1080, 60, 0 },
664 { 2048, 1152, 60, 0 },
665 { 2048, 1536, 60, 0 },
669 * Probably taken from CEA-861 spec.
670 * This table is converted from xorg's hw/xfree86/modes/xf86EdidModes.c.
672 * Index using the VIC.
674 static const struct drm_display_mode edid_cea_modes
[] = {
675 /* 0 - dummy, VICs start at 1 */
677 /* 1 - 640x480@60Hz */
678 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER
, 25175, 640, 656,
679 752, 800, 0, 480, 490, 492, 525, 0,
680 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
681 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
682 /* 2 - 720x480@60Hz */
683 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER
, 27000, 720, 736,
684 798, 858, 0, 480, 489, 495, 525, 0,
685 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
686 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
687 /* 3 - 720x480@60Hz */
688 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER
, 27000, 720, 736,
689 798, 858, 0, 480, 489, 495, 525, 0,
690 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
691 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
692 /* 4 - 1280x720@60Hz */
693 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 1390,
694 1430, 1650, 0, 720, 725, 730, 750, 0,
695 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
696 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
697 /* 5 - 1920x1080i@60Hz */
698 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER
, 74250, 1920, 2008,
699 2052, 2200, 0, 1080, 1084, 1094, 1125, 0,
700 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
|
701 DRM_MODE_FLAG_INTERLACE
),
702 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
703 /* 6 - 720(1440)x480i@60Hz */
704 { DRM_MODE("720x480i", DRM_MODE_TYPE_DRIVER
, 13500, 720, 739,
705 801, 858, 0, 480, 488, 494, 525, 0,
706 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
707 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
708 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
709 /* 7 - 720(1440)x480i@60Hz */
710 { DRM_MODE("720x480i", DRM_MODE_TYPE_DRIVER
, 13500, 720, 739,
711 801, 858, 0, 480, 488, 494, 525, 0,
712 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
713 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
714 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
715 /* 8 - 720(1440)x240@60Hz */
716 { DRM_MODE("720x240", DRM_MODE_TYPE_DRIVER
, 13500, 720, 739,
717 801, 858, 0, 240, 244, 247, 262, 0,
718 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
719 DRM_MODE_FLAG_DBLCLK
),
720 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
721 /* 9 - 720(1440)x240@60Hz */
722 { DRM_MODE("720x240", DRM_MODE_TYPE_DRIVER
, 13500, 720, 739,
723 801, 858, 0, 240, 244, 247, 262, 0,
724 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
725 DRM_MODE_FLAG_DBLCLK
),
726 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
727 /* 10 - 2880x480i@60Hz */
728 { DRM_MODE("2880x480i", DRM_MODE_TYPE_DRIVER
, 54000, 2880, 2956,
729 3204, 3432, 0, 480, 488, 494, 525, 0,
730 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
731 DRM_MODE_FLAG_INTERLACE
),
732 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
733 /* 11 - 2880x480i@60Hz */
734 { DRM_MODE("2880x480i", DRM_MODE_TYPE_DRIVER
, 54000, 2880, 2956,
735 3204, 3432, 0, 480, 488, 494, 525, 0,
736 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
737 DRM_MODE_FLAG_INTERLACE
),
738 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
739 /* 12 - 2880x240@60Hz */
740 { DRM_MODE("2880x240", DRM_MODE_TYPE_DRIVER
, 54000, 2880, 2956,
741 3204, 3432, 0, 240, 244, 247, 262, 0,
742 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
743 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
744 /* 13 - 2880x240@60Hz */
745 { DRM_MODE("2880x240", DRM_MODE_TYPE_DRIVER
, 54000, 2880, 2956,
746 3204, 3432, 0, 240, 244, 247, 262, 0,
747 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
748 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
749 /* 14 - 1440x480@60Hz */
750 { DRM_MODE("1440x480", DRM_MODE_TYPE_DRIVER
, 54000, 1440, 1472,
751 1596, 1716, 0, 480, 489, 495, 525, 0,
752 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
753 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
754 /* 15 - 1440x480@60Hz */
755 { DRM_MODE("1440x480", DRM_MODE_TYPE_DRIVER
, 54000, 1440, 1472,
756 1596, 1716, 0, 480, 489, 495, 525, 0,
757 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
758 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
759 /* 16 - 1920x1080@60Hz */
760 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 148500, 1920, 2008,
761 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
762 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
763 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
764 /* 17 - 720x576@50Hz */
765 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER
, 27000, 720, 732,
766 796, 864, 0, 576, 581, 586, 625, 0,
767 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
768 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
769 /* 18 - 720x576@50Hz */
770 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER
, 27000, 720, 732,
771 796, 864, 0, 576, 581, 586, 625, 0,
772 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
773 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
774 /* 19 - 1280x720@50Hz */
775 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 1720,
776 1760, 1980, 0, 720, 725, 730, 750, 0,
777 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
778 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
779 /* 20 - 1920x1080i@50Hz */
780 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER
, 74250, 1920, 2448,
781 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
782 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
|
783 DRM_MODE_FLAG_INTERLACE
),
784 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
785 /* 21 - 720(1440)x576i@50Hz */
786 { DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER
, 13500, 720, 732,
787 795, 864, 0, 576, 580, 586, 625, 0,
788 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
789 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
790 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
791 /* 22 - 720(1440)x576i@50Hz */
792 { DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER
, 13500, 720, 732,
793 795, 864, 0, 576, 580, 586, 625, 0,
794 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
795 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
796 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
797 /* 23 - 720(1440)x288@50Hz */
798 { DRM_MODE("720x288", DRM_MODE_TYPE_DRIVER
, 13500, 720, 732,
799 795, 864, 0, 288, 290, 293, 312, 0,
800 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
801 DRM_MODE_FLAG_DBLCLK
),
802 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
803 /* 24 - 720(1440)x288@50Hz */
804 { DRM_MODE("720x288", DRM_MODE_TYPE_DRIVER
, 13500, 720, 732,
805 795, 864, 0, 288, 290, 293, 312, 0,
806 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
807 DRM_MODE_FLAG_DBLCLK
),
808 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
809 /* 25 - 2880x576i@50Hz */
810 { DRM_MODE("2880x576i", DRM_MODE_TYPE_DRIVER
, 54000, 2880, 2928,
811 3180, 3456, 0, 576, 580, 586, 625, 0,
812 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
813 DRM_MODE_FLAG_INTERLACE
),
814 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
815 /* 26 - 2880x576i@50Hz */
816 { DRM_MODE("2880x576i", DRM_MODE_TYPE_DRIVER
, 54000, 2880, 2928,
817 3180, 3456, 0, 576, 580, 586, 625, 0,
818 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
819 DRM_MODE_FLAG_INTERLACE
),
820 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
821 /* 27 - 2880x288@50Hz */
822 { DRM_MODE("2880x288", DRM_MODE_TYPE_DRIVER
, 54000, 2880, 2928,
823 3180, 3456, 0, 288, 290, 293, 312, 0,
824 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
825 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
826 /* 28 - 2880x288@50Hz */
827 { DRM_MODE("2880x288", DRM_MODE_TYPE_DRIVER
, 54000, 2880, 2928,
828 3180, 3456, 0, 288, 290, 293, 312, 0,
829 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
830 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
831 /* 29 - 1440x576@50Hz */
832 { DRM_MODE("1440x576", DRM_MODE_TYPE_DRIVER
, 54000, 1440, 1464,
833 1592, 1728, 0, 576, 581, 586, 625, 0,
834 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
835 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
836 /* 30 - 1440x576@50Hz */
837 { DRM_MODE("1440x576", DRM_MODE_TYPE_DRIVER
, 54000, 1440, 1464,
838 1592, 1728, 0, 576, 581, 586, 625, 0,
839 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
840 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
841 /* 31 - 1920x1080@50Hz */
842 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 148500, 1920, 2448,
843 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
844 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
845 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
846 /* 32 - 1920x1080@24Hz */
847 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 74250, 1920, 2558,
848 2602, 2750, 0, 1080, 1084, 1089, 1125, 0,
849 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
850 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
851 /* 33 - 1920x1080@25Hz */
852 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 74250, 1920, 2448,
853 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
854 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
855 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
856 /* 34 - 1920x1080@30Hz */
857 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 74250, 1920, 2008,
858 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
859 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
860 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
861 /* 35 - 2880x480@60Hz */
862 { DRM_MODE("2880x480", DRM_MODE_TYPE_DRIVER
, 108000, 2880, 2944,
863 3192, 3432, 0, 480, 489, 495, 525, 0,
864 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
865 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
866 /* 36 - 2880x480@60Hz */
867 { DRM_MODE("2880x480", DRM_MODE_TYPE_DRIVER
, 108000, 2880, 2944,
868 3192, 3432, 0, 480, 489, 495, 525, 0,
869 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
870 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
871 /* 37 - 2880x576@50Hz */
872 { DRM_MODE("2880x576", DRM_MODE_TYPE_DRIVER
, 108000, 2880, 2928,
873 3184, 3456, 0, 576, 581, 586, 625, 0,
874 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
875 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
876 /* 38 - 2880x576@50Hz */
877 { DRM_MODE("2880x576", DRM_MODE_TYPE_DRIVER
, 108000, 2880, 2928,
878 3184, 3456, 0, 576, 581, 586, 625, 0,
879 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
880 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
881 /* 39 - 1920x1080i@50Hz */
882 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER
, 72000, 1920, 1952,
883 2120, 2304, 0, 1080, 1126, 1136, 1250, 0,
884 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_NVSYNC
|
885 DRM_MODE_FLAG_INTERLACE
),
886 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
887 /* 40 - 1920x1080i@100Hz */
888 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER
, 148500, 1920, 2448,
889 2492, 2640, 0, 1080, 1084, 1094, 1125, 0,
890 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
|
891 DRM_MODE_FLAG_INTERLACE
),
892 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
893 /* 41 - 1280x720@100Hz */
894 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 148500, 1280, 1720,
895 1760, 1980, 0, 720, 725, 730, 750, 0,
896 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
897 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
898 /* 42 - 720x576@100Hz */
899 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER
, 54000, 720, 732,
900 796, 864, 0, 576, 581, 586, 625, 0,
901 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
902 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
903 /* 43 - 720x576@100Hz */
904 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER
, 54000, 720, 732,
905 796, 864, 0, 576, 581, 586, 625, 0,
906 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
907 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
908 /* 44 - 720(1440)x576i@100Hz */
909 { DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER
, 27000, 720, 732,
910 795, 864, 0, 576, 580, 586, 625, 0,
911 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
912 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
913 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
914 /* 45 - 720(1440)x576i@100Hz */
915 { DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER
, 27000, 720, 732,
916 795, 864, 0, 576, 580, 586, 625, 0,
917 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
918 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
919 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
920 /* 46 - 1920x1080i@120Hz */
921 { DRM_MODE("1920x1080i", DRM_MODE_TYPE_DRIVER
, 148500, 1920, 2008,
922 2052, 2200, 0, 1080, 1084, 1094, 1125, 0,
923 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
|
924 DRM_MODE_FLAG_INTERLACE
),
925 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
926 /* 47 - 1280x720@120Hz */
927 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 148500, 1280, 1390,
928 1430, 1650, 0, 720, 725, 730, 750, 0,
929 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
930 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
931 /* 48 - 720x480@120Hz */
932 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER
, 54000, 720, 736,
933 798, 858, 0, 480, 489, 495, 525, 0,
934 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
935 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
936 /* 49 - 720x480@120Hz */
937 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER
, 54000, 720, 736,
938 798, 858, 0, 480, 489, 495, 525, 0,
939 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
940 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
941 /* 50 - 720(1440)x480i@120Hz */
942 { DRM_MODE("720x480i", DRM_MODE_TYPE_DRIVER
, 27000, 720, 739,
943 801, 858, 0, 480, 488, 494, 525, 0,
944 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
945 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
946 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
947 /* 51 - 720(1440)x480i@120Hz */
948 { DRM_MODE("720x480i", DRM_MODE_TYPE_DRIVER
, 27000, 720, 739,
949 801, 858, 0, 480, 488, 494, 525, 0,
950 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
951 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
952 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
953 /* 52 - 720x576@200Hz */
954 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER
, 108000, 720, 732,
955 796, 864, 0, 576, 581, 586, 625, 0,
956 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
957 .vrefresh
= 200, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
958 /* 53 - 720x576@200Hz */
959 { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER
, 108000, 720, 732,
960 796, 864, 0, 576, 581, 586, 625, 0,
961 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
962 .vrefresh
= 200, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
963 /* 54 - 720(1440)x576i@200Hz */
964 { DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER
, 54000, 720, 732,
965 795, 864, 0, 576, 580, 586, 625, 0,
966 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
967 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
968 .vrefresh
= 200, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
969 /* 55 - 720(1440)x576i@200Hz */
970 { DRM_MODE("720x576i", DRM_MODE_TYPE_DRIVER
, 54000, 720, 732,
971 795, 864, 0, 576, 580, 586, 625, 0,
972 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
973 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
974 .vrefresh
= 200, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
975 /* 56 - 720x480@240Hz */
976 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER
, 108000, 720, 736,
977 798, 858, 0, 480, 489, 495, 525, 0,
978 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
979 .vrefresh
= 240, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
980 /* 57 - 720x480@240Hz */
981 { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER
, 108000, 720, 736,
982 798, 858, 0, 480, 489, 495, 525, 0,
983 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
),
984 .vrefresh
= 240, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
985 /* 58 - 720(1440)x480i@240Hz */
986 { DRM_MODE("720x480i", DRM_MODE_TYPE_DRIVER
, 54000, 720, 739,
987 801, 858, 0, 480, 488, 494, 525, 0,
988 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
989 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
990 .vrefresh
= 240, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_4_3
, },
991 /* 59 - 720(1440)x480i@240Hz */
992 { DRM_MODE("720x480i", DRM_MODE_TYPE_DRIVER
, 54000, 720, 739,
993 801, 858, 0, 480, 488, 494, 525, 0,
994 DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
|
995 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_DBLCLK
),
996 .vrefresh
= 240, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
997 /* 60 - 1280x720@24Hz */
998 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 59400, 1280, 3040,
999 3080, 3300, 0, 720, 725, 730, 750, 0,
1000 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1001 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1002 /* 61 - 1280x720@25Hz */
1003 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 3700,
1004 3740, 3960, 0, 720, 725, 730, 750, 0,
1005 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1006 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1007 /* 62 - 1280x720@30Hz */
1008 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 3040,
1009 3080, 3300, 0, 720, 725, 730, 750, 0,
1010 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1011 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1012 /* 63 - 1920x1080@120Hz */
1013 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 297000, 1920, 2008,
1014 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
1015 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1016 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1017 /* 64 - 1920x1080@100Hz */
1018 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 297000, 1920, 2448,
1019 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
1020 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1021 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1022 /* 65 - 1280x720@24Hz */
1023 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 59400, 1280, 3040,
1024 3080, 3300, 0, 720, 725, 730, 750, 0,
1025 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1026 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1027 /* 66 - 1280x720@25Hz */
1028 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 3700,
1029 3740, 3960, 0, 720, 725, 730, 750, 0,
1030 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1031 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1032 /* 67 - 1280x720@30Hz */
1033 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 3040,
1034 3080, 3300, 0, 720, 725, 730, 750, 0,
1035 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1036 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1037 /* 68 - 1280x720@50Hz */
1038 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 1720,
1039 1760, 1980, 0, 720, 725, 730, 750, 0,
1040 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1041 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1042 /* 69 - 1280x720@60Hz */
1043 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 74250, 1280, 1390,
1044 1430, 1650, 0, 720, 725, 730, 750, 0,
1045 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1046 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1047 /* 70 - 1280x720@100Hz */
1048 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 148500, 1280, 1720,
1049 1760, 1980, 0, 720, 725, 730, 750, 0,
1050 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1051 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1052 /* 71 - 1280x720@120Hz */
1053 { DRM_MODE("1280x720", DRM_MODE_TYPE_DRIVER
, 148500, 1280, 1390,
1054 1430, 1650, 0, 720, 725, 730, 750, 0,
1055 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1056 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1057 /* 72 - 1920x1080@24Hz */
1058 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 74250, 1920, 2558,
1059 2602, 2750, 0, 1080, 1084, 1089, 1125, 0,
1060 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1061 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1062 /* 73 - 1920x1080@25Hz */
1063 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 74250, 1920, 2448,
1064 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
1065 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1066 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1067 /* 74 - 1920x1080@30Hz */
1068 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 74250, 1920, 2008,
1069 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
1070 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1071 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1072 /* 75 - 1920x1080@50Hz */
1073 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 148500, 1920, 2448,
1074 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
1075 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1076 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1077 /* 76 - 1920x1080@60Hz */
1078 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 148500, 1920, 2008,
1079 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
1080 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1081 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1082 /* 77 - 1920x1080@100Hz */
1083 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 297000, 1920, 2448,
1084 2492, 2640, 0, 1080, 1084, 1089, 1125, 0,
1085 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1086 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1087 /* 78 - 1920x1080@120Hz */
1088 { DRM_MODE("1920x1080", DRM_MODE_TYPE_DRIVER
, 297000, 1920, 2008,
1089 2052, 2200, 0, 1080, 1084, 1089, 1125, 0,
1090 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1091 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1092 /* 79 - 1680x720@24Hz */
1093 { DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER
, 59400, 1680, 3040,
1094 3080, 3300, 0, 720, 725, 730, 750, 0,
1095 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1096 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1097 /* 80 - 1680x720@25Hz */
1098 { DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER
, 59400, 1680, 2908,
1099 2948, 3168, 0, 720, 725, 730, 750, 0,
1100 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1101 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1102 /* 81 - 1680x720@30Hz */
1103 { DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER
, 59400, 1680, 2380,
1104 2420, 2640, 0, 720, 725, 730, 750, 0,
1105 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1106 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1107 /* 82 - 1680x720@50Hz */
1108 { DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER
, 82500, 1680, 1940,
1109 1980, 2200, 0, 720, 725, 730, 750, 0,
1110 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1111 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1112 /* 83 - 1680x720@60Hz */
1113 { DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER
, 99000, 1680, 1940,
1114 1980, 2200, 0, 720, 725, 730, 750, 0,
1115 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1116 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1117 /* 84 - 1680x720@100Hz */
1118 { DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER
, 165000, 1680, 1740,
1119 1780, 2000, 0, 720, 725, 730, 825, 0,
1120 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1121 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1122 /* 85 - 1680x720@120Hz */
1123 { DRM_MODE("1680x720", DRM_MODE_TYPE_DRIVER
, 198000, 1680, 1740,
1124 1780, 2000, 0, 720, 725, 730, 825, 0,
1125 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1126 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1127 /* 86 - 2560x1080@24Hz */
1128 { DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER
, 99000, 2560, 3558,
1129 3602, 3750, 0, 1080, 1084, 1089, 1100, 0,
1130 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1131 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1132 /* 87 - 2560x1080@25Hz */
1133 { DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER
, 90000, 2560, 3008,
1134 3052, 3200, 0, 1080, 1084, 1089, 1125, 0,
1135 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1136 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1137 /* 88 - 2560x1080@30Hz */
1138 { DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER
, 118800, 2560, 3328,
1139 3372, 3520, 0, 1080, 1084, 1089, 1125, 0,
1140 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1141 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1142 /* 89 - 2560x1080@50Hz */
1143 { DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER
, 185625, 2560, 3108,
1144 3152, 3300, 0, 1080, 1084, 1089, 1125, 0,
1145 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1146 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1147 /* 90 - 2560x1080@60Hz */
1148 { DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER
, 198000, 2560, 2808,
1149 2852, 3000, 0, 1080, 1084, 1089, 1100, 0,
1150 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1151 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1152 /* 91 - 2560x1080@100Hz */
1153 { DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER
, 371250, 2560, 2778,
1154 2822, 2970, 0, 1080, 1084, 1089, 1250, 0,
1155 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1156 .vrefresh
= 100, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1157 /* 92 - 2560x1080@120Hz */
1158 { DRM_MODE("2560x1080", DRM_MODE_TYPE_DRIVER
, 495000, 2560, 3108,
1159 3152, 3300, 0, 1080, 1084, 1089, 1250, 0,
1160 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1161 .vrefresh
= 120, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1162 /* 93 - 3840x2160p@24Hz 16:9 */
1163 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000, 3840, 5116,
1164 5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
1165 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1166 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1167 /* 94 - 3840x2160p@25Hz 16:9 */
1168 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000, 3840, 4896,
1169 4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
1170 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1171 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1172 /* 95 - 3840x2160p@30Hz 16:9 */
1173 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000, 3840, 4016,
1174 4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
1175 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1176 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1177 /* 96 - 3840x2160p@50Hz 16:9 */
1178 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 594000, 3840, 4896,
1179 4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
1180 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1181 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1182 /* 97 - 3840x2160p@60Hz 16:9 */
1183 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 594000, 3840, 4016,
1184 4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
1185 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1186 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_16_9
, },
1187 /* 98 - 4096x2160p@24Hz 256:135 */
1188 { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER
, 297000, 4096, 5116,
1189 5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
1190 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1191 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_256_135
, },
1192 /* 99 - 4096x2160p@25Hz 256:135 */
1193 { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER
, 297000, 4096, 5064,
1194 5152, 5280, 0, 2160, 2168, 2178, 2250, 0,
1195 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1196 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_256_135
, },
1197 /* 100 - 4096x2160p@30Hz 256:135 */
1198 { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER
, 297000, 4096, 4184,
1199 4272, 4400, 0, 2160, 2168, 2178, 2250, 0,
1200 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1201 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_256_135
, },
1202 /* 101 - 4096x2160p@50Hz 256:135 */
1203 { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER
, 594000, 4096, 5064,
1204 5152, 5280, 0, 2160, 2168, 2178, 2250, 0,
1205 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1206 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_256_135
, },
1207 /* 102 - 4096x2160p@60Hz 256:135 */
1208 { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER
, 594000, 4096, 4184,
1209 4272, 4400, 0, 2160, 2168, 2178, 2250, 0,
1210 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1211 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_256_135
, },
1212 /* 103 - 3840x2160p@24Hz 64:27 */
1213 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000, 3840, 5116,
1214 5204, 5500, 0, 2160, 2168, 2178, 2250, 0,
1215 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1216 .vrefresh
= 24, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1217 /* 104 - 3840x2160p@25Hz 64:27 */
1218 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000, 3840, 4896,
1219 4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
1220 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1221 .vrefresh
= 25, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1222 /* 105 - 3840x2160p@30Hz 64:27 */
1223 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000, 3840, 4016,
1224 4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
1225 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1226 .vrefresh
= 30, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1227 /* 106 - 3840x2160p@50Hz 64:27 */
1228 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 594000, 3840, 4896,
1229 4984, 5280, 0, 2160, 2168, 2178, 2250, 0,
1230 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1231 .vrefresh
= 50, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1232 /* 107 - 3840x2160p@60Hz 64:27 */
1233 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 594000, 3840, 4016,
1234 4104, 4400, 0, 2160, 2168, 2178, 2250, 0,
1235 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1236 .vrefresh
= 60, .picture_aspect_ratio
= HDMI_PICTURE_ASPECT_64_27
, },
1240 * HDMI 1.4 4k modes. Index using the VIC.
1242 static const struct drm_display_mode edid_4k_modes
[] = {
1243 /* 0 - dummy, VICs start at 1 */
1245 /* 1 - 3840x2160@30Hz */
1246 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000,
1247 3840, 4016, 4104, 4400, 0,
1248 2160, 2168, 2178, 2250, 0,
1249 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1251 /* 2 - 3840x2160@25Hz */
1252 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000,
1253 3840, 4896, 4984, 5280, 0,
1254 2160, 2168, 2178, 2250, 0,
1255 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1257 /* 3 - 3840x2160@24Hz */
1258 { DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER
, 297000,
1259 3840, 5116, 5204, 5500, 0,
1260 2160, 2168, 2178, 2250, 0,
1261 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1263 /* 4 - 4096x2160@24Hz (SMPTE) */
1264 { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER
, 297000,
1265 4096, 5116, 5204, 5500, 0,
1266 2160, 2168, 2178, 2250, 0,
1267 DRM_MODE_FLAG_PHSYNC
| DRM_MODE_FLAG_PVSYNC
),
1271 /*** DDC fetch and block validation ***/
1273 static const u8 edid_header
[] = {
1274 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
1278 * drm_edid_header_is_valid - sanity check the header of the base EDID block
1279 * @raw_edid: pointer to raw base EDID block
1281 * Sanity check the header of the base EDID block.
1283 * Return: 8 if the header is perfect, down to 0 if it's totally wrong.
1285 int drm_edid_header_is_valid(const u8
*raw_edid
)
1289 for (i
= 0; i
< sizeof(edid_header
); i
++)
1290 if (raw_edid
[i
] == edid_header
[i
])
1295 EXPORT_SYMBOL(drm_edid_header_is_valid
);
1297 static int edid_fixup __read_mostly
= 6;
1298 module_param_named(edid_fixup
, edid_fixup
, int, 0400);
1299 MODULE_PARM_DESC(edid_fixup
,
1300 "Minimum number of valid EDID header bytes (0-8, default 6)");
1302 static void drm_get_displayid(struct drm_connector
*connector
,
1305 static int drm_edid_block_checksum(const u8
*raw_edid
)
1309 for (i
= 0; i
< EDID_LENGTH
; i
++)
1310 csum
+= raw_edid
[i
];
1315 static bool drm_edid_is_zero(const u8
*in_edid
, int length
)
1317 if (memchr_inv(in_edid
, 0, length
))
1324 * drm_edid_block_valid - Sanity check the EDID block (base or extension)
1325 * @raw_edid: pointer to raw EDID block
1326 * @block: type of block to validate (0 for base, extension otherwise)
1327 * @print_bad_edid: if true, dump bad EDID blocks to the console
1328 * @edid_corrupt: if true, the header or checksum is invalid
1330 * Validate a base or extension EDID block and optionally dump bad blocks to
1333 * Return: True if the block is valid, false otherwise.
1335 bool drm_edid_block_valid(u8
*raw_edid
, int block
, bool print_bad_edid
,
1339 struct edid
*edid
= (struct edid
*)raw_edid
;
1341 if (WARN_ON(!raw_edid
))
1344 if (edid_fixup
> 8 || edid_fixup
< 0)
1348 int score
= drm_edid_header_is_valid(raw_edid
);
1351 *edid_corrupt
= false;
1352 } else if (score
>= edid_fixup
) {
1353 /* Displayport Link CTS Core 1.2 rev1.1 test 4.2.2.6
1354 * The corrupt flag needs to be set here otherwise, the
1355 * fix-up code here will correct the problem, the
1356 * checksum is correct and the test fails
1359 *edid_corrupt
= true;
1360 DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
1361 memcpy(raw_edid
, edid_header
, sizeof(edid_header
));
1364 *edid_corrupt
= true;
1369 csum
= drm_edid_block_checksum(raw_edid
);
1372 *edid_corrupt
= true;
1374 /* allow CEA to slide through, switches mangle this */
1375 if (raw_edid
[0] == CEA_EXT
) {
1376 DRM_DEBUG("EDID checksum is invalid, remainder is %d\n", csum
);
1377 DRM_DEBUG("Assuming a KVM switch modified the CEA block but left the original checksum\n");
1380 DRM_NOTE("EDID checksum is invalid, remainder is %d\n", csum
);
1386 /* per-block-type checks */
1387 switch (raw_edid
[0]) {
1389 if (edid
->version
!= 1) {
1390 DRM_NOTE("EDID has major version %d, instead of 1\n", edid
->version
);
1394 if (edid
->revision
> 4)
1395 DRM_DEBUG("EDID minor > 4, assuming backward compatibility\n");
1405 if (print_bad_edid
) {
1406 if (drm_edid_is_zero(raw_edid
, EDID_LENGTH
)) {
1407 pr_notice("EDID block is all zeroes\n");
1409 pr_notice("Raw EDID:\n");
1410 print_hex_dump(KERN_NOTICE
,
1411 " \t", DUMP_PREFIX_NONE
, 16, 1,
1412 raw_edid
, EDID_LENGTH
, false);
1417 EXPORT_SYMBOL(drm_edid_block_valid
);
1420 * drm_edid_is_valid - sanity check EDID data
1423 * Sanity-check an entire EDID record (including extensions)
1425 * Return: True if the EDID data is valid, false otherwise.
1427 bool drm_edid_is_valid(struct edid
*edid
)
1430 u8
*raw
= (u8
*)edid
;
1435 for (i
= 0; i
<= edid
->extensions
; i
++)
1436 if (!drm_edid_block_valid(raw
+ i
* EDID_LENGTH
, i
, true, NULL
))
1441 EXPORT_SYMBOL(drm_edid_is_valid
);
1443 #define DDC_SEGMENT_ADDR 0x30
1445 * drm_do_probe_ddc_edid() - get EDID information via I2C
1446 * @data: I2C device adapter
1447 * @buf: EDID data buffer to be filled
1448 * @block: 128 byte EDID block to start fetching from
1449 * @len: EDID data buffer length to fetch
1451 * Try to fetch EDID information by calling I2C driver functions.
1453 * Return: 0 on success or -1 on failure.
1456 drm_do_probe_ddc_edid(void *data
, u8
*buf
, unsigned int block
, size_t len
)
1458 struct i2c_adapter
*adapter
= data
;
1459 unsigned char start
= block
* EDID_LENGTH
;
1460 unsigned char segment
= block
>> 1;
1461 unsigned char xfers
= segment
? 3 : 2;
1462 int ret
, retries
= 5;
1465 * The core I2C driver will automatically retry the transfer if the
1466 * adapter reports EAGAIN. However, we find that bit-banging transfers
1467 * are susceptible to errors under a heavily loaded machine and
1468 * generate spurious NAKs and timeouts. Retrying the transfer
1469 * of the individual block a few times seems to overcome this.
1472 struct i2c_msg msgs
[] = {
1474 .addr
= DDC_SEGMENT_ADDR
,
1492 * Avoid sending the segment addr to not upset non-compliant
1495 ret
= i2c_transfer(adapter
, &msgs
[3 - xfers
], xfers
);
1497 if (ret
== -ENXIO
) {
1498 DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n",
1502 } while (ret
!= xfers
&& --retries
);
1504 return ret
== xfers
? 0 : -1;
1507 static void connector_bad_edid(struct drm_connector
*connector
,
1508 u8
*edid
, int num_blocks
)
1512 if (connector
->bad_edid_counter
++ && !(drm_debug
& DRM_UT_KMS
))
1515 dev_warn(connector
->dev
->dev
,
1516 "%s: EDID is invalid:\n",
1518 for (i
= 0; i
< num_blocks
; i
++) {
1519 u8
*block
= edid
+ i
* EDID_LENGTH
;
1522 if (drm_edid_is_zero(block
, EDID_LENGTH
))
1523 ksprintf(prefix
, "\t[%02x] ZERO ", i
);
1524 else if (!drm_edid_block_valid(block
, i
, false, NULL
))
1525 ksprintf(prefix
, "\t[%02x] BAD ", i
);
1527 ksprintf(prefix
, "\t[%02x] GOOD ", i
);
1529 print_hex_dump(KERN_WARNING
,
1530 prefix
, DUMP_PREFIX_NONE
, 16, 1,
1531 block
, EDID_LENGTH
, false);
1536 * drm_do_get_edid - get EDID data using a custom EDID block read function
1537 * @connector: connector we're probing
1538 * @get_edid_block: EDID block read function
1539 * @data: private data passed to the block read function
1541 * When the I2C adapter connected to the DDC bus is hidden behind a device that
1542 * exposes a different interface to read EDID blocks this function can be used
1543 * to get EDID data using a custom block read function.
1545 * As in the general case the DDC bus is accessible by the kernel at the I2C
1546 * level, drivers must make all reasonable efforts to expose it as an I2C
1547 * adapter and use drm_get_edid() instead of abusing this function.
1549 * The EDID may be overridden using debugfs override_edid or firmare EDID
1550 * (drm_load_edid_firmware() and drm.edid_firmware parameter), in this priority
1551 * order. Having either of them bypasses actual EDID reads.
1553 * Return: Pointer to valid EDID or NULL if we couldn't find any.
1555 struct edid
*drm_do_get_edid(struct drm_connector
*connector
,
1556 int (*get_edid_block
)(void *data
, u8
*buf
, unsigned int block
,
1560 int i
, j
= 0, valid_extensions
= 0;
1562 struct edid
*override
= NULL
;
1564 if (connector
->override_edid
)
1565 override
= drm_edid_duplicate((const struct edid
*)
1566 connector
->edid_blob_ptr
->data
);
1569 override
= drm_load_edid_firmware(connector
);
1571 if (!IS_ERR_OR_NULL(override
))
1574 if ((edid
= kmalloc(EDID_LENGTH
, M_DRM
, GFP_KERNEL
)) == NULL
)
1577 /* base block fetch */
1578 for (i
= 0; i
< 4; i
++) {
1579 if (get_edid_block(data
, edid
, 0, EDID_LENGTH
))
1581 if (drm_edid_block_valid(edid
, 0, false,
1582 &connector
->edid_corrupt
))
1584 if (i
== 0 && drm_edid_is_zero(edid
, EDID_LENGTH
)) {
1585 connector
->null_edid_counter
++;
1592 /* if there's no extensions, we're done */
1593 valid_extensions
= edid
[0x7e];
1594 if (valid_extensions
== 0)
1595 return (struct edid
*)edid
;
1597 new = krealloc(edid
, (valid_extensions
+ 1) * EDID_LENGTH
, M_DRM
,
1603 for (j
= 1; j
<= edid
[0x7e]; j
++) {
1604 u8
*block
= edid
+ j
* EDID_LENGTH
;
1606 for (i
= 0; i
< 4; i
++) {
1607 if (get_edid_block(data
, block
, j
, EDID_LENGTH
))
1609 if (drm_edid_block_valid(block
, j
, false, NULL
))
1617 if (valid_extensions
!= edid
[0x7e]) {
1620 connector_bad_edid(connector
, edid
, edid
[0x7e] + 1);
1622 edid
[EDID_LENGTH
-1] += edid
[0x7e] - valid_extensions
;
1623 edid
[0x7e] = valid_extensions
;
1625 new = kmalloc((valid_extensions
+ 1) * EDID_LENGTH
, M_DRM
,
1631 for (i
= 0; i
<= edid
[0x7e]; i
++) {
1632 u8
*block
= edid
+ i
* EDID_LENGTH
;
1634 if (!drm_edid_block_valid(block
, i
, false, NULL
))
1637 memcpy(base
, block
, EDID_LENGTH
);
1638 base
+= EDID_LENGTH
;
1645 return (struct edid
*)edid
;
1648 connector_bad_edid(connector
, edid
, 1);
1655 * drm_probe_ddc() - probe DDC presence
1656 * @adapter: I2C adapter to probe
1658 * Return: True on success, false on failure.
1661 drm_probe_ddc(struct i2c_adapter
*adapter
)
1665 return (drm_do_probe_ddc_edid(adapter
, &out
, 0, 1) == 0);
1667 EXPORT_SYMBOL(drm_probe_ddc
);
1670 * drm_get_edid - get EDID data, if available
1671 * @connector: connector we're probing
1672 * @adapter: I2C adapter to use for DDC
1674 * Poke the given I2C channel to grab EDID data if possible. If found,
1675 * attach it to the connector.
1677 * Return: Pointer to valid EDID or NULL if we couldn't find any.
1679 struct edid
*drm_get_edid(struct drm_connector
*connector
,
1680 struct i2c_adapter
*adapter
)
1684 if (connector
->force
== DRM_FORCE_OFF
)
1687 if (connector
->force
== DRM_FORCE_UNSPECIFIED
&& !drm_probe_ddc(adapter
))
1690 edid
= drm_do_get_edid(connector
, drm_do_probe_ddc_edid
, adapter
);
1692 drm_get_displayid(connector
, edid
);
1695 EXPORT_SYMBOL(drm_get_edid
);
1698 * drm_get_edid_switcheroo - get EDID data for a vga_switcheroo output
1699 * @connector: connector we're probing
1700 * @adapter: I2C adapter to use for DDC
1702 * Wrapper around drm_get_edid() for laptops with dual GPUs using one set of
1703 * outputs. The wrapper adds the requisite vga_switcheroo calls to temporarily
1704 * switch DDC to the GPU which is retrieving EDID.
1706 * Return: Pointer to valid EDID or %NULL if we couldn't find any.
1708 struct edid
*drm_get_edid_switcheroo(struct drm_connector
*connector
,
1709 struct i2c_adapter
*adapter
)
1711 struct pci_dev
*pdev
= connector
->dev
->pdev
;
1714 vga_switcheroo_lock_ddc(pdev
);
1715 edid
= drm_get_edid(connector
, adapter
);
1716 vga_switcheroo_unlock_ddc(pdev
);
1720 EXPORT_SYMBOL(drm_get_edid_switcheroo
);
1723 * drm_edid_duplicate - duplicate an EDID and the extensions
1724 * @edid: EDID to duplicate
1726 * Return: Pointer to duplicated EDID or NULL on allocation failure.
1728 struct edid
*drm_edid_duplicate(const struct edid
*edid
)
1730 return kmemdup(edid
, (edid
->extensions
+ 1) * EDID_LENGTH
, GFP_KERNEL
);
1732 EXPORT_SYMBOL(drm_edid_duplicate
);
1734 /*** EDID parsing ***/
1737 * edid_vendor - match a string against EDID's obfuscated vendor field
1738 * @edid: EDID to match
1739 * @vendor: vendor string
1741 * Returns true if @vendor is in @edid, false otherwise
1743 static bool edid_vendor(const struct edid
*edid
, const char *vendor
)
1745 char edid_vendor
[3];
1747 edid_vendor
[0] = ((edid
->mfg_id
[0] & 0x7c) >> 2) + '@';
1748 edid_vendor
[1] = (((edid
->mfg_id
[0] & 0x3) << 3) |
1749 ((edid
->mfg_id
[1] & 0xe0) >> 5)) + '@';
1750 edid_vendor
[2] = (edid
->mfg_id
[1] & 0x1f) + '@';
1752 return !strncmp(edid_vendor
, vendor
, 3);
1756 * edid_get_quirks - return quirk flags for a given EDID
1757 * @edid: EDID to process
1759 * This tells subsequent routines what fixes they need to apply.
1761 static u32
edid_get_quirks(const struct edid
*edid
)
1763 const struct edid_quirk
*quirk
;
1766 for (i
= 0; i
< ARRAY_SIZE(edid_quirk_list
); i
++) {
1767 quirk
= &edid_quirk_list
[i
];
1769 if (edid_vendor(edid
, quirk
->vendor
) &&
1770 (EDID_PRODUCT_ID(edid
) == quirk
->product_id
))
1771 return quirk
->quirks
;
1777 #define MODE_SIZE(m) ((m)->hdisplay * (m)->vdisplay)
1778 #define MODE_REFRESH_DIFF(c,t) (abs((c) - (t)))
1781 * edid_fixup_preferred - set preferred modes based on quirk list
1782 * @connector: has mode list to fix up
1783 * @quirks: quirks list
1785 * Walk the mode list for @connector, clearing the preferred status
1786 * on existing modes and setting it anew for the right mode ala @quirks.
1788 static void edid_fixup_preferred(struct drm_connector
*connector
,
1791 struct drm_display_mode
*t
, *cur_mode
, *preferred_mode
;
1792 int target_refresh
= 0;
1793 int cur_vrefresh
, preferred_vrefresh
;
1795 if (list_empty(&connector
->probed_modes
))
1798 if (quirks
& EDID_QUIRK_PREFER_LARGE_60
)
1799 target_refresh
= 60;
1800 if (quirks
& EDID_QUIRK_PREFER_LARGE_75
)
1801 target_refresh
= 75;
1803 preferred_mode
= list_first_entry(&connector
->probed_modes
,
1804 struct drm_display_mode
, head
);
1806 list_for_each_entry_safe(cur_mode
, t
, &connector
->probed_modes
, head
) {
1807 cur_mode
->type
&= ~DRM_MODE_TYPE_PREFERRED
;
1809 if (cur_mode
== preferred_mode
)
1812 /* Largest mode is preferred */
1813 if (MODE_SIZE(cur_mode
) > MODE_SIZE(preferred_mode
))
1814 preferred_mode
= cur_mode
;
1816 cur_vrefresh
= cur_mode
->vrefresh
?
1817 cur_mode
->vrefresh
: drm_mode_vrefresh(cur_mode
);
1818 preferred_vrefresh
= preferred_mode
->vrefresh
?
1819 preferred_mode
->vrefresh
: drm_mode_vrefresh(preferred_mode
);
1820 /* At a given size, try to get closest to target refresh */
1821 if ((MODE_SIZE(cur_mode
) == MODE_SIZE(preferred_mode
)) &&
1822 MODE_REFRESH_DIFF(cur_vrefresh
, target_refresh
) <
1823 MODE_REFRESH_DIFF(preferred_vrefresh
, target_refresh
)) {
1824 preferred_mode
= cur_mode
;
1828 preferred_mode
->type
|= DRM_MODE_TYPE_PREFERRED
;
1832 mode_is_rb(const struct drm_display_mode
*mode
)
1834 return (mode
->htotal
- mode
->hdisplay
== 160) &&
1835 (mode
->hsync_end
- mode
->hdisplay
== 80) &&
1836 (mode
->hsync_end
- mode
->hsync_start
== 32) &&
1837 (mode
->vsync_start
- mode
->vdisplay
== 3);
1841 * drm_mode_find_dmt - Create a copy of a mode if present in DMT
1842 * @dev: Device to duplicate against
1843 * @hsize: Mode width
1844 * @vsize: Mode height
1845 * @fresh: Mode refresh rate
1846 * @rb: Mode reduced-blanking-ness
1848 * Walk the DMT mode list looking for a match for the given parameters.
1850 * Return: A newly allocated copy of the mode, or NULL if not found.
1852 struct drm_display_mode
*drm_mode_find_dmt(struct drm_device
*dev
,
1853 int hsize
, int vsize
, int fresh
,
1858 for (i
= 0; i
< ARRAY_SIZE(drm_dmt_modes
); i
++) {
1859 const struct drm_display_mode
*ptr
= &drm_dmt_modes
[i
];
1860 if (hsize
!= ptr
->hdisplay
)
1862 if (vsize
!= ptr
->vdisplay
)
1864 if (fresh
!= drm_mode_vrefresh(ptr
))
1866 if (rb
!= mode_is_rb(ptr
))
1869 return drm_mode_duplicate(dev
, ptr
);
1874 EXPORT_SYMBOL(drm_mode_find_dmt
);
1876 typedef void detailed_cb(struct detailed_timing
*timing
, void *closure
);
1879 cea_for_each_detailed_block(u8
*ext
, detailed_cb
*cb
, void *closure
)
1883 u8
*det_base
= ext
+ d
;
1886 for (i
= 0; i
< n
; i
++)
1887 cb((struct detailed_timing
*)(det_base
+ 18 * i
), closure
);
1891 vtb_for_each_detailed_block(u8
*ext
, detailed_cb
*cb
, void *closure
)
1893 unsigned int i
, n
= min((int)ext
[0x02], 6);
1894 u8
*det_base
= ext
+ 5;
1897 return; /* unknown version */
1899 for (i
= 0; i
< n
; i
++)
1900 cb((struct detailed_timing
*)(det_base
+ 18 * i
), closure
);
1904 drm_for_each_detailed_block(u8
*raw_edid
, detailed_cb
*cb
, void *closure
)
1907 struct edid
*edid
= (struct edid
*)raw_edid
;
1912 for (i
= 0; i
< EDID_DETAILED_TIMINGS
; i
++)
1913 cb(&(edid
->detailed_timings
[i
]), closure
);
1915 for (i
= 1; i
<= raw_edid
[0x7e]; i
++) {
1916 u8
*ext
= raw_edid
+ (i
* EDID_LENGTH
);
1919 cea_for_each_detailed_block(ext
, cb
, closure
);
1922 vtb_for_each_detailed_block(ext
, cb
, closure
);
1931 is_rb(struct detailed_timing
*t
, void *data
)
1934 if (r
[3] == EDID_DETAIL_MONITOR_RANGE
)
1936 *(bool *)data
= true;
1939 /* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */
1941 drm_monitor_supports_rb(struct edid
*edid
)
1943 if (edid
->revision
>= 4) {
1945 drm_for_each_detailed_block((u8
*)edid
, is_rb
, &ret
);
1949 return ((edid
->input
& DRM_EDID_INPUT_DIGITAL
) != 0);
1953 find_gtf2(struct detailed_timing
*t
, void *data
)
1956 if (r
[3] == EDID_DETAIL_MONITOR_RANGE
&& r
[10] == 0x02)
1960 /* Secondary GTF curve kicks in above some break frequency */
1962 drm_gtf2_hbreak(struct edid
*edid
)
1965 drm_for_each_detailed_block((u8
*)edid
, find_gtf2
, &r
);
1966 return r
? (r
[12] * 2) : 0;
1970 drm_gtf2_2c(struct edid
*edid
)
1973 drm_for_each_detailed_block((u8
*)edid
, find_gtf2
, &r
);
1974 return r
? r
[13] : 0;
1978 drm_gtf2_m(struct edid
*edid
)
1981 drm_for_each_detailed_block((u8
*)edid
, find_gtf2
, &r
);
1982 return r
? (r
[15] << 8) + r
[14] : 0;
1986 drm_gtf2_k(struct edid
*edid
)
1989 drm_for_each_detailed_block((u8
*)edid
, find_gtf2
, &r
);
1990 return r
? r
[16] : 0;
1994 drm_gtf2_2j(struct edid
*edid
)
1997 drm_for_each_detailed_block((u8
*)edid
, find_gtf2
, &r
);
1998 return r
? r
[17] : 0;
2002 * standard_timing_level - get std. timing level(CVT/GTF/DMT)
2003 * @edid: EDID block to scan
2005 static int standard_timing_level(struct edid
*edid
)
2007 if (edid
->revision
>= 2) {
2008 if (edid
->revision
>= 4 && (edid
->features
& DRM_EDID_FEATURE_DEFAULT_GTF
))
2010 if (drm_gtf2_hbreak(edid
))
2018 * 0 is reserved. The spec says 0x01 fill for unused timings. Some old
2019 * monitors fill with ascii space (0x20) instead.
2022 bad_std_timing(u8 a
, u8 b
)
2024 return (a
== 0x00 && b
== 0x00) ||
2025 (a
== 0x01 && b
== 0x01) ||
2026 (a
== 0x20 && b
== 0x20);
2030 * drm_mode_std - convert standard mode info (width, height, refresh) into mode
2031 * @connector: connector of for the EDID block
2032 * @edid: EDID block to scan
2033 * @t: standard timing params
2035 * Take the standard timing params (in this case width, aspect, and refresh)
2036 * and convert them into a real mode using CVT/GTF/DMT.
2038 static struct drm_display_mode
*
2039 drm_mode_std(struct drm_connector
*connector
, struct edid
*edid
,
2040 struct std_timing
*t
)
2042 struct drm_device
*dev
= connector
->dev
;
2043 struct drm_display_mode
*m
, *mode
= NULL
;
2046 unsigned aspect_ratio
= (t
->vfreq_aspect
& EDID_TIMING_ASPECT_MASK
)
2047 >> EDID_TIMING_ASPECT_SHIFT
;
2048 unsigned vfreq
= (t
->vfreq_aspect
& EDID_TIMING_VFREQ_MASK
)
2049 >> EDID_TIMING_VFREQ_SHIFT
;
2050 int timing_level
= standard_timing_level(edid
);
2052 if (bad_std_timing(t
->hsize
, t
->vfreq_aspect
))
2055 /* According to the EDID spec, the hdisplay = hsize * 8 + 248 */
2056 hsize
= t
->hsize
* 8 + 248;
2057 /* vrefresh_rate = vfreq + 60 */
2058 vrefresh_rate
= vfreq
+ 60;
2059 /* the vdisplay is calculated based on the aspect ratio */
2060 if (aspect_ratio
== 0) {
2061 if (edid
->revision
< 3)
2064 vsize
= (hsize
* 10) / 16;
2065 } else if (aspect_ratio
== 1)
2066 vsize
= (hsize
* 3) / 4;
2067 else if (aspect_ratio
== 2)
2068 vsize
= (hsize
* 4) / 5;
2070 vsize
= (hsize
* 9) / 16;
2072 /* HDTV hack, part 1 */
2073 if (vrefresh_rate
== 60 &&
2074 ((hsize
== 1360 && vsize
== 765) ||
2075 (hsize
== 1368 && vsize
== 769))) {
2081 * If this connector already has a mode for this size and refresh
2082 * rate (because it came from detailed or CVT info), use that
2083 * instead. This way we don't have to guess at interlace or
2086 list_for_each_entry(m
, &connector
->probed_modes
, head
)
2087 if (m
->hdisplay
== hsize
&& m
->vdisplay
== vsize
&&
2088 drm_mode_vrefresh(m
) == vrefresh_rate
)
2091 /* HDTV hack, part 2 */
2092 if (hsize
== 1366 && vsize
== 768 && vrefresh_rate
== 60) {
2093 mode
= drm_cvt_mode(dev
, 1366, 768, vrefresh_rate
, 0, 0,
2095 mode
->hdisplay
= 1366;
2096 mode
->hsync_start
= mode
->hsync_start
- 1;
2097 mode
->hsync_end
= mode
->hsync_end
- 1;
2101 /* check whether it can be found in default mode table */
2102 if (drm_monitor_supports_rb(edid
)) {
2103 mode
= drm_mode_find_dmt(dev
, hsize
, vsize
, vrefresh_rate
,
2108 mode
= drm_mode_find_dmt(dev
, hsize
, vsize
, vrefresh_rate
, false);
2112 /* okay, generate it */
2113 switch (timing_level
) {
2117 mode
= drm_gtf_mode(dev
, hsize
, vsize
, vrefresh_rate
, 0, 0);
2121 * This is potentially wrong if there's ever a monitor with
2122 * more than one ranges section, each claiming a different
2123 * secondary GTF curve. Please don't do that.
2125 mode
= drm_gtf_mode(dev
, hsize
, vsize
, vrefresh_rate
, 0, 0);
2128 if (drm_mode_hsync(mode
) > drm_gtf2_hbreak(edid
)) {
2129 drm_mode_destroy(dev
, mode
);
2130 mode
= drm_gtf_mode_complex(dev
, hsize
, vsize
,
2131 vrefresh_rate
, 0, 0,
2139 mode
= drm_cvt_mode(dev
, hsize
, vsize
, vrefresh_rate
, 0, 0,
2147 * EDID is delightfully ambiguous about how interlaced modes are to be
2148 * encoded. Our internal representation is of frame height, but some
2149 * HDTV detailed timings are encoded as field height.
2151 * The format list here is from CEA, in frame size. Technically we
2152 * should be checking refresh rate too. Whatever.
2155 drm_mode_do_interlace_quirk(struct drm_display_mode
*mode
,
2156 struct detailed_pixel_timing
*pt
)
2159 static const struct {
2161 } cea_interlaced
[] = {
2171 if (!(pt
->misc
& DRM_EDID_PT_INTERLACED
))
2174 for (i
= 0; i
< ARRAY_SIZE(cea_interlaced
); i
++) {
2175 if ((mode
->hdisplay
== cea_interlaced
[i
].w
) &&
2176 (mode
->vdisplay
== cea_interlaced
[i
].h
/ 2)) {
2177 mode
->vdisplay
*= 2;
2178 mode
->vsync_start
*= 2;
2179 mode
->vsync_end
*= 2;
2185 mode
->flags
|= DRM_MODE_FLAG_INTERLACE
;
2189 * drm_mode_detailed - create a new mode from an EDID detailed timing section
2190 * @dev: DRM device (needed to create new mode)
2192 * @timing: EDID detailed timing info
2193 * @quirks: quirks to apply
2195 * An EDID detailed timing block contains enough info for us to create and
2196 * return a new struct drm_display_mode.
2198 static struct drm_display_mode
*drm_mode_detailed(struct drm_device
*dev
,
2200 struct detailed_timing
*timing
,
2203 struct drm_display_mode
*mode
;
2204 struct detailed_pixel_timing
*pt
= &timing
->data
.pixel_data
;
2205 unsigned hactive
= (pt
->hactive_hblank_hi
& 0xf0) << 4 | pt
->hactive_lo
;
2206 unsigned vactive
= (pt
->vactive_vblank_hi
& 0xf0) << 4 | pt
->vactive_lo
;
2207 unsigned hblank
= (pt
->hactive_hblank_hi
& 0xf) << 8 | pt
->hblank_lo
;
2208 unsigned vblank
= (pt
->vactive_vblank_hi
& 0xf) << 8 | pt
->vblank_lo
;
2209 unsigned hsync_offset
= (pt
->hsync_vsync_offset_pulse_width_hi
& 0xc0) << 2 | pt
->hsync_offset_lo
;
2210 unsigned hsync_pulse_width
= (pt
->hsync_vsync_offset_pulse_width_hi
& 0x30) << 4 | pt
->hsync_pulse_width_lo
;
2211 unsigned vsync_offset
= (pt
->hsync_vsync_offset_pulse_width_hi
& 0xc) << 2 | pt
->vsync_offset_pulse_width_lo
>> 4;
2212 unsigned vsync_pulse_width
= (pt
->hsync_vsync_offset_pulse_width_hi
& 0x3) << 4 | (pt
->vsync_offset_pulse_width_lo
& 0xf);
2214 /* ignore tiny modes */
2215 if (hactive
< 64 || vactive
< 64)
2218 if (pt
->misc
& DRM_EDID_PT_STEREO
) {
2219 DRM_DEBUG_KMS("stereo mode not supported\n");
2222 if (!(pt
->misc
& DRM_EDID_PT_SEPARATE_SYNC
)) {
2223 DRM_DEBUG_KMS("composite sync not supported\n");
2226 /* it is incorrect if hsync/vsync width is zero */
2227 if (!hsync_pulse_width
|| !vsync_pulse_width
) {
2228 DRM_DEBUG_KMS("Incorrect Detailed timing. "
2229 "Wrong Hsync/Vsync pulse width\n");
2233 if (quirks
& EDID_QUIRK_FORCE_REDUCED_BLANKING
) {
2234 mode
= drm_cvt_mode(dev
, hactive
, vactive
, 60, true, false, false);
2241 mode
= drm_mode_create(dev
);
2245 if (quirks
& EDID_QUIRK_135_CLOCK_TOO_HIGH
)
2246 timing
->pixel_clock
= cpu_to_le16(1088);
2248 mode
->clock
= le16_to_cpu(timing
->pixel_clock
) * 10;
2250 mode
->hdisplay
= hactive
;
2251 mode
->hsync_start
= mode
->hdisplay
+ hsync_offset
;
2252 mode
->hsync_end
= mode
->hsync_start
+ hsync_pulse_width
;
2253 mode
->htotal
= mode
->hdisplay
+ hblank
;
2255 mode
->vdisplay
= vactive
;
2256 mode
->vsync_start
= mode
->vdisplay
+ vsync_offset
;
2257 mode
->vsync_end
= mode
->vsync_start
+ vsync_pulse_width
;
2258 mode
->vtotal
= mode
->vdisplay
+ vblank
;
2260 /* Some EDIDs have bogus h/vtotal values */
2261 if (mode
->hsync_end
> mode
->htotal
)
2262 mode
->htotal
= mode
->hsync_end
+ 1;
2263 if (mode
->vsync_end
> mode
->vtotal
)
2264 mode
->vtotal
= mode
->vsync_end
+ 1;
2266 drm_mode_do_interlace_quirk(mode
, pt
);
2268 if (quirks
& EDID_QUIRK_DETAILED_SYNC_PP
) {
2269 pt
->misc
|= DRM_EDID_PT_HSYNC_POSITIVE
| DRM_EDID_PT_VSYNC_POSITIVE
;
2272 mode
->flags
|= (pt
->misc
& DRM_EDID_PT_HSYNC_POSITIVE
) ?
2273 DRM_MODE_FLAG_PHSYNC
: DRM_MODE_FLAG_NHSYNC
;
2274 mode
->flags
|= (pt
->misc
& DRM_EDID_PT_VSYNC_POSITIVE
) ?
2275 DRM_MODE_FLAG_PVSYNC
: DRM_MODE_FLAG_NVSYNC
;
2278 mode
->width_mm
= pt
->width_mm_lo
| (pt
->width_height_mm_hi
& 0xf0) << 4;
2279 mode
->height_mm
= pt
->height_mm_lo
| (pt
->width_height_mm_hi
& 0xf) << 8;
2281 if (quirks
& EDID_QUIRK_DETAILED_IN_CM
) {
2282 mode
->width_mm
*= 10;
2283 mode
->height_mm
*= 10;
2286 if (quirks
& EDID_QUIRK_DETAILED_USE_MAXIMUM_SIZE
) {
2287 mode
->width_mm
= edid
->width_cm
* 10;
2288 mode
->height_mm
= edid
->height_cm
* 10;
2291 mode
->type
= DRM_MODE_TYPE_DRIVER
;
2292 mode
->vrefresh
= drm_mode_vrefresh(mode
);
2293 drm_mode_set_name(mode
);
2299 mode_in_hsync_range(const struct drm_display_mode
*mode
,
2300 struct edid
*edid
, u8
*t
)
2302 int hsync
, hmin
, hmax
;
2305 if (edid
->revision
>= 4)
2306 hmin
+= ((t
[4] & 0x04) ? 255 : 0);
2308 if (edid
->revision
>= 4)
2309 hmax
+= ((t
[4] & 0x08) ? 255 : 0);
2310 hsync
= drm_mode_hsync(mode
);
2312 return (hsync
<= hmax
&& hsync
>= hmin
);
2316 mode_in_vsync_range(const struct drm_display_mode
*mode
,
2317 struct edid
*edid
, u8
*t
)
2319 int vsync
, vmin
, vmax
;
2322 if (edid
->revision
>= 4)
2323 vmin
+= ((t
[4] & 0x01) ? 255 : 0);
2325 if (edid
->revision
>= 4)
2326 vmax
+= ((t
[4] & 0x02) ? 255 : 0);
2327 vsync
= drm_mode_vrefresh(mode
);
2329 return (vsync
<= vmax
&& vsync
>= vmin
);
2333 range_pixel_clock(struct edid
*edid
, u8
*t
)
2336 if (t
[9] == 0 || t
[9] == 255)
2339 /* 1.4 with CVT support gives us real precision, yay */
2340 if (edid
->revision
>= 4 && t
[10] == 0x04)
2341 return (t
[9] * 10000) - ((t
[12] >> 2) * 250);
2343 /* 1.3 is pathetic, so fuzz up a bit */
2344 return t
[9] * 10000 + 5001;
2348 mode_in_range(const struct drm_display_mode
*mode
, struct edid
*edid
,
2349 struct detailed_timing
*timing
)
2352 u8
*t
= (u8
*)timing
;
2354 if (!mode_in_hsync_range(mode
, edid
, t
))
2357 if (!mode_in_vsync_range(mode
, edid
, t
))
2360 if ((max_clock
= range_pixel_clock(edid
, t
)))
2361 if (mode
->clock
> max_clock
)
2364 /* 1.4 max horizontal check */
2365 if (edid
->revision
>= 4 && t
[10] == 0x04)
2366 if (t
[13] && mode
->hdisplay
> 8 * (t
[13] + (256 * (t
[12]&0x3))))
2369 if (mode_is_rb(mode
) && !drm_monitor_supports_rb(edid
))
2375 static bool valid_inferred_mode(const struct drm_connector
*connector
,
2376 const struct drm_display_mode
*mode
)
2378 const struct drm_display_mode
*m
;
2381 list_for_each_entry(m
, &connector
->probed_modes
, head
) {
2382 if (mode
->hdisplay
== m
->hdisplay
&&
2383 mode
->vdisplay
== m
->vdisplay
&&
2384 drm_mode_vrefresh(mode
) == drm_mode_vrefresh(m
))
2385 return false; /* duplicated */
2386 if (mode
->hdisplay
<= m
->hdisplay
&&
2387 mode
->vdisplay
<= m
->vdisplay
)
2394 drm_dmt_modes_for_range(struct drm_connector
*connector
, struct edid
*edid
,
2395 struct detailed_timing
*timing
)
2398 struct drm_display_mode
*newmode
;
2399 struct drm_device
*dev
= connector
->dev
;
2401 for (i
= 0; i
< ARRAY_SIZE(drm_dmt_modes
); i
++) {
2402 if (mode_in_range(drm_dmt_modes
+ i
, edid
, timing
) &&
2403 valid_inferred_mode(connector
, drm_dmt_modes
+ i
)) {
2404 newmode
= drm_mode_duplicate(dev
, &drm_dmt_modes
[i
]);
2406 drm_mode_probed_add(connector
, newmode
);
2415 /* fix up 1366x768 mode from 1368x768;
2416 * GFT/CVT can't express 1366 width which isn't dividable by 8
2418 void drm_mode_fixup_1366x768(struct drm_display_mode
*mode
)
2420 if (mode
->hdisplay
== 1368 && mode
->vdisplay
== 768) {
2421 mode
->hdisplay
= 1366;
2422 mode
->hsync_start
--;
2424 drm_mode_set_name(mode
);
2429 drm_gtf_modes_for_range(struct drm_connector
*connector
, struct edid
*edid
,
2430 struct detailed_timing
*timing
)
2433 struct drm_display_mode
*newmode
;
2434 struct drm_device
*dev
= connector
->dev
;
2436 for (i
= 0; i
< ARRAY_SIZE(extra_modes
); i
++) {
2437 const struct minimode
*m
= &extra_modes
[i
];
2438 newmode
= drm_gtf_mode(dev
, m
->w
, m
->h
, m
->r
, 0, 0);
2442 drm_mode_fixup_1366x768(newmode
);
2443 if (!mode_in_range(newmode
, edid
, timing
) ||
2444 !valid_inferred_mode(connector
, newmode
)) {
2445 drm_mode_destroy(dev
, newmode
);
2449 drm_mode_probed_add(connector
, newmode
);
2457 drm_cvt_modes_for_range(struct drm_connector
*connector
, struct edid
*edid
,
2458 struct detailed_timing
*timing
)
2461 struct drm_display_mode
*newmode
;
2462 struct drm_device
*dev
= connector
->dev
;
2463 bool rb
= drm_monitor_supports_rb(edid
);
2465 for (i
= 0; i
< ARRAY_SIZE(extra_modes
); i
++) {
2466 const struct minimode
*m
= &extra_modes
[i
];
2467 newmode
= drm_cvt_mode(dev
, m
->w
, m
->h
, m
->r
, rb
, 0, 0);
2471 drm_mode_fixup_1366x768(newmode
);
2472 if (!mode_in_range(newmode
, edid
, timing
) ||
2473 !valid_inferred_mode(connector
, newmode
)) {
2474 drm_mode_destroy(dev
, newmode
);
2478 drm_mode_probed_add(connector
, newmode
);
2486 do_inferred_modes(struct detailed_timing
*timing
, void *c
)
2488 struct detailed_mode_closure
*closure
= c
;
2489 struct detailed_non_pixel
*data
= &timing
->data
.other_data
;
2490 struct detailed_data_monitor_range
*range
= &data
->data
.range
;
2492 if (data
->type
!= EDID_DETAIL_MONITOR_RANGE
)
2495 closure
->modes
+= drm_dmt_modes_for_range(closure
->connector
,
2499 if (!version_greater(closure
->edid
, 1, 1))
2500 return; /* GTF not defined yet */
2502 switch (range
->flags
) {
2503 case 0x02: /* secondary gtf, XXX could do more */
2504 case 0x00: /* default gtf */
2505 closure
->modes
+= drm_gtf_modes_for_range(closure
->connector
,
2509 case 0x04: /* cvt, only in 1.4+ */
2510 if (!version_greater(closure
->edid
, 1, 3))
2513 closure
->modes
+= drm_cvt_modes_for_range(closure
->connector
,
2517 case 0x01: /* just the ranges, no formula */
2524 add_inferred_modes(struct drm_connector
*connector
, struct edid
*edid
)
2526 struct detailed_mode_closure closure
= {
2527 .connector
= connector
,
2531 if (version_greater(edid
, 1, 0))
2532 drm_for_each_detailed_block((u8
*)edid
, do_inferred_modes
,
2535 return closure
.modes
;
2539 drm_est3_modes(struct drm_connector
*connector
, struct detailed_timing
*timing
)
2541 int i
, j
, m
, modes
= 0;
2542 struct drm_display_mode
*mode
;
2543 u8
*est
= ((u8
*)timing
) + 6;
2545 for (i
= 0; i
< 6; i
++) {
2546 for (j
= 7; j
>= 0; j
--) {
2547 m
= (i
* 8) + (7 - j
);
2548 if (m
>= ARRAY_SIZE(est3_modes
))
2550 if (est
[i
] & (1 << j
)) {
2551 mode
= drm_mode_find_dmt(connector
->dev
,
2557 drm_mode_probed_add(connector
, mode
);
2568 do_established_modes(struct detailed_timing
*timing
, void *c
)
2570 struct detailed_mode_closure
*closure
= c
;
2571 struct detailed_non_pixel
*data
= &timing
->data
.other_data
;
2573 if (data
->type
== EDID_DETAIL_EST_TIMINGS
)
2574 closure
->modes
+= drm_est3_modes(closure
->connector
, timing
);
2578 * add_established_modes - get est. modes from EDID and add them
2579 * @connector: connector to add mode(s) to
2580 * @edid: EDID block to scan
2582 * Each EDID block contains a bitmap of the supported "established modes" list
2583 * (defined above). Tease them out and add them to the global modes list.
2586 add_established_modes(struct drm_connector
*connector
, struct edid
*edid
)
2588 struct drm_device
*dev
= connector
->dev
;
2589 unsigned long est_bits
= edid
->established_timings
.t1
|
2590 (edid
->established_timings
.t2
<< 8) |
2591 ((edid
->established_timings
.mfg_rsvd
& 0x80) << 9);
2593 struct detailed_mode_closure closure
= {
2594 .connector
= connector
,
2598 for (i
= 0; i
<= EDID_EST_TIMINGS
; i
++) {
2599 if (est_bits
& (1<<i
)) {
2600 struct drm_display_mode
*newmode
;
2601 newmode
= drm_mode_duplicate(dev
, &edid_est_modes
[i
]);
2603 drm_mode_probed_add(connector
, newmode
);
2609 if (version_greater(edid
, 1, 0))
2610 drm_for_each_detailed_block((u8
*)edid
,
2611 do_established_modes
, &closure
);
2613 return modes
+ closure
.modes
;
2617 do_standard_modes(struct detailed_timing
*timing
, void *c
)
2619 struct detailed_mode_closure
*closure
= c
;
2620 struct detailed_non_pixel
*data
= &timing
->data
.other_data
;
2621 struct drm_connector
*connector
= closure
->connector
;
2622 struct edid
*edid
= closure
->edid
;
2624 if (data
->type
== EDID_DETAIL_STD_MODES
) {
2626 for (i
= 0; i
< 6; i
++) {
2627 struct std_timing
*std
;
2628 struct drm_display_mode
*newmode
;
2630 std
= &data
->data
.timings
[i
];
2631 newmode
= drm_mode_std(connector
, edid
, std
);
2633 drm_mode_probed_add(connector
, newmode
);
2641 * add_standard_modes - get std. modes from EDID and add them
2642 * @connector: connector to add mode(s) to
2643 * @edid: EDID block to scan
2645 * Standard modes can be calculated using the appropriate standard (DMT,
2646 * GTF or CVT. Grab them from @edid and add them to the list.
2649 add_standard_modes(struct drm_connector
*connector
, struct edid
*edid
)
2652 struct detailed_mode_closure closure
= {
2653 .connector
= connector
,
2657 for (i
= 0; i
< EDID_STD_TIMINGS
; i
++) {
2658 struct drm_display_mode
*newmode
;
2660 newmode
= drm_mode_std(connector
, edid
,
2661 &edid
->standard_timings
[i
]);
2663 drm_mode_probed_add(connector
, newmode
);
2668 if (version_greater(edid
, 1, 0))
2669 drm_for_each_detailed_block((u8
*)edid
, do_standard_modes
,
2672 /* XXX should also look for standard codes in VTB blocks */
2674 return modes
+ closure
.modes
;
2677 static int drm_cvt_modes(struct drm_connector
*connector
,
2678 struct detailed_timing
*timing
)
2680 int i
, j
, modes
= 0;
2681 struct drm_display_mode
*newmode
;
2682 struct drm_device
*dev
= connector
->dev
;
2683 struct cvt_timing
*cvt
;
2684 const int rates
[] = { 60, 85, 75, 60, 50 };
2685 const u8 empty
[3] = { 0, 0, 0 };
2687 for (i
= 0; i
< 4; i
++) {
2688 int width
= 0, height
;
2689 cvt
= &(timing
->data
.other_data
.data
.cvt
[i
]);
2691 if (!memcmp(cvt
->code
, empty
, 3))
2694 height
= (cvt
->code
[0] + ((cvt
->code
[1] & 0xf0) << 4) + 1) * 2;
2695 switch (cvt
->code
[1] & 0x0c) {
2697 width
= height
* 4 / 3;
2700 width
= height
* 16 / 9;
2703 width
= height
* 16 / 10;
2706 width
= height
* 15 / 9;
2710 for (j
= 1; j
< 5; j
++) {
2711 if (cvt
->code
[2] & (1 << j
)) {
2712 newmode
= drm_cvt_mode(dev
, width
, height
,
2716 drm_mode_probed_add(connector
, newmode
);
2727 do_cvt_mode(struct detailed_timing
*timing
, void *c
)
2729 struct detailed_mode_closure
*closure
= c
;
2730 struct detailed_non_pixel
*data
= &timing
->data
.other_data
;
2732 if (data
->type
== EDID_DETAIL_CVT_3BYTE
)
2733 closure
->modes
+= drm_cvt_modes(closure
->connector
, timing
);
2737 add_cvt_modes(struct drm_connector
*connector
, struct edid
*edid
)
2739 struct detailed_mode_closure closure
= {
2740 .connector
= connector
,
2744 if (version_greater(edid
, 1, 2))
2745 drm_for_each_detailed_block((u8
*)edid
, do_cvt_mode
, &closure
);
2747 /* XXX should also look for CVT codes in VTB blocks */
2749 return closure
.modes
;
2752 static void fixup_detailed_cea_mode_clock(struct drm_display_mode
*mode
);
2755 do_detailed_mode(struct detailed_timing
*timing
, void *c
)
2757 struct detailed_mode_closure
*closure
= c
;
2758 struct drm_display_mode
*newmode
;
2760 if (timing
->pixel_clock
) {
2761 newmode
= drm_mode_detailed(closure
->connector
->dev
,
2762 closure
->edid
, timing
,
2767 if (closure
->preferred
)
2768 newmode
->type
|= DRM_MODE_TYPE_PREFERRED
;
2771 * Detailed modes are limited to 10kHz pixel clock resolution,
2772 * so fix up anything that looks like CEA/HDMI mode, but the clock
2773 * is just slightly off.
2775 fixup_detailed_cea_mode_clock(newmode
);
2777 drm_mode_probed_add(closure
->connector
, newmode
);
2779 closure
->preferred
= 0;
2784 * add_detailed_modes - Add modes from detailed timings
2785 * @connector: attached connector
2786 * @edid: EDID block to scan
2787 * @quirks: quirks to apply
2790 add_detailed_modes(struct drm_connector
*connector
, struct edid
*edid
,
2793 struct detailed_mode_closure closure
= {
2794 .connector
= connector
,
2800 if (closure
.preferred
&& !version_greater(edid
, 1, 3))
2802 (edid
->features
& DRM_EDID_FEATURE_PREFERRED_TIMING
);
2804 drm_for_each_detailed_block((u8
*)edid
, do_detailed_mode
, &closure
);
2806 return closure
.modes
;
2809 #define AUDIO_BLOCK 0x01
2810 #define VIDEO_BLOCK 0x02
2811 #define VENDOR_BLOCK 0x03
2812 #define SPEAKER_BLOCK 0x04
2813 #define USE_EXTENDED_TAG 0x07
2814 #define EXT_VIDEO_CAPABILITY_BLOCK 0x00
2815 #define EXT_VIDEO_DATA_BLOCK_420 0x0E
2816 #define EXT_VIDEO_CAP_BLOCK_Y420CMDB 0x0F
2817 #define EDID_BASIC_AUDIO (1 << 6)
2818 #define EDID_CEA_YCRCB444 (1 << 5)
2819 #define EDID_CEA_YCRCB422 (1 << 4)
2820 #define EDID_CEA_VCDB_QS (1 << 6)
2823 * Search EDID for CEA extension block.
2825 static u8
*drm_find_edid_extension(const struct edid
*edid
, int ext_id
)
2827 u8
*edid_ext
= NULL
;
2830 /* No EDID or EDID extensions */
2831 if (edid
== NULL
|| edid
->extensions
== 0)
2834 /* Find CEA extension */
2835 for (i
= 0; i
< edid
->extensions
; i
++) {
2836 edid_ext
= (u8
*)edid
+ EDID_LENGTH
* (i
+ 1);
2837 if (edid_ext
[0] == ext_id
)
2841 if (i
== edid
->extensions
)
2847 static u8
*drm_find_cea_extension(const struct edid
*edid
)
2849 return drm_find_edid_extension(edid
, CEA_EXT
);
2852 static u8
*drm_find_displayid_extension(const struct edid
*edid
)
2854 return drm_find_edid_extension(edid
, DISPLAYID_EXT
);
2858 * Calculate the alternate clock for the CEA mode
2859 * (60Hz vs. 59.94Hz etc.)
2862 cea_mode_alternate_clock(const struct drm_display_mode
*cea_mode
)
2864 unsigned int clock
= cea_mode
->clock
;
2866 if (cea_mode
->vrefresh
% 6 != 0)
2870 * edid_cea_modes contains the 59.94Hz
2871 * variant for 240 and 480 line modes,
2872 * and the 60Hz variant otherwise.
2874 if (cea_mode
->vdisplay
== 240 || cea_mode
->vdisplay
== 480)
2875 clock
= DIV_ROUND_CLOSEST(clock
* 1001, 1000);
2877 clock
= DIV_ROUND_CLOSEST(clock
* 1000, 1001);
2883 cea_mode_alternate_timings(u8 vic
, struct drm_display_mode
*mode
)
2886 * For certain VICs the spec allows the vertical
2887 * front porch to vary by one or two lines.
2889 * cea_modes[] stores the variant with the shortest
2890 * vertical front porch. We can adjust the mode to
2891 * get the other variants by simply increasing the
2892 * vertical front porch length.
2894 BUILD_BUG_ON(edid_cea_modes
[8].vtotal
!= 262 ||
2895 edid_cea_modes
[9].vtotal
!= 262 ||
2896 edid_cea_modes
[12].vtotal
!= 262 ||
2897 edid_cea_modes
[13].vtotal
!= 262 ||
2898 edid_cea_modes
[23].vtotal
!= 312 ||
2899 edid_cea_modes
[24].vtotal
!= 312 ||
2900 edid_cea_modes
[27].vtotal
!= 312 ||
2901 edid_cea_modes
[28].vtotal
!= 312);
2903 if (((vic
== 8 || vic
== 9 ||
2904 vic
== 12 || vic
== 13) && mode
->vtotal
< 263) ||
2905 ((vic
== 23 || vic
== 24 ||
2906 vic
== 27 || vic
== 28) && mode
->vtotal
< 314)) {
2907 mode
->vsync_start
++;
2917 static u8
drm_match_cea_mode_clock_tolerance(const struct drm_display_mode
*to_match
,
2918 unsigned int clock_tolerance
)
2922 if (!to_match
->clock
)
2925 for (vic
= 1; vic
< ARRAY_SIZE(edid_cea_modes
); vic
++) {
2926 struct drm_display_mode cea_mode
= edid_cea_modes
[vic
];
2927 unsigned int clock1
, clock2
;
2929 /* Check both 60Hz and 59.94Hz */
2930 clock1
= cea_mode
.clock
;
2931 clock2
= cea_mode_alternate_clock(&cea_mode
);
2933 if (abs(to_match
->clock
- clock1
) > clock_tolerance
&&
2934 abs(to_match
->clock
- clock2
) > clock_tolerance
)
2938 if (drm_mode_equal_no_clocks_no_stereo(to_match
, &cea_mode
))
2940 } while (cea_mode_alternate_timings(vic
, &cea_mode
));
2947 * drm_match_cea_mode - look for a CEA mode matching given mode
2948 * @to_match: display mode
2950 * Return: The CEA Video ID (VIC) of the mode or 0 if it isn't a CEA-861
2953 u8
drm_match_cea_mode(const struct drm_display_mode
*to_match
)
2957 if (!to_match
->clock
)
2960 for (vic
= 1; vic
< ARRAY_SIZE(edid_cea_modes
); vic
++) {
2961 struct drm_display_mode cea_mode
= edid_cea_modes
[vic
];
2962 unsigned int clock1
, clock2
;
2964 /* Check both 60Hz and 59.94Hz */
2965 clock1
= cea_mode
.clock
;
2966 clock2
= cea_mode_alternate_clock(&cea_mode
);
2968 if (KHZ2PICOS(to_match
->clock
) != KHZ2PICOS(clock1
) &&
2969 KHZ2PICOS(to_match
->clock
) != KHZ2PICOS(clock2
))
2973 if (drm_mode_equal_no_clocks_no_stereo(to_match
, &cea_mode
))
2975 } while (cea_mode_alternate_timings(vic
, &cea_mode
));
2980 EXPORT_SYMBOL(drm_match_cea_mode
);
2982 static bool drm_valid_cea_vic(u8 vic
)
2984 return vic
> 0 && vic
< ARRAY_SIZE(edid_cea_modes
);
2988 * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
2989 * the input VIC from the CEA mode list
2990 * @video_code: ID given to each of the CEA modes
2992 * Returns picture aspect ratio
2994 enum hdmi_picture_aspect
drm_get_cea_aspect_ratio(const u8 video_code
)
2996 return edid_cea_modes
[video_code
].picture_aspect_ratio
;
2998 EXPORT_SYMBOL(drm_get_cea_aspect_ratio
);
3001 * Calculate the alternate clock for HDMI modes (those from the HDMI vendor
3004 * It's almost like cea_mode_alternate_clock(), we just need to add an
3005 * exception for the VIC 4 mode (4096x2160@24Hz): no alternate clock for this
3009 hdmi_mode_alternate_clock(const struct drm_display_mode
*hdmi_mode
)
3011 if (hdmi_mode
->vdisplay
== 4096 && hdmi_mode
->hdisplay
== 2160)
3012 return hdmi_mode
->clock
;
3014 return cea_mode_alternate_clock(hdmi_mode
);
3017 static u8
drm_match_hdmi_mode_clock_tolerance(const struct drm_display_mode
*to_match
,
3018 unsigned int clock_tolerance
)
3022 if (!to_match
->clock
)
3025 for (vic
= 1; vic
< ARRAY_SIZE(edid_4k_modes
); vic
++) {
3026 const struct drm_display_mode
*hdmi_mode
= &edid_4k_modes
[vic
];
3027 unsigned int clock1
, clock2
;
3029 /* Make sure to also match alternate clocks */
3030 clock1
= hdmi_mode
->clock
;
3031 clock2
= hdmi_mode_alternate_clock(hdmi_mode
);
3033 if (abs(to_match
->clock
- clock1
) > clock_tolerance
&&
3034 abs(to_match
->clock
- clock2
) > clock_tolerance
)
3037 if (drm_mode_equal_no_clocks(to_match
, hdmi_mode
))
3045 * drm_match_hdmi_mode - look for a HDMI mode matching given mode
3046 * @to_match: display mode
3048 * An HDMI mode is one defined in the HDMI vendor specific block.
3050 * Returns the HDMI Video ID (VIC) of the mode or 0 if it isn't one.
3052 static u8
drm_match_hdmi_mode(const struct drm_display_mode
*to_match
)
3056 if (!to_match
->clock
)
3059 for (vic
= 1; vic
< ARRAY_SIZE(edid_4k_modes
); vic
++) {
3060 const struct drm_display_mode
*hdmi_mode
= &edid_4k_modes
[vic
];
3061 unsigned int clock1
, clock2
;
3063 /* Make sure to also match alternate clocks */
3064 clock1
= hdmi_mode
->clock
;
3065 clock2
= hdmi_mode_alternate_clock(hdmi_mode
);
3067 if ((KHZ2PICOS(to_match
->clock
) == KHZ2PICOS(clock1
) ||
3068 KHZ2PICOS(to_match
->clock
) == KHZ2PICOS(clock2
)) &&
3069 drm_mode_equal_no_clocks_no_stereo(to_match
, hdmi_mode
))
3075 static bool drm_valid_hdmi_vic(u8 vic
)
3077 return vic
> 0 && vic
< ARRAY_SIZE(edid_4k_modes
);
3081 add_alternate_cea_modes(struct drm_connector
*connector
, struct edid
*edid
)
3083 struct drm_device
*dev
= connector
->dev
;
3084 struct drm_display_mode
*mode
, *tmp
;
3085 LINUX_LIST_HEAD(list
);
3088 /* Don't add CEA modes if the CEA extension block is missing */
3089 if (!drm_find_cea_extension(edid
))
3093 * Go through all probed modes and create a new mode
3094 * with the alternate clock for certain CEA modes.
3096 list_for_each_entry(mode
, &connector
->probed_modes
, head
) {
3097 const struct drm_display_mode
*cea_mode
= NULL
;
3098 struct drm_display_mode
*newmode
;
3099 u8 vic
= drm_match_cea_mode(mode
);
3100 unsigned int clock1
, clock2
;
3102 if (drm_valid_cea_vic(vic
)) {
3103 cea_mode
= &edid_cea_modes
[vic
];
3104 clock2
= cea_mode_alternate_clock(cea_mode
);
3106 vic
= drm_match_hdmi_mode(mode
);
3107 if (drm_valid_hdmi_vic(vic
)) {
3108 cea_mode
= &edid_4k_modes
[vic
];
3109 clock2
= hdmi_mode_alternate_clock(cea_mode
);
3116 clock1
= cea_mode
->clock
;
3118 if (clock1
== clock2
)
3121 if (mode
->clock
!= clock1
&& mode
->clock
!= clock2
)
3124 newmode
= drm_mode_duplicate(dev
, cea_mode
);
3128 /* Carry over the stereo flags */
3129 newmode
->flags
|= mode
->flags
& DRM_MODE_FLAG_3D_MASK
;
3132 * The current mode could be either variant. Make
3133 * sure to pick the "other" clock for the new mode.
3135 if (mode
->clock
!= clock1
)
3136 newmode
->clock
= clock1
;
3138 newmode
->clock
= clock2
;
3140 list_add_tail(&newmode
->head
, &list
);
3143 list_for_each_entry_safe(mode
, tmp
, &list
, head
) {
3144 list_del(&mode
->head
);
3145 drm_mode_probed_add(connector
, mode
);
3152 static u8
svd_to_vic(u8 svd
)
3154 /* 0-6 bit vic, 7th bit native mode indicator */
3155 if ((svd
>= 1 && svd
<= 64) || (svd
>= 129 && svd
<= 192))
3161 static struct drm_display_mode
*
3162 drm_display_mode_from_vic_index(struct drm_connector
*connector
,
3163 const u8
*video_db
, u8 video_len
,
3166 struct drm_device
*dev
= connector
->dev
;
3167 struct drm_display_mode
*newmode
;
3170 if (video_db
== NULL
|| video_index
>= video_len
)
3173 /* CEA modes are numbered 1..127 */
3174 vic
= svd_to_vic(video_db
[video_index
]);
3175 if (!drm_valid_cea_vic(vic
))
3178 newmode
= drm_mode_duplicate(dev
, &edid_cea_modes
[vic
]);
3182 newmode
->vrefresh
= 0;
3188 * do_y420vdb_modes - Parse YCBCR 420 only modes
3189 * @connector: connector corresponding to the HDMI sink
3190 * @svds: start of the data block of CEA YCBCR 420 VDB
3191 * @len: length of the CEA YCBCR 420 VDB
3193 * Parse the CEA-861-F YCBCR 420 Video Data Block (Y420VDB)
3194 * which contains modes which can be supported in YCBCR 420
3195 * output format only.
3197 static int do_y420vdb_modes(struct drm_connector
*connector
,
3198 const u8
*svds
, u8 svds_len
)
3201 struct drm_device
*dev
= connector
->dev
;
3202 struct drm_display_info
*info
= &connector
->display_info
;
3203 struct drm_hdmi_info
*hdmi
= &info
->hdmi
;
3205 for (i
= 0; i
< svds_len
; i
++) {
3206 u8 vic
= svd_to_vic(svds
[i
]);
3207 struct drm_display_mode
*newmode
;
3209 if (!drm_valid_cea_vic(vic
))
3212 newmode
= drm_mode_duplicate(dev
, &edid_cea_modes
[vic
]);
3215 bitmap_set(hdmi
->y420_vdb_modes
, vic
, 1);
3216 drm_mode_probed_add(connector
, newmode
);
3221 info
->color_formats
|= DRM_COLOR_FORMAT_YCRCB420
;
3226 * drm_add_cmdb_modes - Add a YCBCR 420 mode into bitmap
3227 * @connector: connector corresponding to the HDMI sink
3228 * @vic: CEA vic for the video mode to be added in the map
3230 * Makes an entry for a videomode in the YCBCR 420 bitmap
3233 drm_add_cmdb_modes(struct drm_connector
*connector
, u8 svd
)
3235 u8 vic
= svd_to_vic(svd
);
3236 struct drm_hdmi_info
*hdmi
= &connector
->display_info
.hdmi
;
3238 if (!drm_valid_cea_vic(vic
))
3241 bitmap_set(hdmi
->y420_cmdb_modes
, vic
, 1);
3245 do_cea_modes(struct drm_connector
*connector
, const u8
*db
, u8 len
)
3248 struct drm_hdmi_info
*hdmi
= &connector
->display_info
.hdmi
;
3250 for (i
= 0; i
< len
; i
++) {
3251 struct drm_display_mode
*mode
;
3252 mode
= drm_display_mode_from_vic_index(connector
, db
, len
, i
);
3255 * YCBCR420 capability block contains a bitmap which
3256 * gives the index of CEA modes from CEA VDB, which
3257 * can support YCBCR 420 sampling output also (apart
3258 * from RGB/YCBCR444 etc).
3259 * For example, if the bit 0 in bitmap is set,
3260 * first mode in VDB can support YCBCR420 output too.
3261 * Add YCBCR420 modes only if sink is HDMI 2.0 capable.
3263 if (i
< 64 && hdmi
->y420_cmdb_map
& (1ULL << i
))
3264 drm_add_cmdb_modes(connector
, db
[i
]);
3266 drm_mode_probed_add(connector
, mode
);
3274 struct stereo_mandatory_mode
{
3275 int width
, height
, vrefresh
;
3279 static const struct stereo_mandatory_mode stereo_mandatory_modes
[] = {
3280 { 1920, 1080, 24, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM
},
3281 { 1920, 1080, 24, DRM_MODE_FLAG_3D_FRAME_PACKING
},
3283 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
},
3285 DRM_MODE_FLAG_INTERLACE
| DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
},
3286 { 1280, 720, 50, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM
},
3287 { 1280, 720, 50, DRM_MODE_FLAG_3D_FRAME_PACKING
},
3288 { 1280, 720, 60, DRM_MODE_FLAG_3D_TOP_AND_BOTTOM
},
3289 { 1280, 720, 60, DRM_MODE_FLAG_3D_FRAME_PACKING
}
3293 stereo_match_mandatory(const struct drm_display_mode
*mode
,
3294 const struct stereo_mandatory_mode
*stereo_mode
)
3296 unsigned int interlaced
= mode
->flags
& DRM_MODE_FLAG_INTERLACE
;
3298 return mode
->hdisplay
== stereo_mode
->width
&&
3299 mode
->vdisplay
== stereo_mode
->height
&&
3300 interlaced
== (stereo_mode
->flags
& DRM_MODE_FLAG_INTERLACE
) &&
3301 drm_mode_vrefresh(mode
) == stereo_mode
->vrefresh
;
3304 static int add_hdmi_mandatory_stereo_modes(struct drm_connector
*connector
)
3306 struct drm_device
*dev
= connector
->dev
;
3307 const struct drm_display_mode
*mode
;
3308 struct list_head stereo_modes
;
3311 INIT_LIST_HEAD(&stereo_modes
);
3313 list_for_each_entry(mode
, &connector
->probed_modes
, head
) {
3314 for (i
= 0; i
< ARRAY_SIZE(stereo_mandatory_modes
); i
++) {
3315 const struct stereo_mandatory_mode
*mandatory
;
3316 struct drm_display_mode
*new_mode
;
3318 if (!stereo_match_mandatory(mode
,
3319 &stereo_mandatory_modes
[i
]))
3322 mandatory
= &stereo_mandatory_modes
[i
];
3323 new_mode
= drm_mode_duplicate(dev
, mode
);
3327 new_mode
->flags
|= mandatory
->flags
;
3328 list_add_tail(&new_mode
->head
, &stereo_modes
);
3333 list_splice_tail(&stereo_modes
, &connector
->probed_modes
);
3338 static int add_hdmi_mode(struct drm_connector
*connector
, u8 vic
)
3340 struct drm_device
*dev
= connector
->dev
;
3341 struct drm_display_mode
*newmode
;
3343 if (!drm_valid_hdmi_vic(vic
)) {
3344 DRM_ERROR("Unknown HDMI VIC: %d\n", vic
);
3348 newmode
= drm_mode_duplicate(dev
, &edid_4k_modes
[vic
]);
3352 drm_mode_probed_add(connector
, newmode
);
3357 static int add_3d_struct_modes(struct drm_connector
*connector
, u16 structure
,
3358 const u8
*video_db
, u8 video_len
, u8 video_index
)
3360 struct drm_display_mode
*newmode
;
3363 if (structure
& (1 << 0)) {
3364 newmode
= drm_display_mode_from_vic_index(connector
, video_db
,
3368 newmode
->flags
|= DRM_MODE_FLAG_3D_FRAME_PACKING
;
3369 drm_mode_probed_add(connector
, newmode
);
3373 if (structure
& (1 << 6)) {
3374 newmode
= drm_display_mode_from_vic_index(connector
, video_db
,
3378 newmode
->flags
|= DRM_MODE_FLAG_3D_TOP_AND_BOTTOM
;
3379 drm_mode_probed_add(connector
, newmode
);
3383 if (structure
& (1 << 8)) {
3384 newmode
= drm_display_mode_from_vic_index(connector
, video_db
,
3388 newmode
->flags
|= DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
;
3389 drm_mode_probed_add(connector
, newmode
);
3398 * do_hdmi_vsdb_modes - Parse the HDMI Vendor Specific data block
3399 * @connector: connector corresponding to the HDMI sink
3400 * @db: start of the CEA vendor specific block
3401 * @len: length of the CEA block payload, ie. one can access up to db[len]
3403 * Parses the HDMI VSDB looking for modes to add to @connector. This function
3404 * also adds the stereo 3d modes when applicable.
3407 do_hdmi_vsdb_modes(struct drm_connector
*connector
, const u8
*db
, u8 len
,
3408 const u8
*video_db
, u8 video_len
)
3410 int modes
= 0, offset
= 0, i
, multi_present
= 0, multi_len
;
3411 u8 vic_len
, hdmi_3d_len
= 0;
3418 /* no HDMI_Video_Present */
3419 if (!(db
[8] & (1 << 5)))
3422 /* Latency_Fields_Present */
3423 if (db
[8] & (1 << 7))
3426 /* I_Latency_Fields_Present */
3427 if (db
[8] & (1 << 6))
3430 /* the declared length is not long enough for the 2 first bytes
3431 * of additional video format capabilities */
3432 if (len
< (8 + offset
+ 2))
3437 if (db
[8 + offset
] & (1 << 7)) {
3438 modes
+= add_hdmi_mandatory_stereo_modes(connector
);
3440 /* 3D_Multi_present */
3441 multi_present
= (db
[8 + offset
] & 0x60) >> 5;
3445 vic_len
= db
[8 + offset
] >> 5;
3446 hdmi_3d_len
= db
[8 + offset
] & 0x1f;
3448 for (i
= 0; i
< vic_len
&& len
>= (9 + offset
+ i
); i
++) {
3451 vic
= db
[9 + offset
+ i
];
3452 modes
+= add_hdmi_mode(connector
, vic
);
3454 offset
+= 1 + vic_len
;
3456 if (multi_present
== 1)
3458 else if (multi_present
== 2)
3463 if (len
< (8 + offset
+ hdmi_3d_len
- 1))
3466 if (hdmi_3d_len
< multi_len
)
3469 if (multi_present
== 1 || multi_present
== 2) {
3470 /* 3D_Structure_ALL */
3471 structure_all
= (db
[8 + offset
] << 8) | db
[9 + offset
];
3473 /* check if 3D_MASK is present */
3474 if (multi_present
== 2)
3475 mask
= (db
[10 + offset
] << 8) | db
[11 + offset
];
3479 for (i
= 0; i
< 16; i
++) {
3480 if (mask
& (1 << i
))
3481 modes
+= add_3d_struct_modes(connector
,
3488 offset
+= multi_len
;
3490 for (i
= 0; i
< (hdmi_3d_len
- multi_len
); i
++) {
3492 struct drm_display_mode
*newmode
= NULL
;
3493 unsigned int newflag
= 0;
3494 bool detail_present
;
3496 detail_present
= ((db
[8 + offset
+ i
] & 0x0f) > 7);
3498 if (detail_present
&& (i
+ 1 == hdmi_3d_len
- multi_len
))
3501 /* 2D_VIC_order_X */
3502 vic_index
= db
[8 + offset
+ i
] >> 4;
3504 /* 3D_Structure_X */
3505 switch (db
[8 + offset
+ i
] & 0x0f) {
3507 newflag
= DRM_MODE_FLAG_3D_FRAME_PACKING
;
3510 newflag
= DRM_MODE_FLAG_3D_TOP_AND_BOTTOM
;
3514 if ((db
[9 + offset
+ i
] >> 4) == 1)
3515 newflag
= DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
;
3520 newmode
= drm_display_mode_from_vic_index(connector
,
3526 newmode
->flags
|= newflag
;
3527 drm_mode_probed_add(connector
, newmode
);
3541 cea_db_payload_len(const u8
*db
)
3543 return db
[0] & 0x1f;
3547 cea_db_extended_tag(const u8
*db
)
3553 cea_db_tag(const u8
*db
)
3559 cea_revision(const u8
*cea
)
3565 cea_db_offsets(const u8
*cea
, int *start
, int *end
)
3567 /* Data block offset in CEA extension block */
3572 if (*end
< 4 || *end
> 127)
3577 static bool cea_db_is_hdmi_vsdb(const u8
*db
)
3581 if (cea_db_tag(db
) != VENDOR_BLOCK
)
3584 if (cea_db_payload_len(db
) < 5)
3587 hdmi_id
= db
[1] | (db
[2] << 8) | (db
[3] << 16);
3589 return hdmi_id
== HDMI_IEEE_OUI
;
3592 static bool cea_db_is_hdmi_forum_vsdb(const u8
*db
)
3596 if (cea_db_tag(db
) != VENDOR_BLOCK
)
3599 if (cea_db_payload_len(db
) < 7)
3602 oui
= db
[3] << 16 | db
[2] << 8 | db
[1];
3604 return oui
== HDMI_FORUM_IEEE_OUI
;
3607 static bool cea_db_is_y420cmdb(const u8
*db
)
3609 if (cea_db_tag(db
) != USE_EXTENDED_TAG
)
3612 if (!cea_db_payload_len(db
))
3615 if (cea_db_extended_tag(db
) != EXT_VIDEO_CAP_BLOCK_Y420CMDB
)
3621 static bool cea_db_is_y420vdb(const u8
*db
)
3623 if (cea_db_tag(db
) != USE_EXTENDED_TAG
)
3626 if (!cea_db_payload_len(db
))
3629 if (cea_db_extended_tag(db
) != EXT_VIDEO_DATA_BLOCK_420
)
3635 #define for_each_cea_db(cea, i, start, end) \
3636 for ((i) = (start); (i) < (end) && (i) + cea_db_payload_len(&(cea)[(i)]) < (end); (i) += cea_db_payload_len(&(cea)[(i)]) + 1)
3638 static void drm_parse_y420cmdb_bitmap(struct drm_connector
*connector
,
3641 struct drm_display_info
*info
= &connector
->display_info
;
3642 struct drm_hdmi_info
*hdmi
= &info
->hdmi
;
3643 u8 map_len
= cea_db_payload_len(db
) - 1;
3648 /* All CEA modes support ycbcr420 sampling also.*/
3649 hdmi
->y420_cmdb_map
= U64_MAX
;
3650 info
->color_formats
|= DRM_COLOR_FORMAT_YCRCB420
;
3655 * This map indicates which of the existing CEA block modes
3656 * from VDB can support YCBCR420 output too. So if bit=0 is
3657 * set, first mode from VDB can support YCBCR420 output too.
3658 * We will parse and keep this map, before parsing VDB itself
3659 * to avoid going through the same block again and again.
3661 * Spec is not clear about max possible size of this block.
3662 * Clamping max bitmap block size at 8 bytes. Every byte can
3663 * address 8 CEA modes, in this way this map can address
3664 * 8*8 = first 64 SVDs.
3666 if (WARN_ON_ONCE(map_len
> 8))
3669 for (count
= 0; count
< map_len
; count
++)
3670 map
|= (u64
)db
[2 + count
] << (8 * count
);
3673 info
->color_formats
|= DRM_COLOR_FORMAT_YCRCB420
;
3675 hdmi
->y420_cmdb_map
= map
;
3679 add_cea_modes(struct drm_connector
*connector
, struct edid
*edid
)
3681 const u8
*cea
= drm_find_cea_extension(edid
);
3682 const u8
*db
, *hdmi
= NULL
, *video
= NULL
;
3683 u8 dbl
, hdmi_len
, video_len
= 0;
3686 if (cea
&& cea_revision(cea
) >= 3) {
3689 if (cea_db_offsets(cea
, &start
, &end
))
3692 for_each_cea_db(cea
, i
, start
, end
) {
3694 dbl
= cea_db_payload_len(db
);
3696 if (cea_db_tag(db
) == VIDEO_BLOCK
) {
3699 modes
+= do_cea_modes(connector
, video
, dbl
);
3700 } else if (cea_db_is_hdmi_vsdb(db
)) {
3703 } else if (cea_db_is_y420vdb(db
)) {
3704 const u8
*vdb420
= &db
[2];
3706 /* Add 4:2:0(only) modes present in EDID */
3707 modes
+= do_y420vdb_modes(connector
,
3715 * We parse the HDMI VSDB after having added the cea modes as we will
3716 * be patching their flags when the sink supports stereo 3D.
3719 modes
+= do_hdmi_vsdb_modes(connector
, hdmi
, hdmi_len
, video
,
3725 static void fixup_detailed_cea_mode_clock(struct drm_display_mode
*mode
)
3727 const struct drm_display_mode
*cea_mode
;
3728 int clock1
, clock2
, clock
;
3733 * allow 5kHz clock difference either way to account for
3734 * the 10kHz clock resolution limit of detailed timings.
3736 vic
= drm_match_cea_mode_clock_tolerance(mode
, 5);
3737 if (drm_valid_cea_vic(vic
)) {
3739 cea_mode
= &edid_cea_modes
[vic
];
3740 clock1
= cea_mode
->clock
;
3741 clock2
= cea_mode_alternate_clock(cea_mode
);
3743 vic
= drm_match_hdmi_mode_clock_tolerance(mode
, 5);
3744 if (drm_valid_hdmi_vic(vic
)) {
3746 cea_mode
= &edid_4k_modes
[vic
];
3747 clock1
= cea_mode
->clock
;
3748 clock2
= hdmi_mode_alternate_clock(cea_mode
);
3754 /* pick whichever is closest */
3755 if (abs(mode
->clock
- clock1
) < abs(mode
->clock
- clock2
))
3760 if (mode
->clock
== clock
)
3763 DRM_DEBUG("detailed mode matches %s VIC %d, adjusting clock %d -> %d\n",
3764 type
, vic
, mode
->clock
, clock
);
3765 mode
->clock
= clock
;
3769 drm_parse_hdmi_vsdb_audio(struct drm_connector
*connector
, const u8
*db
)
3771 u8 len
= cea_db_payload_len(db
);
3774 connector
->eld
[5] |= (db
[6] >> 7) << 1; /* Supports_AI */
3776 connector
->latency_present
[0] = db
[8] >> 7;
3777 connector
->latency_present
[1] = (db
[8] >> 6) & 1;
3780 connector
->video_latency
[0] = db
[9];
3782 connector
->audio_latency
[0] = db
[10];
3784 connector
->video_latency
[1] = db
[11];
3786 connector
->audio_latency
[1] = db
[12];
3788 DRM_DEBUG_KMS("HDMI: latency present %d %d, "
3789 "video latency %d %d, "
3790 "audio latency %d %d\n",
3791 connector
->latency_present
[0],
3792 connector
->latency_present
[1],
3793 connector
->video_latency
[0],
3794 connector
->video_latency
[1],
3795 connector
->audio_latency
[0],
3796 connector
->audio_latency
[1]);
3800 monitor_name(struct detailed_timing
*t
, void *data
)
3802 if (t
->data
.other_data
.type
== EDID_DETAIL_MONITOR_NAME
)
3803 *(u8
**)data
= t
->data
.other_data
.data
.str
.str
;
3806 static int get_monitor_name(struct edid
*edid
, char name
[13])
3808 char *edid_name
= NULL
;
3814 drm_for_each_detailed_block((u8
*)edid
, monitor_name
, &edid_name
);
3815 for (mnl
= 0; edid_name
&& mnl
< 13; mnl
++) {
3816 if (edid_name
[mnl
] == 0x0a)
3819 name
[mnl
] = edid_name
[mnl
];
3826 * drm_edid_get_monitor_name - fetch the monitor name from the edid
3827 * @edid: monitor EDID information
3828 * @name: pointer to a character array to hold the name of the monitor
3829 * @bufsize: The size of the name buffer (should be at least 14 chars.)
3832 void drm_edid_get_monitor_name(struct edid
*edid
, char *name
, int bufsize
)
3840 name_length
= min(get_monitor_name(edid
, buf
), bufsize
- 1);
3841 memcpy(name
, buf
, name_length
);
3842 name
[name_length
] = '\0';
3844 EXPORT_SYMBOL(drm_edid_get_monitor_name
);
3847 * drm_edid_to_eld - build ELD from EDID
3848 * @connector: connector corresponding to the HDMI/DP sink
3849 * @edid: EDID to parse
3851 * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The
3852 * HDCP and Port_ID ELD fields are left for the graphics driver to fill in.
3854 void drm_edid_to_eld(struct drm_connector
*connector
, struct edid
*edid
)
3856 uint8_t *eld
= connector
->eld
;
3859 int total_sad_count
= 0;
3863 memset(eld
, 0, sizeof(connector
->eld
));
3865 connector
->latency_present
[0] = false;
3866 connector
->latency_present
[1] = false;
3867 connector
->video_latency
[0] = 0;
3868 connector
->audio_latency
[0] = 0;
3869 connector
->video_latency
[1] = 0;
3870 connector
->audio_latency
[1] = 0;
3875 cea
= drm_find_cea_extension(edid
);
3877 DRM_DEBUG_KMS("ELD: no CEA Extension found\n");
3881 mnl
= get_monitor_name(edid
, eld
+ 20);
3883 eld
[4] = (cea
[1] << 5) | mnl
;
3884 DRM_DEBUG_KMS("ELD monitor %s\n", eld
+ 20);
3886 eld
[0] = 2 << 3; /* ELD version: 2 */
3888 eld
[16] = edid
->mfg_id
[0];
3889 eld
[17] = edid
->mfg_id
[1];
3890 eld
[18] = edid
->prod_code
[0];
3891 eld
[19] = edid
->prod_code
[1];
3893 if (cea_revision(cea
) >= 3) {
3896 if (cea_db_offsets(cea
, &start
, &end
)) {
3901 for_each_cea_db(cea
, i
, start
, end
) {
3903 dbl
= cea_db_payload_len(db
);
3905 switch (cea_db_tag(db
)) {
3909 /* Audio Data Block, contains SADs */
3910 sad_count
= min(dbl
/ 3, 15 - total_sad_count
);
3912 memcpy(eld
+ 20 + mnl
+ total_sad_count
* 3,
3913 &db
[1], sad_count
* 3);
3914 total_sad_count
+= sad_count
;
3917 /* Speaker Allocation Data Block */
3922 /* HDMI Vendor-Specific Data Block */
3923 if (cea_db_is_hdmi_vsdb(db
))
3924 drm_parse_hdmi_vsdb_audio(connector
, db
);
3931 eld
[5] |= total_sad_count
<< 4;
3933 if (connector
->connector_type
== DRM_MODE_CONNECTOR_DisplayPort
||
3934 connector
->connector_type
== DRM_MODE_CONNECTOR_eDP
)
3935 eld
[DRM_ELD_SAD_COUNT_CONN_TYPE
] |= DRM_ELD_CONN_TYPE_DP
;
3937 eld
[DRM_ELD_SAD_COUNT_CONN_TYPE
] |= DRM_ELD_CONN_TYPE_HDMI
;
3939 eld
[DRM_ELD_BASELINE_ELD_LEN
] =
3940 DIV_ROUND_UP(drm_eld_calc_baseline_block_size(eld
), 4);
3942 DRM_DEBUG_KMS("ELD size %d, SAD count %d\n",
3943 drm_eld_size(eld
), total_sad_count
);
3945 EXPORT_SYMBOL(drm_edid_to_eld
);
3948 * drm_edid_to_sad - extracts SADs from EDID
3949 * @edid: EDID to parse
3950 * @sads: pointer that will be set to the extracted SADs
3952 * Looks for CEA EDID block and extracts SADs (Short Audio Descriptors) from it.
3954 * Note: The returned pointer needs to be freed using kfree().
3956 * Return: The number of found SADs or negative number on error.
3958 int drm_edid_to_sad(struct edid
*edid
, struct cea_sad
**sads
)
3961 int i
, start
, end
, dbl
;
3964 cea
= drm_find_cea_extension(edid
);
3966 DRM_DEBUG_KMS("SAD: no CEA Extension found\n");
3970 if (cea_revision(cea
) < 3) {
3971 DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
3975 if (cea_db_offsets(cea
, &start
, &end
)) {
3976 DRM_DEBUG_KMS("SAD: invalid data block offsets\n");
3980 for_each_cea_db(cea
, i
, start
, end
) {
3983 if (cea_db_tag(db
) == AUDIO_BLOCK
) {
3985 dbl
= cea_db_payload_len(db
);
3987 count
= dbl
/ 3; /* SAD is 3B */
3988 *sads
= kcalloc(count
, sizeof(**sads
), GFP_KERNEL
);
3991 for (j
= 0; j
< count
; j
++) {
3992 u8
*sad
= &db
[1 + j
* 3];
3994 (*sads
)[j
].format
= (sad
[0] & 0x78) >> 3;
3995 (*sads
)[j
].channels
= sad
[0] & 0x7;
3996 (*sads
)[j
].freq
= sad
[1] & 0x7F;
3997 (*sads
)[j
].byte2
= sad
[2];
4005 EXPORT_SYMBOL(drm_edid_to_sad
);
4008 * drm_edid_to_speaker_allocation - extracts Speaker Allocation Data Blocks from EDID
4009 * @edid: EDID to parse
4010 * @sadb: pointer to the speaker block
4012 * Looks for CEA EDID block and extracts the Speaker Allocation Data Block from it.
4014 * Note: The returned pointer needs to be freed using kfree().
4016 * Return: The number of found Speaker Allocation Blocks or negative number on
4019 int drm_edid_to_speaker_allocation(struct edid
*edid
, u8
**sadb
)
4022 int i
, start
, end
, dbl
;
4025 cea
= drm_find_cea_extension(edid
);
4027 DRM_DEBUG_KMS("SAD: no CEA Extension found\n");
4031 if (cea_revision(cea
) < 3) {
4032 DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
4036 if (cea_db_offsets(cea
, &start
, &end
)) {
4037 DRM_DEBUG_KMS("SAD: invalid data block offsets\n");
4041 for_each_cea_db(cea
, i
, start
, end
) {
4042 const u8
*db
= &cea
[i
];
4044 if (cea_db_tag(db
) == SPEAKER_BLOCK
) {
4045 dbl
= cea_db_payload_len(db
);
4047 /* Speaker Allocation Data Block */
4049 *sadb
= kmemdup(&db
[1], dbl
, GFP_KERNEL
);
4060 EXPORT_SYMBOL(drm_edid_to_speaker_allocation
);
4063 * drm_av_sync_delay - compute the HDMI/DP sink audio-video sync delay
4064 * @connector: connector associated with the HDMI/DP sink
4065 * @mode: the display mode
4067 * Return: The HDMI/DP sink's audio-video sync delay in milliseconds or 0 if
4068 * the sink doesn't support audio or video.
4070 int drm_av_sync_delay(struct drm_connector
*connector
,
4071 const struct drm_display_mode
*mode
)
4073 int i
= !!(mode
->flags
& DRM_MODE_FLAG_INTERLACE
);
4076 if (!connector
->latency_present
[0])
4078 if (!connector
->latency_present
[1])
4081 a
= connector
->audio_latency
[i
];
4082 v
= connector
->video_latency
[i
];
4085 * HDMI/DP sink doesn't support audio or video?
4087 if (a
== 255 || v
== 255)
4091 * Convert raw EDID values to millisecond.
4092 * Treat unknown latency as 0ms.
4095 a
= min(2 * (a
- 1), 500);
4097 v
= min(2 * (v
- 1), 500);
4099 return max(v
- a
, 0);
4101 EXPORT_SYMBOL(drm_av_sync_delay
);
4104 * drm_detect_hdmi_monitor - detect whether monitor is HDMI
4105 * @edid: monitor EDID information
4107 * Parse the CEA extension according to CEA-861-B.
4109 * Return: True if the monitor is HDMI, false if not or unknown.
4111 bool drm_detect_hdmi_monitor(struct edid
*edid
)
4115 int start_offset
, end_offset
;
4117 edid_ext
= drm_find_cea_extension(edid
);
4121 if (cea_db_offsets(edid_ext
, &start_offset
, &end_offset
))
4125 * Because HDMI identifier is in Vendor Specific Block,
4126 * search it from all data blocks of CEA extension.
4128 for_each_cea_db(edid_ext
, i
, start_offset
, end_offset
) {
4129 if (cea_db_is_hdmi_vsdb(&edid_ext
[i
]))
4135 EXPORT_SYMBOL(drm_detect_hdmi_monitor
);
4138 * drm_detect_monitor_audio - check monitor audio capability
4139 * @edid: EDID block to scan
4141 * Monitor should have CEA extension block.
4142 * If monitor has 'basic audio', but no CEA audio blocks, it's 'basic
4143 * audio' only. If there is any audio extension block and supported
4144 * audio format, assume at least 'basic audio' support, even if 'basic
4145 * audio' is not defined in EDID.
4147 * Return: True if the monitor supports audio, false otherwise.
4149 bool drm_detect_monitor_audio(struct edid
*edid
)
4153 bool has_audio
= false;
4154 int start_offset
, end_offset
;
4156 edid_ext
= drm_find_cea_extension(edid
);
4160 has_audio
= ((edid_ext
[3] & EDID_BASIC_AUDIO
) != 0);
4163 DRM_DEBUG_KMS("Monitor has basic audio support\n");
4167 if (cea_db_offsets(edid_ext
, &start_offset
, &end_offset
))
4170 for_each_cea_db(edid_ext
, i
, start_offset
, end_offset
) {
4171 if (cea_db_tag(&edid_ext
[i
]) == AUDIO_BLOCK
) {
4173 for (j
= 1; j
< cea_db_payload_len(&edid_ext
[i
]) + 1; j
+= 3)
4174 DRM_DEBUG_KMS("CEA audio format %d\n",
4175 (edid_ext
[i
+ j
] >> 3) & 0xf);
4182 EXPORT_SYMBOL(drm_detect_monitor_audio
);
4185 * drm_rgb_quant_range_selectable - is RGB quantization range selectable?
4186 * @edid: EDID block to scan
4188 * Check whether the monitor reports the RGB quantization range selection
4189 * as supported. The AVI infoframe can then be used to inform the monitor
4190 * which quantization range (full or limited) is used.
4192 * Return: True if the RGB quantization range is selectable, false otherwise.
4194 bool drm_rgb_quant_range_selectable(struct edid
*edid
)
4199 edid_ext
= drm_find_cea_extension(edid
);
4203 if (cea_db_offsets(edid_ext
, &start
, &end
))
4206 for_each_cea_db(edid_ext
, i
, start
, end
) {
4207 if (cea_db_tag(&edid_ext
[i
]) == USE_EXTENDED_TAG
&&
4208 cea_db_payload_len(&edid_ext
[i
]) == 2 &&
4209 cea_db_extended_tag(&edid_ext
[i
]) ==
4210 EXT_VIDEO_CAPABILITY_BLOCK
) {
4211 DRM_DEBUG_KMS("CEA VCDB 0x%02x\n", edid_ext
[i
+ 2]);
4212 return edid_ext
[i
+ 2] & EDID_CEA_VCDB_QS
;
4218 EXPORT_SYMBOL(drm_rgb_quant_range_selectable
);
4221 * drm_default_rgb_quant_range - default RGB quantization range
4222 * @mode: display mode
4224 * Determine the default RGB quantization range for the mode,
4225 * as specified in CEA-861.
4227 * Return: The default RGB quantization range for the mode
4229 enum hdmi_quantization_range
4230 drm_default_rgb_quant_range(const struct drm_display_mode
*mode
)
4232 /* All CEA modes other than VIC 1 use limited quantization range. */
4233 return drm_match_cea_mode(mode
) > 1 ?
4234 HDMI_QUANTIZATION_RANGE_LIMITED
:
4235 HDMI_QUANTIZATION_RANGE_FULL
;
4237 EXPORT_SYMBOL(drm_default_rgb_quant_range
);
4239 static void drm_parse_ycbcr420_deep_color_info(struct drm_connector
*connector
,
4243 struct drm_hdmi_info
*hdmi
= &connector
->display_info
.hdmi
;
4245 dc_mask
= db
[7] & DRM_EDID_YCBCR420_DC_MASK
;
4246 hdmi
->y420_dc_modes
|= dc_mask
;
4249 static void drm_parse_hdmi_forum_vsdb(struct drm_connector
*connector
,
4252 struct drm_display_info
*display
= &connector
->display_info
;
4253 struct drm_hdmi_info
*hdmi
= &display
->hdmi
;
4255 if (hf_vsdb
[6] & 0x80) {
4256 hdmi
->scdc
.supported
= true;
4257 if (hf_vsdb
[6] & 0x40)
4258 hdmi
->scdc
.read_request
= true;
4262 * All HDMI 2.0 monitors must support scrambling at rates > 340 MHz.
4263 * And as per the spec, three factors confirm this:
4264 * * Availability of a HF-VSDB block in EDID (check)
4265 * * Non zero Max_TMDS_Char_Rate filed in HF-VSDB (let's check)
4266 * * SCDC support available (let's check)
4267 * Lets check it out.
4271 /* max clock is 5000 KHz times block value */
4272 u32 max_tmds_clock
= hf_vsdb
[5] * 5000;
4273 struct drm_scdc
*scdc
= &hdmi
->scdc
;
4275 if (max_tmds_clock
> 340000) {
4276 display
->max_tmds_clock
= max_tmds_clock
;
4277 DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n",
4278 display
->max_tmds_clock
);
4281 if (scdc
->supported
) {
4282 scdc
->scrambling
.supported
= true;
4284 /* Few sinks support scrambling for cloks < 340M */
4285 if ((hf_vsdb
[6] & 0x8))
4286 scdc
->scrambling
.low_rates
= true;
4290 drm_parse_ycbcr420_deep_color_info(connector
, hf_vsdb
);
4293 static void drm_parse_hdmi_deep_color_info(struct drm_connector
*connector
,
4296 struct drm_display_info
*info
= &connector
->display_info
;
4297 unsigned int dc_bpc
= 0;
4299 /* HDMI supports at least 8 bpc */
4302 if (cea_db_payload_len(hdmi
) < 6)
4305 if (hdmi
[6] & DRM_EDID_HDMI_DC_30
) {
4307 info
->edid_hdmi_dc_modes
|= DRM_EDID_HDMI_DC_30
;
4308 DRM_DEBUG("%s: HDMI sink does deep color 30.\n",
4312 if (hdmi
[6] & DRM_EDID_HDMI_DC_36
) {
4314 info
->edid_hdmi_dc_modes
|= DRM_EDID_HDMI_DC_36
;
4315 DRM_DEBUG("%s: HDMI sink does deep color 36.\n",
4319 if (hdmi
[6] & DRM_EDID_HDMI_DC_48
) {
4321 info
->edid_hdmi_dc_modes
|= DRM_EDID_HDMI_DC_48
;
4322 DRM_DEBUG("%s: HDMI sink does deep color 48.\n",
4327 DRM_DEBUG("%s: No deep color support on this HDMI sink.\n",
4332 DRM_DEBUG("%s: Assigning HDMI sink color depth as %d bpc.\n",
4333 connector
->name
, dc_bpc
);
4337 * Deep color support mandates RGB444 support for all video
4338 * modes and forbids YCRCB422 support for all video modes per
4341 info
->color_formats
= DRM_COLOR_FORMAT_RGB444
;
4343 /* YCRCB444 is optional according to spec. */
4344 if (hdmi
[6] & DRM_EDID_HDMI_DC_Y444
) {
4345 info
->color_formats
|= DRM_COLOR_FORMAT_YCRCB444
;
4346 DRM_DEBUG("%s: HDMI sink does YCRCB444 in deep color.\n",
4351 * Spec says that if any deep color mode is supported at all,
4352 * then deep color 36 bit must be supported.
4354 if (!(hdmi
[6] & DRM_EDID_HDMI_DC_36
)) {
4355 DRM_DEBUG("%s: HDMI sink should do DC_36, but does not!\n",
4361 drm_parse_hdmi_vsdb_video(struct drm_connector
*connector
, const u8
*db
)
4363 struct drm_display_info
*info
= &connector
->display_info
;
4364 u8 len
= cea_db_payload_len(db
);
4367 info
->dvi_dual
= db
[6] & 1;
4369 info
->max_tmds_clock
= db
[7] * 5000;
4371 DRM_DEBUG_KMS("HDMI: DVI dual %d, "
4372 "max TMDS clock %d kHz\n",
4374 info
->max_tmds_clock
);
4376 drm_parse_hdmi_deep_color_info(connector
, db
);
4379 static void drm_parse_cea_ext(struct drm_connector
*connector
,
4380 const struct edid
*edid
)
4382 struct drm_display_info
*info
= &connector
->display_info
;
4386 edid_ext
= drm_find_cea_extension(edid
);
4390 info
->cea_rev
= edid_ext
[1];
4392 /* The existence of a CEA block should imply RGB support */
4393 info
->color_formats
= DRM_COLOR_FORMAT_RGB444
;
4394 if (edid_ext
[3] & EDID_CEA_YCRCB444
)
4395 info
->color_formats
|= DRM_COLOR_FORMAT_YCRCB444
;
4396 if (edid_ext
[3] & EDID_CEA_YCRCB422
)
4397 info
->color_formats
|= DRM_COLOR_FORMAT_YCRCB422
;
4399 if (cea_db_offsets(edid_ext
, &start
, &end
))
4402 for_each_cea_db(edid_ext
, i
, start
, end
) {
4403 const u8
*db
= &edid_ext
[i
];
4405 if (cea_db_is_hdmi_vsdb(db
))
4406 drm_parse_hdmi_vsdb_video(connector
, db
);
4407 if (cea_db_is_hdmi_forum_vsdb(db
))
4408 drm_parse_hdmi_forum_vsdb(connector
, db
);
4409 if (cea_db_is_y420cmdb(db
))
4410 drm_parse_y420cmdb_bitmap(connector
, db
);
4414 /* A connector has no EDID information, so we've got no EDID to compute quirks from. Reset
4415 * all of the values which would have been set from EDID
4418 drm_reset_display_info(struct drm_connector
*connector
)
4420 struct drm_display_info
*info
= &connector
->display_info
;
4423 info
->height_mm
= 0;
4426 info
->color_formats
= 0;
4428 info
->max_tmds_clock
= 0;
4429 info
->dvi_dual
= false;
4431 info
->non_desktop
= 0;
4433 EXPORT_SYMBOL_GPL(drm_reset_display_info
);
4435 u32
drm_add_display_info(struct drm_connector
*connector
, const struct edid
*edid
)
4437 struct drm_display_info
*info
= &connector
->display_info
;
4439 u32 quirks
= edid_get_quirks(edid
);
4441 info
->width_mm
= edid
->width_cm
* 10;
4442 info
->height_mm
= edid
->height_cm
* 10;
4444 /* driver figures it out in this case */
4446 info
->color_formats
= 0;
4448 info
->max_tmds_clock
= 0;
4449 info
->dvi_dual
= false;
4451 info
->non_desktop
= !!(quirks
& EDID_QUIRK_NON_DESKTOP
);
4453 DRM_DEBUG_KMS("non_desktop set to %d\n", info
->non_desktop
);
4455 if (edid
->revision
< 3)
4458 if (!(edid
->input
& DRM_EDID_INPUT_DIGITAL
))
4461 drm_parse_cea_ext(connector
, edid
);
4464 * Digital sink with "DFP 1.x compliant TMDS" according to EDID 1.3?
4466 * For such displays, the DFP spec 1.0, section 3.10 "EDID support"
4467 * tells us to assume 8 bpc color depth if the EDID doesn't have
4468 * extensions which tell otherwise.
4470 if ((info
->bpc
== 0) && (edid
->revision
< 4) &&
4471 (edid
->input
& DRM_EDID_DIGITAL_TYPE_DVI
)) {
4473 DRM_DEBUG("%s: Assigning DFP sink color depth as %d bpc.\n",
4474 connector
->name
, info
->bpc
);
4477 /* Only defined for 1.4 with digital displays */
4478 if (edid
->revision
< 4)
4481 switch (edid
->input
& DRM_EDID_DIGITAL_DEPTH_MASK
) {
4482 case DRM_EDID_DIGITAL_DEPTH_6
:
4485 case DRM_EDID_DIGITAL_DEPTH_8
:
4488 case DRM_EDID_DIGITAL_DEPTH_10
:
4491 case DRM_EDID_DIGITAL_DEPTH_12
:
4494 case DRM_EDID_DIGITAL_DEPTH_14
:
4497 case DRM_EDID_DIGITAL_DEPTH_16
:
4500 case DRM_EDID_DIGITAL_DEPTH_UNDEF
:
4506 DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n",
4507 connector
->name
, info
->bpc
);
4509 info
->color_formats
|= DRM_COLOR_FORMAT_RGB444
;
4510 if (edid
->features
& DRM_EDID_FEATURE_RGB_YCRCB444
)
4511 info
->color_formats
|= DRM_COLOR_FORMAT_YCRCB444
;
4512 if (edid
->features
& DRM_EDID_FEATURE_RGB_YCRCB422
)
4513 info
->color_formats
|= DRM_COLOR_FORMAT_YCRCB422
;
4516 EXPORT_SYMBOL_GPL(drm_add_display_info
);
4518 static int validate_displayid(u8
*displayid
, int length
, int idx
)
4522 struct displayid_hdr
*base
;
4524 base
= (struct displayid_hdr
*)&displayid
[idx
];
4526 DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n",
4527 base
->rev
, base
->bytes
, base
->prod_id
, base
->ext_count
);
4529 if (base
->bytes
+ 5 > length
- idx
)
4531 for (i
= idx
; i
<= base
->bytes
+ 5; i
++) {
4532 csum
+= displayid
[i
];
4535 DRM_NOTE("DisplayID checksum invalid, remainder is %d\n", csum
);
4541 static struct drm_display_mode
*drm_mode_displayid_detailed(struct drm_device
*dev
,
4542 struct displayid_detailed_timings_1
*timings
)
4544 struct drm_display_mode
*mode
;
4545 unsigned pixel_clock
= (timings
->pixel_clock
[0] |
4546 (timings
->pixel_clock
[1] << 8) |
4547 (timings
->pixel_clock
[2] << 16));
4548 unsigned hactive
= (timings
->hactive
[0] | timings
->hactive
[1] << 8) + 1;
4549 unsigned hblank
= (timings
->hblank
[0] | timings
->hblank
[1] << 8) + 1;
4550 unsigned hsync
= (timings
->hsync
[0] | (timings
->hsync
[1] & 0x7f) << 8) + 1;
4551 unsigned hsync_width
= (timings
->hsw
[0] | timings
->hsw
[1] << 8) + 1;
4552 unsigned vactive
= (timings
->vactive
[0] | timings
->vactive
[1] << 8) + 1;
4553 unsigned vblank
= (timings
->vblank
[0] | timings
->vblank
[1] << 8) + 1;
4554 unsigned vsync
= (timings
->vsync
[0] | (timings
->vsync
[1] & 0x7f) << 8) + 1;
4555 unsigned vsync_width
= (timings
->vsw
[0] | timings
->vsw
[1] << 8) + 1;
4556 bool hsync_positive
= (timings
->hsync
[1] >> 7) & 0x1;
4557 bool vsync_positive
= (timings
->vsync
[1] >> 7) & 0x1;
4558 mode
= drm_mode_create(dev
);
4562 mode
->clock
= pixel_clock
* 10;
4563 mode
->hdisplay
= hactive
;
4564 mode
->hsync_start
= mode
->hdisplay
+ hsync
;
4565 mode
->hsync_end
= mode
->hsync_start
+ hsync_width
;
4566 mode
->htotal
= mode
->hdisplay
+ hblank
;
4568 mode
->vdisplay
= vactive
;
4569 mode
->vsync_start
= mode
->vdisplay
+ vsync
;
4570 mode
->vsync_end
= mode
->vsync_start
+ vsync_width
;
4571 mode
->vtotal
= mode
->vdisplay
+ vblank
;
4574 mode
->flags
|= hsync_positive
? DRM_MODE_FLAG_PHSYNC
: DRM_MODE_FLAG_NHSYNC
;
4575 mode
->flags
|= vsync_positive
? DRM_MODE_FLAG_PVSYNC
: DRM_MODE_FLAG_NVSYNC
;
4576 mode
->type
= DRM_MODE_TYPE_DRIVER
;
4578 if (timings
->flags
& 0x80)
4579 mode
->type
|= DRM_MODE_TYPE_PREFERRED
;
4580 mode
->vrefresh
= drm_mode_vrefresh(mode
);
4581 drm_mode_set_name(mode
);
4586 static int add_displayid_detailed_1_modes(struct drm_connector
*connector
,
4587 struct displayid_block
*block
)
4589 struct displayid_detailed_timing_block
*det
= (struct displayid_detailed_timing_block
*)block
;
4592 struct drm_display_mode
*newmode
;
4594 /* blocks must be multiple of 20 bytes length */
4595 if (block
->num_bytes
% 20)
4598 num_timings
= block
->num_bytes
/ 20;
4599 for (i
= 0; i
< num_timings
; i
++) {
4600 struct displayid_detailed_timings_1
*timings
= &det
->timings
[i
];
4602 newmode
= drm_mode_displayid_detailed(connector
->dev
, timings
);
4606 drm_mode_probed_add(connector
, newmode
);
4612 static int add_displayid_detailed_modes(struct drm_connector
*connector
,
4618 int length
= EDID_LENGTH
;
4619 struct displayid_block
*block
;
4622 displayid
= drm_find_displayid_extension(edid
);
4626 ret
= validate_displayid(displayid
, length
, idx
);
4630 idx
+= sizeof(struct displayid_hdr
);
4631 while (block
= (struct displayid_block
*)&displayid
[idx
],
4632 idx
+ sizeof(struct displayid_block
) <= length
&&
4633 idx
+ sizeof(struct displayid_block
) + block
->num_bytes
<= length
&&
4634 block
->num_bytes
> 0) {
4635 idx
+= block
->num_bytes
+ sizeof(struct displayid_block
);
4636 switch (block
->tag
) {
4637 case DATA_BLOCK_TYPE_1_DETAILED_TIMING
:
4638 num_modes
+= add_displayid_detailed_1_modes(connector
, block
);
4646 * drm_add_edid_modes - add modes from EDID data, if available
4647 * @connector: connector we're probing
4650 * Add the specified modes to the connector's mode list. Also fills out the
4651 * &drm_display_info structure in @connector with any information which can be
4652 * derived from the edid.
4654 * Return: The number of modes added or 0 if we couldn't find any.
4656 int drm_add_edid_modes(struct drm_connector
*connector
, struct edid
*edid
)
4664 if (!drm_edid_is_valid(edid
)) {
4665 dev_warn(connector
->dev
->dev
, "%s: EDID invalid.\n",
4671 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks.
4672 * To avoid multiple parsing of same block, lets parse that map
4673 * from sink info, before parsing CEA modes.
4675 quirks
= drm_add_display_info(connector
, edid
);
4678 * EDID spec says modes should be preferred in this order:
4679 * - preferred detailed mode
4680 * - other detailed modes from base block
4681 * - detailed modes from extension blocks
4682 * - CVT 3-byte code modes
4683 * - standard timing codes
4684 * - established timing codes
4685 * - modes inferred from GTF or CVT range information
4687 * We get this pretty much right.
4689 * XXX order for additional mode types in extension blocks?
4691 num_modes
+= add_detailed_modes(connector
, edid
, quirks
);
4692 num_modes
+= add_cvt_modes(connector
, edid
);
4693 num_modes
+= add_standard_modes(connector
, edid
);
4694 num_modes
+= add_established_modes(connector
, edid
);
4695 num_modes
+= add_cea_modes(connector
, edid
);
4696 num_modes
+= add_alternate_cea_modes(connector
, edid
);
4697 num_modes
+= add_displayid_detailed_modes(connector
, edid
);
4698 if (edid
->features
& DRM_EDID_FEATURE_DEFAULT_GTF
)
4699 num_modes
+= add_inferred_modes(connector
, edid
);
4701 if (quirks
& (EDID_QUIRK_PREFER_LARGE_60
| EDID_QUIRK_PREFER_LARGE_75
))
4702 edid_fixup_preferred(connector
, quirks
);
4704 if (quirks
& EDID_QUIRK_FORCE_6BPC
)
4705 connector
->display_info
.bpc
= 6;
4707 if (quirks
& EDID_QUIRK_FORCE_8BPC
)
4708 connector
->display_info
.bpc
= 8;
4710 if (quirks
& EDID_QUIRK_FORCE_10BPC
)
4711 connector
->display_info
.bpc
= 10;
4713 if (quirks
& EDID_QUIRK_FORCE_12BPC
)
4714 connector
->display_info
.bpc
= 12;
4718 EXPORT_SYMBOL(drm_add_edid_modes
);
4721 * drm_add_modes_noedid - add modes for the connectors without EDID
4722 * @connector: connector we're probing
4723 * @hdisplay: the horizontal display limit
4724 * @vdisplay: the vertical display limit
4726 * Add the specified modes to the connector's mode list. Only when the
4727 * hdisplay/vdisplay is not beyond the given limit, it will be added.
4729 * Return: The number of modes added or 0 if we couldn't find any.
4731 int drm_add_modes_noedid(struct drm_connector
*connector
,
4732 int hdisplay
, int vdisplay
)
4734 int i
, count
, num_modes
= 0;
4735 struct drm_display_mode
*mode
;
4736 struct drm_device
*dev
= connector
->dev
;
4738 count
= ARRAY_SIZE(drm_dmt_modes
);
4744 for (i
= 0; i
< count
; i
++) {
4745 const struct drm_display_mode
*ptr
= &drm_dmt_modes
[i
];
4746 if (hdisplay
&& vdisplay
) {
4748 * Only when two are valid, they will be used to check
4749 * whether the mode should be added to the mode list of
4752 if (ptr
->hdisplay
> hdisplay
||
4753 ptr
->vdisplay
> vdisplay
)
4756 if (drm_mode_vrefresh(ptr
) > 61)
4758 mode
= drm_mode_duplicate(dev
, ptr
);
4760 drm_mode_probed_add(connector
, mode
);
4766 EXPORT_SYMBOL(drm_add_modes_noedid
);
4769 * drm_set_preferred_mode - Sets the preferred mode of a connector
4770 * @connector: connector whose mode list should be processed
4771 * @hpref: horizontal resolution of preferred mode
4772 * @vpref: vertical resolution of preferred mode
4774 * Marks a mode as preferred if it matches the resolution specified by @hpref
4777 void drm_set_preferred_mode(struct drm_connector
*connector
,
4778 int hpref
, int vpref
)
4780 struct drm_display_mode
*mode
;
4782 list_for_each_entry(mode
, &connector
->probed_modes
, head
) {
4783 if (mode
->hdisplay
== hpref
&&
4784 mode
->vdisplay
== vpref
)
4785 mode
->type
|= DRM_MODE_TYPE_PREFERRED
;
4788 EXPORT_SYMBOL(drm_set_preferred_mode
);
4791 * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
4792 * data from a DRM display mode
4793 * @frame: HDMI AVI infoframe
4794 * @mode: DRM display mode
4795 * @is_hdmi2_sink: Sink is HDMI 2.0 compliant
4797 * Return: 0 on success or a negative error code on failure.
4800 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe
*frame
,
4801 const struct drm_display_mode
*mode
,
4806 if (!frame
|| !mode
)
4809 err
= hdmi_avi_infoframe_init(frame
);
4813 if (mode
->flags
& DRM_MODE_FLAG_DBLCLK
)
4814 frame
->pixel_repeat
= 1;
4816 frame
->video_code
= drm_match_cea_mode(mode
);
4819 * HDMI 1.4 VIC range: 1 <= VIC <= 64 (CEA-861-D) but
4820 * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we
4821 * have to make sure we dont break HDMI 1.4 sinks.
4823 if (!is_hdmi2_sink
&& frame
->video_code
> 64)
4824 frame
->video_code
= 0;
4827 * HDMI spec says if a mode is found in HDMI 1.4b 4K modes
4828 * we should send its VIC in vendor infoframes, else send the
4829 * VIC in AVI infoframes. Lets check if this mode is present in
4830 * HDMI 1.4b 4K modes
4832 if (frame
->video_code
) {
4833 u8 vendor_if_vic
= drm_match_hdmi_mode(mode
);
4834 bool is_s3d
= mode
->flags
& DRM_MODE_FLAG_3D_MASK
;
4836 if (drm_valid_hdmi_vic(vendor_if_vic
) && !is_s3d
)
4837 frame
->video_code
= 0;
4840 frame
->picture_aspect
= HDMI_PICTURE_ASPECT_NONE
;
4843 * Populate picture aspect ratio from either
4844 * user input (if specified) or from the CEA mode list.
4846 if (mode
->picture_aspect_ratio
== HDMI_PICTURE_ASPECT_4_3
||
4847 mode
->picture_aspect_ratio
== HDMI_PICTURE_ASPECT_16_9
)
4848 frame
->picture_aspect
= mode
->picture_aspect_ratio
;
4849 else if (frame
->video_code
> 0)
4850 frame
->picture_aspect
= drm_get_cea_aspect_ratio(
4853 frame
->active_aspect
= HDMI_ACTIVE_ASPECT_PICTURE
;
4854 frame
->scan_mode
= HDMI_SCAN_MODE_UNDERSCAN
;
4858 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_from_display_mode
);
4861 * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
4862 * quantization range information
4863 * @frame: HDMI AVI infoframe
4864 * @mode: DRM display mode
4865 * @rgb_quant_range: RGB quantization range (Q)
4866 * @rgb_quant_range_selectable: Sink support selectable RGB quantization range (QS)
4869 drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe
*frame
,
4870 const struct drm_display_mode
*mode
,
4871 enum hdmi_quantization_range rgb_quant_range
,
4872 bool rgb_quant_range_selectable
,
4877 * "A Source shall not send a non-zero Q value that does not correspond
4878 * to the default RGB Quantization Range for the transmitted Picture
4879 * unless the Sink indicates support for the Q bit in a Video
4880 * Capabilities Data Block."
4882 * HDMI 2.0 recommends sending non-zero Q when it does match the
4883 * default RGB quantization range for the mode, even when QS=0.
4885 if (rgb_quant_range_selectable
||
4886 rgb_quant_range
== drm_default_rgb_quant_range(mode
))
4887 frame
->quantization_range
= rgb_quant_range
;
4889 frame
->quantization_range
= HDMI_QUANTIZATION_RANGE_DEFAULT
;
4893 * "When transmitting any RGB colorimetry, the Source should set the
4894 * YQ-field to match the RGB Quantization Range being transmitted
4895 * (e.g., when Limited Range RGB, set YQ=0 or when Full Range RGB,
4896 * set YQ=1) and the Sink shall ignore the YQ-field."
4898 * Unfortunate certain sinks (eg. VIZ Model 67/E261VA) get confused
4899 * by non-zero YQ when receiving RGB. There doesn't seem to be any
4900 * good way to tell which version of CEA-861 the sink supports, so
4901 * we limit non-zero YQ to HDMI 2.0 sinks only as HDMI 2.0 is based
4904 if (!is_hdmi2_sink
||
4905 rgb_quant_range
== HDMI_QUANTIZATION_RANGE_LIMITED
)
4906 frame
->ycc_quantization_range
=
4907 HDMI_YCC_QUANTIZATION_RANGE_LIMITED
;
4909 frame
->ycc_quantization_range
=
4910 HDMI_YCC_QUANTIZATION_RANGE_FULL
;
4912 EXPORT_SYMBOL(drm_hdmi_avi_infoframe_quant_range
);
4914 static enum hdmi_3d_structure
4915 s3d_structure_from_display_mode(const struct drm_display_mode
*mode
)
4917 u32 layout
= mode
->flags
& DRM_MODE_FLAG_3D_MASK
;
4920 case DRM_MODE_FLAG_3D_FRAME_PACKING
:
4921 return HDMI_3D_STRUCTURE_FRAME_PACKING
;
4922 case DRM_MODE_FLAG_3D_FIELD_ALTERNATIVE
:
4923 return HDMI_3D_STRUCTURE_FIELD_ALTERNATIVE
;
4924 case DRM_MODE_FLAG_3D_LINE_ALTERNATIVE
:
4925 return HDMI_3D_STRUCTURE_LINE_ALTERNATIVE
;
4926 case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_FULL
:
4927 return HDMI_3D_STRUCTURE_SIDE_BY_SIDE_FULL
;
4928 case DRM_MODE_FLAG_3D_L_DEPTH
:
4929 return HDMI_3D_STRUCTURE_L_DEPTH
;
4930 case DRM_MODE_FLAG_3D_L_DEPTH_GFX_GFX_DEPTH
:
4931 return HDMI_3D_STRUCTURE_L_DEPTH_GFX_GFX_DEPTH
;
4932 case DRM_MODE_FLAG_3D_TOP_AND_BOTTOM
:
4933 return HDMI_3D_STRUCTURE_TOP_AND_BOTTOM
;
4934 case DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
:
4935 return HDMI_3D_STRUCTURE_SIDE_BY_SIDE_HALF
;
4937 return HDMI_3D_STRUCTURE_INVALID
;
4942 * drm_hdmi_vendor_infoframe_from_display_mode() - fill an HDMI infoframe with
4943 * data from a DRM display mode
4944 * @frame: HDMI vendor infoframe
4945 * @mode: DRM display mode
4947 * Note that there's is a need to send HDMI vendor infoframes only when using a
4948 * 4k or stereoscopic 3D mode. So when giving any other mode as input this
4949 * function will return -EINVAL, error that can be safely ignored.
4951 * Return: 0 on success or a negative error code on failure.
4954 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe
*frame
,
4955 const struct drm_display_mode
*mode
)
4961 if (!frame
|| !mode
)
4964 vic
= drm_match_hdmi_mode(mode
);
4965 s3d_flags
= mode
->flags
& DRM_MODE_FLAG_3D_MASK
;
4967 if (!vic
&& !s3d_flags
)
4970 if (vic
&& s3d_flags
)
4973 err
= hdmi_vendor_infoframe_init(frame
);
4980 frame
->s3d_struct
= s3d_structure_from_display_mode(mode
);
4984 EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode
);
4986 static int drm_parse_tiled_block(struct drm_connector
*connector
,
4987 struct displayid_block
*block
)
4989 struct displayid_tiled_block
*tile
= (struct displayid_tiled_block
*)block
;
4991 u8 tile_v_loc
, tile_h_loc
;
4992 u8 num_v_tile
, num_h_tile
;
4993 struct drm_tile_group
*tg
;
4995 w
= tile
->tile_size
[0] | tile
->tile_size
[1] << 8;
4996 h
= tile
->tile_size
[2] | tile
->tile_size
[3] << 8;
4998 num_v_tile
= (tile
->topo
[0] & 0xf) | (tile
->topo
[2] & 0x30);
4999 num_h_tile
= (tile
->topo
[0] >> 4) | ((tile
->topo
[2] >> 2) & 0x30);
5000 tile_v_loc
= (tile
->topo
[1] & 0xf) | ((tile
->topo
[2] & 0x3) << 4);
5001 tile_h_loc
= (tile
->topo
[1] >> 4) | (((tile
->topo
[2] >> 2) & 0x3) << 4);
5003 connector
->has_tile
= true;
5004 if (tile
->tile_cap
& 0x80)
5005 connector
->tile_is_single_monitor
= true;
5007 connector
->num_h_tile
= num_h_tile
+ 1;
5008 connector
->num_v_tile
= num_v_tile
+ 1;
5009 connector
->tile_h_loc
= tile_h_loc
;
5010 connector
->tile_v_loc
= tile_v_loc
;
5011 connector
->tile_h_size
= w
+ 1;
5012 connector
->tile_v_size
= h
+ 1;
5014 DRM_DEBUG_KMS("tile cap 0x%x\n", tile
->tile_cap
);
5015 DRM_DEBUG_KMS("tile_size %d x %d\n", w
+ 1, h
+ 1);
5016 DRM_DEBUG_KMS("topo num tiles %dx%d, location %dx%d\n",
5017 num_h_tile
+ 1, num_v_tile
+ 1, tile_h_loc
, tile_v_loc
);
5018 DRM_DEBUG_KMS("vend %c%c%c\n", tile
->topology_id
[0], tile
->topology_id
[1], tile
->topology_id
[2]);
5020 tg
= drm_mode_get_tile_group(connector
->dev
, tile
->topology_id
);
5022 tg
= drm_mode_create_tile_group(connector
->dev
, tile
->topology_id
);
5027 if (connector
->tile_group
!= tg
) {
5028 /* if we haven't got a pointer,
5029 take the reference, drop ref to old tile group */
5030 if (connector
->tile_group
) {
5031 drm_mode_put_tile_group(connector
->dev
, connector
->tile_group
);
5033 connector
->tile_group
= tg
;
5035 /* if same tile group, then release the ref we just took. */
5036 drm_mode_put_tile_group(connector
->dev
, tg
);
5040 static int drm_parse_display_id(struct drm_connector
*connector
,
5041 u8
*displayid
, int length
,
5042 bool is_edid_extension
)
5044 /* if this is an EDID extension the first byte will be 0x70 */
5046 struct displayid_block
*block
;
5049 if (is_edid_extension
)
5052 ret
= validate_displayid(displayid
, length
, idx
);
5056 idx
+= sizeof(struct displayid_hdr
);
5057 while (block
= (struct displayid_block
*)&displayid
[idx
],
5058 idx
+ sizeof(struct displayid_block
) <= length
&&
5059 idx
+ sizeof(struct displayid_block
) + block
->num_bytes
<= length
&&
5060 block
->num_bytes
> 0) {
5061 idx
+= block
->num_bytes
+ sizeof(struct displayid_block
);
5062 DRM_DEBUG_KMS("block id 0x%x, rev %d, len %d\n",
5063 block
->tag
, block
->rev
, block
->num_bytes
);
5065 switch (block
->tag
) {
5066 case DATA_BLOCK_TILED_DISPLAY
:
5067 ret
= drm_parse_tiled_block(connector
, block
);
5071 case DATA_BLOCK_TYPE_1_DETAILED_TIMING
:
5072 /* handled in mode gathering code. */
5075 DRM_DEBUG_KMS("found DisplayID tag 0x%x, unhandled\n", block
->tag
);
5082 static void drm_get_displayid(struct drm_connector
*connector
,
5085 void *displayid
= NULL
;
5087 connector
->has_tile
= false;
5088 displayid
= drm_find_displayid_extension(edid
);
5090 /* drop reference to any tile group we had */
5094 ret
= drm_parse_display_id(connector
, displayid
, EDID_LENGTH
, true);
5097 if (!connector
->has_tile
)
5101 if (connector
->tile_group
) {
5102 drm_mode_put_tile_group(connector
->dev
, connector
->tile_group
);
5103 connector
->tile_group
= NULL
;