[PATCH v2 1/6] drm/i915/display: create a common function to check validity of ELD

Vinod Govindapillai vinod.govindapillai at intel.com
Wed Nov 27 12:07:10 UTC 2024


We would need to check the validity of connector ELD from multiple
places in the follow up patches. So create a separate function to
check the validity for ELD.

v2: Keep intel_encoder being passed to audio config calls
    Use intel_display instead of i915

Signed-off-by: Vinod Govindapillai <vinod.govindapillai at intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen at linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_audio.c | 23 ++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
index c6b251f178c2..e8c2cbe34523 100644
--- a/drivers/gpu/drm/i915/display/intel_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_audio.c
@@ -689,21 +689,32 @@ void intel_audio_sdp_split_update(const struct intel_crtc_state *crtc_state)
 			     crtc_state->sdp_split_enable ? AUD_ENABLE_SDP_SPLIT : 0);
 }
 
+static bool intel_audio_eld_valid(struct intel_encoder *encoder,
+				  struct drm_connector_state *conn_state)
+{
+	struct intel_display *display = to_intel_display(encoder);
+	struct drm_connector *connector = conn_state->connector;
+
+	if (!connector->eld[0]) {
+		drm_dbg_kms(display->drm,
+			    "Bogus ELD on [CONNECTOR:%d:%s]\n",
+			    connector->base.id, connector->name);
+		return false;
+	}
+
+	return true;
+}
+
 bool intel_audio_compute_config(struct intel_encoder *encoder,
 				struct intel_crtc_state *crtc_state,
 				struct drm_connector_state *conn_state)
 {
-	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	struct drm_connector *connector = conn_state->connector;
 	const struct drm_display_mode *adjusted_mode =
 		&crtc_state->hw.adjusted_mode;
 
-	if (!connector->eld[0]) {
-		drm_dbg_kms(&i915->drm,
-			    "Bogus ELD on [CONNECTOR:%d:%s]\n",
-			    connector->base.id, connector->name);
+	if (!intel_audio_eld_valid(encoder, conn_state))
 		return false;
-	}
 
 	BUILD_BUG_ON(sizeof(crtc_state->eld) != sizeof(connector->eld));
 	memcpy(crtc_state->eld, connector->eld, sizeof(crtc_state->eld));
-- 
2.34.1



More information about the Intel-xe mailing list