Skip to content

Commit 584cf61

Browse files
vsyrjalajnikula
authored andcommitted
drm/i915/dp: Reject HBR3 when sink doesn't support TPS4
According to the DP spec TPS4 is mandatory for HBR3. We have however seen some broken eDP sinks that violate this and declare support for HBR3 without TPS4 support. At least in the case of the icl Dell XPS 13 7390 this results in an unstable output. Reject HBR3 when TPS4 supports is unavailable on the sink. v2: Leave breadcrumbs in dmesg to avoid head scratching (Jani) Cc: stable@vger.kernel.org Cc: Jani Nikula <jani.nikula@linux.intel.com> Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/5969 Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250306210740.11886-1-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com> (cherry picked from commit 38188a7) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 2e43ae7 commit 584cf61

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

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

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,28 @@ int intel_dp_link_symbol_clock(int rate)
172172

173173
static int max_dprx_rate(struct intel_dp *intel_dp)
174174
{
175+
struct intel_display *display = to_intel_display(intel_dp);
176+
struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
177+
int max_rate;
178+
175179
if (intel_dp_tunnel_bw_alloc_is_enabled(intel_dp))
176-
return drm_dp_tunnel_max_dprx_rate(intel_dp->tunnel);
180+
max_rate = drm_dp_tunnel_max_dprx_rate(intel_dp->tunnel);
181+
else
182+
max_rate = drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]);
177183

178-
return drm_dp_bw_code_to_link_rate(intel_dp->dpcd[DP_MAX_LINK_RATE]);
184+
/*
185+
* Some broken eDP sinks illegally declare support for
186+
* HBR3 without TPS4, and are unable to produce a stable
187+
* output. Reject HBR3 when TPS4 is not available.
188+
*/
189+
if (max_rate >= 810000 && !drm_dp_tps4_supported(intel_dp->dpcd)) {
190+
drm_dbg_kms(display->drm,
191+
"[ENCODER:%d:%s] Rejecting HBR3 due to missing TPS4 support\n",
192+
encoder->base.base.id, encoder->base.name);
193+
max_rate = 540000;
194+
}
195+
196+
return max_rate;
179197
}
180198

181199
static int max_dprx_lane_count(struct intel_dp *intel_dp)
@@ -4170,6 +4188,9 @@ static void intel_edp_mso_init(struct intel_dp *intel_dp)
41704188
static void
41714189
intel_edp_set_sink_rates(struct intel_dp *intel_dp)
41724190
{
4191+
struct intel_display *display = to_intel_display(intel_dp);
4192+
struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base;
4193+
41734194
intel_dp->num_sink_rates = 0;
41744195

41754196
if (intel_dp->edp_dpcd[0] >= DP_EDP_14) {
@@ -4180,18 +4201,32 @@ intel_edp_set_sink_rates(struct intel_dp *intel_dp)
41804201
sink_rates, sizeof(sink_rates));
41814202

41824203
for (i = 0; i < ARRAY_SIZE(sink_rates); i++) {
4183-
int val = le16_to_cpu(sink_rates[i]);
4184-
4185-
if (val == 0)
4186-
break;
4204+
int rate;
41874205

41884206
/* Value read multiplied by 200kHz gives the per-lane
41894207
* link rate in kHz. The source rates are, however,
41904208
* stored in terms of LS_Clk kHz. The full conversion
41914209
* back to symbols is
41924210
* (val * 200kHz)*(8/10 ch. encoding)*(1/8 bit to Byte)
41934211
*/
4194-
intel_dp->sink_rates[i] = (val * 200) / 10;
4212+
rate = le16_to_cpu(sink_rates[i]) * 200 / 10;
4213+
4214+
if (rate == 0)
4215+
break;
4216+
4217+
/*
4218+
* Some broken eDP sinks illegally declare support for
4219+
* HBR3 without TPS4, and are unable to produce a stable
4220+
* output. Reject HBR3 when TPS4 is not available.
4221+
*/
4222+
if (rate >= 810000 && !drm_dp_tps4_supported(intel_dp->dpcd)) {
4223+
drm_dbg_kms(display->drm,
4224+
"[ENCODER:%d:%s] Rejecting HBR3 due to missing TPS4 support\n",
4225+
encoder->base.base.id, encoder->base.name);
4226+
break;
4227+
}
4228+
4229+
intel_dp->sink_rates[i] = rate;
41954230
}
41964231
intel_dp->num_sink_rates = i;
41974232
}

0 commit comments

Comments
 (0)