From: Todd Previte <tprevite@gmail.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/5] drm/i915: Displayport - Add function to check link status
Date: Tue, 8 Apr 2014 10:47:40 -0700 [thread overview]
Message-ID: <1396979263-3245-3-git-send-email-tprevite@gmail.com> (raw)
In-Reply-To: <1396979263-3245-1-git-send-email-tprevite@gmail.com>
Adds a function to check the link status across all lanes for Displayport.
This is functionality required to establish more fine-grained control over
the Displayport interface, both for operational reliability and
compliance testing.
Signed-off-by: Todd Previte <tprevite@gmail.com>
---
drivers/gpu/drm/i915/intel_dp.c | 61 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 64c9803..c865c32 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -38,6 +38,22 @@
#define DP_LINK_CHECK_TIMEOUT (10 * 1000)
+typedef enum {
+ LINK_TRAINING_STATUS_OK = 0,
+ LINK_TRAINING_CR_FAILED,
+ LINK_TRAINING_CR_COMPLETE,
+ LINK_TRAINING_CE_FAILED,
+ LINK_TRAINING_CE_COMPLETE,
+ LINK_TRAINING_STATUS_READ_FAILED
+} IntelDPLinkTrainingStatus;
+
+typedef enum {
+ DP_LINK_TRAINING_STATE_IDLE = 0,
+ DP_LINK_TRAINING_STATE_CLOCK_REC,
+ DP_LINK_TRAINING_STATE_CHANNEL_EQ,
+ DP_LINK_TRAINING_STATE_ADJUST
+} DPLinkTrainingState;
+
struct dp_link_dpll {
int link_bw;
struct dpll dpll;
@@ -2356,6 +2372,51 @@ intel_dp_set_signal_levels(struct intel_dp *intel_dp, uint32_t *DP)
*DP = (*DP & ~mask) | signal_levels;
}
+bool
+intel_dp_verify_link_status(DPLinkTrainingState state,
+ uint8_t lane_count,
+ uint8_t *link_status)
+{
+ uint32_t status = 0;
+ bool link_ok = false;
+ uint8_t ls[5];
+
+ switch (state) {
+ case DP_LINK_TRAINING_STATE_CLOCK_REC:
+ status = (link_status[0] & DP_LANE_CR_DONE) +
+ ((link_status[0] >> 4) & DP_LANE_CR_DONE) +
+ (link_status[1] & DP_LANE_CR_DONE) +
+ ((link_status[1] >> 4) & DP_LANE_CR_DONE);
+ // Valid CR status = sum of bits == lane count
+ link_ok = status == lane_count ? true : false;
+ break;
+ case DP_LINK_TRAINING_STATE_CHANNEL_EQ:
+ ls[0] = ((link_status[0] & DP_LANE_CHANNEL_EQ_DONE) >> 1) +
+ ((link_status[0] & DP_LANE_SYMBOL_LOCKED) >> 2);
+ ls[1] = (((link_status[0] >> 4) & DP_LANE_CHANNEL_EQ_DONE) >> 1) +
+ (((link_status[0] >> 4) & DP_LANE_SYMBOL_LOCKED) >> 2);
+ ls[2] = ((link_status[1] & DP_LANE_CHANNEL_EQ_DONE) >> 1) +
+ ((link_status[1] & DP_LANE_SYMBOL_LOCKED) >> 2);
+ ls[3] = (((link_status[1] >> 4) & DP_LANE_CHANNEL_EQ_DONE) >> 1) +
+ (((link_status[1] >> 4) & DP_LANE_SYMBOL_LOCKED) >> 2);
+ ls[4] = link_status[2] & DP_INTERLANE_ALIGN_DONE;
+ // Combine lane status - must equal active lane count
+ status = ls[0] + ls[1] + ls[2] + ls[3];
+ // CE status is all lanes + lane alignment (ls[4])
+ link_ok = (status == lane_count) && ls[4] ? true : false;
+ break;
+ default:
+ // Invalid state for checking link status
+ break;
+ }
+
+ if (!link_ok) {
+ // FIXME: Log failure here, detailed error status output
+ }
+
+ return link_ok;
+}
+
uint32_t
intel_dp_set_training_pattern(uint8_t training_pattern,
struct intel_dp *intel_dp)
--
1.8.3.2
next prev parent reply other threads:[~2014-04-08 17:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-08 17:47 [PATCH 0/5] RFC: Displayport Link Policy Maker Update Todd Previte
2014-04-08 17:47 ` [PATCH 1/5] dmr/i915: Displayport - Add a function to set the training pattern Todd Previte
2014-04-08 19:52 ` Paulo Zanoni
2014-04-08 17:47 ` Todd Previte [this message]
2014-04-08 17:47 ` [PATCH 3/5] drm/i915: Displayport - Add function to enable/disable scrambling on the main link Todd Previte
2014-04-08 17:47 ` [PATCH 4/5] drm/i915: Displayport - Add function for executing a single iteration of clock recovery Todd Previte
2014-04-08 17:47 ` [PATCH 5/5] drm/i915: Displayport - Add function to execute a single iteration of channel equalization Todd Previte
2014-04-09 13:26 ` [PATCH 0/5] RFC: Displayport Link Policy Maker Update Daniel Vetter
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=1396979263-3245-3-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