All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/i915/dp: On link train failure on eDP, retry with max params first
@ 2019-04-04 15:19 Manasi Navare
  2019-04-04 18:19 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dp: On link train failure on eDP, retry with max params first (rev2) Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Manasi Navare @ 2019-04-04 15:19 UTC (permalink / raw)
  To: intel-gfx; +Cc: Albert Astals Cid, Ralgor, Emanuele Panigati

Certain eDP panels fail to link train with optimized settings for
link rate and lane count and need the max link parameters to be used
for link training to pass.
So in on link training failure for eDP, retry the link training
with max link parameters first since this tends to fix link
failures on most eDP 1.4 panels

v2:
* Forgot to ammend the previous patch with the fixes. This is
a clean fixed patch

Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Albert Astals Cid <aacid@kde.org>
Cc: Emanuele Panigati <ilpanich@gmail.com>
Cc: Ralgor <ralgorfdb@compuspex.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109959
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c  | 37 +++++++++++++++++++++-----------
 drivers/gpu/drm/i915/intel_drv.h |  3 +++
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 72c49070ed14..ae9766400171 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -463,6 +463,14 @@ static bool intel_dp_can_link_train_fallback_for_edp(struct intel_dp *intel_dp,
 	return true;
 }
 
+static bool intel_dp_uses_max_link_params(struct intel_dp *intel_dp,
+					  int link_rate,
+					  u8 lane_count)
+{
+	return link_rate == intel_dp->max_link_rate &&
+		lane_count == intel_dp->max_link_lane_count;
+}
+
 int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 					    int link_rate, u8 lane_count)
 {
@@ -471,24 +479,24 @@ int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
 	index = intel_dp_rate_index(intel_dp->common_rates,
 				    intel_dp->num_common_rates,
 				    link_rate);
-	if (index > 0) {
-		if (intel_dp_is_edp(intel_dp) &&
-		    !intel_dp_can_link_train_fallback_for_edp(intel_dp,
-							      intel_dp->common_rates[index - 1],
-							      lane_count)) {
+
+	if (intel_dp_is_edp(intel_dp)) {
+		if (!intel_dp_uses_max_link_params(intel_dp, link_rate,
+						   lane_count)) {
+			intel_dp->retry_with_max_link_params = true;
+			DRM_DEBUG_KMS("Retrying Link training for eDP with max link parameters\n");
+			return 0;
+		} else if (!intel_dp_can_link_train_fallback_for_edp(intel_dp,
+								     intel_dp->common_rates[index - 1],
+								     lane_count)) {
 			DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n");
 			return 0;
 		}
+	}
+	if (index > 0) {
 		intel_dp->max_link_rate = intel_dp->common_rates[index - 1];
 		intel_dp->max_link_lane_count = lane_count;
 	} else if (lane_count > 1) {
-		if (intel_dp_is_edp(intel_dp) &&
-		    !intel_dp_can_link_train_fallback_for_edp(intel_dp,
-							      intel_dp_max_common_rate(intel_dp),
-							      lane_count >> 1)) {
-			DRM_DEBUG_KMS("Retrying Link training for eDP with same parameters\n");
-			return 0;
-		}
 		intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp);
 		intel_dp->max_link_lane_count = lane_count >> 1;
 	} else {
@@ -2028,7 +2036,8 @@ intel_dp_compute_link_config(struct intel_encoder *encoder,
 	limits.min_bpp = 6 * 3;
 	limits.max_bpp = intel_dp_compute_bpp(intel_dp, pipe_config);
 
-	if (intel_dp_is_edp(intel_dp) && intel_dp->edp_dpcd[0] < DP_EDP_14) {
+	if ((intel_dp_is_edp(intel_dp) && intel_dp->edp_dpcd[0] < DP_EDP_14) ||
+	    intel_dp->retry_with_max_link_params) {
 		/*
 		 * Use the maximum clock and number of lanes the eDP panel
 		 * advertizes being capable of. The eDP 1.3 and earlier panels
@@ -5432,6 +5441,8 @@ intel_dp_detect(struct drm_connector *connector,
 		/* Initial max link rate */
 		intel_dp->max_link_rate = intel_dp_max_common_rate(intel_dp);
 
+		intel_dp->retry_with_max_link_params = false;
+
 		intel_dp->reset_link_params = false;
 	}
 
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index f8c7b291fdc3..c3cf702c1cba 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1327,6 +1327,9 @@ struct intel_dp {
 
 	/* Display stream compression testing */
 	bool force_dsc_en;
+
+	/* Some panels need max link params for link training */
+	bool retry_with_max_link_params;
 };
 
 enum lspcon_vendor {
-- 
2.19.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-05 12:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04 15:19 [PATCH v2] drm/i915/dp: On link train failure on eDP, retry with max params first Manasi Navare
2019-04-04 18:19 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/dp: On link train failure on eDP, retry with max params first (rev2) Patchwork
2019-04-04 18:56 ` ✓ Fi.CI.BAT: success " Patchwork
2019-04-05 12:47 ` ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.