Re: [PATCH v2 14/18] drm/i915: enable audio codec after port

Rodrigo Vivi
2014-10-30T19:03:37Z

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

On Mon, Oct 27, 2014 at 7:26 AM, Jani Nikula <jani.nikula@intel.com> wrote:
> As per spec, and similar to DDI.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/i915/intel_dp.c | 13 ++++++++-----
> drivers/gpu/drm/i915/intel_hdmi.c | 15 +++++++--------
> 2 files changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index f4c3e19bb0e3..bd8385cc5e42 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1246,12 +1246,8 @@ static void intel_dp_prepare(struct intel_encoder *encoder)
> intel_dp->DP |= DP_VOLTAGE_0_4 | DP_PRE_EMPHASIS_0;
> intel_dp->DP |= DP_PORT_WIDTH(intel_dp->lane_count);
>
> - if (crtc->config.has_audio) {
> - DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n",
> - pipe_name(crtc->pipe));
> + if (crtc->config.has_audio)
> intel_dp->DP |= DP_AUDIO_OUTPUT_ENABLE;
> - intel_audio_codec_enable(encoder);
> - }
>
> /* Split out the IBX/CPU vs CPT settings */
>
> @@ -2541,6 +2537,7 @@ static void intel_enable_dp(struct intel_encoder *encoder)
> struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
> struct drm_device *dev = encoder->base.dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> + struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
> uint32_t dp_reg = I915_READ(intel_dp->output_reg);
>
> if (WARN_ON(dp_reg & DP_PORT_EN))
> @@ -2554,6 +2551,12 @@ static void intel_enable_dp(struct intel_encoder *encoder)
> intel_dp_start_link_train(intel_dp);
> intel_dp_complete_link_train(intel_dp);
> intel_dp_stop_link_train(intel_dp);
> +
> + if (crtc->config.has_audio) {
> + DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n",
> + pipe_name(crtc->pipe));
> + intel_audio_codec_enable(encoder);
> + }
> }
>
> static void g4x_enable_dp(struct intel_encoder *encoder)
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index f89f71e1f2ce..29baa53aef90 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -661,14 +661,6 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder)
> if (crtc->config.has_hdmi_sink)
> hdmi_val |= HDMI_MODE_SELECT_HDMI;
>
> - if (crtc->config.has_audio) {
> - WARN_ON(!crtc->config.has_hdmi_sink);
> - DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
> - pipe_name(crtc->pipe));
> - hdmi_val |= SDVO_AUDIO_ENABLE;
> - intel_audio_codec_enable(encoder);
> - }
> -
> if (HAS_PCH_CPT(dev))
> hdmi_val |= SDVO_PIPE_SEL_CPT(crtc->pipe);
> else if (IS_CHERRYVIEW(dev))
> @@ -791,6 +783,13 @@ static void intel_enable_hdmi(struct intel_encoder *encoder)
> I915_WRITE(intel_hdmi->hdmi_reg, temp);
> POSTING_READ(intel_hdmi->hdmi_reg);
> }
> +
> + if (intel_crtc->config.has_audio) {
> + WARN_ON(!intel_crtc->config.has_hdmi_sink);
> + DRM_DEBUG_DRIVER("Enabling HDMI audio on pipe %c\n",
> + pipe_name(intel_crtc->pipe));
> + intel_audio_codec_enable(encoder);
> + }
> }
>
> static void vlv_enable_hdmi(struct intel_encoder *encoder)
> --
> 2.1.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Rodrigo Vivi
Blog: http://blog.vivi.eng.br