diff mbox series

[v2,5/6] drm/i915/display: update audio support based on the available frequencies

Message ID 20241127120715.185348-6-vinod.govindapillai@intel.com (mailing list archive)
State New
Headers show
Series prunue audio frequencies based on bw limits for DP2 | expand

Commit Message

Vinod Govindapillai Nov. 27, 2024, 12:07 p.m. UTC
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.govindapillai@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_audio.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

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,