[Intel-gfx] [PATCH 07/21] drm/i915: split audio functions from display vtable

Jani Nikula jani.nikula at linux.intel.com
Wed Sep 8 09:48:37 UTC 2021


On Wed, 08 Sep 2021, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> These are only used internally in the audio code
> ---
>  drivers/gpu/drm/i915/display/intel_audio.c | 24 +++++++++++-----------
>  drivers/gpu/drm/i915/i915_drv.h            | 19 +++++++++++------
>  2 files changed, 25 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
> index 532237588511..f539826c0424 100644
> --- a/drivers/gpu/drm/i915/display/intel_audio.c
> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
> @@ -848,8 +848,8 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,
>  
>  	connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
>  
> -	if (dev_priv->display.audio_codec_enable)
> -		dev_priv->display.audio_codec_enable(encoder,
> +	if (dev_priv->audio_funcs.audio_codec_enable)
> +		dev_priv->audio_funcs.audio_codec_enable(encoder,
>  						     crtc_state,
>  						     conn_state);
>  
> @@ -893,8 +893,8 @@ void intel_audio_codec_disable(struct intel_encoder *encoder,
>  	enum port port = encoder->port;
>  	enum pipe pipe = crtc->pipe;
>  
> -	if (dev_priv->display.audio_codec_disable)
> -		dev_priv->display.audio_codec_disable(encoder,
> +	if (dev_priv->audio_funcs.audio_codec_disable)
> +		dev_priv->audio_funcs.audio_codec_disable(encoder,
>  						      old_crtc_state,
>  						      old_conn_state);

Again, nice isolation here. :)

>  
> @@ -922,17 +922,17 @@ void intel_audio_codec_disable(struct intel_encoder *encoder,
>  void intel_init_audio_hooks(struct drm_i915_private *dev_priv)
>  {
>  	if (IS_G4X(dev_priv)) {
> -		dev_priv->display.audio_codec_enable = g4x_audio_codec_enable;
> -		dev_priv->display.audio_codec_disable = g4x_audio_codec_disable;
> +		dev_priv->audio_funcs.audio_codec_enable = g4x_audio_codec_enable;
> +		dev_priv->audio_funcs.audio_codec_disable = g4x_audio_codec_disable;
>  	} else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) {
> -		dev_priv->display.audio_codec_enable = ilk_audio_codec_enable;
> -		dev_priv->display.audio_codec_disable = ilk_audio_codec_disable;
> +		dev_priv->audio_funcs.audio_codec_enable = ilk_audio_codec_enable;
> +		dev_priv->audio_funcs.audio_codec_disable = ilk_audio_codec_disable;
>  	} else if (IS_HASWELL(dev_priv) || DISPLAY_VER(dev_priv) >= 8) {
> -		dev_priv->display.audio_codec_enable = hsw_audio_codec_enable;
> -		dev_priv->display.audio_codec_disable = hsw_audio_codec_disable;
> +		dev_priv->audio_funcs.audio_codec_enable = hsw_audio_codec_enable;
> +		dev_priv->audio_funcs.audio_codec_disable = hsw_audio_codec_disable;
>  	} else if (HAS_PCH_SPLIT(dev_priv)) {
> -		dev_priv->display.audio_codec_enable = ilk_audio_codec_enable;
> -		dev_priv->display.audio_codec_disable = ilk_audio_codec_disable;
> +		dev_priv->audio_funcs.audio_codec_enable = ilk_audio_codec_enable;
> +		dev_priv->audio_funcs.audio_codec_disable = ilk_audio_codec_disable;
>  	}
>  }
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 7e5a8b1bbdd8..3e60bf8182e3 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -364,6 +364,15 @@ struct drm_i915_display_color_funcs {
>  	void (*read_luts)(struct intel_crtc_state *crtc_state);
>  };
>  
> +struct drm_i915_display_audio_funcs {

Nitpick, I'd make it struct intel_audio_funcs.

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

> +	void (*audio_codec_enable)(struct intel_encoder *encoder,
> +				   const struct intel_crtc_state *crtc_state,
> +				   const struct drm_connector_state *conn_state);
> +	void (*audio_codec_disable)(struct intel_encoder *encoder,
> +				    const struct intel_crtc_state *old_crtc_state,
> +				    const struct drm_connector_state *old_conn_state);
> +};
> +
>  struct drm_i915_display_funcs {
>  	void (*get_cdclk)(struct drm_i915_private *dev_priv,
>  			  struct intel_cdclk_config *cdclk_config);
> @@ -386,12 +395,7 @@ struct drm_i915_display_funcs {
>  			     struct intel_crtc *crtc);
>  	void (*commit_modeset_enables)(struct intel_atomic_state *state);
>  	void (*commit_modeset_disables)(struct intel_atomic_state *state);
> -	void (*audio_codec_enable)(struct intel_encoder *encoder,
> -				   const struct intel_crtc_state *crtc_state,
> -				   const struct drm_connector_state *conn_state);
> -	void (*audio_codec_disable)(struct intel_encoder *encoder,
> -				    const struct intel_crtc_state *old_crtc_state,
> -				    const struct drm_connector_state *old_conn_state);
> +
>  	void (*fdi_link_train)(struct intel_crtc *crtc,
>  			       const struct intel_crtc_state *crtc_state);
>  	void (*hpd_irq_setup)(struct drm_i915_private *dev_priv);
> @@ -992,6 +996,9 @@ struct drm_i915_private {
>  	/* Display internal color functions */
>  	struct drm_i915_display_color_funcs color_funcs;
>  
> +	/* Display internal audio functions */
> +	struct drm_i915_display_audio_funcs audio_funcs;
> +
>  	/* PCH chipset type */
>  	enum intel_pch pch_type;
>  	unsigned short pch_id;

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list