[Intel-gfx] [RFC 01/19] drm/edid: add drm_edid_extension_block_count() and drm_edid_size()
Ville Syrjälä
ville.syrjala at linux.intel.com
Wed Mar 23 15:21:40 UTC 2022
On Tue, Mar 22, 2022 at 11:40:30PM +0200, Jani Nikula wrote:
> Add abstractions for getting the number of EDID extension blocks and the
> total EDID size in bytes.
>
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
> 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)
It's just a number, so could be 'int' IMO.
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> +{
> + 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
--
Ville Syrjälä
Intel
More information about the dri-devel
mailing list