[PATCH 3/4] drm/i915: dp: Reset link params in compute_config if necessary
Sean Paul
sean at poorly.run
Tue Oct 30 13:17:50 UTC 2018
From: Sean Paul <seanpaul at chromium.org>
Currently compute_config() will continue without ensuring the link
parameters are correct. If the dpcd information is invalid, this will
result in a bogus config. So either reset the link parameters if dpcd is
valid, or fail compute_config() if they're not.
Cc: stable at vger.kernel.org
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Maarten Lankhorst <maarten.lankhorst at linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
drivers/gpu/drm/i915/intel_dp.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index fcce82509044..aba89baaa7f6 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2066,6 +2066,11 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
return true;
}
+static bool intel_dp_dpcd_valid(struct intel_dp *intel_dp)
+{
+ return intel_dp->dpcd[DP_DPCD_REV] != 0;
+}
+
static void
intel_dp_reset_link_params(struct intel_dp *intel_dp)
{
@@ -2098,6 +2103,19 @@ intel_dp_compute_config(struct intel_encoder *encoder,
bool constant_n = drm_dp_has_quirk(&intel_dp->desc,
DP_DPCD_QUIRK_CONSTANT_N);
+ /*
+ * Can't compute the config if the link parameters are invalid. This
+ * case can be hit on resume where we assume the same display is
+ * connected and go straight to a modeset. If we have valid dpcd info,
+ * reset the link parameters, otherwise fail out.
+ */
+ if (intel_dp->reset_link_params) {
+ if (intel_dp_dpcd_valid(intel_dp))
+ intel_dp_reset_link_params(intel_dp);
+ else
+ return false;
+ }
+
if (HAS_PCH_SPLIT(dev_priv) && !HAS_DDI(dev_priv) && port != PORT_A)
pipe_config->has_pch_encoder = true;
@@ -3968,7 +3986,7 @@ intel_dp_read_dpcd(struct intel_dp *intel_dp)
DRM_DEBUG_KMS("DPCD: %*ph\n", (int) sizeof(intel_dp->dpcd), intel_dp->dpcd);
- return intel_dp->dpcd[DP_DPCD_REV] != 0;
+ return intel_dp_dpcd_valid(intel_dp);
}
static bool
--
Sean Paul, Software Engineer, Google / Chromium OS
More information about the Intel-gfx-trybot
mailing list