public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Todd Previte <tprevite@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH] drm/i915: Change order of operations for VLV/CHV to not train DP link before PHYs are ready
Date: Thu,  9 Oct 2014 09:37:12 -0700	[thread overview]
Message-ID: <1412872632-49802-1-git-send-email-tprevite@gmail.com> (raw)

Reorder the function calls in chv/vlv_pre_enable_dp() such that link training is not initiated
before the PHYs come up out of reset. Also check the status of vlv_wait_port_ready() and
only attempt to train if the PHYs are actually running.

The specification lists the wait for the PHYs as one of the final steps in enabling
the Displayport hardware for use.  While the PHYs are in reset, no communication is p
ossible across the link. Attempting to train the link while the PHYs are in reset will
result in link training failure with one or more WARN() in the logs. Moving the
intel_enable_dp() function after vlv_wait_port_ready() and only when the PHYs are ready
helps ensure reliable operation of the Displayport link.

Signed-off-by: Todd Previte <tprevite@gmail.com>
---
 drivers/gpu/drm/i915/intel_display.c |  8 ++++++--
 drivers/gpu/drm/i915/intel_dp.c      | 10 ++++------
 drivers/gpu/drm/i915/intel_drv.h     |  2 +-
 3 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index c51d950..4b280c1 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -1723,7 +1723,7 @@ static void chv_disable_pll(struct drm_i915_private *dev_priv, enum pipe pipe)
 	mutex_unlock(&dev_priv->dpio_lock);
 }
 
-void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
+int vlv_wait_port_ready(struct drm_i915_private *dev_priv,
 		struct intel_digital_port *dport)
 {
 	u32 port_mask;
@@ -1746,9 +1746,13 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
 		BUG();
 	}
 
-	if (wait_for((I915_READ(dpll_reg) & port_mask) == 0, 1000))
+	if (wait_for((I915_READ(dpll_reg) & port_mask) == 0, 1000)) {
 		WARN(1, "timed out waiting for port %c ready: 0x%08x\n",
 		     port_name(dport->port), I915_READ(dpll_reg));
+		return -EIO;
+	}
+
+	return 0;
 }
 
 static void intel_prepare_shared_dpll(struct intel_crtc *crtc)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index a8352c4..ada8b07 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2705,9 +2705,8 @@ static void vlv_pre_enable_dp(struct intel_encoder *encoder)
 		pps_unlock(intel_dp);
 	}
 
-	intel_enable_dp(encoder);
-
-	vlv_wait_port_ready(dev_priv, dport);
+	if (vlv_wait_port_ready(dev_priv, dport) == 0)
+	    intel_enable_dp(encoder);
 }
 
 static void vlv_dp_pre_pll_enable(struct intel_encoder *encoder)
@@ -2805,9 +2804,8 @@ static void chv_pre_enable_dp(struct intel_encoder *encoder)
 		pps_unlock(intel_dp);
 	}
 
-	intel_enable_dp(encoder);
-
-	vlv_wait_port_ready(dev_priv, dport);
+	if (vlv_wait_port_ready(dev_priv, dport) == 0)
+	    intel_enable_dp(encoder);
 }
 
 static void chv_dp_pre_pll_enable(struct intel_encoder *encoder)
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index dc80444..2ff2c8c 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -876,7 +876,7 @@ intel_wait_for_vblank(struct drm_device *dev, int pipe)
 	drm_wait_one_vblank(dev, pipe);
 }
 int ironlake_get_lanes_required(int target_clock, int link_bw, int bpp);
-void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
+int vlv_wait_port_ready(struct drm_i915_private *dev_priv,
 			 struct intel_digital_port *dport);
 bool intel_get_load_detect_pipe(struct drm_connector *connector,
 				struct drm_display_mode *mode,
-- 
1.9.1

             reply	other threads:[~2014-10-09 16:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-09 16:37 Todd Previte [this message]
2014-10-10  8:04 ` [PATCH] drm/i915: Change order of operations for VLV/CHV to not train DP link before PHYs are ready Jani Nikula
2014-10-11  0:18   ` Todd Previte
2014-10-17 18:41   ` [PATCH V2] " Todd Previte
2014-10-17 18:41     ` [PATCH 2/3] " Todd Previte
2014-10-22  7:17       ` Ville Syrjälä
2014-10-21 14:41     ` [PATCH V2] " Daniel Vetter
2014-10-22 15:21       ` Todd Previte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412872632-49802-1-git-send-email-tprevite@gmail.com \
    --to=tprevite@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox