Skip to content

Commit cdb0e95

Browse files
committed
drm/i915: Try harder during dp pattern 1 link training
Instead of going through the sequence just once, run through the whole set up to 5 times to see if something can work. This isn't part of the DP spec, but the BIOS seems to do it, and given that link training failure is so bad, it seems reasonable to follow suit. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
1 parent 21264c6 commit cdb0e95

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

‎drivers/gpu/drm/i915/intel_dp.c‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,7 +1581,7 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
15811581
int i;
15821582
uint8_t voltage;
15831583
bool clock_recovery = false;
1584-
int tries;
1584+
int voltage_tries, loop_tries;
15851585
u32 reg;
15861586
uint32_t DP = intel_dp->DP;
15871587

@@ -1608,7 +1608,8 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
16081608
DP &= ~DP_LINK_TRAIN_MASK;
16091609
memset(intel_dp->train_set, 0, 4);
16101610
voltage = 0xff;
1611-
tries = 0;
1611+
voltage_tries = 0;
1612+
loop_tries = 0;
16121613
clock_recovery = false;
16131614
for (;;) {
16141615
/* Use intel_dp->train_set[0] to set the voltage and pre emphasis values */
@@ -1651,16 +1652,26 @@ intel_dp_start_link_train(struct intel_dp *intel_dp)
16511652
for (i = 0; i < intel_dp->lane_count; i++)
16521653
if ((intel_dp->train_set[i] & DP_TRAIN_MAX_SWING_REACHED) == 0)
16531654
break;
1654-
if (i == intel_dp->lane_count)
1655-
break;
1655+
if (i == intel_dp->lane_count) {
1656+
++loop_tries;
1657+
if (loop_tries == 5) {
1658+
DRM_DEBUG_KMS("too many full retries, give up\n");
1659+
break;
1660+
}
1661+
memset(intel_dp->train_set, 0, 4);
1662+
voltage_tries = 0;
1663+
continue;
1664+
}
16561665

16571666
/* Check to see if we've tried the same voltage 5 times */
16581667
if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
1659-
++tries;
1660-
if (tries == 5)
1668+
++voltage_tries;
1669+
if (voltage_tries == 5) {
1670+
DRM_DEBUG_KMS("too many voltage retries, give up\n");
16611671
break;
1672+
}
16621673
} else
1663-
tries = 0;
1674+
voltage_tries = 0;
16641675
voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
16651676

16661677
/* Compute new intel_dp->train_set as requested by target */

0 commit comments

Comments
 (0)