After pruning the sad audio frequency list, if there are no
supported audio frequencies left, audio cannot be supported.
So mark has_audio accordingly.

v2: avoid bitwise operations on bool and use str_yes_no (Jani)
    use intel_display instead of i915

Signed-off-by: Vinod Govindapillai <vinod.govindapil...@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehma...@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_audio.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_audio.c 
b/drivers/gpu/drm/i915/display/intel_audio.c
index cf88728b8f80..f0a50dc3b8a6 100644
--- a/drivers/gpu/drm/i915/display/intel_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_audio.c
@@ -797,6 +797,7 @@ bool intel_audio_compute_eld_config(struct intel_encoder 
*encoder,
 {
        struct intel_display *display = to_intel_display(encoder);
        struct intel_connector *connector = 
to_intel_connector(conn_state->connector);
+       bool audio_supported = false;
        u8 *eld;
 
        if (!intel_audio_eld_valid(encoder, conn_state))
@@ -826,9 +827,18 @@ bool intel_audio_compute_eld_config(struct intel_encoder 
*encoder,
                                    sad.freq, sad_freq, sad.channels,
                                    sad_channels);
                }
+
+               /* If no supported freq in any sads, report audio not supported 
*/
+               if (sad.freq)
+                       audio_supported = true;
        }
 
-       return true;
+       drm_dbg_kms(display->drm,
+                   "[CONNECTOR:%d:%s][ENCODER:%d:%s] audio supported: %s\n",
+                   connector->base.base.id, connector->base.name,
+                   encoder->base.base.id, encoder->base.name,
+                   str_yes_no(audio_supported));
+       return audio_supported;
 }
 
 bool intel_audio_compute_config(struct intel_encoder *encoder,
-- 
2.34.1

Reply via email to