diff mbox series

[13/22] drm/i915/audio: Split "ELD valid" vs. audio PD on hsw+

Message ID 20221011170011.17198-14-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: ELD precompute and readout | expand

Commit Message

Ville Syrjälä Oct. 11, 2022, 5 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

On the older platforms the audio presence detect bit is in
the port register, so it gets written outside audio codec hooks
and is this separate from the ELD valid toggling. Split the
operations into two steps on hsw+ to be more consistent with
both the other platforms and the spec. Also according to the
spec we might need some vblank waits between the two which
definitely needs them done separately.

Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_audio.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Comments

Jani Nikula Oct. 12, 2022, 3:01 p.m. UTC | #1
On Tue, 11 Oct 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> On the older platforms the audio presence detect bit is in
> the port register, so it gets written outside audio codec hooks
> and is this separate from the ELD valid toggling. Split the
> operations into two steps on hsw+ to be more consistent with
> both the other platforms and the spec. Also according to the
> spec we might need some vblank waits between the two which
> definitely needs them done separately.
>
> Cc: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com>
> Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_audio.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
> index 1b928d283b8d..0a1ba10fc20d 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -479,9 +479,12 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder,
>  		     intel_crtc_has_dp_encoder(old_crtc_state) ?
>  		     AUD_CONFIG_N_VALUE_INDEX : 0);
>  
> -	/* Disable audio presence detect, invalidate ELD */
> +	/* Invalidate ELD */
> +	intel_de_rmw(i915, HSW_AUD_PIN_ELD_CP_VLD,
> +		     AUDIO_ELD_VALID(cpu_transcoder), 0);
> +
> +	/* Disable audio presence detect */
>  	intel_de_rmw(i915, HSW_AUD_PIN_ELD_CP_VLD,
> -		     AUDIO_ELD_VALID(cpu_transcoder) |
>  		     AUDIO_OUTPUT_ENABLE(cpu_transcoder), 0);
>  
>  	mutex_unlock(&i915->display.audio.mutex);
> @@ -612,10 +615,13 @@ static void hsw_audio_codec_enable(struct intel_encoder *encoder,
>  	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP))
>  		enable_audio_dsc_wa(encoder, crtc_state);
>  
> -	/* Enable audio presence detect, invalidate ELD */
> +	/* Enable audio presence detect */
>  	intel_de_rmw(i915, HSW_AUD_PIN_ELD_CP_VLD,
> -		     AUDIO_ELD_VALID(cpu_transcoder),
> -		     AUDIO_OUTPUT_ENABLE(cpu_transcoder));
> +		     0, AUDIO_OUTPUT_ENABLE(cpu_transcoder));
> +
> +	/* Invalidate ELD */
> +	intel_de_rmw(i915, HSW_AUD_PIN_ELD_CP_VLD,
> +		     AUDIO_ELD_VALID(cpu_transcoder), 0);
>  
>  	/*
>  	 * FIXME: We're supposed to wait for vblank here, but we have vblanks
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 1b928d283b8d..0a1ba10fc20d 100644
--- a/drivers/gpu/drm/i915/display/intel_audio.c
+++ b/drivers/gpu/drm/i915/display/intel_audio.c
@@ -479,9 +479,12 @@  static void hsw_audio_codec_disable(struct intel_encoder *encoder,
 		     intel_crtc_has_dp_encoder(old_crtc_state) ?
 		     AUD_CONFIG_N_VALUE_INDEX : 0);
 
-	/* Disable audio presence detect, invalidate ELD */
+	/* Invalidate ELD */
+	intel_de_rmw(i915, HSW_AUD_PIN_ELD_CP_VLD,
+		     AUDIO_ELD_VALID(cpu_transcoder), 0);
+
+	/* Disable audio presence detect */
 	intel_de_rmw(i915, HSW_AUD_PIN_ELD_CP_VLD,
-		     AUDIO_ELD_VALID(cpu_transcoder) |
 		     AUDIO_OUTPUT_ENABLE(cpu_transcoder), 0);
 
 	mutex_unlock(&i915->display.audio.mutex);
@@ -612,10 +615,13 @@  static void hsw_audio_codec_enable(struct intel_encoder *encoder,
 	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP))
 		enable_audio_dsc_wa(encoder, crtc_state);
 
-	/* Enable audio presence detect, invalidate ELD */
+	/* Enable audio presence detect */
 	intel_de_rmw(i915, HSW_AUD_PIN_ELD_CP_VLD,
-		     AUDIO_ELD_VALID(cpu_transcoder),
-		     AUDIO_OUTPUT_ENABLE(cpu_transcoder));
+		     0, AUDIO_OUTPUT_ENABLE(cpu_transcoder));
+
+	/* Invalidate ELD */
+	intel_de_rmw(i915, HSW_AUD_PIN_ELD_CP_VLD,
+		     AUDIO_ELD_VALID(cpu_transcoder), 0);
 
 	/*
 	 * FIXME: We're supposed to wait for vblank here, but we have vblanks