From patchwork Tue Aug 28 22:06:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 1382811 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 4F2593FDF5 for ; Tue, 28 Aug 2012 22:17:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1EBC89E879 for ; Tue, 28 Aug 2012 15:17:15 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-yx0-f177.google.com (mail-yx0-f177.google.com [209.85.213.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 8BEF19EB1F for ; Tue, 28 Aug 2012 15:07:43 -0700 (PDT) Received: by mail-yx0-f177.google.com with SMTP id q9so1203648yen.36 for ; Tue, 28 Aug 2012 15:07:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=t8Yg6cO/dDExght4C6dbrYZwxb/iWIQ55Ppot8lH26o=; b=zzim6KL0OnpEYZyBt0ic8hdmvNHg/6oxlWOKQbePp42CLbwoZxE7FnZzR2GC/NM9sQ UIq/nsLiVZuEzgl9NUMnoZOsxqQBxN8rfzhlT6XKTulI24QHJ9foWU2RMWmlB05sDvDJ Sm6By2tAVKhh1wFwM9gPV96IoX/YLv7qR+7mPxm7HFeIP0zkyYqzUjjVWPxcYBrfdOqz SinsdUbFwb+eJfAAON9wr5VqM9ZDtyyeJIEG1jLXmaFFa8UgxQ/1uRCMG/SErHX5xk6S tsoUi3WGpC9qiXj4TTgP5zpYktqkAmF3Teek48n//wIybi/9cXLIVyxNjlyAaI3zyzkz 4uqQ== Received: by 10.236.108.194 with SMTP id q42mr15859027yhg.3.1346191663173; Tue, 28 Aug 2012 15:07:43 -0700 (PDT) Received: from vicky.domain.invalid (189.114.178.236.dynamic.adsl.gvt.net.br. [189.114.178.236]) by mx.google.com with ESMTPS id z3sm4434172anj.20.2012.08.28.15.07.41 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Aug 2012 15:07:42 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 28 Aug 2012 19:06:44 -0300 Message-Id: <1346191621-12996-14-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1346191621-12996-1-git-send-email-przanoni@gmail.com> References: <1346191621-12996-1-git-send-email-przanoni@gmail.com> Cc: Paulo Zanoni Subject: [Intel-gfx] [RFC 13/30] drm/i915: add intel_ddi_commit X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org From: Paulo Zanoni On DDI code we should only enable the DDI pipe registers after the link train, so adjust the code in a way that makes this possible. Also use intel_ddi_commit for the HDMI mode. Signed-off-by: Paulo Zanoni --- drivers/gpu/drm/i915/intel_ddi.c | 27 +++++++++++++++++++-------- drivers/gpu/drm/i915/intel_dp.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 2 ++ drivers/gpu/drm/i915/intel_hdmi.c | 2 +- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index 23ec6a2..151963e 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c @@ -787,14 +787,14 @@ bool intel_ddi_pll_mode_set(struct drm_crtc *crtc) return true; } -static void intel_ddi_enable_pipe(struct intel_encoder *intel_encoder, - struct drm_display_mode *adjusted_mode) +static void intel_ddi_enable_pipe(struct intel_encoder *intel_encoder) { struct drm_encoder *encoder = &intel_encoder->base; struct drm_device *dev = encoder->dev; struct drm_i915_private *dev_priv = dev->dev_private; struct drm_crtc *crtc = encoder->crtc; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); + struct drm_display_mode *mode = &crtc->mode; int port; int pipe = intel_crtc->pipe; u32 func_val, msa_val; @@ -836,9 +836,9 @@ static void intel_ddi_enable_pipe(struct intel_encoder *intel_encoder, intel_crtc->bpp); } - if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) + if (mode->flags & DRM_MODE_FLAG_PVSYNC) func_val |= PIPE_DDI_PVSYNC; - if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) + if (mode->flags & DRM_MODE_FLAG_PHSYNC) func_val |= PIPE_DDI_PHSYNC; if (intel_encoder->type == INTEL_OUTPUT_HDMI) { @@ -875,10 +875,10 @@ static void intel_ddi_enable_pipe(struct intel_encoder *intel_encoder, pipe_name(intel_crtc->pipe)); DRM_DEBUG_KMS("HDMI audio: write eld information\n"); - intel_write_eld(encoder, adjusted_mode); + intel_write_eld(encoder, mode); } - intel_hdmi->set_infoframes(encoder, adjusted_mode); + intel_hdmi->set_infoframes(encoder, mode); } else { if (intel_dp->has_audio) DRM_DEBUG_KMS("DP audio not supported yet\n"); @@ -929,8 +929,6 @@ void intel_ddi_mode_set(struct drm_encoder *encoder, intel_dp_init_link_config(intel_dp); } - - intel_ddi_enable_pipe(intel_encoder, adjusted_mode); } static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv, @@ -974,6 +972,19 @@ void intel_ddi_dpms(struct drm_encoder *encoder, int mode) intel_wait_ddi_buf_idle(dev_priv, port); } +void intel_ddi_commit(struct drm_encoder *encoder) +{ + struct intel_encoder *intel_encoder = to_intel_encoder(encoder); + + if (intel_encoder->type != INTEL_OUTPUT_HDMI) + intel_dp_commit(encoder); + + intel_ddi_enable_pipe(intel_encoder); + + if (intel_encoder->type == INTEL_OUTPUT_HDMI) + intel_ddi_dpms(encoder, DRM_MODE_DPMS_ON); +} + static void intel_ddi_disable_pipe(struct drm_i915_private *dev_priv, enum pipe pipe) { diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a7a5178..24c699a 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1265,7 +1265,7 @@ static void intel_dp_prepare(struct drm_encoder *encoder) intel_dp_link_down(intel_dp); } -static void intel_dp_commit(struct drm_encoder *encoder) +void intel_dp_commit(struct drm_encoder *encoder) { struct intel_dp *intel_dp = enc_to_intel_dp(encoder); struct drm_device *dev = encoder->dev; diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 1b9c549..f3f5b83 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -383,6 +383,7 @@ void intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode); extern void intel_dp_init_link_config(struct intel_dp *intel_dp); +extern void intel_dp_commit(struct drm_encoder *encoder); extern bool intel_dpd_is_edp(struct drm_device *dev); extern void intel_edp_link_config(struct intel_encoder *, int *, int *); extern int intel_edp_target_clock(struct intel_encoder *, @@ -533,5 +534,6 @@ extern void intel_ddi_mode_set(struct drm_encoder *encoder, struct drm_display_mode *adjusted_mode); extern void intel_ddi_pll_init(struct drm_device *dev); extern void intel_ddi_disable(struct drm_encoder *encoder); +extern void intel_ddi_commit(struct drm_encoder *encoder); #endif /* __INTEL_DRV_H__ */ diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index c56d213..ad58bec 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c @@ -853,7 +853,7 @@ static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs_hsw = { .mode_fixup = intel_hdmi_mode_fixup, .prepare = intel_encoder_prepare, .mode_set = intel_ddi_mode_set, - .commit = intel_encoder_commit, + .commit = intel_ddi_commit, .disable = intel_ddi_disable, };