diff options
author | Jani Nikula <jani.nikula@intel.com> | 2022-05-03 12:23:57 +0300 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2022-05-05 20:28:20 +0300 |
commit | 9975af040a04ba9aef33f3ef1ca4e8f04c7223dd (patch) | |
tree | 8278f3702bcac8700e7671c8593f05284385f3e6 /drivers/gpu/drm/drm_edid.c | |
parent | 4ce08703a8c4be77b060aefd14eda272f50a45e4 (diff) | |
download | linux-9975af040a04ba9aef33f3ef1ca4e8f04c7223dd.tar.xz |
drm/edid: convert drm_detect_monitor_audio() to use cea db iter
Iterate through all CEA data blocks.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a7f0c380da9526f8dd6f758d7a748bca7b4da6ce.1651569697.git.jani.nikula@intel.com
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index ca594d502941..3433d9fa4799 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -5166,10 +5166,10 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor); */ bool drm_detect_monitor_audio(const struct edid *edid) { + const struct cea_db *db; + struct cea_db_iter iter; const u8 *edid_ext; - int i, j; bool has_audio = false; - int start_offset, end_offset; edid_ext = drm_find_cea_extension(edid); if (!edid_ext) @@ -5183,18 +5183,21 @@ bool drm_detect_monitor_audio(const struct edid *edid) goto end; } - if (cea_db_offsets(edid_ext, &start_offset, &end_offset)) - goto end; + cea_db_iter_edid_begin(edid, &iter); + cea_db_iter_for_each(db, &iter) { + if (cea_db_tag(db) == CTA_DB_AUDIO) { + const u8 *data = cea_db_data(db); + int i; - for_each_cea_db(edid_ext, i, start_offset, end_offset) { - if (cea_db_tag(&edid_ext[i]) == CTA_DB_AUDIO) { - has_audio = true; - for (j = 1; j < cea_db_payload_len(&edid_ext[i]) + 1; j += 3) + for (i = 0; i < cea_db_payload_len(db); i += 3) DRM_DEBUG_KMS("CEA audio format %d\n", - (edid_ext[i + j] >> 3) & 0xf); - goto end; + (data[i] >> 3) & 0xf); + has_audio = true; + break; } } + cea_db_iter_end(&iter); + end: return has_audio; } |