[2/2] drm/i915: add dp mst judgement in hsw_audio_codec_enable

Submitted by libin.yang@linux.intel.com on Dec. 23, 2015, 6:50 a.m.

Details

Message ID 1450853447-16795-2-git-send-email-libin.yang@linux.intel.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

libin.yang@linux.intel.com Dec. 23, 2015, 6:50 a.m.
From: Libin Yang <libin.yang@linux.intel.com>

hsw platforms supports DP MST while ilk doesn't.
This patch fixes the bug.

Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_audio.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index 431487a0..f46fa7b 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -255,6 +255,11 @@  static void g4x_audio_codec_enable(struct drm_connector *connector,
 	I915_WRITE(G4X_AUD_CNTL_ST, tmp);
 }
 
+/* pipe type is DP SST or DP MST */
+#define intel_pipe_is_dp(intel_crtc) \
+	(intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) || \
+	 intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
+
 static void hsw_audio_codec_disable(struct intel_encoder *encoder)
 {
 	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
@@ -272,8 +277,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_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
-	    intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
+	if (intel_pipe_is_dp(intel_crtc))
 		tmp |= AUD_CONFIG_N_VALUE_INDEX;
 	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
 
@@ -339,7 +343,7 @@  static void hsw_audio_codec_enable(struct drm_connector *connector,
 	tmp = I915_READ(HSW_AUD_CFG(pipe));
 	tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
 	tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
-	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
+	if (intel_pipe_is_dp(intel_crtc))
 		tmp |= AUD_CONFIG_N_VALUE_INDEX;
 	else
 		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -486,8 +490,7 @@  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_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
-	    intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
+	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
 		tmp |= AUD_CONFIG_N_VALUE_INDEX;
 	else
 		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -526,8 +529,7 @@  void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
 	/* ELD Conn_Type */
 	connector->eld[5] &= ~(3 << 2);
-	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
-	    intel_pipe_has_type(crtc, INTEL_OUTPUT_DP_MST))
+	if (intel_pipe_is_dp(crtc))
 		connector->eld[5] |= (1 << 2);
 
 	connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;

Comments

On Wed, Dec 23, 2015 at 02:50:47PM +0800, libin.yang@linux.intel.com wrote:
> From: Libin Yang <libin.yang@linux.intel.com>
> 
> hsw platforms supports DP MST while ilk doesn't.
> This patch fixes the bug.
> 
> Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index 431487a0..f46fa7b 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -255,6 +255,11 @@ static void g4x_audio_codec_enable(struct drm_connector *connector,
>  	I915_WRITE(G4X_AUD_CNTL_ST, tmp);
>  }
>  
> +/* pipe type is DP SST or DP MST */
> +#define intel_pipe_is_dp(intel_crtc) \
> +	(intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) || \
> +	 intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> +

crtc->config->has_dp_encoder should be good enough for all platforms.

Though I have some plans to eliminate it, but that doesn't mean we can't
use it in the meantime.

>  static void hsw_audio_codec_disable(struct intel_encoder *encoder)
>  {
>  	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
> @@ -272,8 +277,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_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
> -	    intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> +	if (intel_pipe_is_dp(intel_crtc))
>  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
>  	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>  
> @@ -339,7 +343,7 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
>  	tmp = I915_READ(HSW_AUD_CFG(pipe));
>  	tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
>  	tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> -	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
> +	if (intel_pipe_is_dp(intel_crtc))
>  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
>  	else
>  		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> @@ -486,8 +490,7 @@ 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_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
> -	    intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> +	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
>  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
>  	else
>  		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> @@ -526,8 +529,7 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
>  
>  	/* ELD Conn_Type */
>  	connector->eld[5] &= ~(3 << 2);
> -	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
> -	    intel_pipe_has_type(crtc, INTEL_OUTPUT_DP_MST))
> +	if (intel_pipe_is_dp(crtc))
>  		connector->eld[5] |= (1 << 2);
>  
>  	connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
> -- 
> 1.9.1
Hi Ville,

> -----Original Message-----
> From: Ville Syrjälä [mailto:ville.syrjala@linux.intel.com]
> Sent: Tuesday, January 05, 2016 12:03 AM
> To: libin.yang@linux.intel.com
> Cc: intel-gfx@lists.freedesktop.org; conselvan2@gmail.com;
> tiwai@suse.de; jani.nikula@linux.intel.com; Vetter, Daniel; Yang, Libin
> Subject: Re: [PATCH 2/2] drm/i915: add dp mst judgement in
> hsw_audio_codec_enable
> 
> On Wed, Dec 23, 2015 at 02:50:47PM +0800, libin.yang@linux.intel.com
> wrote:
> > From: Libin Yang <libin.yang@linux.intel.com>
> >
> > hsw platforms supports DP MST while ilk doesn't.
> > This patch fixes the bug.
> >
> > Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_audio.c | 16 +++++++++-------
> >  1 file changed, 9 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> b/drivers/gpu/drm/i915/intel_audio.c
> > index 431487a0..f46fa7b 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -255,6 +255,11 @@ static void g4x_audio_codec_enable(struct
> drm_connector *connector,
> >  	I915_WRITE(G4X_AUD_CNTL_ST, tmp);
> >  }
> >
> > +/* pipe type is DP SST or DP MST */
> > +#define intel_pipe_is_dp(intel_crtc) \
> > +	(intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)
> || \
> > +	 intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> > +
> 
> crtc->config->has_dp_encoder should be good enough for all platforms.
> 
> Though I have some plans to eliminate it, but that doesn't mean we can't
> use it in the meantime.

Thanks. I have verified your method and it works. I will send the refined
patches.

Regards,
Libin

> 
> >  static void hsw_audio_codec_disable(struct intel_encoder *encoder)
> >  {
> >  	struct drm_i915_private *dev_priv = encoder->base.dev-
> >dev_private;
> > @@ -272,8 +277,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_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)
> ||
> > -	    intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> > +	if (intel_pipe_is_dp(intel_crtc))
> >  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >  	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >
> > @@ -339,7 +343,7 @@ static void hsw_audio_codec_enable(struct
> drm_connector *connector,
> >  	tmp = I915_READ(HSW_AUD_CFG(pipe));
> >  	tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> >  	tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> > -	if (intel_pipe_has_type(intel_crtc,
> INTEL_OUTPUT_DISPLAYPORT))
> > +	if (intel_pipe_is_dp(intel_crtc))
> >  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >  	else
> >  		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> > @@ -486,8 +490,7 @@ 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_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT)
> ||
> > -	    intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> > +	if (intel_pipe_has_type(intel_crtc,
> INTEL_OUTPUT_DISPLAYPORT))
> >  		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >  	else
> >  		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> > @@ -526,8 +529,7 @@ void intel_audio_codec_enable(struct
> intel_encoder *intel_encoder)
> >
> >  	/* ELD Conn_Type */
> >  	connector->eld[5] &= ~(3 << 2);
> > -	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
> > -	    intel_pipe_has_type(crtc, INTEL_OUTPUT_DP_MST))
> > +	if (intel_pipe_is_dp(crtc))
> >  		connector->eld[5] |= (1 << 2);
> >
> >  	connector->eld[6] = drm_av_sync_delay(connector,
> adjusted_mode) / 2;
> > --
> > 1.9.1
> 
> --
> Ville Syrjälä
> Intel OTC