Lines Matching +full:abs +full:- +full:fuzz
3 * Copyright (c) 2007-2008 Intel Corporation
24 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
45 (((edid)->version > (maj)) || \
46 ((edid)->version == (maj) && (edid)->revision > (min)))
75 /* Force reduced-blanking timings for detailed modes */
116 /* BOE model on HP Pavilion 15-n233sl reports 8 bpc, but is a 6 bpc panel */
122 /* SDC panel of Lenovo B50-80 reports 8 bpc, but is a 6 bpc panel */
132 /* Envision Peripherals, Inc. EN-7100e */
144 /* LG Philips LCD LP154W01-A5 */
156 /* Samsung SyncMaster 22[5-6]BW */
160 /* Sony PVM-2541A does up to 12 bpc, but only reports max 8 bpc */
172 /* Panel in Samsung NP700G7A-S01PL notebook reports 6bpc */
175 /* Rotel RSX-1058 forwards sink's EDID but only does HDMI 1.1*/
232 /* 0x01 - 640x350@85Hz */
236 /* 0x02 - 640x400@85Hz */
240 /* 0x03 - 720x400@85Hz */
244 /* 0x04 - 640x480@60Hz */
248 /* 0x05 - 640x480@72Hz */
252 /* 0x06 - 640x480@75Hz */
256 /* 0x07 - 640x480@85Hz */
260 /* 0x08 - 800x600@56Hz */
264 /* 0x09 - 800x600@60Hz */
268 /* 0x0a - 800x600@72Hz */
272 /* 0x0b - 800x600@75Hz */
276 /* 0x0c - 800x600@85Hz */
280 /* 0x0d - 800x600@120Hz RB */
284 /* 0x0e - 848x480@60Hz */
288 /* 0x0f - 1024x768@43Hz, interlace */
293 /* 0x10 - 1024x768@60Hz */
297 /* 0x11 - 1024x768@70Hz */
301 /* 0x12 - 1024x768@75Hz */
305 /* 0x13 - 1024x768@85Hz */
309 /* 0x14 - 1024x768@120Hz RB */
313 /* 0x15 - 1152x864@75Hz */
317 /* 0x55 - 1280x720@60Hz */
321 /* 0x16 - 1280x768@60Hz RB */
325 /* 0x17 - 1280x768@60Hz */
329 /* 0x18 - 1280x768@75Hz */
333 /* 0x19 - 1280x768@85Hz */
337 /* 0x1a - 1280x768@120Hz RB */
341 /* 0x1b - 1280x800@60Hz RB */
345 /* 0x1c - 1280x800@60Hz */
349 /* 0x1d - 1280x800@75Hz */
353 /* 0x1e - 1280x800@85Hz */
357 /* 0x1f - 1280x800@120Hz RB */
361 /* 0x20 - 1280x960@60Hz */
365 /* 0x21 - 1280x960@85Hz */
369 /* 0x22 - 1280x960@120Hz RB */
373 /* 0x23 - 1280x1024@60Hz */
377 /* 0x24 - 1280x1024@75Hz */
381 /* 0x25 - 1280x1024@85Hz */
385 /* 0x26 - 1280x1024@120Hz RB */
389 /* 0x27 - 1360x768@60Hz */
393 /* 0x28 - 1360x768@120Hz RB */
397 /* 0x51 - 1366x768@60Hz */
401 /* 0x56 - 1366x768@60Hz */
405 /* 0x29 - 1400x1050@60Hz RB */
409 /* 0x2a - 1400x1050@60Hz */
413 /* 0x2b - 1400x1050@75Hz */
417 /* 0x2c - 1400x1050@85Hz */
421 /* 0x2d - 1400x1050@120Hz RB */
425 /* 0x2e - 1440x900@60Hz RB */
429 /* 0x2f - 1440x900@60Hz */
433 /* 0x30 - 1440x900@75Hz */
437 /* 0x31 - 1440x900@85Hz */
441 /* 0x32 - 1440x900@120Hz RB */
445 /* 0x53 - 1600x900@60Hz */
449 /* 0x33 - 1600x1200@60Hz */
453 /* 0x34 - 1600x1200@65Hz */
457 /* 0x35 - 1600x1200@70Hz */
461 /* 0x36 - 1600x1200@75Hz */
465 /* 0x37 - 1600x1200@85Hz */
469 /* 0x38 - 1600x1200@120Hz RB */
473 /* 0x39 - 1680x1050@60Hz RB */
477 /* 0x3a - 1680x1050@60Hz */
481 /* 0x3b - 1680x1050@75Hz */
485 /* 0x3c - 1680x1050@85Hz */
489 /* 0x3d - 1680x1050@120Hz RB */
493 /* 0x3e - 1792x1344@60Hz */
497 /* 0x3f - 1792x1344@75Hz */
501 /* 0x40 - 1792x1344@120Hz RB */
505 /* 0x41 - 1856x1392@60Hz */
509 /* 0x42 - 1856x1392@75Hz */
513 /* 0x43 - 1856x1392@120Hz RB */
517 /* 0x52 - 1920x1080@60Hz */
521 /* 0x44 - 1920x1200@60Hz RB */
525 /* 0x45 - 1920x1200@60Hz */
529 /* 0x46 - 1920x1200@75Hz */
533 /* 0x47 - 1920x1200@85Hz */
537 /* 0x48 - 1920x1200@120Hz RB */
541 /* 0x49 - 1920x1440@60Hz */
545 /* 0x4a - 1920x1440@75Hz */
549 /* 0x4b - 1920x1440@120Hz RB */
553 /* 0x54 - 2048x1152@60Hz */
557 /* 0x4c - 2560x1600@60Hz RB */
561 /* 0x4d - 2560x1600@60Hz */
565 /* 0x4e - 2560x1600@75Hz */
569 /* 0x4f - 2560x1600@85Hz */
573 /* 0x50 - 2560x1600@120Hz RB */
577 /* 0x57 - 4096x2160@60Hz RB */
581 /* 0x58 - 4096x2160@59.94Hz RB */
590 * modes are old-school Mac modes. The EDID spec says the 1152x864@75 mode
594 * The DMT modes have been fact-checked; the rest are mild guesses.
721 * Probably taken from CEA-861 spec.
727 /* 0 - dummy, VICs start at 1 */
729 /* 1 - 640x480@60Hz 4:3 */
734 /* 2 - 720x480@60Hz 4:3 */
739 /* 3 - 720x480@60Hz 16:9 */
744 /* 4 - 1280x720@60Hz 16:9 */
749 /* 5 - 1920x1080i@60Hz 16:9 */
755 /* 6 - 720(1440)x480i@60Hz 4:3 */
761 /* 7 - 720(1440)x480i@60Hz 16:9 */
767 /* 8 - 720(1440)x240@60Hz 4:3 */
773 /* 9 - 720(1440)x240@60Hz 16:9 */
779 /* 10 - 2880x480i@60Hz 4:3 */
785 /* 11 - 2880x480i@60Hz 16:9 */
791 /* 12 - 2880x240@60Hz 4:3 */
796 /* 13 - 2880x240@60Hz 16:9 */
801 /* 14 - 1440x480@60Hz 4:3 */
806 /* 15 - 1440x480@60Hz 16:9 */
811 /* 16 - 1920x1080@60Hz 16:9 */
816 /* 17 - 720x576@50Hz 4:3 */
821 /* 18 - 720x576@50Hz 16:9 */
826 /* 19 - 1280x720@50Hz 16:9 */
831 /* 20 - 1920x1080i@50Hz 16:9 */
837 /* 21 - 720(1440)x576i@50Hz 4:3 */
843 /* 22 - 720(1440)x576i@50Hz 16:9 */
849 /* 23 - 720(1440)x288@50Hz 4:3 */
855 /* 24 - 720(1440)x288@50Hz 16:9 */
861 /* 25 - 2880x576i@50Hz 4:3 */
867 /* 26 - 2880x576i@50Hz 16:9 */
873 /* 27 - 2880x288@50Hz 4:3 */
878 /* 28 - 2880x288@50Hz 16:9 */
883 /* 29 - 1440x576@50Hz 4:3 */
888 /* 30 - 1440x576@50Hz 16:9 */
893 /* 31 - 1920x1080@50Hz 16:9 */
898 /* 32 - 1920x1080@24Hz 16:9 */
903 /* 33 - 1920x1080@25Hz 16:9 */
908 /* 34 - 1920x1080@30Hz 16:9 */
913 /* 35 - 2880x480@60Hz 4:3 */
918 /* 36 - 2880x480@60Hz 16:9 */
923 /* 37 - 2880x576@50Hz 4:3 */
928 /* 38 - 2880x576@50Hz 16:9 */
933 /* 39 - 1920x1080i@50Hz 16:9 */
939 /* 40 - 1920x1080i@100Hz 16:9 */
945 /* 41 - 1280x720@100Hz 16:9 */
950 /* 42 - 720x576@100Hz 4:3 */
955 /* 43 - 720x576@100Hz 16:9 */
960 /* 44 - 720(1440)x576i@100Hz 4:3 */
966 /* 45 - 720(1440)x576i@100Hz 16:9 */
972 /* 46 - 1920x1080i@120Hz 16:9 */
978 /* 47 - 1280x720@120Hz 16:9 */
983 /* 48 - 720x480@120Hz 4:3 */
988 /* 49 - 720x480@120Hz 16:9 */
993 /* 50 - 720(1440)x480i@120Hz 4:3 */
999 /* 51 - 720(1440)x480i@120Hz 16:9 */
1005 /* 52 - 720x576@200Hz 4:3 */
1010 /* 53 - 720x576@200Hz 16:9 */
1015 /* 54 - 720(1440)x576i@200Hz 4:3 */
1021 /* 55 - 720(1440)x576i@200Hz 16:9 */
1027 /* 56 - 720x480@240Hz 4:3 */
1032 /* 57 - 720x480@240Hz 16:9 */
1037 /* 58 - 720(1440)x480i@240Hz 4:3 */
1043 /* 59 - 720(1440)x480i@240Hz 16:9 */
1049 /* 60 - 1280x720@24Hz 16:9 */
1054 /* 61 - 1280x720@25Hz 16:9 */
1059 /* 62 - 1280x720@30Hz 16:9 */
1064 /* 63 - 1920x1080@120Hz 16:9 */
1069 /* 64 - 1920x1080@100Hz 16:9 */
1074 /* 65 - 1280x720@24Hz 64:27 */
1079 /* 66 - 1280x720@25Hz 64:27 */
1084 /* 67 - 1280x720@30Hz 64:27 */
1089 /* 68 - 1280x720@50Hz 64:27 */
1094 /* 69 - 1280x720@60Hz 64:27 */
1099 /* 70 - 1280x720@100Hz 64:27 */
1104 /* 71 - 1280x720@120Hz 64:27 */
1109 /* 72 - 1920x1080@24Hz 64:27 */
1114 /* 73 - 1920x1080@25Hz 64:27 */
1119 /* 74 - 1920x1080@30Hz 64:27 */
1124 /* 75 - 1920x1080@50Hz 64:27 */
1129 /* 76 - 1920x1080@60Hz 64:27 */
1134 /* 77 - 1920x1080@100Hz 64:27 */
1139 /* 78 - 1920x1080@120Hz 64:27 */
1144 /* 79 - 1680x720@24Hz 64:27 */
1149 /* 80 - 1680x720@25Hz 64:27 */
1154 /* 81 - 1680x720@30Hz 64:27 */
1159 /* 82 - 1680x720@50Hz 64:27 */
1164 /* 83 - 1680x720@60Hz 64:27 */
1169 /* 84 - 1680x720@100Hz 64:27 */
1174 /* 85 - 1680x720@120Hz 64:27 */
1179 /* 86 - 2560x1080@24Hz 64:27 */
1184 /* 87 - 2560x1080@25Hz 64:27 */
1189 /* 88 - 2560x1080@30Hz 64:27 */
1194 /* 89 - 2560x1080@50Hz 64:27 */
1199 /* 90 - 2560x1080@60Hz 64:27 */
1204 /* 91 - 2560x1080@100Hz 64:27 */
1209 /* 92 - 2560x1080@120Hz 64:27 */
1214 /* 93 - 3840x2160@24Hz 16:9 */
1219 /* 94 - 3840x2160@25Hz 16:9 */
1224 /* 95 - 3840x2160@30Hz 16:9 */
1229 /* 96 - 3840x2160@50Hz 16:9 */
1234 /* 97 - 3840x2160@60Hz 16:9 */
1239 /* 98 - 4096x2160@24Hz 256:135 */
1244 /* 99 - 4096x2160@25Hz 256:135 */
1249 /* 100 - 4096x2160@30Hz 256:135 */
1254 /* 101 - 4096x2160@50Hz 256:135 */
1259 /* 102 - 4096x2160@60Hz 256:135 */
1264 /* 103 - 3840x2160@24Hz 64:27 */
1269 /* 104 - 3840x2160@25Hz 64:27 */
1274 /* 105 - 3840x2160@30Hz 64:27 */
1279 /* 106 - 3840x2160@50Hz 64:27 */
1284 /* 107 - 3840x2160@60Hz 64:27 */
1295 /* 0 - dummy, VICs start at 1 */
1297 /* 1 - 3840x2160@30Hz */
1303 /* 2 - 3840x2160@25Hz */
1309 /* 3 - 3840x2160@24Hz */
1315 /* 4 - 4096x2160@24Hz (SMPTE) */
1330 * drm_edid_header_is_valid - sanity check the header of the base EDID block
1352 "Minimum number of valid EDID header bytes (0-8, default 6)");
1377 * drm_edid_block_valid - Sanity check the EDID block (base or extension)
1408 * fix-up code here will correct the problem, the in drm_edid_block_valid()
1439 /* per-block-type checks */ in drm_edid_block_valid()
1442 if (edid->version != 1) { in drm_edid_block_valid()
1443 DRM_NOTE("EDID has major version %d, instead of 1\n", edid->version); in drm_edid_block_valid()
1447 if (edid->revision > 4) in drm_edid_block_valid()
1473 * drm_edid_is_valid - sanity check EDID data
1476 * Sanity-check an entire EDID record (including extensions)
1488 for (i = 0; i <= edid->extensions; i++) in drm_edid_is_valid()
1498 * drm_do_probe_ddc_edid() - get EDID information via I2C
1506 * Return: 0 on success or -1 on failure.
1519 * adapter reports EAGAIN. However, we find that bit-banging transfers in drm_do_probe_ddc_edid()
1545 * Avoid sending the segment addr to not upset non-compliant in drm_do_probe_ddc_edid()
1548 ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers); in drm_do_probe_ddc_edid()
1550 if (ret == -ENXIO) { in drm_do_probe_ddc_edid()
1551 DRM_DEBUG_KMS("drm: skipping non-existent adapter %s\n", in drm_do_probe_ddc_edid()
1552 adapter->name); in drm_do_probe_ddc_edid()
1555 } while (ret != xfers && --retries); in drm_do_probe_ddc_edid()
1557 return ret == xfers ? 0 : -1; in drm_do_probe_ddc_edid()
1565 if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS)) in connector_bad_edid()
1568 dev_warn(connector->dev->dev, in connector_bad_edid()
1570 connector->name); in connector_bad_edid()
1593 if (connector->override_edid) in drm_get_override_edid()
1594 override = drm_edid_duplicate(connector->edid_blob_ptr->data); in drm_get_override_edid()
1603 * drm_add_override_edid_modes - add modes from override/firmware EDID
1625 connector->base.id, connector->name, num_modes); in drm_add_override_edid_modes()
1633 * drm_do_get_edid - get EDID data using a custom EDID block read function
1673 &connector->edid_corrupt)) in drm_do_get_edid()
1676 connector->null_edid_counter++; in drm_do_get_edid()
1704 valid_extensions--; in drm_do_get_edid()
1712 edid[EDID_LENGTH-1] += edid[0x7e] - valid_extensions; in drm_do_get_edid()
1746 * drm_probe_ddc() - probe DDC presence
1761 * drm_get_edid - get EDID data, if available
1775 if (connector->force == DRM_FORCE_OFF) in drm_get_edid()
1778 if (connector->force == DRM_FORCE_UNSPECIFIED && !drm_probe_ddc(adapter)) in drm_get_edid()
1789 * drm_get_edid_switcheroo - get EDID data for a vga_switcheroo output
1802 struct pci_dev *pdev = connector->dev->pdev; in drm_get_edid_switcheroo()
1814 * drm_edid_duplicate - duplicate an EDID and the extensions
1821 return kmemdup(edid, (edid->extensions + 1) * EDID_LENGTH, GFP_KERNEL); in drm_edid_duplicate()
1828 * edid_vendor - match a string against EDID's obfuscated vendor field
1838 edid_vendor[0] = ((edid->mfg_id[0] & 0x7c) >> 2) + '@'; in edid_vendor()
1839 edid_vendor[1] = (((edid->mfg_id[0] & 0x3) << 3) | in edid_vendor()
1840 ((edid->mfg_id[1] & 0xe0) >> 5)) + '@'; in edid_vendor()
1841 edid_vendor[2] = (edid->mfg_id[1] & 0x1f) + '@'; in edid_vendor()
1847 * edid_get_quirks - return quirk flags for a given EDID
1860 if (edid_vendor(edid, quirk->vendor) && in edid_get_quirks()
1861 (EDID_PRODUCT_ID(edid) == quirk->product_id)) in edid_get_quirks()
1862 return quirk->quirks; in edid_get_quirks()
1868 #define MODE_SIZE(m) ((m)->hdisplay * (m)->vdisplay)
1869 #define MODE_REFRESH_DIFF(c,t) (abs((c) - (t)))
1872 * edid_fixup_preferred - set preferred modes based on quirk list
1886 if (list_empty(&connector->probed_modes)) in edid_fixup_preferred()
1894 preferred_mode = list_first_entry(&connector->probed_modes, in edid_fixup_preferred()
1897 list_for_each_entry_safe(cur_mode, t, &connector->probed_modes, head) { in edid_fixup_preferred()
1898 cur_mode->type &= ~DRM_MODE_TYPE_PREFERRED; in edid_fixup_preferred()
1907 cur_vrefresh = cur_mode->vrefresh ? in edid_fixup_preferred()
1908 cur_mode->vrefresh : drm_mode_vrefresh(cur_mode); in edid_fixup_preferred()
1909 preferred_vrefresh = preferred_mode->vrefresh ? in edid_fixup_preferred()
1910 preferred_mode->vrefresh : drm_mode_vrefresh(preferred_mode); in edid_fixup_preferred()
1919 preferred_mode->type |= DRM_MODE_TYPE_PREFERRED; in edid_fixup_preferred()
1925 return (mode->htotal - mode->hdisplay == 160) && in mode_is_rb()
1926 (mode->hsync_end - mode->hdisplay == 80) && in mode_is_rb()
1927 (mode->hsync_end - mode->hsync_start == 32) && in mode_is_rb()
1928 (mode->vsync_start - mode->vdisplay == 3); in mode_is_rb()
1932 * drm_mode_find_dmt - Create a copy of a mode if present in DMT
1937 * @rb: Mode reduced-blanking-ness
1951 if (hsize != ptr->hdisplay) in drm_mode_find_dmt()
1953 if (vsize != ptr->vdisplay) in drm_mode_find_dmt()
1976 n = (127 - d) / 18; in cea_for_each_detailed_block()
2004 cb(&(edid->detailed_timings[i]), closure); in drm_for_each_detailed_block()
2034 if (edid->revision >= 4) { in drm_monitor_supports_rb()
2040 return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0); in drm_monitor_supports_rb()
2093 * standard_timing_level - get std. timing level(CVT/GTF/DMT)
2098 if (edid->revision >= 2) { in standard_timing_level()
2099 if (edid->revision >= 4 && (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF)) in standard_timing_level()
2121 * drm_mode_std - convert standard mode info (width, height, refresh) into mode
2133 struct drm_device *dev = connector->dev; in drm_mode_std()
2137 unsigned aspect_ratio = (t->vfreq_aspect & EDID_TIMING_ASPECT_MASK) in drm_mode_std()
2139 unsigned vfreq = (t->vfreq_aspect & EDID_TIMING_VFREQ_MASK) in drm_mode_std()
2143 if (bad_std_timing(t->hsize, t->vfreq_aspect)) in drm_mode_std()
2147 hsize = t->hsize * 8 + 248; in drm_mode_std()
2152 if (edid->revision < 3) in drm_mode_std()
2177 list_for_each_entry(m, &connector->probed_modes, head) in drm_mode_std()
2178 if (m->hdisplay == hsize && m->vdisplay == vsize && in drm_mode_std()
2188 mode->hdisplay = 1366; in drm_mode_std()
2189 mode->hsync_start = mode->hsync_start - 1; in drm_mode_std()
2190 mode->hsync_end = mode->hsync_end - 1; in drm_mode_std()
2264 if (!(pt->misc & DRM_EDID_PT_INTERLACED)) in drm_mode_do_interlace_quirk()
2268 if ((mode->hdisplay == cea_interlaced[i].w) && in drm_mode_do_interlace_quirk()
2269 (mode->vdisplay == cea_interlaced[i].h / 2)) { in drm_mode_do_interlace_quirk()
2270 mode->vdisplay *= 2; in drm_mode_do_interlace_quirk()
2271 mode->vsync_start *= 2; in drm_mode_do_interlace_quirk()
2272 mode->vsync_end *= 2; in drm_mode_do_interlace_quirk()
2273 mode->vtotal *= 2; in drm_mode_do_interlace_quirk()
2274 mode->vtotal |= 1; in drm_mode_do_interlace_quirk()
2278 mode->flags |= DRM_MODE_FLAG_INTERLACE; in drm_mode_do_interlace_quirk()
2282 * drm_mode_detailed - create a new mode from an EDID detailed timing section
2297 struct detailed_pixel_timing *pt = &timing->data.pixel_data; in drm_mode_detailed()
2298 unsigned hactive = (pt->hactive_hblank_hi & 0xf0) << 4 | pt->hactive_lo; in drm_mode_detailed()
2299 unsigned vactive = (pt->vactive_vblank_hi & 0xf0) << 4 | pt->vactive_lo; in drm_mode_detailed()
2300 unsigned hblank = (pt->hactive_hblank_hi & 0xf) << 8 | pt->hblank_lo; in drm_mode_detailed()
2301 unsigned vblank = (pt->vactive_vblank_hi & 0xf) << 8 | pt->vblank_lo; in drm_mode_detailed()
2302 unsigned hsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc0) << 2 | pt->hsync_offset_lo; in drm_mode_detailed()
2303 …unsigned hsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x30) << 4 | pt->hsync_pulse… in drm_mode_detailed()
2304 …unsigned vsync_offset = (pt->hsync_vsync_offset_pulse_width_hi & 0xc) << 2 | pt->vsync_offset_puls… in drm_mode_detailed()
2305 …unsigned vsync_pulse_width = (pt->hsync_vsync_offset_pulse_width_hi & 0x3) << 4 | (pt->vsync_offse… in drm_mode_detailed()
2311 if (pt->misc & DRM_EDID_PT_STEREO) { in drm_mode_detailed()
2315 if (!(pt->misc & DRM_EDID_PT_SEPARATE_SYNC)) { in drm_mode_detailed()
2339 timing->pixel_clock = cpu_to_le16(1088); in drm_mode_detailed()
2341 mode->clock = le16_to_cpu(timing->pixel_clock) * 10; in drm_mode_detailed()
2343 mode->hdisplay = hactive; in drm_mode_detailed()
2344 mode->hsync_start = mode->hdisplay + hsync_offset; in drm_mode_detailed()
2345 mode->hsync_end = mode->hsync_start + hsync_pulse_width; in drm_mode_detailed()
2346 mode->htotal = mode->hdisplay + hblank; in drm_mode_detailed()
2348 mode->vdisplay = vactive; in drm_mode_detailed()
2349 mode->vsync_start = mode->vdisplay + vsync_offset; in drm_mode_detailed()
2350 mode->vsync_end = mode->vsync_start + vsync_pulse_width; in drm_mode_detailed()
2351 mode->vtotal = mode->vdisplay + vblank; in drm_mode_detailed()
2354 if (mode->hsync_end > mode->htotal) in drm_mode_detailed()
2355 mode->htotal = mode->hsync_end + 1; in drm_mode_detailed()
2356 if (mode->vsync_end > mode->vtotal) in drm_mode_detailed()
2357 mode->vtotal = mode->vsync_end + 1; in drm_mode_detailed()
2362 pt->misc |= DRM_EDID_PT_HSYNC_POSITIVE | DRM_EDID_PT_VSYNC_POSITIVE; in drm_mode_detailed()
2365 mode->flags |= (pt->misc & DRM_EDID_PT_HSYNC_POSITIVE) ? in drm_mode_detailed()
2367 mode->flags |= (pt->misc & DRM_EDID_PT_VSYNC_POSITIVE) ? in drm_mode_detailed()
2371 mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi & 0xf0) << 4; in drm_mode_detailed()
2372 mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi & 0xf) << 8; in drm_mode_detailed()
2375 mode->width_mm *= 10; in drm_mode_detailed()
2376 mode->height_mm *= 10; in drm_mode_detailed()
2380 mode->width_mm = edid->width_cm * 10; in drm_mode_detailed()
2381 mode->height_mm = edid->height_cm * 10; in drm_mode_detailed()
2384 mode->type = DRM_MODE_TYPE_DRIVER; in drm_mode_detailed()
2385 mode->vrefresh = drm_mode_vrefresh(mode); in drm_mode_detailed()
2398 if (edid->revision >= 4) in mode_in_hsync_range()
2401 if (edid->revision >= 4) in mode_in_hsync_range()
2415 if (edid->revision >= 4) in mode_in_vsync_range()
2418 if (edid->revision >= 4) in mode_in_vsync_range()
2433 if (edid->revision >= 4 && t[10] == 0x04) in range_pixel_clock()
2434 return (t[9] * 10000) - ((t[12] >> 2) * 250); in range_pixel_clock()
2436 /* 1.3 is pathetic, so fuzz up a bit */ in range_pixel_clock()
2454 if (mode->clock > max_clock) in mode_in_range()
2458 if (edid->revision >= 4 && t[10] == 0x04) in mode_in_range()
2459 if (t[13] && mode->hdisplay > 8 * (t[13] + (256 * (t[12]&0x3)))) in mode_in_range()
2474 list_for_each_entry(m, &connector->probed_modes, head) { in valid_inferred_mode()
2475 if (mode->hdisplay == m->hdisplay && in valid_inferred_mode()
2476 mode->vdisplay == m->vdisplay && in valid_inferred_mode()
2479 if (mode->hdisplay <= m->hdisplay && in valid_inferred_mode()
2480 mode->vdisplay <= m->vdisplay) in valid_inferred_mode()
2492 struct drm_device *dev = connector->dev; in drm_dmt_modes_for_range()
2513 if (mode->hdisplay == 1368 && mode->vdisplay == 768) { in drm_mode_fixup_1366x768()
2514 mode->hdisplay = 1366; in drm_mode_fixup_1366x768()
2515 mode->hsync_start--; in drm_mode_fixup_1366x768()
2516 mode->hsync_end--; in drm_mode_fixup_1366x768()
2527 struct drm_device *dev = connector->dev; in drm_gtf_modes_for_range()
2531 newmode = drm_gtf_mode(dev, m->w, m->h, m->r, 0, 0); in drm_gtf_modes_for_range()
2555 struct drm_device *dev = connector->dev; in drm_cvt_modes_for_range()
2560 newmode = drm_cvt_mode(dev, m->w, m->h, m->r, rb, 0, 0); in drm_cvt_modes_for_range()
2582 struct detailed_non_pixel *data = &timing->data.other_data; in do_inferred_modes()
2583 struct detailed_data_monitor_range *range = &data->data.range; in do_inferred_modes()
2585 if (data->type != EDID_DETAIL_MONITOR_RANGE) in do_inferred_modes()
2588 closure->modes += drm_dmt_modes_for_range(closure->connector, in do_inferred_modes()
2589 closure->edid, in do_inferred_modes()
2592 if (!version_greater(closure->edid, 1, 1)) in do_inferred_modes()
2595 switch (range->flags) { in do_inferred_modes()
2598 closure->modes += drm_gtf_modes_for_range(closure->connector, in do_inferred_modes()
2599 closure->edid, in do_inferred_modes()
2603 if (!version_greater(closure->edid, 1, 3)) in do_inferred_modes()
2606 closure->modes += drm_cvt_modes_for_range(closure->connector, in do_inferred_modes()
2607 closure->edid, in do_inferred_modes()
2639 for (j = 7; j >= 0; j--) { in drm_est3_modes()
2640 m = (i * 8) + (7 - j); in drm_est3_modes()
2644 mode = drm_mode_find_dmt(connector->dev, in drm_est3_modes()
2664 struct detailed_non_pixel *data = &timing->data.other_data; in do_established_modes()
2666 if (data->type == EDID_DETAIL_EST_TIMINGS) in do_established_modes()
2667 closure->modes += drm_est3_modes(closure->connector, timing); in do_established_modes()
2671 * add_established_modes - get est. modes from EDID and add them
2681 struct drm_device *dev = connector->dev; in add_established_modes()
2682 unsigned long est_bits = edid->established_timings.t1 | in add_established_modes()
2683 (edid->established_timings.t2 << 8) | in add_established_modes()
2684 ((edid->established_timings.mfg_rsvd & 0x80) << 9); in add_established_modes()
2713 struct detailed_non_pixel *data = &timing->data.other_data; in do_standard_modes()
2714 struct drm_connector *connector = closure->connector; in do_standard_modes()
2715 struct edid *edid = closure->edid; in do_standard_modes()
2717 if (data->type == EDID_DETAIL_STD_MODES) { in do_standard_modes()
2723 std = &data->data.timings[i]; in do_standard_modes()
2727 closure->modes++; in do_standard_modes()
2734 * add_standard_modes - get std. modes from EDID and add them
2754 &edid->standard_timings[i]); in add_standard_modes()
2775 struct drm_device *dev = connector->dev; in drm_cvt_modes()
2782 cvt = &(timing->data.other_data.data.cvt[i]); in drm_cvt_modes()
2784 if (!memcmp(cvt->code, empty, 3)) in drm_cvt_modes()
2787 height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 4) + 1) * 2; in drm_cvt_modes()
2788 switch (cvt->code[1] & 0x0c) { in drm_cvt_modes()
2804 if (cvt->code[2] & (1 << j)) { in drm_cvt_modes()
2823 struct detailed_non_pixel *data = &timing->data.other_data; in do_cvt_mode()
2825 if (data->type == EDID_DETAIL_CVT_3BYTE) in do_cvt_mode()
2826 closure->modes += drm_cvt_modes(closure->connector, timing); in do_cvt_mode()
2853 if (timing->pixel_clock) { in do_detailed_mode()
2854 newmode = drm_mode_detailed(closure->connector->dev, in do_detailed_mode()
2855 closure->edid, timing, in do_detailed_mode()
2856 closure->quirks); in do_detailed_mode()
2860 if (closure->preferred) in do_detailed_mode()
2861 newmode->type |= DRM_MODE_TYPE_PREFERRED; in do_detailed_mode()
2870 drm_mode_probed_add(closure->connector, newmode); in do_detailed_mode()
2871 closure->modes++; in do_detailed_mode()
2872 closure->preferred = false; in do_detailed_mode()
2877 * add_detailed_modes - Add modes from detailed timings
2895 (edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING); in add_detailed_modes()
2924 if (edid == NULL || edid->extensions == 0) in drm_find_edid_extension()
2928 for (i = 0; i < edid->extensions; i++) { in drm_find_edid_extension()
2934 if (i == edid->extensions) in drm_find_edid_extension()
2971 if (block->tag == DATA_BLOCK_CTA) { in drm_find_cea_extension()
2987 unsigned int clock = cea_mode->clock; in cea_mode_alternate_clock()
2989 if (cea_mode->vrefresh % 6 != 0) in cea_mode_alternate_clock()
2997 if (cea_mode->vdisplay == 240 || cea_mode->vdisplay == 480) in cea_mode_alternate_clock()
3027 vic == 12 || vic == 13) && mode->vtotal < 263) || in cea_mode_alternate_timings()
3029 vic == 27 || vic == 28) && mode->vtotal < 314)) { in cea_mode_alternate_timings()
3030 mode->vsync_start++; in cea_mode_alternate_timings()
3031 mode->vsync_end++; in cea_mode_alternate_timings()
3032 mode->vtotal++; in cea_mode_alternate_timings()
3046 if (!to_match->clock) in drm_match_cea_mode_clock_tolerance()
3049 if (to_match->picture_aspect_ratio) in drm_match_cea_mode_clock_tolerance()
3060 if (abs(to_match->clock - clock1) > clock_tolerance && in drm_match_cea_mode_clock_tolerance()
3061 abs(to_match->clock - clock2) > clock_tolerance) in drm_match_cea_mode_clock_tolerance()
3074 * drm_match_cea_mode - look for a CEA mode matching given mode
3077 * Return: The CEA Video ID (VIC) of the mode or 0 if it isn't a CEA-861
3085 if (!to_match->clock) in drm_match_cea_mode()
3088 if (to_match->picture_aspect_ratio) in drm_match_cea_mode()
3099 if (KHZ2PICOS(to_match->clock) != KHZ2PICOS(clock1) && in drm_match_cea_mode()
3100 KHZ2PICOS(to_match->clock) != KHZ2PICOS(clock2)) in drm_match_cea_mode()
3119 * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to
3142 if (hdmi_mode->vdisplay == 4096 && hdmi_mode->hdisplay == 2160) in hdmi_mode_alternate_clock()
3143 return hdmi_mode->clock; in hdmi_mode_alternate_clock()
3154 if (!to_match->clock) in drm_match_hdmi_mode_clock_tolerance()
3162 clock1 = hdmi_mode->clock; in drm_match_hdmi_mode_clock_tolerance()
3165 if (abs(to_match->clock - clock1) > clock_tolerance && in drm_match_hdmi_mode_clock_tolerance()
3166 abs(to_match->clock - clock2) > clock_tolerance) in drm_match_hdmi_mode_clock_tolerance()
3177 * drm_match_hdmi_mode - look for a HDMI mode matching given mode
3189 if (!to_match->clock) in drm_match_hdmi_mode()
3197 clock1 = hdmi_mode->clock; in drm_match_hdmi_mode()
3200 if ((KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock1) || in drm_match_hdmi_mode()
3201 KHZ2PICOS(to_match->clock) == KHZ2PICOS(clock2)) && in drm_match_hdmi_mode()
3216 struct drm_device *dev = connector->dev; in add_alternate_cea_modes()
3229 list_for_each_entry(mode, &connector->probed_modes, head) { in add_alternate_cea_modes()
3249 clock1 = cea_mode->clock; in add_alternate_cea_modes()
3254 if (mode->clock != clock1 && mode->clock != clock2) in add_alternate_cea_modes()
3262 newmode->flags |= mode->flags & DRM_MODE_FLAG_3D_MASK; in add_alternate_cea_modes()
3268 if (mode->clock != clock1) in add_alternate_cea_modes()
3269 newmode->clock = clock1; in add_alternate_cea_modes()
3271 newmode->clock = clock2; in add_alternate_cea_modes()
3273 list_add_tail(&newmode->head, &list); in add_alternate_cea_modes()
3277 list_del(&mode->head); in add_alternate_cea_modes()
3287 /* 0-6 bit vic, 7th bit native mode indicator */ in svd_to_vic()
3299 struct drm_device *dev = connector->dev; in drm_display_mode_from_vic_index()
3315 newmode->vrefresh = 0; in drm_display_mode_from_vic_index()
3321 * do_y420vdb_modes - Parse YCBCR 420 only modes
3326 * Parse the CEA-861-F YCBCR 420 Video Data Block (Y420VDB)
3334 struct drm_device *dev = connector->dev; in do_y420vdb_modes()
3335 struct drm_display_info *info = &connector->display_info; in do_y420vdb_modes()
3336 struct drm_hdmi_info *hdmi = &info->hdmi; in do_y420vdb_modes()
3348 bitmap_set(hdmi->y420_vdb_modes, vic, 1); in do_y420vdb_modes()
3354 info->color_formats |= DRM_COLOR_FORMAT_YCRCB420; in do_y420vdb_modes()
3359 * drm_add_cmdb_modes - Add a YCBCR 420 mode into bitmap
3369 struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; in drm_add_cmdb_modes()
3374 bitmap_set(hdmi->y420_cmdb_modes, vic, 1); in drm_add_cmdb_modes()
3381 struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; in do_cea_modes()
3396 if (i < 64 && hdmi->y420_cmdb_map & (1ULL << i)) in do_cea_modes()
3429 unsigned int interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE; in stereo_match_mandatory()
3431 return mode->hdisplay == stereo_mode->width && in stereo_match_mandatory()
3432 mode->vdisplay == stereo_mode->height && in stereo_match_mandatory()
3433 interlaced == (stereo_mode->flags & DRM_MODE_FLAG_INTERLACE) && in stereo_match_mandatory()
3434 drm_mode_vrefresh(mode) == stereo_mode->vrefresh; in stereo_match_mandatory()
3439 struct drm_device *dev = connector->dev; in add_hdmi_mandatory_stereo_modes()
3446 list_for_each_entry(mode, &connector->probed_modes, head) { in add_hdmi_mandatory_stereo_modes()
3460 new_mode->flags |= mandatory->flags; in add_hdmi_mandatory_stereo_modes()
3461 list_add_tail(&new_mode->head, &stereo_modes); in add_hdmi_mandatory_stereo_modes()
3466 list_splice_tail(&stereo_modes, &connector->probed_modes); in add_hdmi_mandatory_stereo_modes()
3473 struct drm_device *dev = connector->dev; in add_hdmi_mode()
3501 newmode->flags |= DRM_MODE_FLAG_3D_FRAME_PACKING; in add_3d_struct_modes()
3511 newmode->flags |= DRM_MODE_FLAG_3D_TOP_AND_BOTTOM; in add_3d_struct_modes()
3521 newmode->flags |= DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF; in add_3d_struct_modes()
3531 * do_hdmi_vsdb_modes - Parse the HDMI Vendor Specific data block
3543 struct drm_display_info *info = &connector->display_info; in do_hdmi_vsdb_modes()
3597 if (len < (8 + offset + hdmi_3d_len - 1)) in do_hdmi_vsdb_modes()
3624 for (i = 0; i < (hdmi_3d_len - multi_len); i++) { in do_hdmi_vsdb_modes()
3632 if (detail_present && (i + 1 == hdmi_3d_len - multi_len)) in do_hdmi_vsdb_modes()
3660 newmode->flags |= newflag; in do_hdmi_vsdb_modes()
3672 info->has_hdmi_infoframe = true; in do_hdmi_vsdb_modes()
3703 /* DisplayID CTA extension blocks and top-level CEA EDID in cea_db_offsets()
3714 * Byte number (decimal) within this block where the 18-byte in cea_db_offsets()
3715 * DTDs begin. If no non-DTD data is present in this extension in cea_db_offsets()
3718 * no non-DTD data. in cea_db_offsets()
3730 return -ERANGE; in cea_db_offsets()
3732 return -ENOTSUPP; in cea_db_offsets()
3802 struct drm_display_info *info = &connector->display_info; in drm_parse_y420cmdb_bitmap()
3803 struct drm_hdmi_info *hdmi = &info->hdmi; in drm_parse_y420cmdb_bitmap()
3804 u8 map_len = cea_db_payload_len(db) - 1; in drm_parse_y420cmdb_bitmap()
3810 hdmi->y420_cmdb_map = U64_MAX; in drm_parse_y420cmdb_bitmap()
3811 info->color_formats |= DRM_COLOR_FORMAT_YCRCB420; in drm_parse_y420cmdb_bitmap()
3834 info->color_formats |= DRM_COLOR_FORMAT_YCRCB420; in drm_parse_y420cmdb_bitmap()
3836 hdmi->y420_cmdb_map = map; in drm_parse_y420cmdb_bitmap()
3870 dbl - 1); in add_cea_modes()
3901 clock1 = cea_mode->clock; in fixup_detailed_cea_mode_clock()
3908 clock1 = cea_mode->clock; in fixup_detailed_cea_mode_clock()
3916 if (abs(mode->clock - clock1) < abs(mode->clock - clock2)) in fixup_detailed_cea_mode_clock()
3921 if (mode->clock == clock) in fixup_detailed_cea_mode_clock()
3924 DRM_DEBUG("detailed mode matches %s VIC %d, adjusting clock %d -> %d\n", in fixup_detailed_cea_mode_clock()
3925 type, vic, mode->clock, clock); in fixup_detailed_cea_mode_clock()
3926 mode->clock = clock; in fixup_detailed_cea_mode_clock()
3935 connector->eld[DRM_ELD_SAD_COUNT_CONN_TYPE] |= DRM_ELD_SUPPORTS_AI; in drm_parse_hdmi_vsdb_audio()
3937 connector->latency_present[0] = db[8] >> 7; in drm_parse_hdmi_vsdb_audio()
3938 connector->latency_present[1] = (db[8] >> 6) & 1; in drm_parse_hdmi_vsdb_audio()
3941 connector->video_latency[0] = db[9]; in drm_parse_hdmi_vsdb_audio()
3943 connector->audio_latency[0] = db[10]; in drm_parse_hdmi_vsdb_audio()
3945 connector->video_latency[1] = db[11]; in drm_parse_hdmi_vsdb_audio()
3947 connector->audio_latency[1] = db[12]; in drm_parse_hdmi_vsdb_audio()
3952 connector->latency_present[0], in drm_parse_hdmi_vsdb_audio()
3953 connector->latency_present[1], in drm_parse_hdmi_vsdb_audio()
3954 connector->video_latency[0], in drm_parse_hdmi_vsdb_audio()
3955 connector->video_latency[1], in drm_parse_hdmi_vsdb_audio()
3956 connector->audio_latency[0], in drm_parse_hdmi_vsdb_audio()
3957 connector->audio_latency[1]); in drm_parse_hdmi_vsdb_audio()
3963 if (t->data.other_data.type == EDID_DETAIL_MONITOR_NAME) in monitor_name()
3964 *(u8 **)data = t->data.other_data.data.str.str; in monitor_name()
3987 * drm_edid_get_monitor_name - fetch the monitor name from the edid
4001 name_length = min(get_monitor_name(edid, buf), bufsize - 1); in drm_edid_get_monitor_name()
4009 memset(connector->eld, 0, sizeof(connector->eld)); in clear_eld()
4011 connector->latency_present[0] = false; in clear_eld()
4012 connector->latency_present[1] = false; in clear_eld()
4013 connector->video_latency[0] = 0; in clear_eld()
4014 connector->audio_latency[0] = 0; in clear_eld()
4015 connector->video_latency[1] = 0; in clear_eld()
4016 connector->audio_latency[1] = 0; in clear_eld()
4020 * drm_edid_to_eld - build ELD from EDID
4024 * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The
4029 uint8_t *eld = connector->eld; in drm_edid_to_eld()
4055 eld[DRM_ELD_MANUFACTURER_NAME0] = edid->mfg_id[0]; in drm_edid_to_eld()
4056 eld[DRM_ELD_MANUFACTURER_NAME1] = edid->mfg_id[1]; in drm_edid_to_eld()
4057 eld[DRM_ELD_PRODUCT_CODE0] = edid->prod_code[0]; in drm_edid_to_eld()
4058 eld[DRM_ELD_PRODUCT_CODE1] = edid->prod_code[1]; in drm_edid_to_eld()
4077 sad_count = min(dbl / 3, 15 - total_sad_count); in drm_edid_to_eld()
4089 /* HDMI Vendor-Specific Data Block */ in drm_edid_to_eld()
4100 if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort || in drm_edid_to_eld()
4101 connector->connector_type == DRM_MODE_CONNECTOR_eDP) in drm_edid_to_eld()
4114 * drm_edid_to_sad - extracts SADs from EDID
4133 return -ENOENT; in drm_edid_to_sad()
4138 return -ENOTSUPP; in drm_edid_to_sad()
4143 return -EPROTO; in drm_edid_to_sad()
4156 return -ENOMEM; in drm_edid_to_sad()
4174 * drm_edid_to_speaker_allocation - extracts Speaker Allocation Data Blocks from EDID
4194 return -ENOENT; in drm_edid_to_speaker_allocation()
4199 return -ENOTSUPP; in drm_edid_to_speaker_allocation()
4204 return -EPROTO; in drm_edid_to_speaker_allocation()
4217 return -ENOMEM; in drm_edid_to_speaker_allocation()
4229 * drm_av_sync_delay - compute the HDMI/DP sink audio-video sync delay
4233 * Return: The HDMI/DP sink's audio-video sync delay in milliseconds or 0 if
4239 int i = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); in drm_av_sync_delay()
4242 if (!connector->latency_present[0]) in drm_av_sync_delay()
4244 if (!connector->latency_present[1]) in drm_av_sync_delay()
4247 a = connector->audio_latency[i]; in drm_av_sync_delay()
4248 v = connector->video_latency[i]; in drm_av_sync_delay()
4261 a = min(2 * (a - 1), 500); in drm_av_sync_delay()
4263 v = min(2 * (v - 1), 500); in drm_av_sync_delay()
4265 return max(v - a, 0); in drm_av_sync_delay()
4270 * drm_detect_hdmi_monitor - detect whether monitor is HDMI
4273 * Parse the CEA extension according to CEA-861-B.
4304 * drm_detect_monitor_audio - check monitor audio capability
4351 * drm_rgb_quant_range_selectable - is RGB quantization range selectable?
4387 * drm_default_rgb_quant_range - default RGB quantization range
4391 * as specified in CEA-861.
4409 struct drm_hdmi_info *hdmi = &connector->display_info.hdmi; in drm_parse_ycbcr420_deep_color_info()
4412 hdmi->y420_dc_modes = dc_mask; in drm_parse_ycbcr420_deep_color_info()
4418 struct drm_display_info *display = &connector->display_info; in drm_parse_hdmi_forum_vsdb()
4419 struct drm_hdmi_info *hdmi = &display->hdmi; in drm_parse_hdmi_forum_vsdb()
4421 display->has_hdmi_infoframe = true; in drm_parse_hdmi_forum_vsdb()
4424 hdmi->scdc.supported = true; in drm_parse_hdmi_forum_vsdb()
4426 hdmi->scdc.read_request = true; in drm_parse_hdmi_forum_vsdb()
4432 * * Availability of a HF-VSDB block in EDID (check) in drm_parse_hdmi_forum_vsdb()
4433 * * Non zero Max_TMDS_Char_Rate filed in HF-VSDB (let's check) in drm_parse_hdmi_forum_vsdb()
4441 struct drm_scdc *scdc = &hdmi->scdc; in drm_parse_hdmi_forum_vsdb()
4444 display->max_tmds_clock = max_tmds_clock; in drm_parse_hdmi_forum_vsdb()
4445 DRM_DEBUG_KMS("HF-VSDB: max TMDS clock %d kHz\n", in drm_parse_hdmi_forum_vsdb()
4446 display->max_tmds_clock); in drm_parse_hdmi_forum_vsdb()
4449 if (scdc->supported) { in drm_parse_hdmi_forum_vsdb()
4450 scdc->scrambling.supported = true; in drm_parse_hdmi_forum_vsdb()
4454 scdc->scrambling.low_rates = true; in drm_parse_hdmi_forum_vsdb()
4464 struct drm_display_info *info = &connector->display_info; in drm_parse_hdmi_deep_color_info()
4468 info->bpc = 8; in drm_parse_hdmi_deep_color_info()
4475 info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_30; in drm_parse_hdmi_deep_color_info()
4477 connector->name); in drm_parse_hdmi_deep_color_info()
4482 info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_36; in drm_parse_hdmi_deep_color_info()
4484 connector->name); in drm_parse_hdmi_deep_color_info()
4489 info->edid_hdmi_dc_modes |= DRM_EDID_HDMI_DC_48; in drm_parse_hdmi_deep_color_info()
4491 connector->name); in drm_parse_hdmi_deep_color_info()
4496 connector->name); in drm_parse_hdmi_deep_color_info()
4501 connector->name, dc_bpc); in drm_parse_hdmi_deep_color_info()
4502 info->bpc = dc_bpc; in drm_parse_hdmi_deep_color_info()
4509 info->color_formats = DRM_COLOR_FORMAT_RGB444; in drm_parse_hdmi_deep_color_info()
4513 info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; in drm_parse_hdmi_deep_color_info()
4515 connector->name); in drm_parse_hdmi_deep_color_info()
4524 connector->name); in drm_parse_hdmi_deep_color_info()
4531 struct drm_display_info *info = &connector->display_info; in drm_parse_hdmi_vsdb_video()
4535 info->dvi_dual = db[6] & 1; in drm_parse_hdmi_vsdb_video()
4537 info->max_tmds_clock = db[7] * 5000; in drm_parse_hdmi_vsdb_video()
4541 info->dvi_dual, in drm_parse_hdmi_vsdb_video()
4542 info->max_tmds_clock); in drm_parse_hdmi_vsdb_video()
4550 struct drm_display_info *info = &connector->display_info; in drm_parse_cea_ext()
4558 info->cea_rev = edid_ext[1]; in drm_parse_cea_ext()
4561 info->color_formats = DRM_COLOR_FORMAT_RGB444; in drm_parse_cea_ext()
4563 info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; in drm_parse_cea_ext()
4565 info->color_formats |= DRM_COLOR_FORMAT_YCRCB422; in drm_parse_cea_ext()
4588 struct drm_display_info *info = &connector->display_info; in drm_reset_display_info()
4590 info->width_mm = 0; in drm_reset_display_info()
4591 info->height_mm = 0; in drm_reset_display_info()
4593 info->bpc = 0; in drm_reset_display_info()
4594 info->color_formats = 0; in drm_reset_display_info()
4595 info->cea_rev = 0; in drm_reset_display_info()
4596 info->max_tmds_clock = 0; in drm_reset_display_info()
4597 info->dvi_dual = false; in drm_reset_display_info()
4598 info->has_hdmi_infoframe = false; in drm_reset_display_info()
4599 memset(&info->hdmi, 0, sizeof(info->hdmi)); in drm_reset_display_info()
4601 info->non_desktop = 0; in drm_reset_display_info()
4606 struct drm_display_info *info = &connector->display_info; in drm_add_display_info()
4612 info->width_mm = edid->width_cm * 10; in drm_add_display_info()
4613 info->height_mm = edid->height_cm * 10; in drm_add_display_info()
4615 info->non_desktop = !!(quirks & EDID_QUIRK_NON_DESKTOP); in drm_add_display_info()
4617 DRM_DEBUG_KMS("non_desktop set to %d\n", info->non_desktop); in drm_add_display_info()
4619 if (edid->revision < 3) in drm_add_display_info()
4622 if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) in drm_add_display_info()
4634 if ((info->bpc == 0) && (edid->revision < 4) && in drm_add_display_info()
4635 (edid->input & DRM_EDID_DIGITAL_TYPE_DVI)) { in drm_add_display_info()
4636 info->bpc = 8; in drm_add_display_info()
4638 connector->name, info->bpc); in drm_add_display_info()
4642 if (edid->revision < 4) in drm_add_display_info()
4645 switch (edid->input & DRM_EDID_DIGITAL_DEPTH_MASK) { in drm_add_display_info()
4647 info->bpc = 6; in drm_add_display_info()
4650 info->bpc = 8; in drm_add_display_info()
4653 info->bpc = 10; in drm_add_display_info()
4656 info->bpc = 12; in drm_add_display_info()
4659 info->bpc = 14; in drm_add_display_info()
4662 info->bpc = 16; in drm_add_display_info()
4666 info->bpc = 0; in drm_add_display_info()
4670 DRM_DEBUG("%s: Assigning EDID-1.4 digital sink color depth as %d bpc.\n", in drm_add_display_info()
4671 connector->name, info->bpc); in drm_add_display_info()
4673 info->color_formats |= DRM_COLOR_FORMAT_RGB444; in drm_add_display_info()
4674 if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444) in drm_add_display_info()
4675 info->color_formats |= DRM_COLOR_FORMAT_YCRCB444; in drm_add_display_info()
4676 if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422) in drm_add_display_info()
4677 info->color_formats |= DRM_COLOR_FORMAT_YCRCB422; in drm_add_display_info()
4690 base->rev, base->bytes, base->prod_id, base->ext_count); in validate_displayid()
4692 if (base->bytes + 5 > length - idx) in validate_displayid()
4693 return -EINVAL; in validate_displayid()
4694 for (i = idx; i <= base->bytes + 5; i++) { in validate_displayid()
4699 return -EINVAL; in validate_displayid()
4708 unsigned pixel_clock = (timings->pixel_clock[0] | in drm_mode_displayid_detailed()
4709 (timings->pixel_clock[1] << 8) | in drm_mode_displayid_detailed()
4710 (timings->pixel_clock[2] << 16)) + 1; in drm_mode_displayid_detailed()
4711 unsigned hactive = (timings->hactive[0] | timings->hactive[1] << 8) + 1; in drm_mode_displayid_detailed()
4712 unsigned hblank = (timings->hblank[0] | timings->hblank[1] << 8) + 1; in drm_mode_displayid_detailed()
4713 unsigned hsync = (timings->hsync[0] | (timings->hsync[1] & 0x7f) << 8) + 1; in drm_mode_displayid_detailed()
4714 unsigned hsync_width = (timings->hsw[0] | timings->hsw[1] << 8) + 1; in drm_mode_displayid_detailed()
4715 unsigned vactive = (timings->vactive[0] | timings->vactive[1] << 8) + 1; in drm_mode_displayid_detailed()
4716 unsigned vblank = (timings->vblank[0] | timings->vblank[1] << 8) + 1; in drm_mode_displayid_detailed()
4717 unsigned vsync = (timings->vsync[0] | (timings->vsync[1] & 0x7f) << 8) + 1; in drm_mode_displayid_detailed()
4718 unsigned vsync_width = (timings->vsw[0] | timings->vsw[1] << 8) + 1; in drm_mode_displayid_detailed()
4719 bool hsync_positive = (timings->hsync[1] >> 7) & 0x1; in drm_mode_displayid_detailed()
4720 bool vsync_positive = (timings->vsync[1] >> 7) & 0x1; in drm_mode_displayid_detailed()
4725 mode->clock = pixel_clock * 10; in drm_mode_displayid_detailed()
4726 mode->hdisplay = hactive; in drm_mode_displayid_detailed()
4727 mode->hsync_start = mode->hdisplay + hsync; in drm_mode_displayid_detailed()
4728 mode->hsync_end = mode->hsync_start + hsync_width; in drm_mode_displayid_detailed()
4729 mode->htotal = mode->hdisplay + hblank; in drm_mode_displayid_detailed()
4731 mode->vdisplay = vactive; in drm_mode_displayid_detailed()
4732 mode->vsync_start = mode->vdisplay + vsync; in drm_mode_displayid_detailed()
4733 mode->vsync_end = mode->vsync_start + vsync_width; in drm_mode_displayid_detailed()
4734 mode->vtotal = mode->vdisplay + vblank; in drm_mode_displayid_detailed()
4736 mode->flags = 0; in drm_mode_displayid_detailed()
4737 mode->flags |= hsync_positive ? DRM_MODE_FLAG_PHSYNC : DRM_MODE_FLAG_NHSYNC; in drm_mode_displayid_detailed()
4738 mode->flags |= vsync_positive ? DRM_MODE_FLAG_PVSYNC : DRM_MODE_FLAG_NVSYNC; in drm_mode_displayid_detailed()
4739 mode->type = DRM_MODE_TYPE_DRIVER; in drm_mode_displayid_detailed()
4741 if (timings->flags & 0x80) in drm_mode_displayid_detailed()
4742 mode->type |= DRM_MODE_TYPE_PREFERRED; in drm_mode_displayid_detailed()
4743 mode->vrefresh = drm_mode_vrefresh(mode); in drm_mode_displayid_detailed()
4758 if (block->num_bytes % 20) in add_displayid_detailed_1_modes()
4761 num_timings = block->num_bytes / 20; in add_displayid_detailed_1_modes()
4763 struct displayid_detailed_timings_1 *timings = &det->timings[i]; in add_displayid_detailed_1_modes()
4765 newmode = drm_mode_displayid_detailed(connector->dev, timings); in add_displayid_detailed_1_modes()
4796 idx + sizeof(struct displayid_block) + block->num_bytes <= length && in add_displayid_detailed_modes()
4797 block->num_bytes > 0) { in add_displayid_detailed_modes()
4798 idx += block->num_bytes + sizeof(struct displayid_block); in add_displayid_detailed_modes()
4799 switch (block->tag) { in add_displayid_detailed_modes()
4809 * drm_add_edid_modes - add modes from EDID data, if available
4830 dev_warn(connector->dev->dev, "%s: EDID invalid.\n", in drm_add_edid_modes()
4831 connector->name); in drm_add_edid_modes()
4838 * CEA-861-F adds ycbcr capability map block, for HDMI 2.0 sinks. in drm_add_edid_modes()
4846 * - preferred detailed mode in drm_add_edid_modes()
4847 * - other detailed modes from base block in drm_add_edid_modes()
4848 * - detailed modes from extension blocks in drm_add_edid_modes()
4849 * - CVT 3-byte code modes in drm_add_edid_modes()
4850 * - standard timing codes in drm_add_edid_modes()
4851 * - established timing codes in drm_add_edid_modes()
4852 * - modes inferred from GTF or CVT range information in drm_add_edid_modes()
4865 if (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF) in drm_add_edid_modes()
4872 connector->display_info.bpc = 6; in drm_add_edid_modes()
4875 connector->display_info.bpc = 8; in drm_add_edid_modes()
4878 connector->display_info.bpc = 10; in drm_add_edid_modes()
4881 connector->display_info.bpc = 12; in drm_add_edid_modes()
4888 * drm_add_modes_noedid - add modes for the connectors without EDID
4903 struct drm_device *dev = connector->dev; in drm_add_modes_noedid()
4919 if (ptr->hdisplay > hdisplay || in drm_add_modes_noedid()
4920 ptr->vdisplay > vdisplay) in drm_add_modes_noedid()
4936 * drm_set_preferred_mode - Sets the preferred mode of a connector
4949 list_for_each_entry(mode, &connector->probed_modes, head) { in drm_set_preferred_mode()
4950 if (mode->hdisplay == hpref && in drm_set_preferred_mode()
4951 mode->vdisplay == vpref) in drm_set_preferred_mode()
4952 mode->type |= DRM_MODE_TYPE_PREFERRED; in drm_set_preferred_mode()
4958 * drm_hdmi_avi_infoframe_from_display_mode() - fill an HDMI AVI infoframe with
4975 return -EINVAL; in drm_hdmi_avi_infoframe_from_display_mode()
4981 if (mode->flags & DRM_MODE_FLAG_DBLCLK) in drm_hdmi_avi_infoframe_from_display_mode()
4982 frame->pixel_repeat = 1; in drm_hdmi_avi_infoframe_from_display_mode()
4984 frame->video_code = drm_match_cea_mode(mode); in drm_hdmi_avi_infoframe_from_display_mode()
4987 * HDMI 1.4 VIC range: 1 <= VIC <= 64 (CEA-861-D) but in drm_hdmi_avi_infoframe_from_display_mode()
4988 * HDMI 2.0 VIC range: 1 <= VIC <= 107 (CEA-861-F). So we in drm_hdmi_avi_infoframe_from_display_mode()
4991 if (!is_hdmi2_sink && frame->video_code > 64) in drm_hdmi_avi_infoframe_from_display_mode()
4992 frame->video_code = 0; in drm_hdmi_avi_infoframe_from_display_mode()
5000 if (frame->video_code) { in drm_hdmi_avi_infoframe_from_display_mode()
5002 bool is_s3d = mode->flags & DRM_MODE_FLAG_3D_MASK; in drm_hdmi_avi_infoframe_from_display_mode()
5005 frame->video_code = 0; in drm_hdmi_avi_infoframe_from_display_mode()
5008 frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE; in drm_hdmi_avi_infoframe_from_display_mode()
5015 frame->content_type = HDMI_CONTENT_TYPE_GRAPHICS; in drm_hdmi_avi_infoframe_from_display_mode()
5016 frame->itc = 0; in drm_hdmi_avi_infoframe_from_display_mode()
5022 picture_aspect = mode->picture_aspect_ratio; in drm_hdmi_avi_infoframe_from_display_mode()
5024 picture_aspect = drm_get_cea_aspect_ratio(frame->video_code); in drm_hdmi_avi_infoframe_from_display_mode()
5033 drm_get_cea_aspect_ratio(frame->video_code)) in drm_hdmi_avi_infoframe_from_display_mode()
5034 return -EINVAL; in drm_hdmi_avi_infoframe_from_display_mode()
5038 frame->picture_aspect = picture_aspect; in drm_hdmi_avi_infoframe_from_display_mode()
5039 frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE; in drm_hdmi_avi_infoframe_from_display_mode()
5040 frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN; in drm_hdmi_avi_infoframe_from_display_mode()
5047 * drm_hdmi_avi_infoframe_quant_range() - fill the HDMI AVI infoframe
5067 * CEA-861: in drm_hdmi_avi_infoframe_quant_range()
5068 * "A Source shall not send a non-zero Q value that does not correspond in drm_hdmi_avi_infoframe_quant_range()
5073 * HDMI 2.0 recommends sending non-zero Q when it does match the in drm_hdmi_avi_infoframe_quant_range()
5078 frame->quantization_range = rgb_quant_range; in drm_hdmi_avi_infoframe_quant_range()
5080 frame->quantization_range = HDMI_QUANTIZATION_RANGE_DEFAULT; in drm_hdmi_avi_infoframe_quant_range()
5083 * CEA-861-F: in drm_hdmi_avi_infoframe_quant_range()
5085 * YQ-field to match the RGB Quantization Range being transmitted in drm_hdmi_avi_infoframe_quant_range()
5087 * set YQ=1) and the Sink shall ignore the YQ-field." in drm_hdmi_avi_infoframe_quant_range()
5090 * by non-zero YQ when receiving RGB. There doesn't seem to be any in drm_hdmi_avi_infoframe_quant_range()
5091 * good way to tell which version of CEA-861 the sink supports, so in drm_hdmi_avi_infoframe_quant_range()
5092 * we limit non-zero YQ to HDMI 2.0 sinks only as HDMI 2.0 is based in drm_hdmi_avi_infoframe_quant_range()
5093 * on on CEA-861-F. in drm_hdmi_avi_infoframe_quant_range()
5097 frame->ycc_quantization_range = in drm_hdmi_avi_infoframe_quant_range()
5100 frame->ycc_quantization_range = in drm_hdmi_avi_infoframe_quant_range()
5108 u32 layout = mode->flags & DRM_MODE_FLAG_3D_MASK; in s3d_structure_from_display_mode()
5133 * drm_hdmi_vendor_infoframe_from_display_mode() - fill an HDMI infoframe with
5141 * function will return -EINVAL, error that can be safely ignored.
5151 * FIXME: sil-sii8620 doesn't have a connector around when in drm_hdmi_vendor_infoframe_from_display_mode()
5155 connector->display_info.has_hdmi_infoframe : false; in drm_hdmi_vendor_infoframe_from_display_mode()
5161 return -EINVAL; in drm_hdmi_vendor_infoframe_from_display_mode()
5164 return -EINVAL; in drm_hdmi_vendor_infoframe_from_display_mode()
5167 s3d_flags = mode->flags & DRM_MODE_FLAG_3D_MASK; in drm_hdmi_vendor_infoframe_from_display_mode()
5180 return -EINVAL; in drm_hdmi_vendor_infoframe_from_display_mode()
5186 frame->vic = vic; in drm_hdmi_vendor_infoframe_from_display_mode()
5187 frame->s3d_struct = s3d_structure_from_display_mode(mode); in drm_hdmi_vendor_infoframe_from_display_mode()
5202 w = tile->tile_size[0] | tile->tile_size[1] << 8; in drm_parse_tiled_block()
5203 h = tile->tile_size[2] | tile->tile_size[3] << 8; in drm_parse_tiled_block()
5205 num_v_tile = (tile->topo[0] & 0xf) | (tile->topo[2] & 0x30); in drm_parse_tiled_block()
5206 num_h_tile = (tile->topo[0] >> 4) | ((tile->topo[2] >> 2) & 0x30); in drm_parse_tiled_block()
5207 tile_v_loc = (tile->topo[1] & 0xf) | ((tile->topo[2] & 0x3) << 4); in drm_parse_tiled_block()
5208 tile_h_loc = (tile->topo[1] >> 4) | (((tile->topo[2] >> 2) & 0x3) << 4); in drm_parse_tiled_block()
5210 connector->has_tile = true; in drm_parse_tiled_block()
5211 if (tile->tile_cap & 0x80) in drm_parse_tiled_block()
5212 connector->tile_is_single_monitor = true; in drm_parse_tiled_block()
5214 connector->num_h_tile = num_h_tile + 1; in drm_parse_tiled_block()
5215 connector->num_v_tile = num_v_tile + 1; in drm_parse_tiled_block()
5216 connector->tile_h_loc = tile_h_loc; in drm_parse_tiled_block()
5217 connector->tile_v_loc = tile_v_loc; in drm_parse_tiled_block()
5218 connector->tile_h_size = w + 1; in drm_parse_tiled_block()
5219 connector->tile_v_size = h + 1; in drm_parse_tiled_block()
5221 DRM_DEBUG_KMS("tile cap 0x%x\n", tile->tile_cap); in drm_parse_tiled_block()
5225 DRM_DEBUG_KMS("vend %c%c%c\n", tile->topology_id[0], tile->topology_id[1], tile->topology_id[2]); in drm_parse_tiled_block()
5227 tg = drm_mode_get_tile_group(connector->dev, tile->topology_id); in drm_parse_tiled_block()
5229 tg = drm_mode_create_tile_group(connector->dev, tile->topology_id); in drm_parse_tiled_block()
5232 return -ENOMEM; in drm_parse_tiled_block()
5234 if (connector->tile_group != tg) { in drm_parse_tiled_block()
5237 if (connector->tile_group) { in drm_parse_tiled_block()
5238 drm_mode_put_tile_group(connector->dev, connector->tile_group); in drm_parse_tiled_block()
5240 connector->tile_group = tg; in drm_parse_tiled_block()
5243 drm_mode_put_tile_group(connector->dev, tg); in drm_parse_tiled_block()
5266 idx + sizeof(struct displayid_block) + block->num_bytes <= length && in drm_parse_display_id()
5267 block->num_bytes > 0) { in drm_parse_display_id()
5268 idx += block->num_bytes + sizeof(struct displayid_block); in drm_parse_display_id()
5270 block->tag, block->rev, block->num_bytes); in drm_parse_display_id()
5272 switch (block->tag) { in drm_parse_display_id()
5285 DRM_DEBUG_KMS("found DisplayID tag 0x%x, unhandled\n", block->tag); in drm_parse_display_id()
5297 connector->has_tile = false; in drm_get_displayid()
5307 if (!connector->has_tile) in drm_get_displayid()
5311 if (connector->tile_group) { in drm_get_displayid()
5312 drm_mode_put_tile_group(connector->dev, connector->tile_group); in drm_get_displayid()
5313 connector->tile_group = NULL; in drm_get_displayid()