@@ -155,6 +155,12 @@ max_voltage_reached_on_all_lanes(struct intel_dp *intel_dp)
return true;
}
+static uint8_t
+intel_dp_get_train_voltage(struct intel_dp *intel_dp)
+{
+ return intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
+}
+
/* Enable corresponding port and start training pattern 1 */
static bool
intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
@@ -213,7 +219,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
}
/* Check to see if we've tried the same voltage 5 times */
- if ((intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK) == voltage) {
+ if (intel_dp_get_train_voltage(intel_dp) == voltage) {
++voltage_tries;
if (voltage_tries == 5) {
DRM_ERROR("too many voltage retries, give up\n");
@@ -221,7 +227,7 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp)
}
} else
voltage_tries = 0;
- voltage = intel_dp->train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
+ voltage = intel_dp_get_train_voltage(intel_dp);
/* Update training set as requested by target */
intel_get_adjust_train(intel_dp, link_status);
Add a function for retrieving the current voltage swing being used for link training. Using that function in the clock recovery code makes it a bit more readable. Signed-off-by: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com> --- drivers/gpu/drm/i915/intel_dp_link_training.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)