Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Add helper to compare edids.

Many drivers would benefit from using
drm helper to compare edid, rather
than bothering with own implementation.

v2: Added documentation for this function.

Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200630002700.5451-2-kunal1.joshi@intel.com

authored by

Stanislav Lisovskiy and committed by
Maarten Lankhorst
536faa45 e9d636ab

+42
+33
drivers/gpu/drm/drm_edid.c
··· 1616 1616 } 1617 1617 1618 1618 /** 1619 + * drm_edid_are_equal - compare two edid blobs. 1620 + * @edid1: pointer to first blob 1621 + * @edid2: pointer to second blob 1622 + * This helper can be used during probing to determine if 1623 + * edid had changed. 1624 + */ 1625 + bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2) 1626 + { 1627 + int edid1_len, edid2_len; 1628 + bool edid1_present = edid1 != NULL; 1629 + bool edid2_present = edid2 != NULL; 1630 + 1631 + if (edid1_present != edid2_present) 1632 + return false; 1633 + 1634 + if (edid1) { 1635 + 1636 + edid1_len = EDID_LENGTH * (1 + edid1->extensions); 1637 + edid2_len = EDID_LENGTH * (1 + edid2->extensions); 1638 + 1639 + if (edid1_len != edid2_len) 1640 + return false; 1641 + 1642 + if (memcmp(edid1, edid2, edid1_len)) 1643 + return false; 1644 + } 1645 + 1646 + return true; 1647 + } 1648 + EXPORT_SYMBOL(drm_edid_are_equal); 1649 + 1650 + 1651 + /** 1619 1652 * drm_edid_block_valid - Sanity check the EDID block (base or extension) 1620 1653 * @raw_edid: pointer to raw EDID block 1621 1654 * @block: type of block to validate (0 for base, extension otherwise)
+9
include/drm/drm_edid.h
··· 359 359 } 360 360 #endif 361 361 362 + /** 363 + * drm_edid_are_equal - compare two edid blobs. 364 + * @edid1: pointer to first blob 365 + * @edid2: pointer to second blob 366 + * This helper can be used during probing to determine if 367 + * edid had changed. 368 + */ 369 + bool drm_edid_are_equal(const struct edid *edid1, const struct edid *edid2); 370 + 362 371 int 363 372 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, 364 373 const struct drm_connector *connector,