diff mbox

[v2,1/2] drm/i915/dp: Enable DP audio stall fix for gen9 platforms

Message ID 1477369117-24627-2-git-send-email-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dhinakaran Pandiyan Oct. 25, 2016, 4:18 a.m. UTC
Enabling DP audio stall fix is necessary to play audio over DP HBR2. So,
let's set this bit right before enabling the audio codec. Playing audio
without setting this bit results in pipe FIFO underruns.

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h  |  5 +++++
 drivers/gpu/drm/i915/intel_ddi.c | 38 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_drv.h |  2 ++
 3 files changed, 45 insertions(+)

Comments

Jani Nikula Oct. 25, 2016, 8:47 a.m. UTC | #1
On Tue, 25 Oct 2016, Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> wrote:
> Enabling DP audio stall fix is necessary to play audio over DP HBR2. So,
> let's set this bit right before enabling the audio codec. Playing audio
> without setting this bit results in pipe FIFO underruns.
>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

The fix itself looks legit, but please move the enable to beginning of
hsw_audio_codec_enable and disable to end of hsw_audio_codec_disable in
intel_audio.c. Seems to me you don't have to have separate functions for
this, just add it inline there.

Is there a W/A name for this?


BR,
Jani.


> ---
>  drivers/gpu/drm/i915/i915_reg.h  |  5 +++++
>  drivers/gpu/drm/i915/intel_ddi.c | 38 ++++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h |  2 ++
>  3 files changed, 45 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 00efaa1..76dac48 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -6236,6 +6236,11 @@ enum {
>  #define SLICE_ECO_CHICKEN0			_MMIO(0x7308)
>  #define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)
>  
> +#define _CHICKEN_TRANS_A	0x420C0
> +#define _CHICKEN_TRANS_B	0x420C4
> +#define CHICKEN_TRANS(tran) _MMIO_TRANS(tran, _CHICKEN_TRANS_A, _CHICKEN_TRANS_B)
> +#define SPARE_13	(1<<13)
> +
>  /* WaCatErrorRejectionIssue */
>  #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		_MMIO(0x9030)
>  #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index fb18d69..84c91c1 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1858,6 +1858,38 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
>  	I915_WRITE(FDI_RX_CTL(PIPE_A), val);
>  }
>  
> +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)
> +{
> +	struct drm_i915_private *dev_priv =
> +		to_i915(pipe_config->base.crtc->dev);
> +	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
> +	uint32_t temp;
> +
> +	if (intel_crtc_has_dp_encoder(pipe_config) &&
> +	    pipe_config->port_clock >= 54000) {
> +
> +		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));
> +		temp |= SPARE_13;
> +		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);
> +	}
> +}
> +
> +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)
> +{
> +	struct drm_i915_private *dev_priv =
> +		to_i915(pipe_config->base.crtc->dev);
> +	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
> +	uint32_t temp;
> +
> +	if (intel_crtc_has_dp_encoder(pipe_config) &&
> +	    pipe_config->port_clock >= 54000) {
> +
> +		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));
> +		temp &= ~SPARE_13;
> +		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);
> +	}
> +}
> +
>  static void intel_enable_ddi(struct intel_encoder *intel_encoder,
>  			     struct intel_crtc_state *pipe_config,
>  			     struct drm_connector_state *conn_state)
> @@ -1893,6 +1925,9 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,
>  	}
>  
>  	if (intel_crtc->config->has_audio) {
> +		if (IS_GEN9(dev_priv))
> +			gen9_enable_dp_audio_stall_fix(pipe_config);
> +
>  		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
>  		intel_audio_codec_enable(intel_encoder);
>  	}
> @@ -1912,6 +1947,9 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,
>  	if (intel_crtc->config->has_audio) {
>  		intel_audio_codec_disable(intel_encoder);
>  		intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
> +
> +		if (IS_GEN9(dev_priv))
> +			gen9_disable_dp_audio_stall_fix(old_crtc_state);
>  	}
>  
>  	if (type == INTEL_OUTPUT_EDP) {
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 4e90b07..ef02c62 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1189,6 +1189,8 @@ unsigned int intel_fb_align_height(struct drm_device *dev,
>  				   uint64_t fb_format_modifier);
>  u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv,
>  			      uint64_t fb_modifier, uint32_t pixel_format);
> +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);
> +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);
>  
>  /* intel_audio.c */
>  void intel_init_audio_hooks(struct drm_i915_private *dev_priv);
Dhinakaran Pandiyan Oct. 25, 2016, 6:28 p.m. UTC | #2
On Tue, 2016-10-25 at 11:47 +0300, Jani Nikula wrote:
> On Tue, 25 Oct 2016, Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> wrote:

> > Enabling DP audio stall fix is necessary to play audio over DP HBR2. So,

> > let's set this bit right before enabling the audio codec. Playing audio

> > without setting this bit results in pipe FIFO underruns.

> >

> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

> 

> The fix itself looks legit, but please move the enable to beginning of

> hsw_audio_codec_enable and disable to end of hsw_audio_codec_disable in

> intel_audio.c. Seems to me you don't have to have separate functions for

> this, just add it inline there.

> 


I thought of it, but I didn't find any instances reading/writing of
non-audio registers in intel_audio.c. So, left these functions outside.



> Is there a W/A name for this?

> 

> 

> BR,

> Jani.

> 

> 


Not yet.

-DK

> > ---

> >  drivers/gpu/drm/i915/i915_reg.h  |  5 +++++

> >  drivers/gpu/drm/i915/intel_ddi.c | 38 ++++++++++++++++++++++++++++++++++++++

> >  drivers/gpu/drm/i915/intel_drv.h |  2 ++

> >  3 files changed, 45 insertions(+)

> >

> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h

> > index 00efaa1..76dac48 100644

> > --- a/drivers/gpu/drm/i915/i915_reg.h

> > +++ b/drivers/gpu/drm/i915/i915_reg.h

> > @@ -6236,6 +6236,11 @@ enum {

> >  #define SLICE_ECO_CHICKEN0			_MMIO(0x7308)

> >  #define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)

> >  

> > +#define _CHICKEN_TRANS_A	0x420C0

> > +#define _CHICKEN_TRANS_B	0x420C4

> > +#define CHICKEN_TRANS(tran) _MMIO_TRANS(tran, _CHICKEN_TRANS_A, _CHICKEN_TRANS_B)

> > +#define SPARE_13	(1<<13)

> > +

> >  /* WaCatErrorRejectionIssue */

> >  #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		_MMIO(0x9030)

> >  #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)

> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c

> > index fb18d69..84c91c1 100644

> > --- a/drivers/gpu/drm/i915/intel_ddi.c

> > +++ b/drivers/gpu/drm/i915/intel_ddi.c

> > @@ -1858,6 +1858,38 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,

> >  	I915_WRITE(FDI_RX_CTL(PIPE_A), val);

> >  }

> >  

> > +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)

> > +{

> > +	struct drm_i915_private *dev_priv =

> > +		to_i915(pipe_config->base.crtc->dev);

> > +	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;

> > +	uint32_t temp;

> > +

> > +	if (intel_crtc_has_dp_encoder(pipe_config) &&

> > +	    pipe_config->port_clock >= 54000) {

> > +

> > +		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));

> > +		temp |= SPARE_13;

> > +		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);

> > +	}

> > +}

> > +

> > +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)

> > +{

> > +	struct drm_i915_private *dev_priv =

> > +		to_i915(pipe_config->base.crtc->dev);

> > +	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;

> > +	uint32_t temp;

> > +

> > +	if (intel_crtc_has_dp_encoder(pipe_config) &&

> > +	    pipe_config->port_clock >= 54000) {

> > +

> > +		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));

> > +		temp &= ~SPARE_13;

> > +		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);

> > +	}

> > +}

> > +

> >  static void intel_enable_ddi(struct intel_encoder *intel_encoder,

> >  			     struct intel_crtc_state *pipe_config,

> >  			     struct drm_connector_state *conn_state)

> > @@ -1893,6 +1925,9 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,

> >  	}

> >  

> >  	if (intel_crtc->config->has_audio) {

> > +		if (IS_GEN9(dev_priv))

> > +			gen9_enable_dp_audio_stall_fix(pipe_config);

> > +

> >  		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);

> >  		intel_audio_codec_enable(intel_encoder);

> >  	}

> > @@ -1912,6 +1947,9 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,

> >  	if (intel_crtc->config->has_audio) {

> >  		intel_audio_codec_disable(intel_encoder);

> >  		intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);

> > +

> > +		if (IS_GEN9(dev_priv))

> > +			gen9_disable_dp_audio_stall_fix(old_crtc_state);

> >  	}

> >  

> >  	if (type == INTEL_OUTPUT_EDP) {

> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h

> > index 4e90b07..ef02c62 100644

> > --- a/drivers/gpu/drm/i915/intel_drv.h

> > +++ b/drivers/gpu/drm/i915/intel_drv.h

> > @@ -1189,6 +1189,8 @@ unsigned int intel_fb_align_height(struct drm_device *dev,

> >  				   uint64_t fb_format_modifier);

> >  u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv,

> >  			      uint64_t fb_modifier, uint32_t pixel_format);

> > +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);

> > +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);

> >  

> >  /* intel_audio.c */

> >  void intel_init_audio_hooks(struct drm_i915_private *dev_priv);

>
Daniel Vetter Oct. 26, 2016, 6:37 a.m. UTC | #3
On Mon, Oct 24, 2016 at 09:18:36PM -0700, Dhinakaran Pandiyan wrote:
> Enabling DP audio stall fix is necessary to play audio over DP HBR2. So,
> let's set this bit right before enabling the audio codec. Playing audio
> without setting this bit results in pipe FIFO underruns.

Please insert a full Bspec citation here so that we can find where this is
documented in the future. Both where in Bspec it is, and then just quote
the full text with the explanation and put that into the commit message.

Otherwise there's no way we'll ever find this again in the future.
-Daniel

> 
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h  |  5 +++++
>  drivers/gpu/drm/i915/intel_ddi.c | 38 ++++++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h |  2 ++
>  3 files changed, 45 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 00efaa1..76dac48 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -6236,6 +6236,11 @@ enum {
>  #define SLICE_ECO_CHICKEN0			_MMIO(0x7308)
>  #define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)
>  
> +#define _CHICKEN_TRANS_A	0x420C0
> +#define _CHICKEN_TRANS_B	0x420C4
> +#define CHICKEN_TRANS(tran) _MMIO_TRANS(tran, _CHICKEN_TRANS_A, _CHICKEN_TRANS_B)
> +#define SPARE_13	(1<<13)
> +
>  /* WaCatErrorRejectionIssue */
>  #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		_MMIO(0x9030)
>  #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index fb18d69..84c91c1 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1858,6 +1858,38 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
>  	I915_WRITE(FDI_RX_CTL(PIPE_A), val);
>  }
>  
> +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)
> +{
> +	struct drm_i915_private *dev_priv =
> +		to_i915(pipe_config->base.crtc->dev);
> +	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
> +	uint32_t temp;
> +
> +	if (intel_crtc_has_dp_encoder(pipe_config) &&
> +	    pipe_config->port_clock >= 54000) {
> +
> +		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));
> +		temp |= SPARE_13;
> +		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);
> +	}
> +}
> +
> +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)
> +{
> +	struct drm_i915_private *dev_priv =
> +		to_i915(pipe_config->base.crtc->dev);
> +	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
> +	uint32_t temp;
> +
> +	if (intel_crtc_has_dp_encoder(pipe_config) &&
> +	    pipe_config->port_clock >= 54000) {
> +
> +		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));
> +		temp &= ~SPARE_13;
> +		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);
> +	}
> +}
> +
>  static void intel_enable_ddi(struct intel_encoder *intel_encoder,
>  			     struct intel_crtc_state *pipe_config,
>  			     struct drm_connector_state *conn_state)
> @@ -1893,6 +1925,9 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,
>  	}
>  
>  	if (intel_crtc->config->has_audio) {
> +		if (IS_GEN9(dev_priv))
> +			gen9_enable_dp_audio_stall_fix(pipe_config);
> +
>  		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
>  		intel_audio_codec_enable(intel_encoder);
>  	}
> @@ -1912,6 +1947,9 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,
>  	if (intel_crtc->config->has_audio) {
>  		intel_audio_codec_disable(intel_encoder);
>  		intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
> +
> +		if (IS_GEN9(dev_priv))
> +			gen9_disable_dp_audio_stall_fix(old_crtc_state);
>  	}
>  
>  	if (type == INTEL_OUTPUT_EDP) {
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 4e90b07..ef02c62 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1189,6 +1189,8 @@ unsigned int intel_fb_align_height(struct drm_device *dev,
>  				   uint64_t fb_format_modifier);
>  u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv,
>  			      uint64_t fb_modifier, uint32_t pixel_format);
> +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);
> +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);
>  
>  /* intel_audio.c */
>  void intel_init_audio_hooks(struct drm_i915_private *dev_priv);
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Dhinakaran Pandiyan Oct. 26, 2016, 6:32 p.m. UTC | #4
On Wed, 2016-10-26 at 08:37 +0200, Daniel Vetter wrote:
> On Mon, Oct 24, 2016 at 09:18:36PM -0700, Dhinakaran Pandiyan wrote:

> > Enabling DP audio stall fix is necessary to play audio over DP HBR2. So,

> > let's set this bit right before enabling the audio codec. Playing audio

> > without setting this bit results in pipe FIFO underruns.

> 

> Please insert a full Bspec citation here so that we can find where this is

> documented in the future. Both where in Bspec it is, and then just quote

> the full text with the explanation and put that into the commit message.

> 

> Otherwise there's no way we'll ever find this again in the future.

> -Daniel

> 

This particular update has not landed in BSpec yet. I will update the
commit message and re-send the patches after they are reviewed.

> > 

> > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>

> > ---

> >  drivers/gpu/drm/i915/i915_reg.h  |  5 +++++

> >  drivers/gpu/drm/i915/intel_ddi.c | 38 ++++++++++++++++++++++++++++++++++++++

> >  drivers/gpu/drm/i915/intel_drv.h |  2 ++

> >  3 files changed, 45 insertions(+)

> > 

> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h

> > index 00efaa1..76dac48 100644

> > --- a/drivers/gpu/drm/i915/i915_reg.h

> > +++ b/drivers/gpu/drm/i915/i915_reg.h

> > @@ -6236,6 +6236,11 @@ enum {

> >  #define SLICE_ECO_CHICKEN0			_MMIO(0x7308)

> >  #define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)

> >  

> > +#define _CHICKEN_TRANS_A	0x420C0

> > +#define _CHICKEN_TRANS_B	0x420C4

> > +#define CHICKEN_TRANS(tran) _MMIO_TRANS(tran, _CHICKEN_TRANS_A, _CHICKEN_TRANS_B)

> > +#define SPARE_13	(1<<13)

> > +

> >  /* WaCatErrorRejectionIssue */

> >  #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		_MMIO(0x9030)

> >  #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)

> > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c

> > index fb18d69..84c91c1 100644

> > --- a/drivers/gpu/drm/i915/intel_ddi.c

> > +++ b/drivers/gpu/drm/i915/intel_ddi.c

> > @@ -1858,6 +1858,38 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,

> >  	I915_WRITE(FDI_RX_CTL(PIPE_A), val);

> >  }

> >  

> > +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)

> > +{

> > +	struct drm_i915_private *dev_priv =

> > +		to_i915(pipe_config->base.crtc->dev);

> > +	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;

> > +	uint32_t temp;

> > +

> > +	if (intel_crtc_has_dp_encoder(pipe_config) &&

> > +	    pipe_config->port_clock >= 54000) {

> > +

> > +		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));

> > +		temp |= SPARE_13;

> > +		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);

> > +	}

> > +}

> > +

> > +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)

> > +{

> > +	struct drm_i915_private *dev_priv =

> > +		to_i915(pipe_config->base.crtc->dev);

> > +	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;

> > +	uint32_t temp;

> > +

> > +	if (intel_crtc_has_dp_encoder(pipe_config) &&

> > +	    pipe_config->port_clock >= 54000) {

> > +

> > +		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));

> > +		temp &= ~SPARE_13;

> > +		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);

> > +	}

> > +}

> > +

> >  static void intel_enable_ddi(struct intel_encoder *intel_encoder,

> >  			     struct intel_crtc_state *pipe_config,

> >  			     struct drm_connector_state *conn_state)

> > @@ -1893,6 +1925,9 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder,

> >  	}

> >  

> >  	if (intel_crtc->config->has_audio) {

> > +		if (IS_GEN9(dev_priv))

> > +			gen9_enable_dp_audio_stall_fix(pipe_config);

> > +

> >  		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);

> >  		intel_audio_codec_enable(intel_encoder);

> >  	}

> > @@ -1912,6 +1947,9 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder,

> >  	if (intel_crtc->config->has_audio) {

> >  		intel_audio_codec_disable(intel_encoder);

> >  		intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);

> > +

> > +		if (IS_GEN9(dev_priv))

> > +			gen9_disable_dp_audio_stall_fix(old_crtc_state);

> >  	}

> >  

> >  	if (type == INTEL_OUTPUT_EDP) {

> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h

> > index 4e90b07..ef02c62 100644

> > --- a/drivers/gpu/drm/i915/intel_drv.h

> > +++ b/drivers/gpu/drm/i915/intel_drv.h

> > @@ -1189,6 +1189,8 @@ unsigned int intel_fb_align_height(struct drm_device *dev,

> >  				   uint64_t fb_format_modifier);

> >  u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv,

> >  			      uint64_t fb_modifier, uint32_t pixel_format);

> > +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);

> > +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);

> >  

> >  /* intel_audio.c */

> >  void intel_init_audio_hooks(struct drm_i915_private *dev_priv);

> > -- 

> > 2.7.4

> > 

> > _______________________________________________

> > Intel-gfx mailing list

> > Intel-gfx@lists.freedesktop.org

> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx

>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 00efaa1..76dac48 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -6236,6 +6236,11 @@  enum {
 #define SLICE_ECO_CHICKEN0			_MMIO(0x7308)
 #define   PIXEL_MASK_CAMMING_DISABLE		(1 << 14)
 
+#define _CHICKEN_TRANS_A	0x420C0
+#define _CHICKEN_TRANS_B	0x420C4
+#define CHICKEN_TRANS(tran) _MMIO_TRANS(tran, _CHICKEN_TRANS_A, _CHICKEN_TRANS_B)
+#define SPARE_13	(1<<13)
+
 /* WaCatErrorRejectionIssue */
 #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG		_MMIO(0x9030)
 #define  GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB	(1<<11)
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index fb18d69..84c91c1 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1858,6 +1858,38 @@  void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder,
 	I915_WRITE(FDI_RX_CTL(PIPE_A), val);
 }
 
+void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv =
+		to_i915(pipe_config->base.crtc->dev);
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	uint32_t temp;
+
+	if (intel_crtc_has_dp_encoder(pipe_config) &&
+	    pipe_config->port_clock >= 54000) {
+
+		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));
+		temp |= SPARE_13;
+		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);
+	}
+}
+
+void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config)
+{
+	struct drm_i915_private *dev_priv =
+		to_i915(pipe_config->base.crtc->dev);
+	enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+	uint32_t temp;
+
+	if (intel_crtc_has_dp_encoder(pipe_config) &&
+	    pipe_config->port_clock >= 54000) {
+
+		temp = I915_READ(CHICKEN_TRANS(cpu_transcoder));
+		temp &= ~SPARE_13;
+		I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp);
+	}
+}
+
 static void intel_enable_ddi(struct intel_encoder *intel_encoder,
 			     struct intel_crtc_state *pipe_config,
 			     struct drm_connector_state *conn_state)
@@ -1893,6 +1925,9 @@  static void intel_enable_ddi(struct intel_encoder *intel_encoder,
 	}
 
 	if (intel_crtc->config->has_audio) {
+		if (IS_GEN9(dev_priv))
+			gen9_enable_dp_audio_stall_fix(pipe_config);
+
 		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
 		intel_audio_codec_enable(intel_encoder);
 	}
@@ -1912,6 +1947,9 @@  static void intel_disable_ddi(struct intel_encoder *intel_encoder,
 	if (intel_crtc->config->has_audio) {
 		intel_audio_codec_disable(intel_encoder);
 		intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+
+		if (IS_GEN9(dev_priv))
+			gen9_disable_dp_audio_stall_fix(old_crtc_state);
 	}
 
 	if (type == INTEL_OUTPUT_EDP) {
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 4e90b07..ef02c62 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1189,6 +1189,8 @@  unsigned int intel_fb_align_height(struct drm_device *dev,
 				   uint64_t fb_format_modifier);
 u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv,
 			      uint64_t fb_modifier, uint32_t pixel_format);
+void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);
+void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config);
 
 /* intel_audio.c */
 void intel_init_audio_hooks(struct drm_i915_private *dev_priv);