[RFC 01/19] drm/edid: add drm_edid_extension_block_count() and drm_edid_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add abstractions for getting the number of EDID extension blocks and the
total EDID size in bytes.

Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 drivers/gpu/drm/drm_edid.c | 18 ++++++++++++++++++
 include/drm/drm_edid.h     |  2 ++
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 561f53831e29..f4b49693e666 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -2198,6 +2198,24 @@ struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
 }
 EXPORT_SYMBOL(drm_get_edid_switcheroo);
 
+/**
+ * drm_edid_extension_block_count - get the number of EDID extension blocks
+ */
+u8 drm_edid_extension_block_count(const struct edid *edid)
+{
+	return edid->extensions;
+}
+EXPORT_SYMBOL(drm_edid_extension_block_count);
+
+/**
+ * drm_edid_size - get the EDID size in bytes
+ */
+size_t drm_edid_size(const struct edid *edid)
+{
+	return (drm_edid_extension_block_count(edid) + 1) * EDID_LENGTH;
+}
+EXPORT_SYMBOL(drm_edid_size);
+
 /**
  * drm_edid_duplicate - duplicate an EDID and the extensions
  * @edid: EDID to duplicate
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 144c495b99c4..7a19daa00c0c 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -564,6 +564,8 @@ struct edid *drm_get_edid(struct drm_connector *connector,
 u32 drm_edid_get_panel_id(struct i2c_adapter *adapter);
 struct edid *drm_get_edid_switcheroo(struct drm_connector *connector,
 				     struct i2c_adapter *adapter);
+u8 drm_edid_extension_block_count(const struct edid *edid);
+size_t drm_edid_size(const struct edid *edid);
 struct edid *drm_edid_duplicate(const struct edid *edid);
 int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid);
 int drm_add_override_edid_modes(struct drm_connector *connector);
-- 
2.30.2




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux