Re: [PATCH 1/2] drm/i915: Pass around crtc and connector states for audio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 31, 2017 at 11:19:03AM +0200, Jani Nikula wrote:
> On Mon, 30 Oct 2017, Ville Syrjala <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
> > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> >
> > Explicitly pass the crtc and connector states into the audio
> > code enable/disable hooks, and plumb them all the way down.
> >
> > This gets rid of almost all crtc->config and encoder->crtc
> > uses. The one place where we still use them is
> > i915_audio_component_sync_audio_rate() since that gets called from
> > the audio driver and we don't have explicit states around then.
> 
> What a tedious patch to review!
> 
> On both,
> 
> Reviewed-by: Jani Nikula <jani.nikula@xxxxxxxxx>

Thanks for suffering through the tedium. Series pushed to dinq.

> 
> 
> >
> > Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/i915_drv.h     |  10 +-
> >  drivers/gpu/drm/i915/intel_audio.c  | 202 ++++++++++++++++++++----------------
> >  drivers/gpu/drm/i915/intel_ddi.c    |   6 +-
> >  drivers/gpu/drm/i915/intel_dp.c     |   3 +-
> >  drivers/gpu/drm/i915/intel_dp_mst.c |   3 +-
> >  drivers/gpu/drm/i915/intel_drv.h    |   4 +-
> >  drivers/gpu/drm/i915/intel_hdmi.c   |   6 +-
> >  7 files changed, 132 insertions(+), 102 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 4a7325c4189c..c10fece58e86 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -726,10 +726,12 @@ struct drm_i915_display_funcs {
> >  	void (*crtc_disable)(struct intel_crtc_state *old_crtc_state,
> >  			     struct drm_atomic_state *old_state);
> >  	void (*update_crtcs)(struct drm_atomic_state *state);
> > -	void (*audio_codec_enable)(struct drm_connector *connector,
> > -				   struct intel_encoder *encoder,
> > -				   const struct drm_display_mode *adjusted_mode);
> > -	void (*audio_codec_disable)(struct intel_encoder *encoder);
> > +	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 (*init_clock_gating)(struct drm_i915_private *dev_priv);
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> > index 0ddba16fde1b..e56520037270 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -102,13 +102,13 @@ static const struct dp_aud_n_m dp_aud_n_m[] = {
> >  };
> >  
> >  static const struct dp_aud_n_m *
> > -audio_config_dp_get_n_m(struct intel_crtc *intel_crtc, int rate)
> > +audio_config_dp_get_n_m(const struct intel_crtc_state *crtc_state, int rate)
> >  {
> >  	int i;
> >  
> >  	for (i = 0; i < ARRAY_SIZE(dp_aud_n_m); i++) {
> >  		if (rate == dp_aud_n_m[i].sample_rate &&
> > -		    intel_crtc->config->port_clock == dp_aud_n_m[i].clock)
> > +		    crtc_state->port_clock == dp_aud_n_m[i].clock)
> >  			return &dp_aud_n_m[i];
> >  	}
> >  
> > @@ -157,8 +157,10 @@ static const struct {
> >  };
> >  
> >  /* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */
> > -static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted_mode)
> > +static u32 audio_config_hdmi_pixel_clock(const struct intel_crtc_state *crtc_state)
> >  {
> > +	const struct drm_display_mode *adjusted_mode =
> > +		&crtc_state->base.adjusted_mode;
> >  	int i;
> >  
> >  	for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
> > @@ -179,9 +181,11 @@ static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted
> >  	return hdmi_audio_clock[i].config;
> >  }
> >  
> > -static int audio_config_hdmi_get_n(const struct drm_display_mode *adjusted_mode,
> > +static int audio_config_hdmi_get_n(const struct intel_crtc_state *crtc_state,
> >  				   int rate)
> >  {
> > +	const struct drm_display_mode *adjusted_mode =
> > +		&crtc_state->base.adjusted_mode;
> >  	int i;
> >  
> >  	for (i = 0; i < ARRAY_SIZE(hdmi_aud_ncts); i++) {
> > @@ -220,7 +224,9 @@ static bool intel_eld_uptodate(struct drm_connector *connector,
> >  	return true;
> >  }
> >  
> > -static void g4x_audio_codec_disable(struct intel_encoder *encoder)
> > +static void g4x_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_private *dev_priv = to_i915(encoder->base.dev);
> >  	uint32_t eldv, tmp;
> > @@ -239,11 +245,12 @@ static void g4x_audio_codec_disable(struct intel_encoder *encoder)
> >  	I915_WRITE(G4X_AUD_CNTL_ST, tmp);
> >  }
> >  
> > -static void g4x_audio_codec_enable(struct drm_connector *connector,
> > -				   struct intel_encoder *encoder,
> > -				   const struct drm_display_mode *adjusted_mode)
> > +static void g4x_audio_codec_enable(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(connector->dev);
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > +	struct drm_connector *connector = conn_state->connector;
> >  	uint8_t *eld = connector->eld;
> >  	uint32_t eldv;
> >  	uint32_t tmp;
> > @@ -279,16 +286,20 @@ static void g4x_audio_codec_enable(struct drm_connector *connector,
> >  }
> >  
> >  static void
> > -hsw_dp_audio_config_update(struct intel_crtc *intel_crtc, enum port port,
> > -			   const struct drm_display_mode *adjusted_mode)
> > +hsw_dp_audio_config_update(struct intel_encoder *encoder,
> > +			   const struct intel_crtc_state *crtc_state)
> >  {
> > -	struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct i915_audio_component *acomp = dev_priv->audio_component;
> > -	int rate = acomp ? acomp->aud_sample_rate[port] : 0;
> > -	const struct dp_aud_n_m *nm = audio_config_dp_get_n_m(intel_crtc, rate);
> > -	enum pipe pipe = intel_crtc->pipe;
> > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> > +	enum port port = encoder->port;
> > +	enum pipe pipe = crtc->pipe;
> > +	const struct dp_aud_n_m *nm;
> > +	int rate;
> >  	u32 tmp;
> >  
> > +	rate = acomp ? acomp->aud_sample_rate[port] : 0;
> > +	nm = audio_config_dp_get_n_m(crtc_state, rate);
> >  	if (nm)
> >  		DRM_DEBUG_KMS("using Maud %u, Naud %u\n", nm->m, nm->n);
> >  	else
> > @@ -323,23 +334,26 @@ hsw_dp_audio_config_update(struct intel_crtc *intel_crtc, enum port port,
> >  }
> >  
> >  static void
> > -hsw_hdmi_audio_config_update(struct intel_crtc *intel_crtc, enum port port,
> > -			     const struct drm_display_mode *adjusted_mode)
> > +hsw_hdmi_audio_config_update(struct intel_encoder *encoder,
> > +			     const struct intel_crtc_state *crtc_state)
> >  {
> > -	struct drm_i915_private *dev_priv = to_i915(intel_crtc->base.dev);
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct i915_audio_component *acomp = dev_priv->audio_component;
> > -	int rate = acomp ? acomp->aud_sample_rate[port] : 0;
> > -	enum pipe pipe = intel_crtc->pipe;
> > -	int n;
> > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> > +	enum port port = encoder->port;
> > +	enum pipe pipe = crtc->pipe;
> > +	int n, rate;
> >  	u32 tmp;
> >  
> > +	rate = acomp ? acomp->aud_sample_rate[port] : 0;
> > +
> >  	tmp = I915_READ(HSW_AUD_CFG(pipe));
> >  	tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> >  	tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> >  	tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> > -	tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> > +	tmp |= audio_config_hdmi_pixel_clock(crtc_state);
> >  
> > -	n = audio_config_hdmi_get_n(adjusted_mode, rate);
> > +	n = audio_config_hdmi_get_n(crtc_state, rate);
> >  	if (n != 0) {
> >  		DRM_DEBUG_KMS("using N %d\n", n);
> >  
> > @@ -363,20 +377,22 @@ hsw_hdmi_audio_config_update(struct intel_crtc *intel_crtc, enum port port,
> >  }
> >  
> >  static void
> > -hsw_audio_config_update(struct intel_crtc *intel_crtc, enum port port,
> > -			const struct drm_display_mode *adjusted_mode)
> > +hsw_audio_config_update(struct intel_encoder *encoder,
> > +			const struct intel_crtc_state *crtc_state)
> >  {
> > -	if (intel_crtc_has_dp_encoder(intel_crtc->config))
> > -		hsw_dp_audio_config_update(intel_crtc, port, adjusted_mode);
> > +	if (intel_crtc_has_dp_encoder(crtc_state))
> > +		hsw_dp_audio_config_update(encoder, crtc_state);
> >  	else
> > -		hsw_hdmi_audio_config_update(intel_crtc, port, adjusted_mode);
> > +		hsw_hdmi_audio_config_update(encoder, crtc_state);
> >  }
> >  
> > -static void hsw_audio_codec_disable(struct intel_encoder *encoder)
> > +static void hsw_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_private *dev_priv = to_i915(encoder->base.dev);
> > -	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> > -	enum pipe pipe = intel_crtc->pipe;
> > +	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->base.crtc);
> > +	enum pipe pipe = crtc->pipe;
> >  	uint32_t tmp;
> >  
> >  	DRM_DEBUG_KMS("Disable audio codec on pipe %c\n", pipe_name(pipe));
> > @@ -389,7 +405,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder)
> >  	tmp |= AUD_CONFIG_N_PROG_ENABLE;
> >  	tmp &= ~AUD_CONFIG_UPPER_N_MASK;
> >  	tmp &= ~AUD_CONFIG_LOWER_N_MASK;
> > -	if (intel_crtc_has_dp_encoder(intel_crtc->config))
> > +	if (intel_crtc_has_dp_encoder(old_crtc_state))
> >  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >  	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >  
> > @@ -402,14 +418,14 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder)
> >  	mutex_unlock(&dev_priv->av_mutex);
> >  }
> >  
> > -static void hsw_audio_codec_enable(struct drm_connector *connector,
> > -				   struct intel_encoder *intel_encoder,
> > -				   const struct drm_display_mode *adjusted_mode)
> > +static void hsw_audio_codec_enable(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(connector->dev);
> > -	struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
> > -	enum pipe pipe = intel_crtc->pipe;
> > -	enum port port = intel_encoder->port;
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> > +	struct drm_connector *connector = conn_state->connector;
> > +	enum pipe pipe = crtc->pipe;
> >  	const uint8_t *eld = connector->eld;
> >  	uint32_t tmp;
> >  	int len, i;
> > @@ -448,17 +464,19 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
> >  	I915_WRITE(HSW_AUD_PIN_ELD_CP_VLD, tmp);
> >  
> >  	/* Enable timestamps */
> > -	hsw_audio_config_update(intel_crtc, port, adjusted_mode);
> > +	hsw_audio_config_update(encoder, crtc_state);
> >  
> >  	mutex_unlock(&dev_priv->av_mutex);
> >  }
> >  
> > -static void ilk_audio_codec_disable(struct intel_encoder *intel_encoder)
> > +static void ilk_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_private *dev_priv = to_i915(intel_encoder->base.dev);
> > -	struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
> > -	enum pipe pipe = intel_crtc->pipe;
> > -	enum port port = intel_encoder->port;
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > +	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->base.crtc);
> > +	enum pipe pipe = crtc->pipe;
> > +	enum port port = encoder->port;
> >  	uint32_t tmp, eldv;
> >  	i915_reg_t aud_config, aud_cntrl_st2;
> >  
> > @@ -485,7 +503,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *intel_encoder)
> >  	tmp |= AUD_CONFIG_N_PROG_ENABLE;
> >  	tmp &= ~AUD_CONFIG_UPPER_N_MASK;
> >  	tmp &= ~AUD_CONFIG_LOWER_N_MASK;
> > -	if (intel_crtc_has_dp_encoder(intel_crtc->config))
> > +	if (intel_crtc_has_dp_encoder(old_crtc_state))
> >  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >  	I915_WRITE(aud_config, tmp);
> >  
> > @@ -497,14 +515,15 @@ static void ilk_audio_codec_disable(struct intel_encoder *intel_encoder)
> >  	I915_WRITE(aud_cntrl_st2, tmp);
> >  }
> >  
> > -static void ilk_audio_codec_enable(struct drm_connector *connector,
> > -				   struct intel_encoder *intel_encoder,
> > -				   const struct drm_display_mode *adjusted_mode)
> > +static void ilk_audio_codec_enable(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(connector->dev);
> > -	struct intel_crtc *intel_crtc = to_intel_crtc(intel_encoder->base.crtc);
> > -	enum pipe pipe = intel_crtc->pipe;
> > -	enum port port = intel_encoder->port;
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> > +	struct drm_connector *connector = conn_state->connector;
> > +	enum pipe pipe = crtc->pipe;
> > +	enum port port = encoder->port;
> >  	uint8_t *eld = connector->eld;
> >  	uint32_t tmp, eldv;
> >  	int len, i;
> > @@ -568,36 +587,36 @@ static void ilk_audio_codec_enable(struct drm_connector *connector,
> >  	tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> >  	tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> >  	tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> > -	if (intel_crtc_has_dp_encoder(intel_crtc->config))
> > +	if (intel_crtc_has_dp_encoder(crtc_state))
> >  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >  	else
> > -		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> > +		tmp |= audio_config_hdmi_pixel_clock(crtc_state);
> >  	I915_WRITE(aud_config, tmp);
> >  }
> >  
> >  /**
> >   * intel_audio_codec_enable - Enable the audio codec for HD audio
> > - * @intel_encoder: encoder on which to enable audio
> > + * @encoder: encoder on which to enable audio
> >   * @crtc_state: pointer to the current crtc state.
> >   * @conn_state: pointer to the current connector state.
> >   *
> >   * The enable sequences may only be performed after enabling the transcoder and
> >   * port, and after completed link training.
> >   */
> > -void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
> > +void intel_audio_codec_enable(struct intel_encoder *encoder,
> >  			      const struct intel_crtc_state *crtc_state,
> >  			      const struct drm_connector_state *conn_state)
> >  {
> > -	struct drm_encoder *encoder = &intel_encoder->base;
> > -	const struct drm_display_mode *adjusted_mode = &crtc_state->base.adjusted_mode;
> > -	struct drm_connector *connector;
> > -	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct i915_audio_component *acomp = dev_priv->audio_component;
> > -	enum port port = intel_encoder->port;
> > -	enum pipe pipe = to_intel_crtc(crtc_state->base.crtc)->pipe;
> > +	struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
> > +	struct drm_connector *connector = conn_state->connector;
> > +	const struct drm_display_mode *adjusted_mode =
> > +		&crtc_state->base.adjusted_mode;
> > +	enum port port = encoder->port;
> > +	enum pipe pipe = crtc->pipe;
> >  
> > -	connector = conn_state->connector;
> > -	if (!connector || !connector->eld[0])
> > +	if (!connector->eld[0])
> >  		return;
> >  
> >  	DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
> > @@ -609,19 +628,20 @@ void intel_audio_codec_enable(struct intel_encoder *intel_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(connector, intel_encoder,
> > -						     adjusted_mode);
> > +		dev_priv->display.audio_codec_enable(encoder,
> > +						     crtc_state,
> > +						     conn_state);
> >  
> >  	mutex_lock(&dev_priv->av_mutex);
> > -	intel_encoder->audio_connector = connector;
> > +	encoder->audio_connector = connector;
> >  
> >  	/* referred in audio callbacks */
> > -	dev_priv->av_enc_map[pipe] = intel_encoder;
> > +	dev_priv->av_enc_map[pipe] = encoder;
> >  	mutex_unlock(&dev_priv->av_mutex);
> >  
> >  	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {
> >  		/* audio drivers expect pipe = -1 to indicate Non-MST cases */
> > -		if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
> > +		if (encoder->type != INTEL_OUTPUT_DP_MST)
> >  			pipe = -1;
> >  		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
> >  						 (int) port, (int) pipe);
> > @@ -629,36 +649,41 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
> >  
> >  	intel_lpe_audio_notify(dev_priv, pipe, port, connector->eld,
> >  			       crtc_state->port_clock,
> > -			       intel_encoder->type == INTEL_OUTPUT_DP);
> > +			       encoder->type == INTEL_OUTPUT_DP);
> >  }
> >  
> >  /**
> >   * intel_audio_codec_disable - Disable the audio codec for HD audio
> > - * @intel_encoder: encoder on which to disable audio
> > + * @encoder: encoder on which to disable audio
> > + * @crtc_state: pointer to the old crtc state.
> > + * @conn_state: pointer to the old connector state.
> >   *
> >   * The disable sequences must be performed before disabling the transcoder or
> >   * port.
> >   */
> > -void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
> > +void intel_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_encoder *encoder = &intel_encoder->base;
> > -	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
> > +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct i915_audio_component *acomp = dev_priv->audio_component;
> > -	enum port port = intel_encoder->port;
> > -	struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
> > +	struct intel_crtc *crtc = to_intel_crtc(old_crtc_state->base.crtc);
> > +	enum port port = encoder->port;
> >  	enum pipe pipe = crtc->pipe;
> >  
> >  	if (dev_priv->display.audio_codec_disable)
> > -		dev_priv->display.audio_codec_disable(intel_encoder);
> > +		dev_priv->display.audio_codec_disable(encoder,
> > +						      old_crtc_state,
> > +						      old_conn_state);
> >  
> >  	mutex_lock(&dev_priv->av_mutex);
> > -	intel_encoder->audio_connector = NULL;
> > +	encoder->audio_connector = NULL;
> >  	dev_priv->av_enc_map[pipe] = NULL;
> >  	mutex_unlock(&dev_priv->av_mutex);
> >  
> >  	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {
> >  		/* audio drivers expect pipe = -1 to indicate Non-MST cases */
> > -		if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
> > +		if (encoder->type != INTEL_OUTPUT_DP_MST)
> >  			pipe = -1;
> >  		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
> >  						 (int) port, (int) pipe);
> > @@ -793,10 +818,9 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port,
> >  						int pipe, int rate)
> >  {
> >  	struct drm_i915_private *dev_priv = kdev_to_i915(kdev);
> > -	struct intel_encoder *intel_encoder;
> > -	struct intel_crtc *crtc;
> > -	struct drm_display_mode *adjusted_mode;
> >  	struct i915_audio_component *acomp = dev_priv->audio_component;
> > +	struct intel_encoder *encoder;
> > +	struct intel_crtc *crtc;
> >  	int err = 0;
> >  
> >  	if (!HAS_DDI(dev_priv))
> > @@ -806,23 +830,19 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port,
> >  	mutex_lock(&dev_priv->av_mutex);
> >  
> >  	/* 1. get the pipe */
> > -	intel_encoder = get_saved_enc(dev_priv, port, pipe);
> > -	if (!intel_encoder || !intel_encoder->base.crtc) {
> > +	encoder = get_saved_enc(dev_priv, port, pipe);
> > +	if (!encoder || !encoder->base.crtc) {
> >  		DRM_DEBUG_KMS("Not valid for port %c\n", port_name(port));
> >  		err = -ENODEV;
> >  		goto unlock;
> >  	}
> >  
> > -	/* pipe passed from the audio driver will be -1 for Non-MST case */
> > -	crtc = to_intel_crtc(intel_encoder->base.crtc);
> > -	pipe = crtc->pipe;
> > -
> > -	adjusted_mode = &crtc->config->base.adjusted_mode;
> > +	crtc = to_intel_crtc(encoder->base.crtc);
> >  
> >  	/* port must be valid now, otherwise the pipe will be invalid */
> >  	acomp->aud_sample_rate[port] = rate;
> >  
> > -	hsw_audio_config_update(crtc, port, adjusted_mode);
> > +	hsw_audio_config_update(encoder, crtc->config);
> >  
> >   unlock:
> >  	mutex_unlock(&dev_priv->av_mutex);
> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> > index eb8f4e3bb85f..ace674cd79b9 100644
> > --- a/drivers/gpu/drm/i915/intel_ddi.c
> > +++ b/drivers/gpu/drm/i915/intel_ddi.c
> > @@ -2425,7 +2425,8 @@ static void intel_disable_ddi_dp(struct intel_encoder *encoder,
> >  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> >  
> >  	if (old_crtc_state->has_audio)
> > -		intel_audio_codec_disable(encoder);
> > +		intel_audio_codec_disable(encoder,
> > +					  old_crtc_state, old_conn_state);
> >  
> >  	intel_edp_drrs_disable(intel_dp, old_crtc_state);
> >  	intel_psr_disable(intel_dp, old_crtc_state);
> > @@ -2437,7 +2438,8 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder,
> >  				   const struct drm_connector_state *old_conn_state)
> >  {
> >  	if (old_crtc_state->has_audio)
> > -		intel_audio_codec_disable(encoder);
> > +		intel_audio_codec_disable(encoder,
> > +					  old_crtc_state, old_conn_state);
> >  
> >  	intel_hdmi_handle_sink_scrambling(encoder,
> >  					  old_conn_state->connector,
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index f0c49962ffbe..d27c0145ac91 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -2708,7 +2708,8 @@ static void intel_disable_dp(struct intel_encoder *encoder,
> >  	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> >  
> >  	if (old_crtc_state->has_audio)
> > -		intel_audio_codec_disable(encoder);
> > +		intel_audio_codec_disable(encoder,
> > +					  old_crtc_state, old_conn_state);
> >  
> >  	/* Make sure the panel is off before trying to change the mode. But also
> >  	 * ensure that we have vdd while we switch off the panel. */
> > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c
> > index 6f11bb35f66f..653ca39789b8 100644
> > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > @@ -149,7 +149,8 @@ static void intel_mst_disable_dp(struct intel_encoder *encoder,
> >  		DRM_ERROR("failed to update payload %d\n", ret);
> >  	}
> >  	if (old_crtc_state->has_audio)
> > -		intel_audio_codec_disable(encoder);
> > +		intel_audio_codec_disable(encoder,
> > +					  old_crtc_state, old_conn_state);
> >  }
> >  
> >  static void intel_mst_post_disable_dp(struct intel_encoder *encoder,
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index 4498d743cebc..4b807303415b 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -1311,7 +1311,9 @@ void intel_init_audio_hooks(struct drm_i915_private *dev_priv);
> >  void intel_audio_codec_enable(struct intel_encoder *encoder,
> >  			      const struct intel_crtc_state *crtc_state,
> >  			      const struct drm_connector_state *conn_state);
> > -void intel_audio_codec_disable(struct intel_encoder *encoder);
> > +void intel_audio_codec_disable(struct intel_encoder *encoder,
> > +			      const struct intel_crtc_state *old_crtc_state,
> > +			      const struct drm_connector_state *old_conn_state);
> >  void i915_audio_component_init(struct drm_i915_private *dev_priv);
> >  void i915_audio_component_cleanup(struct drm_i915_private *dev_priv);
> >  void intel_audio_init(struct drm_i915_private *dev_priv);
> > diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> > index fe46abfeba26..fa1c793a21ef 100644
> > --- a/drivers/gpu/drm/i915/intel_hdmi.c
> > +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> > @@ -1206,7 +1206,8 @@ static void g4x_disable_hdmi(struct intel_encoder *encoder,
> >  			     const struct drm_connector_state *old_conn_state)
> >  {
> >  	if (old_crtc_state->has_audio)
> > -		intel_audio_codec_disable(encoder);
> > +		intel_audio_codec_disable(encoder,
> > +					  old_crtc_state, old_conn_state);
> >  
> >  	intel_disable_hdmi(encoder, old_crtc_state, old_conn_state);
> >  }
> > @@ -1216,7 +1217,8 @@ static void pch_disable_hdmi(struct intel_encoder *encoder,
> >  			     const struct drm_connector_state *old_conn_state)
> >  {
> >  	if (old_crtc_state->has_audio)
> > -		intel_audio_codec_disable(encoder);
> > +		intel_audio_codec_disable(encoder,
> > +					  old_crtc_state, old_conn_state);
> >  }
> >  
> >  static void pch_post_disable_hdmi(struct intel_encoder *encoder,
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux