drm/i915/hsw: Add display Audio codec disable sequence for Haswell
Subsystems (2)
PATCH v3 1/2 drm/i915/hsw: Add display Audio codec disable sequence for Haswell
From: Mukesh <[email protected]>
The code defines a new function intel_disable_audio() to implement the entire audio codec disable sequence, called by intel_disable_ddi() in DDI port disablement. This audio codec disbale sequence is implemented as per the recommendation of the Bspec.
[Patch modified by Mendong to apply to both HDMI and DP port.]
drivers/gpu/drm/i915/intel_ddi.c +46 -10
@@ -1088,6 +1088,50 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)I915_WRITE (PORT_CLK_SEL (port),PORT_CLK_SEL_NONE ); } +/* audio codec disable sequence, as per Bspec */ +void intel_disable_audio (struct intel_encoder *intel_encoder) +{ +int type = intel_encoder->type; +struct drm_encoder *encoder = &intel_encoder->base; +struct drm_device *dev = encoder->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); +int pipe = intel_crtc->pipe; +int aud_config =HSW_AUD_CFG (pipe); +u32 temp; + +/* need not disable sample fabrication because never enabled */ + +/* disable timestamps */ + temp =I915_READ (aud_config); +if (type ==INTEL_OUTPUT_HDMI ) + temp &= ~AUD_CONFIG_N_VALUE_INDEX ; +else if (type ==INTEL_OUTPUT_DISPLAYPORT ) + temp |=AUD_CONFIG_N_VALUE_INDEX ; +else +return ; + temp |=AUD_CONFIG_N_PROG_ENABLE ; + temp &= ~(AUD_CONFIG_UPPER_N_VALUE |AUD_CONFIG_LOWER_N_VALUE ); +I915_WRITE (aud_config, temp); +POSTING_READ (aud_config); + +/* Disable ELDV and ELD buffer */ + temp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); + temp &= ~(AUDIO_ELD_VALID_A << (pipe *4 )); +I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , temp); +POSTING_READ (HSW_AUD_PIN_ELD_CP_VLD ); + +/* Wait for 2 vertical blanks */ +intel_wait_for_vblank (dev, pipe); +intel_wait_for_vblank (dev, pipe); + +/* Disable audio PD. This is optional as per Bspec. */ + temp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); + temp &= ~(AUDIO_OUTPUT_ENABLE_A << (pipe *4 )); +I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , temp); +POSTING_READ (HSW_AUD_PIN_ELD_CP_VLD ); +} +static void intel_enable_ddi (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base;
@@ -1132,18 +1176,10 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)struct drm_encoder *encoder = &intel_encoder->base;struct drm_crtc *crtc = encoder->crtc;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe;int type = intel_encoder->type; -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -uint32_t tmp; -if (intel_crtc->eld_vld && type !=INTEL_OUTPUT_EDP ) { - tmp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); - tmp &= ~((AUDIO_OUTPUT_ENABLE_A |AUDIO_ELD_VALID_A ) << - (pipe *4 )); -I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , tmp); - } +if (intel_crtc->eld_vld && type !=INTEL_OUTPUT_EDP ) +intel_disable_audio (intel_encoder);if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);
Signature · 1 line
1.8.1.2
Hi,
Is it okay to integrate this patch at first?
We can check whether vblank wait can be removed safely later
Thanks
Mengdong
Quoted 99 lines
-----Original Message-----
From: Lin, Mengdong
Sent: Tuesday, September 24, 2013 1:01 PM
To: [email protected]
Cc: Arora, MukeshX; Lin, Mengdong
Subject: [PATCH v3 1/2] drm/i915/hsw: Add display Audio codec disable sequence for HaswellFrom: Mukesh <[email protected]>
The code defines a new function
intel_disable_audio()to implement the entire audio codec disable sequence, called byintel_disable_ddi()in DDI port disablement. This audio codec disbale sequence is implemented as per the recommendation of the Bspec.[Patch modified by Mendong to apply to both HDMI and DP port.]
Signed-off-by Mukesh Arora <[email protected]>Signed-off-by Mengdong Lin <[email protected]>Reviewed-by Ben Widawsky <[email protected]>drivers/gpu/drm/i915/intel_ddi.c +44
-0@@ -1088,6 +1088,50 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)I915_WRITE (PORT_CLK_SEL (port ),PORT_CLK_SEL_NONE ); } +/* audio codec disable sequence, as per Bspec */ void +intel_disable_audio (struct intel_encoder *intel_encoder) { +int type = intel_encoder->type; +struct drm_encoder *encoder = &intel_encoder->base; +struct drm_device *dev = encoder->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); +int pipe = intel_crtc->pipe; +int aud_config =HSW_AUD_CFG (pipe); +u32 temp; + +/* need not disable sample fabrication because never enabled */ + +/* disable timestamps */ + temp =I915_READ (aud_config); +if (type ==INTEL_OUTPUT_HDMI ) + temp &= ~AUD_CONFIG_N_VALUE_INDEX ; +else if (type ==INTEL_OUTPUT_DISPLAYPORT ) + temp |=AUD_CONFIG_N_VALUE_INDEX ; +else +return ; + temp |=AUD_CONFIG_N_PROG_ENABLE ; + temp &= ~(AUD_CONFIG_UPPER_N_VALUE |AUD_CONFIG_LOWER_N_VALUE ); +I915_WRITE (aud_config, temp); +POSTING_READ (aud_config); + +/* Disable ELDV and ELD buffer */ + temp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); + temp &= ~(AUDIO_ELD_VALID_A << (pipe *4 )); +I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , temp); +POSTING_READ (HSW_AUD_PIN_ELD_CP_VLD ); + +/* Wait for 2 vertical blanks */ +intel_wait_for_vblank (dev, pipe); +intel_wait_for_vblank (dev, pipe); + +/* Disable audio PD. This is optional as per Bspec. */ + temp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); + temp &= ~(AUDIO_OUTPUT_ENABLE_A << (pipe *4 )); +I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , temp); +POSTING_READ (HSW_AUD_PIN_ELD_CP_VLD ); +} +static void intel_enable_ddi (struct intel_encoder *intel_encoder) { struct drm_encoder *encoder = &intel_encoder->base; @@ -1132,18 +1176,10 @@ static void intel_disable_ddi(struct intel_encoder
*intel_encoder)drivers/gpu/drm/i915/intel_ddi.c +2
-11struct drm_encoder *encoder = &intel_encoder->base;struct drm_crtc *crtc = encoder->crtc;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe;int type = intel_encoder->type; -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -uint32_t tmp; -if (intel_crtc->eld_vld && type !=INTEL_OUTPUT_EDP ) { - tmp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); - tmp &= ~((AUDIO_OUTPUT_ENABLE_A |AUDIO_ELD_VALID_A ) << - (pipe *4 )); -I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , tmp); - } +if (intel_crtc->eld_vld && type !=INTEL_OUTPUT_EDP ) +intel_disable_audio (intel_encoder);if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder); --1.8.1.2
Hi
2013/9/24 <[email protected]>:
Quoted 18 lines
From: Mukesh <[email protected]>
The code defines a new function
intel_disable_audio()to implement the entire audio codec disable sequence, called byintel_disable_ddi()in DDI port disablement. This audio codec disbale sequence is implemented as per the recommendation of the Bspec.[Patch modified by Mendong to apply to both HDMI and DP port.]
Signed-off-by Mukesh Arora <[email protected]>Signed-off-by Mengdong Lin <[email protected]>Reviewed-by Ben Widawsky <[email protected]>drivers/gpu/drm/i915/intel_ddi.c +0
-0
drivers/gpu/drm/i915/intel_ddi.c static void intel_ddi_post_disable(struct intel_encoder *intel_encoder) · line 1092
Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +2
-0@@ -1088,6 +1088,50 @@ static void intel_ddi_post_disable(struct intel_encoder *intel_encoder)I915_WRITE (PORT_CLK_SEL (port),PORT_CLK_SEL_NONE ); } +/* audio codec disable sequence, as per Bspec */ +void intel_disable_audio (struct intel_encoder *intel_encoder)
This needs to be static. I'd also rename it to "intel_ddi_disable_audio" or "hsw_disable_audio" or something that suggests we're doing this for DDI/HSW only.
With this fixed: Reviewed-by: Paulo Zanoni <[email protected]>
Quoted 73 lines
drivers/gpu/drm/i915/intel_ddi.c +44
-11+{ +int type = intel_encoder->type; +struct drm_encoder *encoder = &intel_encoder->base; +struct drm_device *dev = encoder->dev; +struct drm_i915_private *dev_priv = dev->dev_private; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); +int pipe = intel_crtc->pipe; +int aud_config =HSW_AUD_CFG (pipe); +u32 temp; + +/* need not disable sample fabrication because never enabled */ + +/* disable timestamps */ + temp =I915_READ (aud_config); +if (type ==INTEL_OUTPUT_HDMI ) + temp &= ~AUD_CONFIG_N_VALUE_INDEX ; +else if (type ==INTEL_OUTPUT_DISPLAYPORT ) + temp |=AUD_CONFIG_N_VALUE_INDEX ; +else +return ; + temp |=AUD_CONFIG_N_PROG_ENABLE ; + temp &= ~(AUD_CONFIG_UPPER_N_VALUE |AUD_CONFIG_LOWER_N_VALUE ); +I915_WRITE (aud_config, temp); +POSTING_READ (aud_config); + +/* Disable ELDV and ELD buffer */ + temp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); + temp &= ~(AUDIO_ELD_VALID_A << (pipe *4 )); +I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , temp); +POSTING_READ (HSW_AUD_PIN_ELD_CP_VLD ); + +/* Wait for 2 vertical blanks */ +intel_wait_for_vblank (dev, pipe); +intel_wait_for_vblank (dev, pipe); + +/* Disable audio PD. This is optional as per Bspec. */ + temp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); + temp &= ~(AUDIO_OUTPUT_ENABLE_A << (pipe *4 )); +I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , temp); +POSTING_READ (HSW_AUD_PIN_ELD_CP_VLD ); +} +static void intel_enable_ddi (struct intel_encoder *intel_encoder) {struct drm_encoder *encoder = &intel_encoder->base;@@ -1132,18 +1176,10 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)struct drm_encoder *encoder = &intel_encoder->base;struct drm_crtc *crtc = encoder->crtc;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -int pipe = intel_crtc->pipe;int type = intel_encoder->type; -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -uint32_t tmp; -if (intel_crtc->eld_vld && type !=INTEL_OUTPUT_EDP ) { - tmp =I915_READ (HSW_AUD_PIN_ELD_CP_VLD ); - tmp &= ~((AUDIO_OUTPUT_ENABLE_A |AUDIO_ELD_VALID_A ) << - (pipe *4 )); -I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , tmp); - } +if (intel_crtc->eld_vld && type !=INTEL_OUTPUT_EDP ) +intel_disable_audio (intel_encoder);if (type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder); --1.8.1.2
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Paulo Zanoni