[Intel-gfx] [PATCH] drm/i915/display: Trigger Modeset at boot for audio codec init

Maarten Lankhorst maarten.lankhorst at linux.intel.com
Wed Mar 18 12:15:31 UTC 2020


Op 18-03-2020 om 12:30 schreef Uma Shankar:
> If external monitors are connected during boot up, driver
> uses the same mode programmed by BIOS and avoids a full modeset.
> This results in display audio codec left uninitialized and
> display audio fails to work till user triggers a modeset.
>
> This patch fixes the same by triggering a modeset at boot.
>
> Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
> Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
> Cc: Kai Vehmanen <kai.vehmanen at linux.intel.com>
> Signed-off-by: Uma Shankar <uma.shankar at intel.com>
> Signed-off-by: SweeAun Khor <swee.aun.khor at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c     | 4 ++++
>  drivers/gpu/drm/i915/display/intel_display.c | 8 ++++++++
>  drivers/gpu/drm/i915/i915_drv.h              | 3 +++
>  3 files changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 73d0f4648c06..ba380afa73a6 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3704,6 +3704,10 @@ static void intel_ddi_update_pipe(struct intel_encoder *encoder,
>  				  const struct intel_crtc_state *crtc_state,
>  				  const struct drm_connector_state *conn_state)
>  {
> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> +
> +	/* Clear the bootflag */
> +	dev_priv->bootflag = false;
>  
>  	if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
>  		intel_ddi_update_pipe_dp(encoder, crtc_state, conn_state);
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 8f23c4d51c33..a1487539495f 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -14751,6 +14751,10 @@ static int intel_atomic_check(struct drm_device *dev,
>  		if (new_crtc_state->hw.mode.private_flags !=
>  		    old_crtc_state->hw.mode.private_flags)
>  			new_crtc_state->uapi.mode_changed = true;
> +
> +		/* Set mode_change to init audio code once at boot */
> +		if (dev_priv->bootflag && new_crtc_state->hw.active)
> +			new_crtc_state->uapi.mode_changed = true;
>  	}
>  
>  	ret = drm_atomic_helper_check_modeset(dev, &state->base);
> @@ -17655,11 +17659,15 @@ static void intel_update_fdi_pll_freq(struct drm_i915_private *dev_priv)
>  
>  static int intel_initial_commit(struct drm_device *dev)
>  {
> +	struct drm_i915_private *dev_priv = to_i915(dev);
>  	struct drm_atomic_state *state = NULL;
>  	struct drm_modeset_acquire_ctx ctx;
>  	struct intel_crtc *crtc;
>  	int ret = 0;
>  
> +	/* Set Flag to trigger modeset for audio codec init */
> +	dev_priv->bootflag = true;
> +
>  	state = drm_atomic_state_alloc(dev);
>  	if (!state)
>  		return -ENOMEM;
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index a7ea1d855359..207196f9632b 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1210,6 +1210,9 @@ struct drm_i915_private {
>  	 * NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
>  	 * will be rejected. Instead look for a better place.
>  	 */
> +
> +	/* Flag to trigger modeset for Audio codec init once during boot */
> +	bool bootflag;
>  };
>  
>  static inline struct drm_i915_private *to_i915(const struct drm_device *dev)

This is not going to help. We read out the has_audio flag now, the only thing we miss is to enable the audio codec. This should be done after the first detect(), in the manner which I described to get the correct eld values.

~Maarten



More information about the Intel-gfx mailing list