From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: nouveau@lists.freedesktop.org,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
xorg-driver-ati@lists.x.org,
Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH 04/10] drm/nouveau: use the cr_ok/chanel_eq_ok helpers
Date: Thu, 18 Oct 2012 10:15:26 +0200 [thread overview]
Message-ID: <1350548132-3037-5-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1350548132-3037-1-git-send-email-daniel.vetter@ffwll.ch>
Only compile-tested, due to a lack of nouveau dp hw. Should be
equivalent code though.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/nouveau/nouveau_dp.c | 26 +++++---------------------
1 file changed, 5 insertions(+), 21 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c
index e754aa3..60d561e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dp.c
@@ -298,7 +298,7 @@ dp_link_train_cr(struct drm_device *dev, struct dp_state *dp)
{
bool cr_done = false, abort = false;
int voltage = dp->conf[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
- int tries = 0, i;
+ int tries = 0;
dp_set_training_pattern(dev, dp, DP_TRAINING_PATTERN_1);
@@ -307,16 +307,7 @@ dp_link_train_cr(struct drm_device *dev, struct dp_state *dp)
dp_link_train_update(dev, dp, 100))
break;
- cr_done = true;
- for (i = 0; i < dp->link_nr; i++) {
- u8 lane = (dp->stat[i >> 1] >> ((i & 1) * 4)) & 0xf;
- if (!(lane & DP_LANE_CR_DONE)) {
- cr_done = false;
- if (dp->conf[i] & DP_TRAIN_MAX_SWING_REACHED)
- abort = true;
- break;
- }
- }
+ cr_done = drm_dp_clock_recovery_ok(dp->stat, dp->link_nr);
if ((dp->conf[0] & DP_TRAIN_VOLTAGE_SWING_MASK) != voltage) {
voltage = dp->conf[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
@@ -331,7 +322,7 @@ static int
dp_link_train_eq(struct drm_device *dev, struct dp_state *dp)
{
bool eq_done, cr_done = true;
- int tries = 0, i;
+ int tries = 0;
dp_set_training_pattern(dev, dp, DP_TRAINING_PATTERN_2);
@@ -339,15 +330,8 @@ dp_link_train_eq(struct drm_device *dev, struct dp_state *dp)
if (dp_link_train_update(dev, dp, 400))
break;
- eq_done = !!(dp->stat[2] & DP_INTERLANE_ALIGN_DONE);
- for (i = 0; i < dp->link_nr && eq_done; i++) {
- u8 lane = (dp->stat[i >> 1] >> ((i & 1) * 4)) & 0xf;
- if (!(lane & DP_LANE_CR_DONE))
- cr_done = false;
- if (!(lane & DP_LANE_CHANNEL_EQ_DONE) ||
- !(lane & DP_LANE_SYMBOL_LOCKED))
- eq_done = false;
- }
+ eq_done = drm_dp_channel_eq_ok(dp->stat, dp->link_nr);
+ cr_done = drm_dp_clock_recovery_ok(dp->stat, dp->link_nr);
if (dp_link_train_commit(dev, dp))
break;
--
1.7.11.4
next prev parent reply other threads:[~2012-10-18 8:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-18 8:15 [PATCH 00/10] extract dp helper functions Daniel Vetter
2012-10-18 8:15 ` [PATCH 01/10] drm: rename drm_dp_i2c_helper.c to drm_dp_helper.c Daniel Vetter
[not found] ` <1350548132-3037-1-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2012-10-18 8:15 ` [PATCH 02/10] drm: dp helper: extract drm_dp_channel_eq_ok Daniel Vetter
2012-10-18 8:15 ` [PATCH 03/10] drm: dp helper: extract drm_dp_clock_recovery_ok Daniel Vetter
2012-10-18 8:15 ` [PATCH 06/10] drm/nouveau: use dp link train request helper Daniel Vetter
2012-10-18 8:15 ` [PATCH 09/10] drm: extract dp link bw helpers Daniel Vetter
2012-10-18 13:30 ` [PATCH 00/10] extract dp helper functions Alex Deucher
2012-10-22 21:30 ` Daniel Vetter
2012-10-18 13:48 ` Alex Deucher
[not found] ` <CADnq5_P_x00ZUNxo=d3NM2zxNxfPqS5inONaHY-8+MiRv7XRSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-18 14:12 ` Daniel Vetter
2012-10-18 8:15 ` Daniel Vetter [this message]
2012-10-18 8:15 ` [PATCH 05/10] drm: extract helpers to compute new training values from sink request Daniel Vetter
2012-10-18 8:15 ` [PATCH 07/10] drm: extract dp link train delay functions from radeon Daniel Vetter
[not found] ` <1350548132-3037-8-git-send-email-daniel.vetter-/w4YWyX8dFk@public.gmane.org>
2012-10-18 13:23 ` Alex Deucher
2012-10-18 13:32 ` [PATCH] " Daniel Vetter
2012-10-18 8:15 ` [PATCH 08/10] drm/i915: use the new dp train delay helpers Daniel Vetter
2012-10-18 8:15 ` [PATCH 10/10] drm: extract drm_dp_max_lane_count helper 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=1350548132-3037-5-git-send-email-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=nouveau@lists.freedesktop.org \
--cc=xorg-driver-ati@lists.x.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;
as well as URLs for NNTP newsgroup(s).