Lines Matching refs:edid

1584 	/* Size allocated for edid */
1586 const struct edid *edid;
1589 static int edid_hfeeodb_extension_block_count(const struct edid *edid);
1591 static int edid_hfeeodb_block_count(const struct edid *edid)
1593 int eeodb = edid_hfeeodb_extension_block_count(edid);
1598 static int edid_extension_block_count(const struct edid *edid)
1600 return edid->extensions;
1603 static int edid_block_count(const struct edid *edid)
1605 return edid_extension_block_count(edid) + 1;
1613 static int edid_size(const struct edid *edid)
1615 return edid_size_by_blocks(edid_block_count(edid));
1618 static const void *edid_block_data(const struct edid *edid, int index)
1620 BUILD_BUG_ON(sizeof(*edid) != EDID_LENGTH);
1622 return edid + index;
1625 static const void *edid_extension_block_data(const struct edid *edid, int index)
1627 return edid_block_data(edid, index + 1);
1636 num_blocks = edid_block_count(drm_edid->edid);
1646 eeodb = edid_hfeeodb_block_count(drm_edid->edid);
1670 return edid_block_data(drm_edid->edid, index);
1676 return edid_extension_block_data(drm_edid->edid, index);
1681 * trust edid size. Not for general purpose use.
1684 const struct edid *edid)
1686 if (!edid)
1691 drm_edid->edid = edid;
1692 drm_edid->size = edid_size(edid);
1749 static void edid_header_fix(void *edid)
1751 memcpy(edid, edid_header, sizeof(edid_header));
1764 const struct edid *edid = _edid;
1768 if (edid->header[i] == edid_header[i])
1797 const struct edid *block = _block;
1809 static bool edid_block_is_zero(const void *edid)
1811 return !memchr_inv(edid, 0, EDID_LENGTH);
1815 * drm_edid_are_equal - compare two edid blobs.
1819 * edid had changed.
1821 bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2)
1860 const struct edid *block = _block;
1908 const struct edid *block,
1948 WARN(1, "EDID block %d unknown edid block status code %d\n",
1986 struct edid *block = (struct edid *)_block;
2033 * @edid: EDID data
2039 bool drm_edid_is_valid(struct edid *edid)
2043 if (!edid)
2046 for (i = 0; i < edid_block_count(edid); i++) {
2047 void *block = (void *)edid_block_data(edid, i);
2087 static struct edid *edid_filter_invalid_blocks(struct edid *edid,
2090 struct edid *new;
2098 for (i = 0; i < edid_block_count(edid); i++) {
2099 const void *src_block = edid_block_data(edid, i);
2102 void *dst_block = (void *)edid_block_data(edid, valid_blocks);
2111 kfree(edid);
2115 edid->extensions = valid_blocks - 1;
2116 edid->checksum = edid_block_compute_checksum(edid);
2120 new = krealloc(edid, *alloc_size, GFP_KERNEL);
2122 kfree(edid);
2192 const struct edid *edid, int num_blocks)
2203 last_block = edid->extensions;
2205 /* Calculate real checksum for the last edid extension block data */
2208 edid_block_compute_checksum(edid + last_block);
2216 edid_block_dump(KERN_DEBUG, edid + i, i);
2246 seq_write(m, drm_edid->edid, drm_edid->size);
2254 int drm_edid_override_set(struct drm_connector *connector, const void *edid,
2259 drm_edid = drm_edid_alloc(edid, size);
2363 static struct edid *_drm_do_get_edid(struct drm_connector *connector,
2370 struct edid *edid, *new;
2376 edid = kmemdup(override->edid, alloc_size, GFP_KERNEL);
2378 if (!edid)
2383 edid = kmalloc(alloc_size, GFP_KERNEL);
2384 if (!edid)
2387 status = edid_block_read(edid, 0, read_block, context);
2389 edid_block_status_print(status, edid, 0);
2400 if (!edid_block_status_valid(status, edid_block_tag(edid))) {
2404 connector_bad_edid(connector, edid, 1);
2408 if (!edid_extension_block_count(edid))
2411 alloc_size = edid_size(edid);
2412 new = krealloc(edid, alloc_size, GFP_KERNEL);
2415 edid = new;
2417 num_blocks = edid_block_count(edid);
2419 void *block = (void *)edid_block_data(edid, i);
2439 int eeodb = edid_hfeeodb_block_count(edid);
2444 new = krealloc(edid, alloc_size, GFP_KERNEL);
2447 edid = new;
2453 connector_bad_edid(connector, edid, num_blocks);
2455 edid = edid_filter_invalid_blocks(edid, &alloc_size);
2462 return edid;
2465 kfree(edid);
2489 struct edid *drm_do_get_edid(struct drm_connector *connector,
2507 const struct edid *drm_edid_raw(const struct drm_edid *drm_edid)
2516 if (WARN_ON(edid_size(drm_edid->edid) > drm_edid->size))
2519 return drm_edid->edid;
2523 /* Allocate struct drm_edid container *without* duplicating the edid data */
2524 static const struct drm_edid *_drm_edid_alloc(const void *edid, size_t size)
2528 if (!edid || !size || size < EDID_LENGTH)
2533 drm_edid->edid = edid;
2542 * @edid: Pointer to raw EDID data
2545 * Allocate a new drm_edid container. Do not calculate edid size from edid, pass
2554 const struct drm_edid *drm_edid_alloc(const void *edid, size_t size)
2558 if (!edid || !size || size < EDID_LENGTH)
2561 edid = kmemdup(edid, size, GFP_KERNEL);
2562 if (!edid)
2565 drm_edid = _drm_edid_alloc(edid, size);
2567 kfree(edid);
2586 return drm_edid_alloc(drm_edid->edid, drm_edid->size);
2599 kfree(drm_edid->edid);
2629 struct edid *drm_get_edid(struct drm_connector *connector,
2632 struct edid *edid;
2640 edid = _drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter, NULL);
2641 drm_connector_update_edid_property(connector, edid);
2642 return edid;
2674 struct edid *edid;
2677 edid = _drm_do_get_edid(connector, read_block, context, &size);
2678 if (!edid)
2684 drm_edid = _drm_edid_alloc(edid, size);
2686 kfree(edid);
2752 static u32 edid_extract_panel_id(const struct edid *edid)
2767 return (u32)edid->mfg_id[0] << 24 |
2768 (u32)edid->mfg_id[1] << 16 |
2769 (u32)EDID_PRODUCT_ID(edid);
2837 struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
2842 struct edid *edid;
2848 edid = drm_get_edid(connector, adapter);
2851 return edid;
2886 * @edid: EDID to duplicate
2890 struct edid *drm_edid_duplicate(const struct edid *edid)
2892 if (!edid)
2895 return kmemdup(edid, edid_size(edid), GFP_KERNEL);
2909 u32 panel_id = edid_extract_panel_id(drm_edid->edid);
3075 cb(&drm_edid->edid->detailed_timings[i], closure);
3113 if (drm_edid->edid->revision >= 4) {
3226 const struct edid *edid = drm_edid->edid;
3228 if (edid->revision >= 4) {
3238 } else if (edid->revision >= 3 && drm_gtf2_hbreak(drm_edid)) {
3240 } else if (edid->revision >= 2) {
3323 if (drm_edid->edid->revision < 3)
3541 mode->width_mm = drm_edid->edid->width_cm * 10;
3542 mode->height_mm = drm_edid->edid->height_cm * 10;
3553 const struct edid *edid, const u8 *t)
3558 if (edid->revision >= 4)
3561 if (edid->revision >= 4)
3570 const struct edid *edid, const u8 *t)
3575 if (edid->revision >= 4)
3578 if (edid->revision >= 4)
3586 range_pixel_clock(const struct edid *edid, const u8 *t)
3593 if (edid->revision >= 4 && t[10] == DRM_EDID_CVT_SUPPORT_FLAG)
3604 const struct edid *edid = drm_edid->edid;
3608 if (!mode_in_hsync_range(mode, edid, t))
3611 if (!mode_in_vsync_range(mode, edid, t))
3614 max_clock = range_pixel_clock(edid, t);
3620 if (edid->revision >= 4 && t[10] == DRM_EDID_CVT_SUPPORT_FLAG)
3785 if (closure->drm_edid->edid->revision < 2)
3800 if (closure->drm_edid->edid->revision < 4)
3821 if (drm_edid->edid->revision >= 1)
3876 const struct edid *edid = drm_edid->edid;
3877 unsigned long est_bits = edid->established_timings.t1 |
3878 (edid->established_timings.t2 << 8) |
3879 ((edid->established_timings.mfg_rsvd & 0x80) << 9);
3898 if (edid->revision >= 1)
3946 &drm_edid->edid->standard_timings[i]);
3953 if (drm_edid->edid->revision >= 1)
4033 if (drm_edid->edid->revision >= 3)
4086 if (drm_edid->edid->revision >= 4)
4090 drm_edid->edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING;
4907 * cea_db_iter_edid_begin(edid, &iter);
5183 static int edid_hfeeodb_extension_block_count(const struct edid *edid)
5188 if (!edid_extension_block_count(edid))
5192 cta = edid_extension_block_data(edid, 0);
5476 * drm_edid_get_monitor_name - fetch the monitor name from the edid
5477 * @edid: monitor EDID information
5482 void drm_edid_get_monitor_name(const struct edid *edid, char *name, int bufsize)
5489 if (edid) {
5492 .edid = edid,
5493 .size = edid_size(edid),
5568 eld[DRM_ELD_MANUFACTURER_NAME0] = drm_edid->edid->mfg_id[0];
5569 eld[DRM_ELD_MANUFACTURER_NAME1] = drm_edid->edid->mfg_id[1];
5570 eld[DRM_ELD_PRODUCT_CODE0] = drm_edid->edid->prod_code[0];
5571 eld[DRM_ELD_PRODUCT_CODE1] = drm_edid->edid->prod_code[1];
5652 * @edid: EDID to parse
5661 int drm_edid_to_sad(const struct edid *edid, struct cea_sad **sads)
5665 return _drm_edid_to_sad(drm_edid_legacy_init(&drm_edid, edid), sads);
5697 * @edid: EDID to parse
5707 int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb)
5711 return _drm_edid_to_speaker_allocation(drm_edid_legacy_init(&drm_edid, edid),
5781 * @edid: monitor EDID information
5790 bool drm_detect_hdmi_monitor(const struct edid *edid)
5794 return _drm_detect_hdmi_monitor(drm_edid_legacy_init(&drm_edid, edid));
5842 * @edid: EDID block to scan
5852 bool drm_detect_monitor_audio(const struct edid *edid)
5856 return _drm_detect_monitor_audio(drm_edid_legacy_init(&drm_edid, edid));
6253 * https://docs.microsoft.com/en-us/windows-hardware/drivers/display/specialized-monitors-edid-extension
6346 const struct edid *edid = closure->drm_edid->edid;
6366 if (edid->revision >= 4) {
6383 if (drm_edid->edid->revision < 4)
6386 if (!(drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ))
6539 const struct edid *edid;
6547 edid = drm_edid->edid;
6551 info->width_mm = edid->width_cm * 10;
6552 info->height_mm = edid->height_cm * 10;
6556 if (edid->revision < 3)
6574 if (info->bpc == 0 && edid->revision == 3 &&
6575 edid->input & DRM_EDID_DIGITAL_DFP_1_X) {
6583 if (edid->revision < 4)
6586 switch (edid->input & DRM_EDID_DIGITAL_DEPTH_MASK) {
6615 if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB444)
6617 if (edid->features & DRM_EDID_FEATURE_RGB_YCRCB422)
6771 if (drm_edid->edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ)
6790 const struct edid *old_edid = connector->edid_blob_ptr->data;
6793 if (!drm_edid_are_equal(drm_edid ? drm_edid->edid : NULL, old_edid)) {
6805 drm_edid ? drm_edid->edid : NULL,
6889 * drm_connector_update_edid_property - update the edid property of a connector
6891 * @edid: new value of the edid property
6894 * connector's edid property.
6905 const struct edid *edid)
6909 return drm_edid_connector_update(connector, drm_edid_legacy_init(&drm_edid, edid));
6916 * @edid: EDID data
6920 * can be derived from the edid.
6926 int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
6931 if (edid && !drm_edid_is_valid(edid)) {
6934 edid = NULL;
6937 drm_edid = drm_edid_legacy_init(&_drm_edid, edid);
7362 return drm_edid && drm_edid->edid &&
7363 drm_edid->edid->input & DRM_EDID_INPUT_DIGITAL;