Skip to contentSkip to conversation

Get optimal audio frequency and channels

RFC In review Mitul Golani 2 participants 9 messages Jun 26, 2023 – Jun 28, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Get optimal audio frequency and channels

Currently we do not check if there is enough bandwidth for audio, and what channels and freq it can really support. Also sometimes there can be HW constraints e.g. GLK where audio channels supported are only 2.

https://patchwork.freedesktop.org/series/107647/

Obtain the optimal audio rate and channel based on available display timing constraints.

This can be achieved by:
- Retrieve the supported channel and rate information from SADs
- Adding audio-related config parameters in the CRTC state, such as audio support, rate, and channel.
- Initializing the audio config parameters with the maximum supported rate and channel by the audio source.
- Computing the SADs based on the audio source's capabilities.

Mitul Golani (3):
drm/i915/hdmi: Optimize source audio parameter handling drm/i915/display: Configure and initialize HDMI audio capabilities drm/i915/display: Add wrapper to Compute SAD

 drivers/gpu/drm/i915/display/g4x_dp.c         |  4 +-
 drivers/gpu/drm/i915/display/g4x_hdmi.c       | 16 ++--
 drivers/gpu/drm/i915/display/intel_audio.c    | 75 ++++++++++++++++++-
 drivers/gpu/drm/i915/display/intel_audio.h    |  4 +
 drivers/gpu/drm/i915/display/intel_cdclk.c    |  6 +-
 .../drm/i915/display/intel_crtc_state_dump.c  |  4 +-
 drivers/gpu/drm/i915/display/intel_ddi.c      |  2 +-
 drivers/gpu/drm/i915/display/intel_display.c  |  4 +-
 .../drm/i915/display/intel_display_types.h    | 12 ++-
 drivers/gpu/drm/i915/display/intel_dp.c       |  2 +-
 drivers/gpu/drm/i915/display/intel_dp_mst.c   |  2 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c     | 38 +++++++++-
 drivers/gpu/drm/i915/display/intel_hdmi.h     |  1 +
 drivers/gpu/drm/i915/display/intel_sdvo.c     | 10 +--
 14 files changed, 148 insertions(+), 32 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

RFC 1/3 drm/i915/hdmi: Optimize source audio parameter handling

To enhance the relationship between the has_audio and the source audio parameter, create a separate crtc_state audio property and add the has_audio parameter into it. Additionally, update the access of the has_audio parameter from the crtc_state pointer as it is wrapped under the audio. These modifications establish a more cohesive structure and improve the accessibility and organization of the audio-related parameters within the codebase.

--v1:
- add audio instead of audio_config in crtc_state
- add only has_audio then update related parameter access
- refactor other member to different commit where it is being used
- update commit message and header

---
 drivers/gpu/drm/i915/display/g4x_dp.c            |  4 ++--
 drivers/gpu/drm/i915/display/g4x_hdmi.c          | 16 ++++++++--------
 drivers/gpu/drm/i915/display/intel_audio.c       |  6 +++---
 drivers/gpu/drm/i915/display/intel_cdclk.c       |  6 +++---
 .../gpu/drm/i915/display/intel_crtc_state_dump.c |  4 ++--
 drivers/gpu/drm/i915/display/intel_ddi.c         |  2 +-
 drivers/gpu/drm/i915/display/intel_display.c     |  4 ++--
 .../gpu/drm/i915/display/intel_display_types.h   |  6 +++---
 drivers/gpu/drm/i915/display/intel_dp.c          |  2 +-
 drivers/gpu/drm/i915/display/intel_dp_mst.c      |  2 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c        |  2 +-
 drivers/gpu/drm/i915/display/intel_sdvo.c        | 10 +++++-----
 12 files changed, 32 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/display/g4x_dp.c +2 -2
index c58a3f249a01..af76a71e757c 100644
@@ -345,7 +345,7 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
 
 	tmp = intel_de_read(dev_priv, intel_dp->output_reg);
 
-	pipe_config->has_audio = tmp & DP_AUDIO_OUTPUT_ENABLE && port != PORT_A;
+	pipe_config->audio.has_audio = tmp & DP_AUDIO_OUTPUT_ENABLE && port != PORT_A;
 
 	if (HAS_PCH_CPT(dev_priv) && port != PORT_A) {
 		u32 trans_dp = intel_de_read(dev_priv,
@@ -625,7 +625,7 @@ static void intel_dp_enable_port(struct intel_dp *intel_dp,
 	 * fail when the power sequencer is freshly used for this port.
 	 */
 	intel_dp->DP |= DP_PORT_EN;
-	if (crtc_state->has_audio)
+	if (crtc_state->audio.has_audio)
 		intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE;
 
 	intel_de_write(dev_priv, intel_dp->output_reg, intel_dp->DP);
drivers/gpu/drm/i915/display/g4x_hdmi.c +8 -8
index 8c71e3ede680..568bfc3c6c47 100644
@@ -178,7 +178,7 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
 		pipe_config->has_infoframe = true;
 
 	if (tmp & HDMI_AUDIO_ENABLE)
-		pipe_config->has_audio = true;
+		pipe_config->audio.has_audio = true;
 
 	if (!HAS_PCH_SPLIT(dev_priv) &&
 	    tmp & HDMI_COLOR_RANGE_16_235)
@@ -224,7 +224,7 @@ static void g4x_hdmi_enable_port(struct intel_encoder *encoder,
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
@@ -240,7 +240,7 @@ static void g4x_enable_hdmi(struct intel_atomic_state *state,
 
 	g4x_hdmi_enable_port(encoder, pipe_config);
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio &&
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);
 }
@@ -258,7 +258,7 @@ static void ibx_enable_hdmi(struct intel_atomic_state *state,
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	/*
@@ -293,7 +293,7 @@ static void ibx_enable_hdmi(struct intel_atomic_state *state,
 		intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
 	}
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio &&
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);
 }
@@ -313,7 +313,7 @@ static void cpt_enable_hdmi(struct intel_atomic_state *state,
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	/*
@@ -348,7 +348,7 @@ static void cpt_enable_hdmi(struct intel_atomic_state *state,
 			     TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE, 0);
 	}
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio &&
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);
 }
@@ -360,7 +360,7 @@ static void vlv_enable_hdmi(struct intel_atomic_state *state,
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio &&
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);
 }
drivers/gpu/drm/i915/display/intel_audio.c +3 -3
index 3d9c9b4f27f8..e20ffc8e9654 100644
@@ -815,7 +815,7 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,
 	struct intel_audio_state *audio_state;
 	enum port port = encoder->port;
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s][ENCODER:%d:%s] Enable audio codec on [CRTC:%d:%s], %u bytes ELD\n",
@@ -874,7 +874,7 @@ void intel_audio_codec_disable(struct intel_encoder *encoder,
 	struct intel_audio_state *audio_state;
 	enum port port = encoder->port;
 
-	if (!old_crtc_state->has_audio)
+	if (!old_crtc_state->audio.has_audio)
 		return;
 
 	drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s][ENCODER:%d:%s] Disable audio codec on [CRTC:%d:%s]\n",
@@ -930,7 +930,7 @@ void intel_audio_codec_get_config(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	if (i915->display.funcs.audio)
drivers/gpu/drm/i915/display/intel_cdclk.c +3 -3
index 4207863b7b2a..cb87c2e0cdaa 100644
@@ -2553,7 +2553,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
 	 * restriction for GLK is 316.8 MHz.
 	 */
 	if (intel_crtc_has_dp_encoder(crtc_state) &&
-	    crtc_state->has_audio &&
+	    crtc_state->audio.has_audio &&
 	    crtc_state->port_clock >= 540000 &&
 	    crtc_state->lane_count == 4) {
 		if (DISPLAY_VER(dev_priv) == 10) {
@@ -2569,7 +2569,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
 	 * According to BSpec, "The CD clock frequency must be at least twice
 	 * the frequency of the Azalia BCLK." and BCLK is 96 MHz by default.
 	 */
-	if (crtc_state->has_audio && DISPLAY_VER(dev_priv) >= 9)
+	if (crtc_state->audio.has_audio && DISPLAY_VER(dev_priv) >= 9)
 		min_cdclk = max(2 * 96000, min_cdclk);
 
 	/*
@@ -2580,7 +2580,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
 	 *  162                    | 200 or higher"
 	 */
 	if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
-	    intel_crtc_has_dp_encoder(crtc_state) && crtc_state->has_audio)
+	    intel_crtc_has_dp_encoder(crtc_state) && crtc_state->audio.has_audio)
 		min_cdclk = max(crtc_state->port_clock, min_cdclk);
 
 	/*
drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +2 -2
index 8d4640d0fd34..b7d1be42bf0f 100644
@@ -265,7 +265,7 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config,
 
 	drm_dbg_kms(&i915->drm,
 		    "audio: %i, infoframes: %i, infoframes enabled: 0x%x\n",
-		    pipe_config->has_audio, pipe_config->has_infoframe,
+		    pipe_config->audio.has_audio, pipe_config->has_infoframe,
 		    pipe_config->infoframes.enable);
 
 	if (pipe_config->infoframes.enable &
@@ -291,7 +291,7 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config,
 	    intel_hdmi_infoframe_enable(DP_SDP_VSC))
 		intel_dump_dp_vsc_sdp(i915, &pipe_config->infoframes.vsc);
 
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		intel_dump_buffer(i915, "ELD: ", pipe_config->eld,
 				  drm_eld_size(pipe_config->eld));
 
drivers/gpu/drm/i915/display/intel_ddi.c +1 -1
index 61722556bb47..ff738ca1e118 100644
@@ -3782,7 +3782,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder,
 
 	intel_ddi_mso_get_config(encoder, pipe_config);
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_ddi_is_audio_enabled(dev_priv, cpu_transcoder);
 
 	if (encoder->type == INTEL_OUTPUT_EDP)
drivers/gpu/drm/i915/display/intel_display.c +2 -2
index eed01957bdb9..d87055bd7b11 100644
@@ -1857,7 +1857,7 @@ static void get_crtc_power_domains(struct intel_crtc_state *crtc_state,
 		set_bit(intel_encoder->power_domain, mask->bits);
 	}
 
-	if (HAS_DDI(dev_priv) && crtc_state->has_audio)
+	if (HAS_DDI(dev_priv) && crtc_state->audio.has_audio)
 		set_bit(POWER_DOMAIN_AUDIO_MMIO, mask->bits);
 
 	if (crtc_state->shared_dpll)
@@ -5258,7 +5258,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 	PIPE_CONF_CHECK_BOOL(has_infoframe);
 	PIPE_CONF_CHECK_BOOL(fec_enable);
 
-	PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
+	PIPE_CONF_CHECK_BOOL_INCOMPLETE(audio.has_audio);
 	PIPE_CONF_CHECK_BUFFER(eld, MAX_ELD_BYTES);
 
 	PIPE_CONF_CHECK_X(gmch_pfit.control);
drivers/gpu/drm/i915/display/intel_display_types.h +3 -3
index 731f2ec04d5c..ebd147180a6e 100644
@@ -1129,9 +1129,9 @@ struct intel_crtc_state {
 	/* Whether we should send NULL infoframes. Required for audio. */
 	bool has_hdmi_sink;
 
-	/* Audio enabled on this pipe. Only valid if either has_hdmi_sink or
-	 * has_dp_encoder is set. */
-	bool has_audio;
+	struct {
+		bool has_audio;
+	} audio;
 
 	/*
 	 * Enable dithering, used when the selected pipe bpp doesn't match the
drivers/gpu/drm/i915/display/intel_dp.c +1 -1
index 9f40da20e88d..d3f250dcb398 100644
@@ -2255,7 +2255,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && encoder->port != PORT_A)
 		pipe_config->has_pch_encoder = true;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_dp_has_audio(encoder, conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config, conn_state);
 
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -1
index e3f176a093d2..f6e1bf3d9e25 100644
@@ -322,7 +322,7 @@ static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	pipe_config->has_pch_encoder = false;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_dp_mst_has_audio(conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config, conn_state);
 
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -1
index 7ac5e6c5e00d..32157bef2eef 100644
@@ -2302,7 +2302,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		pipe_config->pixel_multiplier = 2;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_hdmi_has_audio(encoder, pipe_config, conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config, conn_state);
 
drivers/gpu/drm/i915/display/intel_sdvo.c +5 -5
index 8298a86d1334..51495f0bcf75 100644
@@ -1191,7 +1191,7 @@ static void intel_sdvo_get_eld(struct intel_sdvo *intel_sdvo,
 	ssize_t len;
 	u8 val;
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_AUDIO_STAT, &val, 1))
@@ -1406,7 +1406,7 @@ static int intel_sdvo_compute_config(struct intel_encoder *encoder,
 
 	pipe_config->has_hdmi_sink = intel_has_hdmi_sink(intel_sdvo_connector, conn_state);
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_sdvo_has_audio(encoder, pipe_config, conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config, conn_state);
 
@@ -1760,7 +1760,7 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
 	if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_AUDIO_STAT,
 				 &val, 1)) {
 		if (val & SDVO_AUDIO_PRESENCE_DETECT)
-			pipe_config->has_audio = true;
+			pipe_config->audio.has_audio = true;
 	}
 
 	if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE,
@@ -1805,7 +1805,7 @@ static void intel_disable_sdvo(struct intel_atomic_state *state,
 	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
 	u32 temp;
 
-	if (old_crtc_state->has_audio)
+	if (old_crtc_state->audio.has_audio)
 		intel_sdvo_disable_audio(intel_sdvo);
 
 	intel_sdvo_set_active_outputs(intel_sdvo, 0);
@@ -1898,7 +1898,7 @@ static void intel_enable_sdvo(struct intel_atomic_state *state,
 						   DRM_MODE_DPMS_ON);
 	intel_sdvo_set_active_outputs(intel_sdvo, intel_sdvo->attached_output);
 
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		intel_sdvo_enable_audio(intel_sdvo, pipe_config, conn_state);
 }
 
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [Intel-gfx] [RFC 1/3] drm/i915/hdmi: Optimize source audio parameter handling

Quoted 7 lines · Mitul Golani

To enhance the relationship between the has_audio and the source audio parameter, create a separate crtc_state audio property and add the has_audio parameter into it. Additionally, update the access of the has_audio parameter from the crtc_state pointer as it is wrapped under the audio. These modifications establish a more cohesive structure and improve the accessibility and organization of the audio-related parameters within the codebase.

The patch subject does not reflect this.

Other than that,

Quoted 344 lines

--v1:
- add audio instead of audio_config in crtc_state
- add only has_audio then update related parameter access
- refactor other member to different commit where it is being used
- update commit message and header

---
 drivers/gpu/drm/i915/display/g4x_dp.c            |  4 ++--
 drivers/gpu/drm/i915/display/g4x_hdmi.c          | 16 ++++++++--------
 drivers/gpu/drm/i915/display/intel_audio.c       |  6 +++---
 drivers/gpu/drm/i915/display/intel_cdclk.c       |  6 +++---
 .../gpu/drm/i915/display/intel_crtc_state_dump.c |  4 ++--
 drivers/gpu/drm/i915/display/intel_ddi.c         |  2 +-
 drivers/gpu/drm/i915/display/intel_display.c     |  4 ++--
 .../gpu/drm/i915/display/intel_display_types.h   |  6 +++---
 drivers/gpu/drm/i915/display/intel_dp.c          |  2 +-
 drivers/gpu/drm/i915/display/intel_dp_mst.c      |  2 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c        |  2 +-
 drivers/gpu/drm/i915/display/intel_sdvo.c        | 10 +++++-----
 12 files changed, 32 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/display/g4x_dp.c +2 -2
index c58a3f249a01..af76a71e757c 100644
@@ -345,7 +345,7 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
 
 	tmp = intel_de_read(dev_priv, intel_dp->output_reg);
 
-	pipe_config->has_audio = tmp & DP_AUDIO_OUTPUT_ENABLE && port != PORT_A;
+	pipe_config->audio.has_audio = tmp & DP_AUDIO_OUTPUT_ENABLE && port != PORT_A;
 
 	if (HAS_PCH_CPT(dev_priv) && port != PORT_A) {
 		u32 trans_dp = intel_de_read(dev_priv,
@@ -625,7 +625,7 @@ static void intel_dp_enable_port(struct intel_dp *intel_dp,
 	 * fail when the power sequencer is freshly used for this port.
 	 */
 	intel_dp->DP |= DP_PORT_EN;
-	if (crtc_state->has_audio)
+	if (crtc_state->audio.has_audio)
 		intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE;
 
 	intel_de_write(dev_priv, intel_dp->output_reg, intel_dp->DP);
drivers/gpu/drm/i915/display/g4x_hdmi.c +8 -8
index 8c71e3ede680..568bfc3c6c47 100644
@@ -178,7 +178,7 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,
 		pipe_config->has_infoframe = true;
 
 	if (tmp & HDMI_AUDIO_ENABLE)
-		pipe_config->has_audio = true;
+		pipe_config->audio.has_audio = true;
 
 	if (!HAS_PCH_SPLIT(dev_priv) &&
 	    tmp & HDMI_COLOR_RANGE_16_235)
@@ -224,7 +224,7 @@ static void g4x_hdmi_enable_port(struct intel_encoder *encoder,
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
@@ -240,7 +240,7 @@ static void g4x_enable_hdmi(struct intel_atomic_state *state,
 
 	g4x_hdmi_enable_port(encoder, pipe_config);
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio &&
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);
 }
@@ -258,7 +258,7 @@ static void ibx_enable_hdmi(struct intel_atomic_state *state,
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	/*
@@ -293,7 +293,7 @@ static void ibx_enable_hdmi(struct intel_atomic_state *state,
 		intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
 	}
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio &&
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);
 }
@@ -313,7 +313,7 @@ static void cpt_enable_hdmi(struct intel_atomic_state *state,
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	/*
@@ -348,7 +348,7 @@ static void cpt_enable_hdmi(struct intel_atomic_state *state,
 			     TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE, 0);
 	}
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio &&
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);
 }
@@ -360,7 +360,7 @@ static void vlv_enable_hdmi(struct intel_atomic_state *state,
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio &&
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);
 }
drivers/gpu/drm/i915/display/intel_audio.c +3 -3
index 3d9c9b4f27f8..e20ffc8e9654 100644
@@ -815,7 +815,7 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,
 	struct intel_audio_state *audio_state;
 	enum port port = encoder->port;
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s][ENCODER:%d:%s] Enable audio codec on [CRTC:%d:%s], %u bytes ELD\n",
@@ -874,7 +874,7 @@ void intel_audio_codec_disable(struct intel_encoder *encoder,
 	struct intel_audio_state *audio_state;
 	enum port port = encoder->port;
 
-	if (!old_crtc_state->has_audio)
+	if (!old_crtc_state->audio.has_audio)
 		return;
 
 	drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s][ENCODER:%d:%s] Disable audio codec on [CRTC:%d:%s]\n",
@@ -930,7 +930,7 @@ void intel_audio_codec_get_config(struct intel_encoder *encoder,
 {
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	if (i915->display.funcs.audio)
drivers/gpu/drm/i915/display/intel_cdclk.c +3 -3
index 4207863b7b2a..cb87c2e0cdaa 100644
@@ -2553,7 +2553,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
 	 * restriction for GLK is 316.8 MHz.
 	 */
 	if (intel_crtc_has_dp_encoder(crtc_state) &&
-	    crtc_state->has_audio &&
+	    crtc_state->audio.has_audio &&
 	    crtc_state->port_clock >= 540000 &&
 	    crtc_state->lane_count == 4) {
 		if (DISPLAY_VER(dev_priv) == 10) {
@@ -2569,7 +2569,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
 	 * According to BSpec, "The CD clock frequency must be at least twice
 	 * the frequency of the Azalia BCLK." and BCLK is 96 MHz by default.
 	 */
-	if (crtc_state->has_audio && DISPLAY_VER(dev_priv) >= 9)
+	if (crtc_state->audio.has_audio && DISPLAY_VER(dev_priv) >= 9)
 		min_cdclk = max(2 * 96000, min_cdclk);
 
 	/*
@@ -2580,7 +2580,7 @@ int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
 	 *  162                    | 200 or higher"
 	 */
 	if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
-	    intel_crtc_has_dp_encoder(crtc_state) && crtc_state->has_audio)
+	    intel_crtc_has_dp_encoder(crtc_state) && crtc_state->audio.has_audio)
 		min_cdclk = max(crtc_state->port_clock, min_cdclk);
 
 	/*
drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +2 -2
index 8d4640d0fd34..b7d1be42bf0f 100644
@@ -265,7 +265,7 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config,
 
 	drm_dbg_kms(&i915->drm,
 		    "audio: %i, infoframes: %i, infoframes enabled: 0x%x\n",
-		    pipe_config->has_audio, pipe_config->has_infoframe,
+		    pipe_config->audio.has_audio, pipe_config->has_infoframe,
 		    pipe_config->infoframes.enable);
 
 	if (pipe_config->infoframes.enable &
@@ -291,7 +291,7 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config,
 	    intel_hdmi_infoframe_enable(DP_SDP_VSC))
 		intel_dump_dp_vsc_sdp(i915, &pipe_config->infoframes.vsc);
 
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		intel_dump_buffer(i915, "ELD: ", pipe_config->eld,
 				  drm_eld_size(pipe_config->eld));
 
drivers/gpu/drm/i915/display/intel_ddi.c +1 -1
index 61722556bb47..ff738ca1e118 100644
@@ -3782,7 +3782,7 @@ static void intel_ddi_get_config(struct intel_encoder *encoder,
 
 	intel_ddi_mso_get_config(encoder, pipe_config);
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_ddi_is_audio_enabled(dev_priv, cpu_transcoder);
 
 	if (encoder->type == INTEL_OUTPUT_EDP)
drivers/gpu/drm/i915/display/intel_display.c +2 -2
index eed01957bdb9..d87055bd7b11 100644
@@ -1857,7 +1857,7 @@ static void get_crtc_power_domains(struct intel_crtc_state *crtc_state,
 		set_bit(intel_encoder->power_domain, mask->bits);
 	}
 
-	if (HAS_DDI(dev_priv) && crtc_state->has_audio)
+	if (HAS_DDI(dev_priv) && crtc_state->audio.has_audio)
 		set_bit(POWER_DOMAIN_AUDIO_MMIO, mask->bits);
 
 	if (crtc_state->shared_dpll)
@@ -5258,7 +5258,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,
 	PIPE_CONF_CHECK_BOOL(has_infoframe);
 	PIPE_CONF_CHECK_BOOL(fec_enable);
 
-	PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
+	PIPE_CONF_CHECK_BOOL_INCOMPLETE(audio.has_audio);
 	PIPE_CONF_CHECK_BUFFER(eld, MAX_ELD_BYTES);
 
 	PIPE_CONF_CHECK_X(gmch_pfit.control);
drivers/gpu/drm/i915/display/intel_display_types.h +3 -3
index 731f2ec04d5c..ebd147180a6e 100644
@@ -1129,9 +1129,9 @@ struct intel_crtc_state {
 	/* Whether we should send NULL infoframes. Required for audio. */
 	bool has_hdmi_sink;
 
-	/* Audio enabled on this pipe. Only valid if either has_hdmi_sink or
-	 * has_dp_encoder is set. */
-	bool has_audio;
+	struct {
+		bool has_audio;
+	} audio;
 
 	/*
 	 * Enable dithering, used when the selected pipe bpp doesn't match the
drivers/gpu/drm/i915/display/intel_dp.c +1 -1
index 9f40da20e88d..d3f250dcb398 100644
@@ -2255,7 +2255,7 @@ intel_dp_compute_config(struct intel_encoder *encoder,
 	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && encoder->port != PORT_A)
 		pipe_config->has_pch_encoder = true;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_dp_has_audio(encoder, conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config, conn_state);
 
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -1
index e3f176a093d2..f6e1bf3d9e25 100644
@@ -322,7 +322,7 @@ static int intel_dp_mst_compute_config(struct intel_encoder *encoder,
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	pipe_config->has_pch_encoder = false;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_dp_mst_has_audio(conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config, conn_state);
 
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -1
index 7ac5e6c5e00d..32157bef2eef 100644
@@ -2302,7 +2302,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		pipe_config->pixel_multiplier = 2;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_hdmi_has_audio(encoder, pipe_config, conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config, conn_state);
 
drivers/gpu/drm/i915/display/intel_sdvo.c +5 -5
index 8298a86d1334..51495f0bcf75 100644
@@ -1191,7 +1191,7 @@ static void intel_sdvo_get_eld(struct intel_sdvo *intel_sdvo,
 	ssize_t len;
 	u8 val;
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_AUDIO_STAT, &val, 1))
@@ -1406,7 +1406,7 @@ static int intel_sdvo_compute_config(struct intel_encoder *encoder,
 
 	pipe_config->has_hdmi_sink = intel_has_hdmi_sink(intel_sdvo_connector, conn_state);
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_sdvo_has_audio(encoder, pipe_config, conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config, conn_state);
 
@@ -1760,7 +1760,7 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
 	if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_AUDIO_STAT,
 				 &val, 1)) {
 		if (val & SDVO_AUDIO_PRESENCE_DETECT)
-			pipe_config->has_audio = true;
+			pipe_config->audio.has_audio = true;
 	}
 
 	if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE,
@@ -1805,7 +1805,7 @@ static void intel_disable_sdvo(struct intel_atomic_state *state,
 	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
 	u32 temp;
 
-	if (old_crtc_state->has_audio)
+	if (old_crtc_state->audio.has_audio)
 		intel_sdvo_disable_audio(intel_sdvo);
 
 	intel_sdvo_set_active_outputs(intel_sdvo, 0);
@@ -1898,7 +1898,7 @@ static void intel_enable_sdvo(struct intel_atomic_state *state,
 						   DRM_MODE_DPMS_ON);
 	intel_sdvo_set_active_outputs(intel_sdvo, intel_sdvo->attached_output);
 
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		intel_sdvo_enable_audio(intel_sdvo, pipe_config, conn_state);
 }
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#3 lore raw

Re: [Intel-gfx] [RFC 1/3] drm/i915/hdmi: Optimize source audio parameter handling

Hi @Jani Nikula

Quoted 18 lines

-----Original Message-----
From: Jani Nikula <[email protected]>
Sent: 26 June 2023 22:16
To: Golani, Mitulkumar Ajitkumar <[email protected]>; [email protected]
Subject: Re: [Intel-gfx] [RFC 1/3] drm/i915/hdmi: Optimize source audio parameter handling

Quoted 7 lines · Mitul Golani

To enhance the relationship between the has_audio and the source audio parameter, create a separate crtc_state audio property and add the has_audio parameter into it. Additionally, update the access of the has_audio parameter from the crtc_state pointer as it is wrapped under the audio. These modifications establish a more cohesive structure and improve the accessibility and organization of the audio-related parameters within the codebase.

Quoted 6 lines

The patch subject does not reflect this.

Other than that,

Thanks. Updated commit header in latest revision.

Regards,
Mitul

Quoted 406 lines
Quoted 29 lines

--v1:
- add audio instead of audio_config in crtc_state
- add only has_audio then update related parameter access
- refactor other member to different commit where it is being used
- update commit message and header

---
 drivers/gpu/drm/i915/display/g4x_dp.c            |  4 ++--
 drivers/gpu/drm/i915/display/g4x_hdmi.c          | 16 ++++++++--------
 drivers/gpu/drm/i915/display/intel_audio.c       |  6 +++---
 drivers/gpu/drm/i915/display/intel_cdclk.c       |  6 +++---
 .../gpu/drm/i915/display/intel_crtc_state_dump.c |  4 ++--
 drivers/gpu/drm/i915/display/intel_ddi.c         |  2 +-
 drivers/gpu/drm/i915/display/intel_display.c     |  4 ++--
 .../gpu/drm/i915/display/intel_display_types.h   |  6 +++---
 drivers/gpu/drm/i915/display/intel_dp.c          |  2 +-
 drivers/gpu/drm/i915/display/intel_dp_mst.c      |  2 +-
 drivers/gpu/drm/i915/display/intel_hdmi.c        |  2 +-
 drivers/gpu/drm/i915/display/intel_sdvo.c        | 10 +++++-----
 12 files changed, 32 insertions(+), 32 deletions(-)
drivers/gpu/drm/i915/display/g4x_dp.c +0 -0
index c58a3f249a01..af76a71e757c 100644

drivers/gpu/drm/i915/display/g4x_dp.c static void intel_dp_get_config(struct · line 349

Quoted 5 lines
drivers/gpu/drm/i915/display/g4x_dp.c +0 -1
@@ -345,7 +345,7 @@ static void intel_dp_get_config(struct
 intel_encoder *encoder,
 
 	tmp = intel_de_read(dev_priv, intel_dp->output_reg);
 
-	pipe_config->has_audio = tmp & DP_AUDIO_OUTPUT_ENABLE &&

port != PORT_A;

drivers/gpu/drm/i915/display/g4x_dp.c static void intel_dp_get_config(struct · line 349

Quoted 1 line
drivers/gpu/drm/i915/display/g4x_dp.c +1 -0
+	pipe_config->audio.has_audio = tmp &

DP_AUDIO_OUTPUT_ENABLE && port

drivers/gpu/drm/i915/display/g4x_dp.c static void intel_dp_get_config(struct intel_encoder *encoder,

Quoted 4 lines
drivers/gpu/drm/i915/display/g4x_dp.c +1 -0
+!= PORT_A;
 
 	if (HAS_PCH_CPT(dev_priv) && port != PORT_A) {
 		u32 trans_dp = intel_de_read(dev_priv, @@ -625,7 +625,7

@@ static

drivers/gpu/drm/i915/display/g4x_hdmi.c static void intel_hdmi_get_config(struct

Quoted 15 lines

void intel_dp_enable_port(struct intel_dp *intel_dp,

drivers/gpu/drm/i915/display/g4x_dp.c +1 -2
 	 * fail when the power sequencer is freshly used for this port.
 	 */
 	intel_dp->DP |= DP_PORT_EN;
-	if (crtc_state->has_audio)
+	if (crtc_state->audio.has_audio)
 		intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE;
 
 	intel_de_write(dev_priv, intel_dp->output_reg, intel_dp->DP); diff
--git a/drivers/gpu/drm/i915/display/g4x_hdmi.c

b/drivers/gpu/drm/i915/display/g4x_hdmi.c
index 8c71e3ede680..568bfc3c6c47 100644

drivers/gpu/drm/i915/display/g4x_hdmi.c +0 -0
@@ -178,7 +178,7 @@ static void intel_hdmi_get_config(struct

intel_encoder *encoder,

drivers/gpu/drm/i915/display/g4x_hdmi.c static void g4x_hdmi_enable_port(struct

Quoted 9 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +1 -1
 		pipe_config->has_infoframe = true;
 
 	if (tmp & HDMI_AUDIO_ENABLE)
-		pipe_config->has_audio = true;
+		pipe_config->audio.has_audio = true;
 
 	if (!HAS_PCH_SPLIT(dev_priv) &&
 	    tmp & HDMI_COLOR_RANGE_16_235)
@@ -224,7 +224,7 @@ static void g4x_hdmi_enable_port(struct

intel_encoder *encoder,

Quoted 11 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +2 -1
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp); @@ -240,7
+240,7 @@ static void g4x_enable_hdmi(struct intel_atomic_state

*state,

drivers/gpu/drm/i915/display/g4x_hdmi.c static void g4x_enable_hdmi(struct intel_atomic_state *state,

Quoted 4 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +1 -1
 	g4x_hdmi_enable_port(encoder, pipe_config);
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio

&&

drivers/gpu/drm/i915/display/g4x_hdmi.c

Quoted 2 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +0 -0
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);  }

@@

Quoted 1 line

-258,7 +258,7 @@ static void ibx_enable_hdmi(struct intel_atomic_state

*state,

drivers/gpu/drm/i915/display/g4x_hdmi.c static void ibx_enable_hdmi(struct

Quoted 9 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +1 -1
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	/*
@@ -293,7 +293,7 @@ static void ibx_enable_hdmi(struct

intel_atomic_state *state,

drivers/gpu/drm/i915/display/g4x_hdmi.c static void ibx_enable_hdmi(struct intel_atomic_state *state,

Quoted 5 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +1 -1
 		intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
 	}
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio

&&

drivers/gpu/drm/i915/display/g4x_hdmi.c static void ibx_enable_hdmi(struct · line 298

Quoted 2 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +0 -0
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);  }

@@

drivers/gpu/drm/i915/display/g4x_hdmi.c static void ibx_enable_hdmi(struct · line 299

Quoted 1 line
drivers/gpu/drm/i915/display/g4x_hdmi.c +0 -1
-313,7 +313,7 @@ static void cpt_enable_hdmi(struct intel_atomic_state

*state,

drivers/gpu/drm/i915/display/g4x_hdmi.c static void cpt_enable_hdmi(struct

Quoted 9 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +1 -1
 	temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
 
 	temp |= SDVO_ENABLE;
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		temp |= HDMI_AUDIO_ENABLE;
 
 	/*
@@ -348,7 +348,7 @@ static void cpt_enable_hdmi(struct

intel_atomic_state *state,

drivers/gpu/drm/i915/display/g4x_hdmi.c static void cpt_enable_hdmi(struct intel_atomic_state *state,

Quoted 5 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +1 -1
 			     TRANS_CHICKEN1_HDMIUNIT_GC_DISABLE, 0);
 	}
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio

&&

drivers/gpu/drm/i915/display/g4x_hdmi.c static void cpt_enable_hdmi(struct · line 353

Quoted 2 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +0 -0
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);  }

@@

drivers/gpu/drm/i915/display/g4x_hdmi.c static void vlv_enable_hdmi(struct intel_atomic_state *state,

Quoted 6 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +0 -1
-360,7 +360,7 @@ static void vlv_enable_hdmi(struct intel_atomic_state

*state, {

drivers/gpu/drm/i915/display/g4x_hdmi.c +1 -1
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 
-	drm_WARN_ON(&dev_priv->drm, pipe_config->has_audio &&
+	drm_WARN_ON(&dev_priv->drm, pipe_config->audio.has_audio

&&

drivers/gpu/drm/i915/display/intel_audio.c void intel_audio_codec_enable(struct

Quoted 8 lines
drivers/gpu/drm/i915/display/g4x_hdmi.c +0 -1
 		    !pipe_config->has_hdmi_sink);
 	intel_audio_codec_enable(encoder, pipe_config, conn_state);  } diff
--git a/drivers/gpu/drm/i915/display/intel_audio.c

b/drivers/gpu/drm/i915/display/intel_audio.c
index 3d9c9b4f27f8..e20ffc8e9654 100644

drivers/gpu/drm/i915/display/intel_audio.c +0 -0
@@ -815,7 +815,7 @@ void intel_audio_codec_enable(struct

intel_encoder *encoder,

drivers/gpu/drm/i915/display/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *encoder,

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_audio.c +1 -1
 	struct intel_audio_state *audio_state;
 	enum port port = encoder->port;
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	drm_dbg_kms(&i915->drm,

"[CONNECTOR:%d:%s][ENCODER:%d:%s] Enable

Quoted 1 line

audio codec on [CRTC:%d:%s], %u bytes ELD\n", @@ -874,7 +874,7 @@

void intel_audio_codec_disable(struct intel_encoder *encoder,

drivers/gpu/drm/i915/display/intel_audio.c void intel_audio_codec_disable(struct intel_encoder *encoder,

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_audio.c +1 -1
 	struct intel_audio_state *audio_state;
 	enum port port = encoder->port;
 
-	if (!old_crtc_state->has_audio)
+	if (!old_crtc_state->audio.has_audio)
 		return;
 
 	drm_dbg_kms(&i915->drm,

"[CONNECTOR:%d:%s][ENCODER:%d:%s] Disable

drivers/gpu/drm/i915/display/intel_cdclk.c int intel_crtc_compute_min_cdclk(const struct

Quoted 15 lines

audio codec on [CRTC:%d:%s]\n", @@ -930,7 +930,7 @@ void intel_audio_codec_get_config(struct intel_encoder *encoder, {

drivers/gpu/drm/i915/display/intel_audio.c +1 -1
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	if (i915->display.funcs.audio)
drivers/gpu/drm/i915/display/intel_cdclk.c +0 -0
index 4207863b7b2a..cb87c2e0cdaa 100644
@@ -2553,7 +2553,7 @@ int intel_crtc_compute_min_cdclk(const struct

intel_crtc_state *crtc_state)

drivers/gpu/drm/i915/display/intel_cdclk.c int intel_crtc_compute_min_cdclk(const struct

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +1 -1
 	 * restriction for GLK is 316.8 MHz.
 	 */
 	if (intel_crtc_has_dp_encoder(crtc_state) &&
-	    crtc_state->has_audio &&
+	    crtc_state->audio.has_audio &&
 	    crtc_state->port_clock >= 540000 &&
 	    crtc_state->lane_count == 4) {
 		if (DISPLAY_VER(dev_priv) == 10) {
@@ -2569,7 +2569,7 @@ int intel_crtc_compute_min_cdclk(const struct

intel_crtc_state *crtc_state)

drivers/gpu/drm/i915/display/intel_cdclk.c int intel_crtc_compute_min_cdclk(const struct

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +1 -1
 	 * According to BSpec, "The CD clock frequency must be at least twice
 	 * the frequency of the Azalia BCLK." and BCLK is 96 MHz by default.
 	 */
-	if (crtc_state->has_audio && DISPLAY_VER(dev_priv) >= 9)
+	if (crtc_state->audio.has_audio && DISPLAY_VER(dev_priv) >= 9)
 		min_cdclk = max(2 * 96000, min_cdclk);
 
 	/*
@@ -2580,7 +2580,7 @@ int intel_crtc_compute_min_cdclk(const struct

intel_crtc_state *crtc_state)

drivers/gpu/drm/i915/display/intel_display.c static void get_crtc_power_domains(struct

Quoted 56 lines
drivers/gpu/drm/i915/display/intel_cdclk.c +2 -1
 	 *  162                    | 200 or higher"
 	 */
 	if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) &&
-	    intel_crtc_has_dp_encoder(crtc_state) && crtc_state->has_audio)
+	    intel_crtc_has_dp_encoder(crtc_state) &&
+crtc_state->audio.has_audio)
 		min_cdclk = max(crtc_state->port_clock, min_cdclk);
 
 	/*
drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +1 -1
index 8d4640d0fd34..b7d1be42bf0f 100644
@@ -265,7 +265,7 @@ void intel_crtc_state_dump(const struct
 intel_crtc_state *pipe_config,
 
 	drm_dbg_kms(&i915->drm,
 		    "audio: %i, infoframes: %i, infoframes enabled: 0x%x\n",
-		    pipe_config->has_audio, pipe_config->has_infoframe,
+		    pipe_config->audio.has_audio, pipe_config-
 has_infoframe,
 		    pipe_config->infoframes.enable);

if (pipe_config->infoframes.enable & @@ -291,7 +291,7 @@ void
intel_crtc_state_dump(const struct intel_crtc_state *pipe_config,

drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +0 -0
 	    intel_hdmi_infoframe_enable(DP_SDP_VSC))
 		intel_dump_dp_vsc_sdp(i915, &pipe_config-

infoframes.vsc);

drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +1 -1
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		intel_dump_buffer(i915, "ELD: ", pipe_config->eld,
 				  drm_eld_size(pipe_config->eld));
drivers/gpu/drm/i915/display/intel_ddi.c +1 -1
index 61722556bb47..ff738ca1e118 100644
@@ -3782,7 +3782,7 @@ static void intel_ddi_get_config(struct
 intel_encoder *encoder,
 
 	intel_ddi_mso_get_config(encoder, pipe_config);
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_ddi_is_audio_enabled(dev_priv, cpu_transcoder);
 

if (encoder->type == INTEL_OUTPUT_EDP) diff --git
a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index eed01957bdb9..d87055bd7b11 100644

drivers/gpu/drm/i915/display/intel_display.c +0 -0
@@ -1857,7 +1857,7 @@ static void get_crtc_power_domains(struct

intel_crtc_state *crtc_state,

drivers/gpu/drm/i915/display/intel_display.c intel_pipe_config_compare(const struct

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
 		set_bit(intel_encoder->power_domain, mask->bits);
 	}
 
-	if (HAS_DDI(dev_priv) && crtc_state->has_audio)
+	if (HAS_DDI(dev_priv) && crtc_state->audio.has_audio)
 		set_bit(POWER_DOMAIN_AUDIO_MMIO, mask->bits);
 
 	if (crtc_state->shared_dpll)
@@ -5258,7 +5258,7 @@ intel_pipe_config_compare(const struct

intel_crtc_state *current_config,

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_compute_config(struct intel_encoder

Quoted 32 lines
drivers/gpu/drm/i915/display/intel_display.c +1 -1
 	PIPE_CONF_CHECK_BOOL(has_infoframe);
 	PIPE_CONF_CHECK_BOOL(fec_enable);
 
-	PIPE_CONF_CHECK_BOOL_INCOMPLETE(has_audio);
+	PIPE_CONF_CHECK_BOOL_INCOMPLETE(audio.has_audio);
 	PIPE_CONF_CHECK_BUFFER(eld, MAX_ELD_BYTES);
 
 	PIPE_CONF_CHECK_X(gmch_pfit.control);
drivers/gpu/drm/i915/display/intel_display_types.h +3 -3
index 731f2ec04d5c..ebd147180a6e 100644
@@ -1129,9 +1129,9 @@ struct intel_crtc_state {
 	/* Whether we should send NULL infoframes. Required for audio. */
 	bool has_hdmi_sink;
 
-	/* Audio enabled on this pipe. Only valid if either has_hdmi_sink or
-	 * has_dp_encoder is set. */
-	bool has_audio;
+	struct {
+		bool has_audio;
+	} audio;
 
 	/*
 	 * Enable dithering, used when the selected pipe bpp doesn't match

the diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 9f40da20e88d..d3f250dcb398 100644

drivers/gpu/drm/i915/display/intel_dp.c +0 -0
@@ -2255,7 +2255,7 @@ intel_dp_compute_config(struct intel_encoder

*encoder,

drivers/gpu/drm/i915/display/intel_dp.c intel_dp_compute_config(struct intel_encoder *encoder,

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_dp.c +1 -1
 	if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && encoder-
 port != PORT_A)
 		pipe_config->has_pch_encoder = true;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_dp_has_audio(encoder, conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config,

conn_state);

drivers/gpu/drm/i915/display/intel_dp_mst.c static int intel_dp_mst_compute_config(struct

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +0 -0
index e3f176a093d2..f6e1bf3d9e25 100644
@@ -322,7 +322,7 @@ static int intel_dp_mst_compute_config(struct

intel_encoder *encoder,

drivers/gpu/drm/i915/display/intel_dp_mst.c static int intel_dp_mst_compute_config(struct intel_encoder *encoder,

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_dp_mst.c +1 -1
 	pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB;
 	pipe_config->has_pch_encoder = false;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_dp_mst_has_audio(conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config,

conn_state);

drivers/gpu/drm/i915/display/intel_hdmi.c int intel_hdmi_compute_config(struct

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +0 -0
index 7ac5e6c5e00d..32157bef2eef 100644
@@ -2302,7 +2302,7 @@ int intel_hdmi_compute_config(struct

intel_encoder *encoder,

drivers/gpu/drm/i915/display/intel_hdmi.c int intel_hdmi_compute_config(struct intel_encoder *encoder,

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -1
 	if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK)
 		pipe_config->pixel_multiplier = 2;
 
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_hdmi_has_audio(encoder, pipe_config, conn_state)

&&

drivers/gpu/drm/i915/display/intel_hdmi.c int intel_hdmi_compute_config(struct · line 2307

Quoted 1 line
drivers/gpu/drm/i915/display/intel_hdmi.c +0 -0
 		intel_audio_compute_config(encoder, pipe_config,

conn_state);

drivers/gpu/drm/i915/display/intel_sdvo.c static void intel_sdvo_get_eld(struct intel_sdvo

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +0 -0
index 8298a86d1334..51495f0bcf75 100644
@@ -1191,7 +1191,7 @@ static void intel_sdvo_get_eld(struct intel_sdvo

*intel_sdvo,

drivers/gpu/drm/i915/display/intel_sdvo.c static void intel_sdvo_get_eld(struct intel_sdvo *intel_sdvo,

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +1 -1
 	ssize_t len;
 	u8 val;
 
-	if (!crtc_state->has_audio)
+	if (!crtc_state->audio.has_audio)
 		return;
 
 	if (!intel_sdvo_get_value(intel_sdvo,

SDVO_CMD_GET_AUDIO_STAT, &val,

drivers/gpu/drm/i915/display/intel_sdvo.c static int intel_sdvo_compute_config(struct intel_encoder *encoder,

Quoted 10 lines

1)) @@ -1406,7 +1406,7 @@ static int intel_sdvo_compute_config(struct intel_encoder *encoder,

pipe_config->has_hdmi_sink =
intel_has_hdmi_sink(intel_sdvo_connector, conn_state);

drivers/gpu/drm/i915/display/intel_sdvo.c +1 -1
-	pipe_config->has_audio =
+	pipe_config->audio.has_audio =
 		intel_sdvo_has_audio(encoder, pipe_config, conn_state) &&
 		intel_audio_compute_config(encoder, pipe_config,

conn_state);

drivers/gpu/drm/i915/display/intel_sdvo.c static void intel_sdvo_get_config(struct

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +0 -0
@@ -1760,7 +1760,7 @@ static void intel_sdvo_get_config(struct

intel_encoder *encoder,

drivers/gpu/drm/i915/display/intel_sdvo.c static void intel_sdvo_get_config(struct intel_encoder *encoder,

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +1 -1
 	if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_AUDIO_STAT,
 				 &val, 1)) {
 		if (val & SDVO_AUDIO_PRESENCE_DETECT)
-			pipe_config->has_audio = true;
+			pipe_config->audio.has_audio = true;
 	}
 
 	if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE, @@

-1805,7

Quoted 1 line

+1805,7 @@ static void intel_disable_sdvo(struct intel_atomic_state

*state,

drivers/gpu/drm/i915/display/intel_sdvo.c static void intel_disable_sdvo(struct intel_atomic_state *state,

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_sdvo.c +1 -1
 	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->uapi.crtc);
 	u32 temp;
 
-	if (old_crtc_state->has_audio)
+	if (old_crtc_state->audio.has_audio)
 		intel_sdvo_disable_audio(intel_sdvo);
 
 	intel_sdvo_set_active_outputs(intel_sdvo, 0); @@ -1898,7 +1898,7

@@

drivers/gpu/drm/i915/display/intel_sdvo.c

Quoted 8 lines

static void intel_enable_sdvo(struct intel_atomic_state *state,

drivers/gpu/drm/i915/display/intel_sdvo.c +0 -0
 						   DRM_MODE_DPMS_ON);
 	intel_sdvo_set_active_outputs(intel_sdvo,

intel_sdvo->attached_output);

drivers/gpu/drm/i915/display/intel_sdvo.c +1 -1
-	if (pipe_config->has_audio)
+	if (pipe_config->audio.has_audio)
 		intel_sdvo_enable_audio(intel_sdvo, pipe_config,

conn_state); }

--
Jani Nikula, Intel Open Source Graphics Center

#4 lore raw

RFC 2/3 drm/i915/display: Configure and initialize HDMI audio capabilities

In reply to Mitul Golani

Initialize the source audio capabilities for HDMI in crtc_state property by setting them to their maximum supported values, including max_channel and max_frequency. This allows for the calculation of HDMI audio source capabilities with respect to the available mode bandwidth. These capabilities encompass parameters such as supported frequency and channel configurations.

--v1:
- Refactor max_channel and max_rate to this commit as it is being initialised here
- Remove call for intel_audio_compute_eld to avoid any regression while merge. instead call it in different commit when it is defined.
- Use int instead of unsigned int for max_channel and max_frequecy
- Update commit message and header

--v2:
- Use signed instead of unsigned variables.
- Avoid using magic numbers and give them proper name.

---
 drivers/gpu/drm/i915/display/intel_audio.h    |  3 ++
 .../drm/i915/display/intel_display_types.h    |  6 ++++
 drivers/gpu/drm/i915/display/intel_hdmi.c     | 34 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdmi.h     |  1 +
 4 files changed, 44 insertions(+)
drivers/gpu/drm/i915/display/intel_audio.h +3 -0
index 07d034a981e9..be3edf9c4982 100644
@@ -13,6 +13,9 @@ struct drm_i915_private;
 struct intel_crtc_state;
 struct intel_encoder;
 
+#define AUDIO_SAMPLE_CONTAINER_SIZE	32
+#define MAX_CHANNEL_COUNT			8
+
 void intel_audio_hooks_init(struct drm_i915_private *dev_priv);
 bool intel_audio_compute_config(struct intel_encoder *encoder,
 				struct intel_crtc_state *crtc_state,
drivers/gpu/drm/i915/display/intel_display_types.h +6 -0
index ebd147180a6e..74eee87d2df1 100644
@@ -1131,6 +1131,12 @@ struct intel_crtc_state {
 
 	struct {
 		bool has_audio;
+
+		/* Audio rate in Hz */
+		int max_frequency;
+
+		/* Number of audio channels */
+		int max_channel;
 	} audio;
 
 	/*
drivers/gpu/drm/i915/display/intel_hdmi.c +34 -0
index 32157bef2eef..6a4d477e8a15 100644
@@ -2277,6 +2277,39 @@ bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder,
 		!intel_hdmi_is_cloned(crtc_state);
 }
 
+static int calc_audio_bw(int channel, int frequency)
+{
+	int bandwidth = channel * frequency * AUDIO_SAMPLE_CONTAINER_SIZE;
+	return bandwidth;
+}
+
+void
+intel_hdmi_audio_compute_config(struct intel_crtc_state *pipe_config)
+{
+	struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode;
+	int num_of_channel, aud_rates[] = {192000, 176000, 96000, 88000, 48000, 44100, 32000};
+	int audio_req_bandwidth, available_blank_bandwidth, vblank, hblank;
+
+	hblank = adjusted_mode->htotal - adjusted_mode->hdisplay;
+	vblank = adjusted_mode->vtotal - adjusted_mode->vdisplay;
+	available_blank_bandwidth = hblank * vblank *
+				    drm_mode_vrefresh(adjusted_mode) * pipe_config->pipe_bpp;
+	for (num_of_channel = MAX_CHANNEL_COUNT; num_of_channel > 0; num_of_channel--) {
+		for (int index = 0; index < ARRAY_SIZE(aud_rates); index++) {
+			audio_req_bandwidth = calc_audio_bw(num_of_channel,
+							    aud_rates[index]);
+			if (audio_req_bandwidth < available_blank_bandwidth) {
+				pipe_config->audio.max_frequency = aud_rates[index];
+				pipe_config->audio.max_channel = num_of_channel;
+				return;
+			}
+		}
+	}
+
+	pipe_config->audio.max_frequency = 0;
+	pipe_config->audio.max_channel = 0;
+}
+
 int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config,
 			      struct drm_connector_state *conn_state)
@@ -2344,6 +2377,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			pipe_config->hdmi_high_tmds_clock_ratio = true;
 		}
 	}
+	intel_hdmi_audio_compute_config(pipe_config);
 
 	intel_hdmi_compute_gcp_infoframe(encoder, pipe_config,
 					 conn_state);
drivers/gpu/drm/i915/display/intel_hdmi.h +1 -0
index 6b39df38d57a..6df303daf348 100644
@@ -27,6 +27,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *dig_port,
 bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder,
 				      const struct intel_crtc_state *crtc_state,
 				      const struct drm_connector_state *conn_state);
+void intel_hdmi_audio_compute_config(struct intel_crtc_state *pipe_config);
 int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config,
 			      struct drm_connector_state *conn_state);
Signature · 1 line
2.25.1
maintainer
#5 lore raw

Re: [Intel-gfx] [RFC 2/3] drm/i915/display: Configure and initialize HDMI audio capabilities

Quoted 32 lines · Mitul Golani

Initialize the source audio capabilities for HDMI in crtc_state property by setting them to their maximum supported values, including max_channel and max_frequency. This allows for the calculation of HDMI audio source capabilities with respect to the available mode bandwidth. These capabilities encompass parameters such as supported frequency and channel configurations.

--v1:
- Refactor max_channel and max_rate to this commit as it is being initialised here
- Remove call for intel_audio_compute_eld to avoid any regression while merge. instead call it in different commit when it is defined.
- Use int instead of unsigned int for max_channel and max_frequecy
- Update commit message and header

--v2:
- Use signed instead of unsigned variables.
- Avoid using magic numbers and give them proper name.

---
 drivers/gpu/drm/i915/display/intel_audio.h    |  3 ++
 .../drm/i915/display/intel_display_types.h    |  6 ++++
 drivers/gpu/drm/i915/display/intel_hdmi.c     | 34 +++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_hdmi.h     |  1 +
 4 files changed, 44 insertions(+)
drivers/gpu/drm/i915/display/intel_audio.h +0 -0
index 07d034a981e9..be3edf9c4982 100644

drivers/gpu/drm/i915/display/intel_audio.h struct drm_i915_private; · line 17

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_audio.h +2 -0
@@ -13,6 +13,9 @@ struct drm_i915_private;
 struct intel_crtc_state;
 struct intel_encoder;
 
+#define AUDIO_SAMPLE_CONTAINER_SIZE	32
+#define MAX_CHANNEL_COUNT			8

These can be moved within intel_audio.c (see comment below).

Quoted 26 lines
drivers/gpu/drm/i915/display/intel_audio.h +1 -0
+
 void intel_audio_hooks_init(struct drm_i915_private *dev_priv);
 bool intel_audio_compute_config(struct intel_encoder *encoder,
 				struct intel_crtc_state *crtc_state,
drivers/gpu/drm/i915/display/intel_display_types.h +6 -0
index ebd147180a6e..74eee87d2df1 100644
@@ -1131,6 +1131,12 @@ struct intel_crtc_state {
 
 	struct {
 		bool has_audio;
+
+		/* Audio rate in Hz */
+		int max_frequency;
+
+		/* Number of audio channels */
+		int max_channel;
 	} audio;
 
 	/*
drivers/gpu/drm/i915/display/intel_hdmi.c +0 -0
index 32157bef2eef..6a4d477e8a15 100644

drivers/gpu/drm/i915/display/intel_hdmi.c bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder, · line 2280

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -0
@@ -2277,6 +2277,39 @@ bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder,
 		!intel_hdmi_is_cloned(crtc_state);
 }
 
+static int calc_audio_bw(int channel, int frequency)

Please try to use more consistent naming. I suggest "channel_count" and "frequency" (or "rate") throughout. Ditto for the max_ variants.

drivers/gpu/drm/i915/display/intel_hdmi.c bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder, · line 2290

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +10 -0
+{
+	int bandwidth = channel * frequency * AUDIO_SAMPLE_CONTAINER_SIZE;
+	return bandwidth;
+}
+
+void
+intel_hdmi_audio_compute_config(struct intel_crtc_state *pipe_config)
+{
+	struct drm_display_mode *adjusted_mode = &pipe_config->hw.adjusted_mode;
+	int num_of_channel, aud_rates[] = {192000, 176000, 96000, 88000, 48000, 44100, 32000};

Please declare these separately, they are two completely two things. Please add space after { and before }.

drivers/gpu/drm/i915/display/intel_hdmi.c bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder, · line 2298

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +8 -0
+	int audio_req_bandwidth, available_blank_bandwidth, vblank, hblank;
+
+	hblank = adjusted_mode->htotal - adjusted_mode->hdisplay;
+	vblank = adjusted_mode->vtotal - adjusted_mode->vdisplay;
+	available_blank_bandwidth = hblank * vblank *
+				    drm_mode_vrefresh(adjusted_mode) * pipe_config->pipe_bpp;
+	for (num_of_channel = MAX_CHANNEL_COUNT; num_of_channel > 0; num_of_channel--) {
+		for (int index = 0; index < ARRAY_SIZE(aud_rates); index++) {

Please don't declare index within the for loop.

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +4 -0
+			audio_req_bandwidth = calc_audio_bw(num_of_channel,
+							    aud_rates[index]);
+			if (audio_req_bandwidth < available_blank_bandwidth) {
+				pipe_config->audio.max_frequency = aud_rates[index];

drivers/gpu/drm/i915/display/intel_hdmi.c bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder, · line 2312

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +10 -0
+				pipe_config->audio.max_channel = num_of_channel;
+				return;
+			}
+		}
+	}
+
+	pipe_config->audio.max_frequency = 0;
+	pipe_config->audio.max_channel = 0;
+}
+

I think the above should be moved to intel_audio.c as static and called directly from intel_audio_compute_config(). There's no reason for the above to be in intel_hdmi.c.

Quoted 23 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +1 -0
 int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config,
 			      struct drm_connector_state *conn_state)
@@ -2344,6 +2377,7 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			pipe_config->hdmi_high_tmds_clock_ratio = true;
 		}
 	}
+	intel_hdmi_audio_compute_config(pipe_config);
 
 	intel_hdmi_compute_gcp_infoframe(encoder, pipe_config,
 					 conn_state);
drivers/gpu/drm/i915/display/intel_hdmi.h +1 -0
index 6b39df38d57a..6df303daf348 100644
@@ -27,6 +27,7 @@ void intel_hdmi_init_connector(struct intel_digital_port *dig_port,
 bool intel_hdmi_compute_has_hdmi_sink(struct intel_encoder *encoder,
 				      const struct intel_crtc_state *crtc_state,
 				      const struct drm_connector_state *conn_state);
+void intel_hdmi_audio_compute_config(struct intel_crtc_state *pipe_config);
 int intel_hdmi_compute_config(struct intel_encoder *encoder,
 			      struct intel_crtc_state *pipe_config,
 			      struct drm_connector_state *conn_state);
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#6 lore raw

RFC 3/3 drm/i915/display: Add wrapper to Compute SAD

In reply to Mitul Golani

Compute SADs that takes into account the supported rate and channel based on the capabilities of the audio source. This wrapper function should encapsulate the logic for determining the supported rate and channel and should return a set of SADs that are compatible with the source.

--v1:
- call intel_audio_compute_eld in this commit as it is defined here

--v2:
- Handle case when max frequency is less than 32k.
- remove drm prefix.
- name change for parse_sad to eld_to_sad.

--v3:
- Use signed int wherever required.
- add debug trace when channel is limited.

---
 drivers/gpu/drm/i915/display/intel_audio.c | 69 ++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_audio.h |  1 +
 drivers/gpu/drm/i915/display/intel_hdmi.c  |  2 +
 3 files changed, 72 insertions(+)
drivers/gpu/drm/i915/display/intel_audio.c +69 -0
index e20ffc8e9654..1a1c773c1d41 100644
@@ -794,6 +794,75 @@ bool intel_audio_compute_config(struct intel_encoder *encoder,
 	return true;
 }
 
+static int sad_to_channels(const u8 *sad)
+{
+	return 1 + (sad[0] & 0x7);
+}
+
+static inline u8 *eld_to_sad(u8 *eld)
+{
+	int ver, mnl;
+
+	ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >> DRM_ELD_VER_SHIFT;
+	if (ver != 2 && ver != 31)
+		return NULL;
+
+	mnl = drm_eld_mnl(eld);
+	if (mnl > 16)
+		return NULL;
+
+	return eld + DRM_ELD_CEA_SAD(mnl, 0);
+}
+
+static int get_supported_freq_mask(struct intel_crtc_state *crtc_state)
+{
+	int audio_freq_hz[] = {32000, 44100, 48000, 88000, 96000, 176000, 192000, 0};
+	int mask = 0;
+
+	for (u8 index = 0; index < ARRAY_SIZE(audio_freq_hz); index++) {
+		mask |= 1 << index;
+		if (crtc_state->audio.max_frequency != audio_freq_hz[index])
+			continue;
+		else
+			break;
+	}
+
+	return mask;
+}
+
+void intel_audio_compute_eld(struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
+	u8 *eld, *sad;
+	int index, mask = 0;
+
+	eld = crtc_state->eld;
+	if (!eld) {
+		drm_err(&i915->drm, "failed to locate eld\n");
+		return;
+	}
+
+	sad = (u8 *)eld_to_sad(eld);
+	if (sad) {
+		mask = get_supported_freq_mask(crtc_state);
+
+		for (index = 0; index < drm_eld_sad_count(eld); index++, sad += 3) {
+			/*
+			 * Respect source restricitions. Limit capabilities to a subset that is
+			 * supported both by the source and the sink.
+			 */
+			if (sad_to_channels(sad) >= crtc_state->audio.max_channel) {
+				sad[0] &= ~0x7;
+				sad[0] |= crtc_state->audio.max_channel - 1;
+				drm_dbg_kms(&i915->drm, "Channel count is limited to %d\n",
+					    crtc_state->audio.max_channel - 1);
+			}
+
+			sad[1] &= mask;
+		}
+	}
+}
+
 /**
  * intel_audio_codec_enable - Enable the audio codec for HD audio
  * @encoder: encoder on which to enable audio
drivers/gpu/drm/i915/display/intel_audio.h +1 -0
index be3edf9c4982..a0162cdc7999 100644
@@ -17,6 +17,7 @@ struct intel_encoder;
 #define MAX_CHANNEL_COUNT			8
 
 void intel_audio_hooks_init(struct drm_i915_private *dev_priv);
+void intel_audio_compute_eld(struct intel_crtc_state *crtc_state);
 bool intel_audio_compute_config(struct intel_encoder *encoder,
 				struct intel_crtc_state *crtc_state,
 				struct drm_connector_state *conn_state);
drivers/gpu/drm/i915/display/intel_hdmi.c +2 -0
index 6a4d477e8a15..daaa08c0ee47 100644
@@ -2402,6 +2402,8 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 		return -EINVAL;
 	}
 
+	intel_audio_compute_eld(pipe_config);
+
 	return 0;
 }
 
Signature · 1 line
2.25.1
maintainer
#7 lore raw

Re: [Intel-gfx] [RFC 3/3] drm/i915/display: Add wrapper to Compute SAD

Quoted 30 lines · Mitul Golani

Compute SADs that takes into account the supported rate and channel based on the capabilities of the audio source. This wrapper function should encapsulate the logic for determining the supported rate and channel and should return a set of SADs that are compatible with the source.

--v1:
- call intel_audio_compute_eld in this commit as it is defined here

--v2:
- Handle case when max frequency is less than 32k.
- remove drm prefix.
- name change for parse_sad to eld_to_sad.

--v3:
- Use signed int wherever required.
- add debug trace when channel is limited.

---
 drivers/gpu/drm/i915/display/intel_audio.c | 69 ++++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_audio.h |  1 +
 drivers/gpu/drm/i915/display/intel_hdmi.c  |  2 +
 3 files changed, 72 insertions(+)
drivers/gpu/drm/i915/display/intel_audio.c +0 -0
index e20ffc8e9654..1a1c773c1d41 100644

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 802

Quoted 9 lines
drivers/gpu/drm/i915/display/intel_audio.c +6 -0
@@ -794,6 +794,75 @@ bool intel_audio_compute_config(struct intel_encoder *encoder,
 	return true;
 }
 
+static int sad_to_channels(const u8 *sad)
+{
+	return 1 + (sad[0] & 0x7);
+}
+
+static inline u8 *eld_to_sad(u8 *eld)

Please don't use inline.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 814

Quoted 12 lines
drivers/gpu/drm/i915/display/intel_audio.c +12 -0
+{
+	int ver, mnl;
+
+	ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >> DRM_ELD_VER_SHIFT;
+	if (ver != 2 && ver != 31)
+		return NULL;
+
+	mnl = drm_eld_mnl(eld);
+	if (mnl > 16)
+		return NULL;
+
+	return eld + DRM_ELD_CEA_SAD(mnl, 0);

Feels like this should be in drm_edid.[ch]... but hey, it actually is! drm_eld_sad().

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 819

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_audio.c +5 -0
+}
+
+static int get_supported_freq_mask(struct intel_crtc_state *crtc_state)
+{
+	int audio_freq_hz[] = {32000, 44100, 48000, 88000, 96000, 176000, 192000, 0};

This needs a comment referencing the source spec, as apparently the order is significant.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 822

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_audio.c +3 -0
+	int mask = 0;
+
+	for (u8 index = 0; index < ARRAY_SIZE(audio_freq_hz); index++) {

int index, and please declare it separately instead of within the for.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 823

Quoted 1 line
drivers/gpu/drm/i915/display/intel_audio.c +1 -0
+		mask |= 1 << index;

This means the first one is always supported. Is that the case? What if max_frequency is 0?

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 827

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_audio.c +4 -0
+		if (crtc_state->audio.max_frequency != audio_freq_hz[index])
+			continue;
+		else
+			break;

Maybe you mean:

		if (audio_freq_hz[index] > crtc_state->audio.max_frequency)
        		break;

		mask |= 1 << index;
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_audio.c +4 -0
+	}
+
+	return mask;
+}

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 841

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_audio.c +10 -0
+
+void intel_audio_compute_eld(struct intel_crtc_state *crtc_state)
+{
+	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
+	u8 *eld, *sad;
+	int index, mask = 0;
+
+	eld = crtc_state->eld;
+	if (!eld) {
+		drm_err(&i915->drm, "failed to locate eld\n");

It doesn't need to be an error.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 845

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_audio.c +4 -0
+		return;
+	}
+
+	sad = (u8 *)eld_to_sad(eld);

Unnecessary cast.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 846

Quoted 1 line
drivers/gpu/drm/i915/display/intel_audio.c +1 -0
+	if (sad) {

if (!sad)

	return;

and reduce indent below.

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_audio.c +8 -0
+		mask = get_supported_freq_mask(crtc_state);
+
+		for (index = 0; index < drm_eld_sad_count(eld); index++, sad += 3) {
+			/*
+			 * Respect source restricitions. Limit capabilities to a subset that is
+			 * supported both by the source and the sink.
+			 */
+			if (sad_to_channels(sad) >= crtc_state->audio.max_channel) {

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 864

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_audio.c +10 -0
+				sad[0] &= ~0x7;
+				sad[0] |= crtc_state->audio.max_channel - 1;
+				drm_dbg_kms(&i915->drm, "Channel count is limited to %d\n",
+					    crtc_state->audio.max_channel - 1);
+			}
+
+			sad[1] &= mask;
+		}
+	}
+}

This should also be static within intel_audio.c.

Quoted 28 lines
drivers/gpu/drm/i915/display/intel_audio.c +1 -0
+
 /**
  * intel_audio_codec_enable - Enable the audio codec for HD audio
  * @encoder: encoder on which to enable audio
drivers/gpu/drm/i915/display/intel_audio.h +1 -0
index be3edf9c4982..a0162cdc7999 100644
@@ -17,6 +17,7 @@ struct intel_encoder;
 #define MAX_CHANNEL_COUNT			8
 
 void intel_audio_hooks_init(struct drm_i915_private *dev_priv);
+void intel_audio_compute_eld(struct intel_crtc_state *crtc_state);
 bool intel_audio_compute_config(struct intel_encoder *encoder,
 				struct intel_crtc_state *crtc_state,
 				struct drm_connector_state *conn_state);
drivers/gpu/drm/i915/display/intel_hdmi.c +2 -0
index 6a4d477e8a15..daaa08c0ee47 100644
@@ -2402,6 +2402,8 @@ int intel_hdmi_compute_config(struct intel_encoder *encoder,
 		return -EINVAL;
 	}
 
+	intel_audio_compute_eld(pipe_config);
+
 	return 0;
 }
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#8 lore raw

Re: [Intel-gfx] [RFC 3/3] drm/i915/display: Add wrapper to Compute SAD

Hi @Jani Nikula

Quoted 58 lines

-----Original Message-----
From: Jani Nikula <[email protected]>
Sent: 26 June 2023 22:48
To: Golani, Mitulkumar Ajitkumar <[email protected]>; [email protected]
Subject: Re: [Intel-gfx] [RFC 3/3] drm/i915/display: Add wrapper to Compute SAD

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct

Quoted 31 lines · Mitul Golani

Compute SADs that takes into account the supported rate and channel based on the capabilities of the audio source. This wrapper function should encapsulate the logic for determining the supported rate and channel and should return a set of SADs that are compatible with the source.

--v1:
- call intel_audio_compute_eld in this commit as it is defined here

--v2:
- Handle case when max frequency is less than 32k.
- remove drm prefix.
- name change for parse_sad to eld_to_sad.

--v3:
- Use signed int wherever required.
- add debug trace when channel is limited.

---
 drivers/gpu/drm/i915/display/intel_audio.c | 69
++++++++++++++++++++++  drivers/gpu/drm/i915/display/intel_audio.h |
1 +  drivers/gpu/drm/i915/display/intel_hdmi.c  |  2 +
 3 files changed, 72 insertions(+)
drivers/gpu/drm/i915/display/intel_audio.c +0 -0
index e20ffc8e9654..1a1c773c1d41 100644
@@ -794,6 +794,75 @@ bool intel_audio_compute_config(struct

intel_encoder *encoder,

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 802

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_audio.c +5 -0
 	return true;
 }
 
+static int sad_to_channels(const u8 *sad) {
+	return 1 + (sad[0] & 0x7);
+}
+
+static inline u8 *eld_to_sad(u8 *eld)

Please don't use inline.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder,

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_audio.c +4 -0
+{
+	int ver, mnl;
+
+	ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >>

DRM_ELD_VER_SHIFT;

Quoted 11 lines

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 814

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_audio.c +8 -0
+	if (ver != 2 && ver != 31)
+		return NULL;
+
+	mnl = drm_eld_mnl(eld);
+	if (mnl > 16)
+		return NULL;
+
+	return eld + DRM_ELD_CEA_SAD(mnl, 0);

Feels like this should be in drm_edid.[ch]... but hey, it actually is! drm_eld_sad().

As now, eld is added to crtc_state as well, intention was to overwrite source eld. drm_eld_sad is returning const *. Due to which created function local to intel_audio.c.

Also addressed rest other comments to this patch.

Thanks,
MItul

Quoted 127 lines

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct · line 819

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_audio.c +6 -0
+}
+
+static int get_supported_freq_mask(struct intel_crtc_state
+*crtc_state) {
+	int audio_freq_hz[] = {32000, 44100, 48000, 88000, 96000, 176000,
+192000, 0};

This needs a comment referencing the source spec, as apparently the order is significant.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 822

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_audio.c +3 -0
+	int mask = 0;
+
+	for (u8 index = 0; index < ARRAY_SIZE(audio_freq_hz); index++) {

int index, and please declare it separately instead of within the for.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 823

Quoted 1 line
drivers/gpu/drm/i915/display/intel_audio.c +1 -0
+		mask |= 1 << index;

This means the first one is always supported. Is that the case? What if max_frequency is 0?

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct · line 824

Quoted 1 line
drivers/gpu/drm/i915/display/intel_audio.c +1 -0
+		if (crtc_state->audio.max_frequency !=

audio_freq_hz[index])

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 827

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_audio.c +3 -0
+			continue;
+		else
+			break;

Maybe you mean:

if (audio_freq_hz[index] > crtc_state-

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct · line 828

Quoted 1 line
drivers/gpu/drm/i915/display/intel_audio.c +0 -0
 audio.max_frequency)
        		break;

		mask |= 1 << index;

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 841

Quoted 13 lines
drivers/gpu/drm/i915/display/intel_audio.c +13 -0
+	}
+
+	return mask;
+}
+
+void intel_audio_compute_eld(struct intel_crtc_state *crtc_state) {
+	struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
+	u8 *eld, *sad;
+	int index, mask = 0;
+
+	eld = crtc_state->eld;
+	if (!eld) {
+		drm_err(&i915->drm, "failed to locate eld\n");

It doesn't need to be an error.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 845

Quoted 4 lines
drivers/gpu/drm/i915/display/intel_audio.c +4 -0
+		return;
+	}
+
+	sad = (u8 *)eld_to_sad(eld);

Unnecessary cast.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 846

Quoted 1 line
drivers/gpu/drm/i915/display/intel_audio.c +1 -0
+	if (sad) {

if (!sad)

	return;

and reduce indent below.

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder,

Quoted 3 lines
drivers/gpu/drm/i915/display/intel_audio.c +3 -0
+		mask = get_supported_freq_mask(crtc_state);
+
+		for (index = 0; index < drm_eld_sad_count(eld); index++, sad

+= 3) {

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct · line 851

Quoted 2 lines
drivers/gpu/drm/i915/display/intel_audio.c +2 -0
+			/*
+			 * Respect source restricitions. Limit capabilities to a

subset that is

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder,

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_audio.c +6 -0
+			 * supported both by the source and the sink.
+			 */
+			if (sad_to_channels(sad) >= crtc_state-
 audio.max_channel) {
+				sad[0] &= ~0x7;
+				sad[0] |= crtc_state->audio.max_channel - 1;
+				drm_dbg_kms(&i915->drm, "Channel count

is limited to %d\n",

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct · line 859

Quoted 1 line
drivers/gpu/drm/i915/display/intel_audio.c +1 -0
+					    crtc_state->audio.max_channel -

1);

drivers/gpu/drm/i915/display/intel_audio.c bool intel_audio_compute_config(struct intel_encoder *encoder, · line 864

Quoted 6 lines
drivers/gpu/drm/i915/display/intel_audio.c +6 -0
+			}
+
+			sad[1] &= mask;
+		}
+	}
+}

This should also be static within intel_audio.c.

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_audio.c +1 -0
+
 /**
  * intel_audio_codec_enable - Enable the audio codec for HD audio
  * @encoder: encoder on which to enable audio diff --git

a/drivers/gpu/drm/i915/display/intel_audio.h
b/drivers/gpu/drm/i915/display/intel_audio.h
index be3edf9c4982..a0162cdc7999 100644

drivers/gpu/drm/i915/display/intel_audio.h struct intel_encoder; · line 23

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_audio.h +1 -0
@@ -17,6 +17,7 @@ struct intel_encoder;
 #define MAX_CHANNEL_COUNT			8
 
 void intel_audio_hooks_init(struct drm_i915_private *dev_priv);
+void intel_audio_compute_eld(struct intel_crtc_state *crtc_state);
 bool intel_audio_compute_config(struct intel_encoder *encoder,
 				struct intel_crtc_state *crtc_state,
 				struct drm_connector_state *conn_state);

diff --git

drivers/gpu/drm/i915/display/intel_hdmi.c int intel_hdmi_compute_config(struct

Quoted 6 lines

a/drivers/gpu/drm/i915/display/intel_hdmi.c
b/drivers/gpu/drm/i915/display/intel_hdmi.c
index 6a4d477e8a15..daaa08c0ee47 100644

drivers/gpu/drm/i915/display/intel_hdmi.c +0 -0
@@ -2402,6 +2402,8 @@ int intel_hdmi_compute_config(struct

intel_encoder *encoder,

drivers/gpu/drm/i915/display/intel_hdmi.c int intel_hdmi_compute_config(struct intel_encoder *encoder, · line 2408

Quoted 7 lines
drivers/gpu/drm/i915/display/intel_hdmi.c +2 -0
 		return -EINVAL;
 	}
 
+	intel_audio_compute_eld(pipe_config);
+
 	return 0;
 }

--
Jani Nikula, Intel Open Source Graphics Center