Skip to content

Commit

Permalink
drm/edid: add function to help find SADs
Browse files Browse the repository at this point in the history
Add a function to find the start of the SADs in the ELD.  This
complements the helper to retrieve the SAD count.

[airlied: this fixes a build problem with the alsa eld helper
which required this].

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Russell King authored and Dave Airlie committed Aug 19, 2015
1 parent 82bd279 commit 1c73d3b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions include/drm/drm_edid.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,25 @@ static inline int drm_eld_mnl(const uint8_t *eld)
return (eld[DRM_ELD_CEA_EDID_VER_MNL] & DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT;
}

/**
* drm_eld_sad - Get ELD SAD structures.
* @eld: pointer to an eld memory structure with sad_count set
*/
static inline const uint8_t *drm_eld_sad(const uint8_t *eld)
{
unsigned int ver, mnl;

ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >> DRM_ELD_VER_SHIFT;
if (ver != 2 && ver != 31)
return NULL;

mnl = drm_eld_mnl(eld);
if (mnl > 16)
return NULL;

return eld + DRM_ELD_CEA_SAD(mnl, 0);
}

/**
* drm_eld_sad_count - Get ELD SAD count.
* @eld: pointer to an eld memory structure with sad_count set
Expand Down

0 comments on commit 1c73d3b

Please sign in to comment.