xref: /rk3399_rockchip-uboot/common/edid.c (revision 05b25c8bf30a77beb555abb8f65e78bd2f21b5de)
1 /*
2  * Copyright (c) 2012 The Chromium OS Authors.
3  *
4  * (C) Copyright 2010
5  * Petr Stetiar <ynezz@true.cz>
6  *
7  * SPDX-License-Identifier:	GPL-2.0+
8  *
9  * Contains stolen code from ddcprobe project which is:
10  * Copyright (C) Nalin Dahyabhai <bigfun@pobox.com>
11  */
12 
13 #include <common.h>
14 #include <edid.h>
15 #include <errno.h>
16 #include <fdtdec.h>
17 #include <linux/ctype.h>
18 #include <linux/string.h>
19 #include <drm_modes.h>
20 
21 int edid_check_info(struct edid1_info *edid_info)
22 {
23 	if ((edid_info == NULL) || (edid_info->version == 0))
24 		return -1;
25 
26 	if (memcmp(edid_info->header, "\x0\xff\xff\xff\xff\xff\xff\x0", 8))
27 		return -1;
28 
29 	if (edid_info->version == 0xff && edid_info->revision == 0xff)
30 		return -1;
31 
32 	return 0;
33 }
34 
35 int edid_check_checksum(u8 *edid_block)
36 {
37 	u8 checksum = 0;
38 	int i;
39 
40 	for (i = 0; i < 128; i++)
41 		checksum += edid_block[i];
42 
43 	return (checksum == 0) ? 0 : -EINVAL;
44 }
45 
46 int edid_get_ranges(struct edid1_info *edid, unsigned int *hmin,
47 		    unsigned int *hmax, unsigned int *vmin,
48 		    unsigned int *vmax)
49 {
50 	int i;
51 	struct edid_monitor_descriptor *monitor;
52 
53 	*hmin = *hmax = *vmin = *vmax = 0;
54 	if (edid_check_info(edid))
55 		return -1;
56 
57 	for (i = 0; i < ARRAY_SIZE(edid->monitor_details.descriptor); i++) {
58 		monitor = &edid->monitor_details.descriptor[i];
59 		if (monitor->type == EDID_MONITOR_DESCRIPTOR_RANGE) {
60 			*hmin = monitor->data.range_data.horizontal_min;
61 			*hmax = monitor->data.range_data.horizontal_max;
62 			*vmin = monitor->data.range_data.vertical_min;
63 			*vmax = monitor->data.range_data.vertical_max;
64 			return 0;
65 		}
66 	}
67 	return -1;
68 }
69 
70 /* Set all parts of a timing entry to the same value */
71 static void set_entry(struct timing_entry *entry, u32 value)
72 {
73 	entry->min = value;
74 	entry->typ = value;
75 	entry->max = value;
76 }
77 
78 /**
79  * decode_timing() - Decoding an 18-byte detailed timing record
80  *
81  * @buf:	Pointer to EDID detailed timing record
82  * @timing:	Place to put timing
83  */
84 static void decode_timing(u8 *buf, struct display_timing *timing)
85 {
86 	uint x_mm, y_mm;
87 	unsigned int ha, hbl, hso, hspw, hborder;
88 	unsigned int va, vbl, vso, vspw, vborder;
89 	struct edid_detailed_timing *t = (struct edid_detailed_timing *)buf;
90 
91 	/* Edid contains pixel clock in terms of 10KHz */
92 	set_entry(&timing->pixelclock, (buf[0] + (buf[1] << 8)) * 10000);
93 	x_mm = (buf[12] + ((buf[14] & 0xf0) << 4));
94 	y_mm = (buf[13] + ((buf[14] & 0x0f) << 8));
95 	ha = (buf[2] + ((buf[4] & 0xf0) << 4));
96 	hbl = (buf[3] + ((buf[4] & 0x0f) << 8));
97 	hso = (buf[8] + ((buf[11] & 0xc0) << 2));
98 	hspw = (buf[9] + ((buf[11] & 0x30) << 4));
99 	hborder = buf[15];
100 	va = (buf[5] + ((buf[7] & 0xf0) << 4));
101 	vbl = (buf[6] + ((buf[7] & 0x0f) << 8));
102 	vso = ((buf[10] >> 4) + ((buf[11] & 0x0c) << 2));
103 	vspw = ((buf[10] & 0x0f) + ((buf[11] & 0x03) << 4));
104 	vborder = buf[16];
105 
106 	set_entry(&timing->hactive, ha);
107 	set_entry(&timing->hfront_porch, hso);
108 	set_entry(&timing->hback_porch, hbl - hso - hspw);
109 	set_entry(&timing->hsync_len, hspw);
110 
111 	set_entry(&timing->vactive, va);
112 	set_entry(&timing->vfront_porch, vso);
113 	set_entry(&timing->vback_porch, vbl - vso - vspw);
114 	set_entry(&timing->vsync_len, vspw);
115 
116 	timing->flags = 0;
117 	if (EDID_DETAILED_TIMING_FLAG_HSYNC_POLARITY(*t))
118 		timing->flags |= DISPLAY_FLAGS_HSYNC_HIGH;
119 	else
120 		timing->flags |= DISPLAY_FLAGS_HSYNC_LOW;
121 	if (EDID_DETAILED_TIMING_FLAG_VSYNC_POLARITY(*t))
122 		timing->flags |= DISPLAY_FLAGS_VSYNC_HIGH;
123 	else
124 		timing->flags |= DISPLAY_FLAGS_VSYNC_LOW;
125 
126 	if (EDID_DETAILED_TIMING_FLAG_INTERLACED(*t))
127 		timing->flags = DISPLAY_FLAGS_INTERLACED;
128 
129 	debug("Detailed mode clock %u Hz, %d mm x %d mm\n"
130 	      "               %04x %04x %04x %04x hborder %x\n"
131 	      "               %04x %04x %04x %04x vborder %x\n",
132 	      timing->pixelclock.typ,
133 	      x_mm, y_mm,
134 	      ha, ha + hso, ha + hso + hspw,
135 	      ha + hbl, hborder,
136 	      va, va + vso, va + vso + vspw,
137 	      va + vbl, vborder);
138 }
139 
140 /**
141  * decode_mode() - Decoding an 18-byte detailed timing record
142  *
143  * @buf:	Pointer to EDID detailed timing record
144  * @timing:	Place to put timing
145  */
146 static void decode_mode(u8 *buf, struct drm_display_mode *mode)
147 {
148 	uint x_mm, y_mm;
149 	unsigned int ha, hbl, hso, hspw, hborder;
150 	unsigned int va, vbl, vso, vspw, vborder;
151 	struct edid_detailed_timing *t = (struct edid_detailed_timing *)buf;
152 
153 	x_mm = (buf[12] + ((buf[14] & 0xf0) << 4));
154 	y_mm = (buf[13] + ((buf[14] & 0x0f) << 8));
155 	ha = (buf[2] + ((buf[4] & 0xf0) << 4));
156 	hbl = (buf[3] + ((buf[4] & 0x0f) << 8));
157 	hso = (buf[8] + ((buf[11] & 0xc0) << 2));
158 	hspw = (buf[9] + ((buf[11] & 0x30) << 4));
159 	hborder = buf[15];
160 	va = (buf[5] + ((buf[7] & 0xf0) << 4));
161 	vbl = (buf[6] + ((buf[7] & 0x0f) << 8));
162 	vso = ((buf[10] >> 4) + ((buf[11] & 0x0c) << 2));
163 	vspw = ((buf[10] & 0x0f) + ((buf[11] & 0x03) << 4));
164 	vborder = buf[16];
165 
166 	/* Edid contains pixel clock in terms of 10KHz */
167 	mode->clock = (buf[0] + (buf[1] << 8)) * 10;
168 	mode->hdisplay = ha;
169 	mode->hsync_start = ha + hso;
170 	mode->hsync_end = ha + hso + hspw;
171 	mode->htotal = ha + hbl;
172 	mode->vdisplay = va;
173 	mode->vsync_start = va + vso;
174 	mode->vsync_end = va + vso + vspw;
175 	mode->vtotal = va + vbl;
176 
177 	mode->flags = EDID_DETAILED_TIMING_FLAG_HSYNC_POLARITY(*t) ?
178 		DRM_MODE_FLAG_PHSYNC : DRM_MODE_FLAG_NHSYNC;
179 	mode->flags |= EDID_DETAILED_TIMING_FLAG_VSYNC_POLARITY(*t) ?
180 		DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC;
181 
182 	if (EDID_DETAILED_TIMING_FLAG_HSYNC_POLARITY(*t))
183 		mode->flags |= DRM_MODE_FLAG_INTERLACE;
184 
185 	debug("Detailed mode clock %u kHz, %d mm x %d mm, flags[%x]\n"
186 	      "     %04d %04d %04d %04d hborder %d\n"
187 	      "     %04d %04d %04d %04d vborder %d\n",
188 	      mode->clock,
189 	      x_mm, y_mm, mode->flags,
190 	      mode->hdisplay, mode->hsync_start, mode->hsync_end,
191 	      mode->htotal, hborder,
192 	      mode->vdisplay, mode->vsync_start, mode->vsync_end,
193 	      mode->vtotal, vborder);
194 }
195 
196 /**
197  * Check if HDMI vendor specific data block is present in CEA block
198  * @param info	CEA extension block
199  * @return true if block is found
200  */
201 static bool cea_is_hdmi_vsdb_present(struct edid_cea861_info *info)
202 {
203 	u8 end, i = 0;
204 
205 	/* check for end of data block */
206 	end = info->dtd_offset;
207 	if (end == 0)
208 		end = sizeof(info->data);
209 	if (end < 4 || end > sizeof(info->data))
210 		return false;
211 	end -= 4;
212 
213 	while (i < end) {
214 		/* Look for vendor specific data block of appropriate size */
215 		if ((EDID_CEA861_DB_TYPE(*info, i) == EDID_CEA861_DB_VENDOR) &&
216 		    (EDID_CEA861_DB_LEN(*info, i) >= 5)) {
217 			u8 *db = &info->data[i + 1];
218 			u32 oui = db[0] | (db[1] << 8) | (db[2] << 16);
219 
220 			if (oui == HDMI_IEEE_OUI)
221 				return true;
222 		}
223 		i += EDID_CEA861_DB_LEN(*info, i) + 1;
224 	}
225 
226 	return false;
227 }
228 
229 int edid_get_drm_mode(u8 *buf, int buf_size, struct drm_display_mode *mode,
230 		      int *panel_bits_per_colourp)
231 {
232 	struct edid1_info *edid = (struct edid1_info *)buf;
233 	bool timing_done;
234 	int i;
235 
236 	if (buf_size < sizeof(*edid) || edid_check_info(edid)) {
237 		debug("%s: Invalid buffer\n", __func__);
238 		return -EINVAL;
239 	}
240 
241 	if (!EDID1_INFO_FEATURE_PREFERRED_TIMING_MODE(*edid)) {
242 		debug("%s: No preferred timing\n", __func__);
243 		return -ENOENT;
244 	}
245 
246 	/* Look for detailed timing */
247 	timing_done = false;
248 	for (i = 0; i < 4; i++) {
249 		struct edid_monitor_descriptor *desc;
250 
251 		desc = &edid->monitor_details.descriptor[i];
252 		if (desc->zero_flag_1 != 0) {
253 			decode_mode((u8 *)desc, mode);
254 			timing_done = true;
255 			break;
256 		}
257 	}
258 	if (!timing_done)
259 		return -EINVAL;
260 
261 	if (!EDID1_INFO_VIDEO_INPUT_DIGITAL(*edid)) {
262 		debug("%s: Not a digital display\n", __func__);
263 		return -ENOSYS;
264 	}
265 	if (edid->version != 1 || edid->revision < 4) {
266 		debug("%s: EDID version %d.%d does not have required info\n",
267 		      __func__, edid->version, edid->revision);
268 		*panel_bits_per_colourp = -1;
269 	} else  {
270 		*panel_bits_per_colourp =
271 			((edid->video_input_definition & 0x70) >> 3) + 4;
272 	}
273 
274 	return 0;
275 }
276 
277 int edid_get_timing(u8 *buf, int buf_size, struct display_timing *timing,
278 		    int *panel_bits_per_colourp)
279 {
280 	struct edid1_info *edid = (struct edid1_info *)buf;
281 	bool timing_done;
282 	int i;
283 
284 	if (buf_size < sizeof(*edid) || edid_check_info(edid)) {
285 		debug("%s: Invalid buffer\n", __func__);
286 		return -EINVAL;
287 	}
288 
289 	if (!EDID1_INFO_FEATURE_PREFERRED_TIMING_MODE(*edid)) {
290 		debug("%s: No preferred timing\n", __func__);
291 		return -ENOENT;
292 	}
293 
294 	/* Look for detailed timing */
295 	timing_done = false;
296 	for (i = 0; i < 4; i++) {
297 		struct edid_monitor_descriptor *desc;
298 
299 		desc = &edid->monitor_details.descriptor[i];
300 		if (desc->zero_flag_1 != 0) {
301 			decode_timing((u8 *)desc, timing);
302 			timing_done = true;
303 			break;
304 		}
305 	}
306 	if (!timing_done)
307 		return -EINVAL;
308 
309 	if (!EDID1_INFO_VIDEO_INPUT_DIGITAL(*edid)) {
310 		debug("%s: Not a digital display\n", __func__);
311 		return -ENOSYS;
312 	}
313 	if (edid->version != 1 || edid->revision < 4) {
314 		debug("%s: EDID version %d.%d does not have required info\n",
315 		      __func__, edid->version, edid->revision);
316 		*panel_bits_per_colourp = -1;
317 	} else  {
318 		*panel_bits_per_colourp =
319 			((edid->video_input_definition & 0x70) >> 3) + 4;
320 	}
321 
322 	timing->hdmi_monitor = false;
323 	if (edid->extension_flag && (buf_size >= EDID_EXT_SIZE)) {
324 		struct edid_cea861_info *info =
325 			(struct edid_cea861_info *)(buf + sizeof(*edid));
326 
327 		if (info->extension_tag == EDID_CEA861_EXTENSION_TAG)
328 			timing->hdmi_monitor = cea_is_hdmi_vsdb_present(info);
329 	}
330 
331 	return 0;
332 }
333 
334 
335 /**
336  * Snip the tailing whitespace/return of a string.
337  *
338  * @param string	The string to be snipped
339  * @return the snipped string
340  */
341 static char *snip(char *string)
342 {
343 	char *s;
344 
345 	/*
346 	 * This is always a 13 character buffer
347 	 * and it's not always terminated.
348 	 */
349 	string[12] = '\0';
350 	s = &string[strlen(string) - 1];
351 
352 	while (s >= string && (isspace(*s) || *s == '\n' || *s == '\r' ||
353 			*s == '\0'))
354 		*(s--) = '\0';
355 
356 	return string;
357 }
358 
359 /**
360  * Print an EDID monitor descriptor block
361  *
362  * @param monitor	The EDID monitor descriptor block
363  * @have_timing		Modifies to 1 if the desciptor contains timing info
364  */
365 static void edid_print_dtd(struct edid_monitor_descriptor *monitor,
366 			   unsigned int *have_timing)
367 {
368 	unsigned char *bytes = (unsigned char *)monitor;
369 	struct edid_detailed_timing *timing =
370 			(struct edid_detailed_timing *)monitor;
371 
372 	if (bytes[0] == 0 && bytes[1] == 0) {
373 		if (monitor->type == EDID_MONITOR_DESCRIPTOR_SERIAL)
374 			printf("Monitor serial number: %s\n",
375 			       snip(monitor->data.string));
376 		else if (monitor->type == EDID_MONITOR_DESCRIPTOR_ASCII)
377 			printf("Monitor ID: %s\n",
378 			       snip(monitor->data.string));
379 		else if (monitor->type == EDID_MONITOR_DESCRIPTOR_NAME)
380 			printf("Monitor name: %s\n",
381 			       snip(monitor->data.string));
382 		else if (monitor->type == EDID_MONITOR_DESCRIPTOR_RANGE)
383 			printf("Monitor range limits, horizontal sync: "
384 			       "%d-%d kHz, vertical refresh: "
385 			       "%d-%d Hz, max pixel clock: "
386 			       "%d MHz\n",
387 			       monitor->data.range_data.horizontal_min,
388 			       monitor->data.range_data.horizontal_max,
389 			       monitor->data.range_data.vertical_min,
390 			       monitor->data.range_data.vertical_max,
391 			       monitor->data.range_data.pixel_clock_max * 10);
392 	} else {
393 		uint32_t pixclock, h_active, h_blanking, v_active, v_blanking;
394 		uint32_t h_total, v_total, vfreq;
395 
396 		pixclock = EDID_DETAILED_TIMING_PIXEL_CLOCK(*timing);
397 		h_active = EDID_DETAILED_TIMING_HORIZONTAL_ACTIVE(*timing);
398 		h_blanking = EDID_DETAILED_TIMING_HORIZONTAL_BLANKING(*timing);
399 		v_active = EDID_DETAILED_TIMING_VERTICAL_ACTIVE(*timing);
400 		v_blanking = EDID_DETAILED_TIMING_VERTICAL_BLANKING(*timing);
401 
402 		h_total = h_active + h_blanking;
403 		v_total = v_active + v_blanking;
404 		if (v_total > 0 && h_total > 0)
405 			vfreq = pixclock / (v_total * h_total);
406 		else
407 			vfreq = 1; /* Error case */
408 		printf("\t%dx%d\%c\t%d Hz (detailed)\n", h_active,
409 		       v_active, h_active > 1000 ? ' ' : '\t', vfreq);
410 		*have_timing = 1;
411 	}
412 }
413 
414 /**
415  * Get the manufacturer name from an EDID info.
416  *
417  * @param edid_info     The EDID info to be printed
418  * @param name		Returns the string of the manufacturer name
419  */
420 static void edid_get_manufacturer_name(struct edid1_info *edid, char *name)
421 {
422 	name[0] = EDID1_INFO_MANUFACTURER_NAME_CHAR1(*edid) + 'A' - 1;
423 	name[1] = EDID1_INFO_MANUFACTURER_NAME_CHAR2(*edid) + 'A' - 1;
424 	name[2] = EDID1_INFO_MANUFACTURER_NAME_CHAR3(*edid) + 'A' - 1;
425 	name[3] = '\0';
426 }
427 
428 void edid_print_info(struct edid1_info *edid_info)
429 {
430 	int i;
431 	char manufacturer[4];
432 	unsigned int have_timing = 0;
433 	uint32_t serial_number;
434 
435 	if (edid_check_info(edid_info)) {
436 		printf("Not a valid EDID\n");
437 		return;
438 	}
439 
440 	printf("EDID version: %d.%d\n",
441 	       edid_info->version, edid_info->revision);
442 
443 	printf("Product ID code: %04x\n", EDID1_INFO_PRODUCT_CODE(*edid_info));
444 
445 	edid_get_manufacturer_name(edid_info, manufacturer);
446 	printf("Manufacturer: %s\n", manufacturer);
447 
448 	serial_number = EDID1_INFO_SERIAL_NUMBER(*edid_info);
449 	if (serial_number != 0xffffffff) {
450 		if (strcmp(manufacturer, "MAG") == 0)
451 			serial_number -= 0x7000000;
452 		if (strcmp(manufacturer, "OQI") == 0)
453 			serial_number -= 456150000;
454 		if (strcmp(manufacturer, "VSC") == 0)
455 			serial_number -= 640000000;
456 	}
457 	printf("Serial number: %08x\n", serial_number);
458 	printf("Manufactured in week: %d year: %d\n",
459 	       edid_info->week, edid_info->year + 1990);
460 
461 	printf("Video input definition: %svoltage level %d%s%s%s%s%s\n",
462 	       EDID1_INFO_VIDEO_INPUT_DIGITAL(*edid_info) ?
463 	       "digital signal, " : "analog signal, ",
464 	       EDID1_INFO_VIDEO_INPUT_VOLTAGE_LEVEL(*edid_info),
465 	       EDID1_INFO_VIDEO_INPUT_BLANK_TO_BLACK(*edid_info) ?
466 	       ", blank to black" : "",
467 	       EDID1_INFO_VIDEO_INPUT_SEPARATE_SYNC(*edid_info) ?
468 	       ", separate sync" : "",
469 	       EDID1_INFO_VIDEO_INPUT_COMPOSITE_SYNC(*edid_info) ?
470 	       ", composite sync" : "",
471 	       EDID1_INFO_VIDEO_INPUT_SYNC_ON_GREEN(*edid_info) ?
472 	       ", sync on green" : "",
473 	       EDID1_INFO_VIDEO_INPUT_SERRATION_V(*edid_info) ?
474 	       ", serration v" : "");
475 
476 	printf("Monitor is %s\n",
477 	       EDID1_INFO_FEATURE_RGB(*edid_info) ? "RGB" : "non-RGB");
478 
479 	printf("Maximum visible display size: %d cm x %d cm\n",
480 	       edid_info->max_size_horizontal,
481 	       edid_info->max_size_vertical);
482 
483 	printf("Power management features: %s%s, %s%s, %s%s\n",
484 	       EDID1_INFO_FEATURE_ACTIVE_OFF(*edid_info) ?
485 	       "" : "no ", "active off",
486 	       EDID1_INFO_FEATURE_SUSPEND(*edid_info) ? "" : "no ", "suspend",
487 	       EDID1_INFO_FEATURE_STANDBY(*edid_info) ? "" : "no ", "standby");
488 
489 	printf("Estabilished timings:\n");
490 	if (EDID1_INFO_ESTABLISHED_TIMING_720X400_70(*edid_info))
491 		printf("\t720x400\t\t70 Hz (VGA 640x400, IBM)\n");
492 	if (EDID1_INFO_ESTABLISHED_TIMING_720X400_88(*edid_info))
493 		printf("\t720x400\t\t88 Hz (XGA2)\n");
494 	if (EDID1_INFO_ESTABLISHED_TIMING_640X480_60(*edid_info))
495 		printf("\t640x480\t\t60 Hz (VGA)\n");
496 	if (EDID1_INFO_ESTABLISHED_TIMING_640X480_67(*edid_info))
497 		printf("\t640x480\t\t67 Hz (Mac II, Apple)\n");
498 	if (EDID1_INFO_ESTABLISHED_TIMING_640X480_72(*edid_info))
499 		printf("\t640x480\t\t72 Hz (VESA)\n");
500 	if (EDID1_INFO_ESTABLISHED_TIMING_640X480_75(*edid_info))
501 		printf("\t640x480\t\t75 Hz (VESA)\n");
502 	if (EDID1_INFO_ESTABLISHED_TIMING_800X600_56(*edid_info))
503 		printf("\t800x600\t\t56 Hz (VESA)\n");
504 	if (EDID1_INFO_ESTABLISHED_TIMING_800X600_60(*edid_info))
505 		printf("\t800x600\t\t60 Hz (VESA)\n");
506 	if (EDID1_INFO_ESTABLISHED_TIMING_800X600_72(*edid_info))
507 		printf("\t800x600\t\t72 Hz (VESA)\n");
508 	if (EDID1_INFO_ESTABLISHED_TIMING_800X600_75(*edid_info))
509 		printf("\t800x600\t\t75 Hz (VESA)\n");
510 	if (EDID1_INFO_ESTABLISHED_TIMING_832X624_75(*edid_info))
511 		printf("\t832x624\t\t75 Hz (Mac II)\n");
512 	if (EDID1_INFO_ESTABLISHED_TIMING_1024X768_87I(*edid_info))
513 		printf("\t1024x768\t87 Hz Interlaced (8514A)\n");
514 	if (EDID1_INFO_ESTABLISHED_TIMING_1024X768_60(*edid_info))
515 		printf("\t1024x768\t60 Hz (VESA)\n");
516 	if (EDID1_INFO_ESTABLISHED_TIMING_1024X768_70(*edid_info))
517 		printf("\t1024x768\t70 Hz (VESA)\n");
518 	if (EDID1_INFO_ESTABLISHED_TIMING_1024X768_75(*edid_info))
519 		printf("\t1024x768\t75 Hz (VESA)\n");
520 	if (EDID1_INFO_ESTABLISHED_TIMING_1280X1024_75(*edid_info))
521 		printf("\t1280x1024\t75 (VESA)\n");
522 	if (EDID1_INFO_ESTABLISHED_TIMING_1152X870_75(*edid_info))
523 		printf("\t1152x870\t75 (Mac II)\n");
524 
525 	/* Standard timings. */
526 	printf("Standard timings:\n");
527 	for (i = 0; i < ARRAY_SIZE(edid_info->standard_timings); i++) {
528 		unsigned int aspect = 10000;
529 		unsigned int x, y;
530 		unsigned char xres, vfreq;
531 
532 		xres = EDID1_INFO_STANDARD_TIMING_XRESOLUTION(*edid_info, i);
533 		vfreq = EDID1_INFO_STANDARD_TIMING_VFREQ(*edid_info, i);
534 		if ((xres != vfreq) ||
535 		    ((xres != 0) && (xres != 1)) ||
536 		    ((vfreq != 0) && (vfreq != 1))) {
537 			switch (EDID1_INFO_STANDARD_TIMING_ASPECT(*edid_info,
538 					i)) {
539 			case ASPECT_625:
540 				aspect = 6250;
541 				break;
542 			case ASPECT_75:
543 				aspect = 7500;
544 				break;
545 			case ASPECT_8:
546 				aspect = 8000;
547 				break;
548 			case ASPECT_5625:
549 				aspect = 5625;
550 				break;
551 			}
552 			x = (xres + 31) * 8;
553 			y = x * aspect / 10000;
554 			printf("\t%dx%d%c\t%d Hz\n", x, y,
555 			       x > 1000 ? ' ' : '\t', (vfreq & 0x3f) + 60);
556 			have_timing = 1;
557 		}
558 	}
559 
560 	/* Detailed timing information. */
561 	for (i = 0; i < ARRAY_SIZE(edid_info->monitor_details.descriptor);
562 			i++) {
563 		edid_print_dtd(&edid_info->monitor_details.descriptor[i],
564 			       &have_timing);
565 	}
566 
567 	if (!have_timing)
568 		printf("\tNone\n");
569 }
570