drm/i915/dp: Prevent setting the LTTPR LT mode if no LTTPRs are detected
authorImre Deak <imre.deak@intel.com>
Mon, 18 Jan 2021 18:31:43 +0000 (20:31 +0200)
committerImre Deak <imre.deak@intel.com>
Fri, 29 Jan 2021 20:00:07 +0000 (22:00 +0200)
commit3b7bbb3619d2cc92f04ba10ad27d3b616aabf175
tree82b503a88d94af77a8d75af390d5b8fde2090ff0
parent6ede6b0616b23611560ec9dc4053ae35651810d2
drm/i915/dp: Prevent setting the LTTPR LT mode if no LTTPRs are detected

Atm, the driver programs explicitly the default transparent link
training mode (0x55) to DP_PHY_REPEATER_MODE even if no LTTPRs are
detected.

This conforms to the spec (3.6.6.1):
"DP upstream devices that do not enable the Non-transparent mode of
 LTTPRs shall program the PHY_REPEATER_MODE register (DPCD Address
 F0003h) to 55h (default) prior to link training"

however writing the default value to this DPCD register seems to cause
occasional link training errors at least for a DELL WD19TB TBT dock, when
no LTTPRs are detected.

Writing to DP_PHY_REPEATER_MODE will also cause an unnecessary timeout
on systems without any LTTPR.

To fix the above two issues let's assume that setting the default mode
is redundant when no LTTPRs are detected. Keep the existing behavior and
program the default mode if more than 8 LTTPRs are detected or in case
the read from DP_PHY_REPEATER_CNT returns an invalid value.

References: https://gitlab.freedesktop.org/drm/intel/-/issues/2801
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Khaled Almahallawy <khaled.almahallawy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210118183143.1145707-1-imre.deak@intel.com
drivers/gpu/drm/i915/display/intel_dp_link_training.c