[Nouveau] [PATCH 2/3] drm/nouveau: use dp link train request helper

Daniel Vetter daniel.vetter at ffwll.ch
Wed Nov 21 08:03:59 PST 2012


nouveau again score with an impressive density of magic numbers.

Again only compile-tested due to lack of hw, but should be equivalent
code.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/nouveau/nouveau_dp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c
index 3045a00..ed10c1d 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dp.c
@@ -137,11 +137,10 @@ dp_link_train_commit(struct drm_device *dev, struct dp_state *dp)
 	int i;
 
 	for (i = 0; i < dp->link_nr; i++) {
-		u8 lane = (dp->stat[4 + (i >> 1)] >> ((i & 1) * 4)) & 0xf;
-		u8 lpre = (lane & 0x0c) >> 2;
-		u8 lvsw = (lane & 0x03) >> 0;
+		u8 lpre = drm_dp_get_adjust_request_pre_emphasis(dp->stat, i);
+		u8 lvsw = drm_dp_get_adjust_request_voltage(dp->stat, i);
 
-		dp->conf[i] = (lpre << 3) | lvsw;
+		dp->conf[i] = lpre | lvsw;
 		if (lvsw == DP_TRAIN_VOLTAGE_SWING_1200)
 			dp->conf[i] |= DP_TRAIN_MAX_SWING_REACHED;
 		if ((lpre << 3) == DP_TRAIN_PRE_EMPHASIS_9_5)
-- 
1.7.11.4



More information about the Nouveau mailing list