On Mon, 06 Nov 2023, Ville Syrjala <ville.syrj...@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrj...@linux.intel.com>
>
> Follow the hsw+ approach toggle the audio presence detect
> when we set up the ELD, instead of doing it when turning the
> port on/off.
>
> This will facilitate audio enable/disable to happen during
> fastsets instead of requiring a full modeset.
>
> Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com>

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

> ---
>  drivers/gpu/drm/i915/display/g4x_hdmi.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/g4x_hdmi.c 
> b/drivers/gpu/drm/i915/display/g4x_hdmi.c
> index 9c70245d8b0a..beda6b480bf1 100644
> --- a/drivers/gpu/drm/i915/display/g4x_hdmi.c
> +++ b/drivers/gpu/drm/i915/display/g4x_hdmi.c
> @@ -228,8 +228,6 @@ 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)
> -             temp |= HDMI_AUDIO_ENABLE;
>  
>       intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
>       intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);
> @@ -240,12 +238,16 @@ static void g4x_hdmi_audio_enable(struct intel_encoder 
> *encoder,
>                                 const struct drm_connector_state *conn_state)
>  {
>       struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> +     struct intel_hdmi *hdmi = enc_to_intel_hdmi(encoder);
>  
>       if (!crtc_state->has_audio)
>               return;
>  
>       drm_WARN_ON(&i915->drm, !crtc_state->has_hdmi_sink);
>  
> +     /* Enable audio presence detect */
> +     intel_de_rmw(i915, hdmi->hdmi_reg, 0, HDMI_AUDIO_ENABLE);
> +
>       intel_audio_codec_enable(encoder, crtc_state, conn_state);
>  }
>  
> @@ -253,10 +255,16 @@ static void g4x_hdmi_audio_disable(struct intel_encoder 
> *encoder,
>                                  const struct intel_crtc_state 
> *old_crtc_state,
>                                  const struct drm_connector_state 
> *old_conn_state)
>  {
> +     struct drm_i915_private *i915 = to_i915(encoder->base.dev);
> +     struct intel_hdmi *hdmi = enc_to_intel_hdmi(encoder);
> +
>       if (!old_crtc_state->has_audio)
>               return;
>  
>       intel_audio_codec_disable(encoder, old_crtc_state, old_conn_state);
> +
> +     /* Disable audio presence detect */
> +     intel_de_rmw(i915, hdmi->hdmi_reg, HDMI_AUDIO_ENABLE, 0);
>  }
>  
>  static void g4x_enable_hdmi(struct intel_atomic_state *state,
> @@ -282,8 +290,6 @@ 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)
> -             temp |= HDMI_AUDIO_ENABLE;
>  
>       /*
>        * HW workaround, need to write this twice for issue
> @@ -335,8 +341,6 @@ 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)
> -             temp |= HDMI_AUDIO_ENABLE;
>  
>       /*
>        * WaEnableHDMI8bpcBefore12bpc:snb,ivb
> @@ -396,7 +400,7 @@ static void intel_disable_hdmi(struct intel_atomic_state 
> *state,
>  
>       temp = intel_de_read(dev_priv, intel_hdmi->hdmi_reg);
>  
> -     temp &= ~(SDVO_ENABLE | HDMI_AUDIO_ENABLE);
> +     temp &= ~SDVO_ENABLE;
>       intel_de_write(dev_priv, intel_hdmi->hdmi_reg, temp);
>       intel_de_posting_read(dev_priv, intel_hdmi->hdmi_reg);

-- 
Jani Nikula, Intel

Reply via email to