Commit 02703451 authored by Jani Nikula's avatar Jani Nikula

drm/edid: add drm_edid helper for drm_edid_to_speaker_allocation()

We'll need to propagate drm_edid everywhere.'

v2: Handle NULL EDID pointer (Ville, CI)
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/770d095c93274969c4b86480e07044e16a7b5760.1652097712.git.jani.nikula@intel.com
parent bba4b647
...@@ -5025,25 +5025,14 @@ int drm_edid_to_sad(const struct edid *edid, struct cea_sad **sads) ...@@ -5025,25 +5025,14 @@ int drm_edid_to_sad(const struct edid *edid, struct cea_sad **sads)
} }
EXPORT_SYMBOL(drm_edid_to_sad); EXPORT_SYMBOL(drm_edid_to_sad);
/** static int _drm_edid_to_speaker_allocation(const struct drm_edid *drm_edid,
* drm_edid_to_speaker_allocation - extracts Speaker Allocation Data Blocks from EDID u8 **sadb)
* @edid: EDID to parse
* @sadb: pointer to the speaker block
*
* Looks for CEA EDID block and extracts the Speaker Allocation Data Block from it.
*
* Note: The returned pointer needs to be freed using kfree().
*
* Return: The number of found Speaker Allocation Blocks or negative number on
* error.
*/
int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb)
{ {
const struct cea_db *db; const struct cea_db *db;
struct cea_db_iter iter; struct cea_db_iter iter;
int count = 0; int count = 0;
cea_db_iter_edid_begin(edid, &iter); cea_db_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter);
cea_db_iter_for_each(db, &iter) { cea_db_iter_for_each(db, &iter) {
if (cea_db_tag(db) == CTA_DB_SPEAKER && if (cea_db_tag(db) == CTA_DB_SPEAKER &&
cea_db_payload_len(db) == 3) { cea_db_payload_len(db) == 3) {
...@@ -5061,6 +5050,26 @@ int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb) ...@@ -5061,6 +5050,26 @@ int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb)
return count; return count;
} }
/**
* drm_edid_to_speaker_allocation - extracts Speaker Allocation Data Blocks from EDID
* @edid: EDID to parse
* @sadb: pointer to the speaker block
*
* Looks for CEA EDID block and extracts the Speaker Allocation Data Block from it.
*
* Note: The returned pointer needs to be freed using kfree().
*
* Return: The number of found Speaker Allocation Blocks or negative number on
* error.
*/
int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb)
{
struct drm_edid drm_edid;
return _drm_edid_to_speaker_allocation(drm_edid_legacy_init(&drm_edid, edid),
sadb);
}
EXPORT_SYMBOL(drm_edid_to_speaker_allocation); EXPORT_SYMBOL(drm_edid_to_speaker_allocation);
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment