Lines Matching refs:edid
47 #define version_greater(edid, maj, min) \
48 (((edid)->version > (maj)) || \
49 ((edid)->version == (maj) && (edid)->revision > (min)))
91 struct edid *edid;
1619 * drm_edid_are_equal - compare two edid blobs.
1623 * edid had changed.
1625 bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2)
1665 struct edid *edid = (struct edid *)raw_edid;
1716 if (edid->version != 1) {
1717 DRM_NOTE("EDID has major version %d, instead of 1\n", edid->version);
1721 if (edid->revision > 4)
1748 * @edid: EDID data
1754 bool drm_edid_is_valid(struct edid *edid)
1757 u8 *raw = (u8 *)edid;
1759 if (!edid)
1762 for (i = 0; i <= edid->extensions; i++)
1835 u8 *edid, int num_blocks)
1846 last_block = edid[0x7e];
1848 /* Calculate real checksum for the last edid extension block data */
1851 drm_edid_block_checksum(edid + last_block * EDID_LENGTH);
1858 u8 *block = edid + i * EDID_LENGTH;
1875 static struct edid *drm_get_override_edid(struct drm_connector *connector)
1877 struct edid *override = NULL;
1901 struct edid *override;
1938 struct edid *drm_do_get_edid(struct drm_connector *connector,
1944 u8 *edid, *new;
1945 struct edid *override;
1951 if ((edid = kmalloc(EDID_LENGTH, GFP_KERNEL)) == NULL)
1956 if (get_edid_block(data, edid, 0, EDID_LENGTH))
1958 if (drm_edid_block_valid(edid, 0, false,
1961 if (i == 0 && drm_edid_is_zero(edid, EDID_LENGTH)) {
1970 valid_extensions = edid[0x7e];
1972 return (struct edid *)edid;
1974 new = krealloc(edid, (valid_extensions + 1) * EDID_LENGTH, GFP_KERNEL);
1977 edid = new;
1979 for (j = 1; j <= edid[0x7e]; j++) {
1980 u8 *block = edid + j * EDID_LENGTH;
1993 if (valid_extensions != edid[0x7e]) {
1996 connector_bad_edid(connector, edid, edid[0x7e] + 1);
2004 for (i = 0; i <= edid[0x7e]; i++) {
2005 u8 *block = edid + i * EDID_LENGTH;
2017 kfree(edid);
2018 edid = new;
2021 return (struct edid *)edid;
2024 connector_bad_edid(connector, edid, 1);
2026 kfree(edid);
2056 struct edid *drm_get_edid(struct drm_connector *connector,
2059 struct edid *edid;
2067 edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter);
2068 drm_connector_update_edid_property(connector, edid);
2069 return edid;
2084 struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
2088 struct edid *edid;
2091 edid = drm_get_edid(connector, adapter);
2094 return edid;
2100 * @edid: EDID to duplicate
2104 struct edid *drm_edid_duplicate(const struct edid *edid)
2106 return kmemdup(edid, (edid->extensions + 1) * EDID_LENGTH, GFP_KERNEL);
2114 * @edid: EDID to match
2117 * Returns true if @vendor is in @edid, false otherwise
2119 static bool edid_vendor(const struct edid *edid, const char *vendor)
2123 edid_vendor[0] = ((edid->mfg_id[0] & 0x7c) >> 2) + '@';
2124 edid_vendor[1] = (((edid->mfg_id[0] & 0x3) << 3) |
2125 ((edid->mfg_id[1] & 0xe0) >> 5)) + '@';
2126 edid_vendor[2] = (edid->mfg_id[1] & 0x1f) + '@';
2133 * @edid: EDID to process
2137 static u32 edid_get_quirks(const struct edid *edid)
2145 if (edid_vendor(edid, quirk->vendor) &&
2146 (EDID_PRODUCT_ID(edid) == quirk->product_id))
2296 struct edid *edid = (struct edid *)raw_edid;
2298 if (edid == NULL)
2302 cb(&(edid->detailed_timings[i]), closure);
2334 drm_monitor_supports_rb(struct edid *edid)
2336 if (edid->revision >= 4) {
2339 drm_for_each_detailed_block((u8 *)edid, is_rb, &ret);
2343 return ((edid->input & DRM_EDID_INPUT_DIGITAL) != 0);
2360 drm_gtf2_hbreak(struct edid *edid)
2364 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
2369 drm_gtf2_2c(struct edid *edid)
2373 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
2378 drm_gtf2_m(struct edid *edid)
2382 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
2387 drm_gtf2_k(struct edid *edid)
2391 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
2396 drm_gtf2_2j(struct edid *edid)
2400 drm_for_each_detailed_block((u8 *)edid, find_gtf2, &r);
2406 * @edid: EDID block to scan
2408 static int standard_timing_level(struct edid *edid)
2410 if (edid->revision >= 2) {
2411 if (edid->revision >= 4 && (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF))
2413 if (drm_gtf2_hbreak(edid))
2415 if (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF)
2444 * @edid: EDID block to scan
2451 drm_mode_std(struct drm_connector *connector, struct edid *edid,
2462 int timing_level = standard_timing_level(edid);
2473 if (edid->revision < 3)
2516 if (drm_monitor_supports_rb(edid)) {
2542 if (drm_mode_hsync(mode) > drm_gtf2_hbreak(edid)) {
2546 drm_gtf2_m(edid),
2547 drm_gtf2_2c(edid),
2548 drm_gtf2_k(edid),
2549 drm_gtf2_2j(edid));
2605 * @edid: EDID block
2613 struct edid *edid,
2701 mode->width_mm = edid->width_cm * 10;
2702 mode->height_mm = edid->height_cm * 10;
2713 struct edid *edid, u8 *t)
2718 if (edid->revision >= 4)
2721 if (edid->revision >= 4)
2730 struct edid *edid, u8 *t)
2735 if (edid->revision >= 4)
2738 if (edid->revision >= 4)
2746 range_pixel_clock(struct edid *edid, u8 *t)
2753 if (edid->revision >= 4 && t[10] == 0x04)
2761 mode_in_range(const struct drm_display_mode *mode, struct edid *edid,
2767 if (!mode_in_hsync_range(mode, edid, t))
2770 if (!mode_in_vsync_range(mode, edid, t))
2773 if ((max_clock = range_pixel_clock(edid, t)))
2778 if (edid->revision >= 4 && t[10] == 0x04)
2782 if (mode_is_rb(mode) && !drm_monitor_supports_rb(edid))
2807 drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
2815 if (mode_in_range(drm_dmt_modes + i, edid, timing) &&
2842 drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
2857 if (!mode_in_range(newmode, edid, timing) ||
2871 drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
2877 bool rb = drm_monitor_supports_rb(edid);
2887 if (!mode_in_range(newmode, edid, timing) ||
2911 closure->edid,
2914 if (!version_greater(closure->edid, 1, 1))
2921 closure->edid,
2925 if (!version_greater(closure->edid, 1, 3))
2929 closure->edid,
2939 add_inferred_modes(struct drm_connector *connector, struct edid *edid)
2943 .edid = edid,
2946 if (version_greater(edid, 1, 0))
2947 drm_for_each_detailed_block((u8 *)edid, do_inferred_modes,
2996 * @edid: EDID block to scan
3002 add_established_modes(struct drm_connector *connector, struct edid *edid)
3005 unsigned long est_bits = edid->established_timings.t1 |
3006 (edid->established_timings.t2 << 8) |
3007 ((edid->established_timings.mfg_rsvd & 0x80) << 9);
3011 .edid = edid,
3026 if (version_greater(edid, 1, 0))
3027 drm_for_each_detailed_block((u8 *)edid,
3039 struct edid *edid = closure->edid;
3049 newmode = drm_mode_std(connector, edid, std);
3060 * @edid: EDID block to scan
3063 * GTF or CVT. Grab them from @edid and add them to the list.
3066 add_standard_modes(struct drm_connector *connector, struct edid *edid)
3071 .edid = edid,
3077 newmode = drm_mode_std(connector, edid,
3078 &edid->standard_timings[i]);
3085 if (version_greater(edid, 1, 0))
3086 drm_for_each_detailed_block((u8 *)edid, do_standard_modes,
3158 add_cvt_modes(struct drm_connector *connector, struct edid *edid)
3162 .edid = edid,
3165 if (version_greater(edid, 1, 2))
3166 drm_for_each_detailed_block((u8 *)edid, do_cvt_mode, &closure);
3185 closure->edid, timing,
3208 * @edid: EDID block to scan
3212 add_detailed_modes(struct drm_connector *connector, struct edid *edid,
3217 .edid = edid,
3222 if (closure.preferred && !version_greater(edid, 1, 3))
3224 (edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING);
3226 drm_for_each_detailed_block((u8 *)edid, do_detailed_mode, &closure);
3248 static u8 *drm_find_edid_extension(const struct edid *edid,
3255 if (edid == NULL || edid->extensions == 0)
3259 for (i = *ext_index; i < edid->extensions; i++) {
3260 edid_ext = (u8 *)edid + EDID_LENGTH * (i + 1);
3265 if (i >= edid->extensions)
3274 static u8 *drm_find_displayid_extension(const struct edid *edid,
3278 u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT, ext_index);
3299 static u8 *drm_find_cea_extension(const struct edid *edid)
3310 cea = drm_find_edid_extension(edid, CEA_EXT, &ext_index);
3317 displayid = drm_find_displayid_extension(edid, &length, &idx,
3591 add_alternate_cea_modes(struct drm_connector *connector, struct edid *edid)
3599 if (!drm_find_cea_extension(edid))
4269 add_cea_modes(struct drm_connector *connector, struct edid *edid)
4271 const u8 *cea = drm_find_cea_extension(edid);
4447 static int get_monitor_name(struct edid *edid, char name[13])
4452 if (!edid || !name)
4455 drm_for_each_detailed_block((u8 *)edid, monitor_name, &edid_name);
4467 * drm_edid_get_monitor_name - fetch the monitor name from the edid
4468 * @edid: monitor EDID information
4473 void drm_edid_get_monitor_name(struct edid *edid, char *name, int bufsize)
4481 name_length = min(get_monitor_name(edid, buf), bufsize - 1);
4502 * @edid: EDID to parse
4507 static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
4518 if (!edid)
4521 cea = drm_find_cea_extension(edid);
4527 mnl = get_monitor_name(edid, &eld[DRM_ELD_MONITOR_NAME_STRING]);
4535 eld[DRM_ELD_MANUFACTURER_NAME0] = edid->mfg_id[0];
4536 eld[DRM_ELD_MANUFACTURER_NAME1] = edid->mfg_id[1];
4537 eld[DRM_ELD_PRODUCT_CODE0] = edid->prod_code[0];
4538 eld[DRM_ELD_PRODUCT_CODE1] = edid->prod_code[1];
4594 * @edid: EDID to parse
4603 int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads)
4609 cea = drm_find_cea_extension(edid);
4655 * @edid: EDID to parse
4665 int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb)
4671 cea = drm_find_cea_extension(edid);
4751 * @edid: monitor EDID information
4760 bool drm_detect_hdmi_monitor(struct edid *edid)
4766 edid_ext = drm_find_cea_extension(edid);
4788 * @edid: EDID block to scan
4798 bool drm_detect_monitor_audio(struct edid *edid)
4805 edid_ext = drm_find_cea_extension(edid);
5001 const struct edid *edid)
5007 edid_ext = drm_find_cea_extension(edid);
5065 const struct edid *edid)
5069 if (!version_greater(edid, 1, 1))
5072 drm_for_each_detailed_block((u8 *)edid, get_monitor_range,
5105 u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edid)
5109 u32 quirks = edid_get_quirks(edid);
5113 info->width_mm = edid->width_cm * 10;
5114 info->height_mm = edid->height_cm * 10;
5118 drm_get_monitor_range(connector, edid);
5122 if (edid->revision < 3)
5125 if (!(edid->input & DRM_EDID_INPUT_DIGITAL))
5129 drm_parse_cea_ext(connector, edid);
5138 if (info->bpc == 0 && edid->revision == 3 &&
5139 edid->input & DRM_EDID_DIGITAL_DFP_1_X) {
5146 if (edid->revision < 4)
5149 switch (edid->input & DRM_EDID_DIGITAL_DEPTH_MASK) {
5177 if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444)
5179 if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422)
5282 struct edid *edid)
5291 displayid = drm_find_displayid_extension(edid, &length, &idx,
5312 * @edid: EDID data
5316 * can be derived from the edid.
5320 int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
5325 if (edid == NULL) {
5329 if (!drm_edid_is_valid(edid)) {
5336 drm_edid_to_eld(connector, edid);
5343 quirks = drm_add_display_info(connector, edid);
5359 num_modes += add_detailed_modes(connector, edid, quirks);
5360 num_modes += add_cvt_modes(connector, edid);
5361 num_modes += add_standard_modes(connector, edid);
5362 num_modes += add_established_modes(connector, edid);
5363 num_modes += add_cea_modes(connector, edid);
5364 num_modes += add_alternate_cea_modes(connector, edid);
5365 num_modes += add_displayid_detailed_modes(connector, edid);
5366 if (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF)
5367 num_modes += add_inferred_modes(connector, edid);
5963 const struct edid *edid)
5971 displayid = drm_find_displayid_extension(edid, &length, &idx,