Skip to content

Commit 7b2a4ab

Browse files
committed
drm/i915: Switch to LTTPR transparent mode link training
By default LTTPRs should be in transparent link training mode, nevertheless in this patch we switch to this default mode explicitly. The DP Standard recommends this, supposedly because an LTTPR may be left in the non-transparent mode (by BIOS, previous kernel, or after reset due to a firmware bug). I haven't seen this happening, but let's follow the DP Standard. v2: - Add a code comment about the explicit disabling of non-transparent mode. v3: - Move check to prevent initing LTTPRs on eDP to init_dp_lttpr_init(). Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201007170917.1764556-6-imre.deak@intel.com
1 parent 9782f52 commit 7b2a4ab

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

drivers/gpu/drm/i915/display/intel_display_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,6 +1302,7 @@ struct intel_dp {
13021302
u8 downstream_ports[DP_MAX_DOWNSTREAM_PORTS];
13031303
u8 edp_dpcd[EDP_DISPLAY_CTL_CAP_SIZE];
13041304
u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE];
1305+
u8 lttpr_common_caps[DP_LTTPR_COMMON_CAP_SIZE];
13051306
u8 fec_capable;
13061307
/* source rates */
13071308
int num_source_rates;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4790,6 +4790,8 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp)
47904790
{
47914791
int ret;
47924792

4793+
intel_dp_lttpr_init(intel_dp);
4794+
47934795
if (drm_dp_read_dpcd_caps(&intel_dp->aux, intel_dp->dpcd))
47944796
return false;
47954797

drivers/gpu/drm/i915/display/intel_dp_link_training.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,55 @@ intel_dp_dump_link_status(const u8 link_status[DP_LINK_STATUS_SIZE])
3434
link_status[3], link_status[4], link_status[5]);
3535
}
3636

37+
static bool intel_dp_read_lttpr_common_caps(struct intel_dp *intel_dp)
38+
{
39+
if (drm_dp_read_lttpr_common_caps(&intel_dp->aux,
40+
intel_dp->lttpr_common_caps) < 0) {
41+
memset(intel_dp->lttpr_common_caps, 0,
42+
sizeof(intel_dp->lttpr_common_caps));
43+
return false;
44+
}
45+
46+
drm_dbg_kms(&dp_to_i915(intel_dp)->drm,
47+
"LTTPR common capabilities: %*ph\n",
48+
(int)sizeof(intel_dp->lttpr_common_caps),
49+
intel_dp->lttpr_common_caps);
50+
51+
return true;
52+
}
53+
54+
static bool
55+
intel_dp_set_lttpr_transparent_mode(struct intel_dp *intel_dp, bool enable)
56+
{
57+
u8 val = enable ? DP_PHY_REPEATER_MODE_TRANSPARENT :
58+
DP_PHY_REPEATER_MODE_NON_TRANSPARENT;
59+
60+
return drm_dp_dpcd_write(&intel_dp->aux, DP_PHY_REPEATER_MODE, &val, 1) == 1;
61+
}
62+
63+
/**
64+
* intel_dp_lttpr_init - detect LTTPRs and init the LTTPR link training mode
65+
* @intel_dp: Intel DP struct
66+
*
67+
* Read the LTTPR common capabilities and switch to transparent link training
68+
* mode.
69+
*/
70+
int intel_dp_lttpr_init(struct intel_dp *intel_dp)
71+
{
72+
if (intel_dp_is_edp(intel_dp))
73+
return 0;
74+
75+
intel_dp_read_lttpr_common_caps(intel_dp);
76+
77+
/*
78+
* See DP Standard v2.0 3.6.6.1. about the explicit disabling of
79+
* non-transparent mode.
80+
*/
81+
intel_dp_set_lttpr_transparent_mode(intel_dp, true);
82+
83+
return 0;
84+
}
85+
3786
static u8 dp_voltage_max(u8 preemph)
3887
{
3988
switch (preemph & DP_TRAIN_PRE_EMPHASIS_MASK) {
@@ -492,6 +541,12 @@ static void intel_dp_schedule_fallback_link_training(struct intel_dp *intel_dp,
492541
void intel_dp_start_link_train(struct intel_dp *intel_dp,
493542
const struct intel_crtc_state *crtc_state)
494543
{
544+
/*
545+
* TODO: Reiniting LTTPRs here won't be needed once proper connector
546+
* HW state readout is added.
547+
*/
548+
intel_dp_lttpr_init(intel_dp);
549+
495550
if (!intel_dp_link_train(intel_dp, crtc_state))
496551
intel_dp_schedule_fallback_link_training(intel_dp, crtc_state);
497552
}

drivers/gpu/drm/i915/display/intel_dp_link_training.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
struct intel_crtc_state;
1212
struct intel_dp;
1313

14+
int intel_dp_lttpr_init(struct intel_dp *intel_dp);
15+
1416
void intel_dp_get_adjust_train(struct intel_dp *intel_dp,
1517
const struct intel_crtc_state *crtc_state,
1618
const u8 link_status[DP_LINK_STATUS_SIZE]);

0 commit comments

Comments
 (0)