]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/edid: detect basic audio in all CEA extensions
authorJani Nikula <jani.nikula@intel.com>
Tue, 3 May 2022 09:24:02 +0000 (12:24 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 5 May 2022 17:28:38 +0000 (20:28 +0300)
Convert drm_find_cea_extension() to EDID block iterator in basic audio
detection. Detect basic audio in all CEA extensions.

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/59481d0397de4b91b3e6ea665882334e92538f40.1651569697.git.jani.nikula@intel.com
drivers/gpu/drm/drm_edid.c

index bc12ede8694c06d308ee6c3b9ddb3fdda9c1c56b..3b18a6e501df0791eb215f9c9dce5edb1b0212e1 100644 (file)
@@ -5112,17 +5112,21 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor);
  */
 bool drm_detect_monitor_audio(const struct edid *edid)
 {
+       struct drm_edid_iter edid_iter;
        const struct cea_db *db;
        struct cea_db_iter iter;
        const u8 *edid_ext;
        bool has_audio = false;
 
-       edid_ext = drm_find_cea_extension(edid);
-       if (!edid_ext)
-               goto end;
-
-       has_audio = (edid_ext[0] == CEA_EXT &&
-                   (edid_ext[3] & EDID_BASIC_AUDIO) != 0);
+       drm_edid_iter_begin(edid, &edid_iter);
+       drm_edid_iter_for_each(edid_ext, &edid_iter) {
+               if (edid_ext[0] == CEA_EXT) {
+                       has_audio = edid_ext[3] & EDID_BASIC_AUDIO;
+                       if (has_audio)
+                               break;
+               }
+       }
+       drm_edid_iter_end(&edid_iter);
 
        if (has_audio) {
                DRM_DEBUG_KMS("Monitor has basic audio support\n");