All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Albert Astals Cid <aacid@kde.org>,
	Ralgor <ralgorfdb@compuspex.org>,
	Emanuele Panigati <ilpanich@gmail.com>
Subject: [PATCH v2] drm/i915/dp: On link train failure on eDP, retry with max params first
Date: Thu,  4 Apr 2019 08:19:13 -0700	[thread overview]
Message-ID: <20190404151913.5301-1-manasi.d.navare@intel.com> (raw)

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

             reply	other threads:[~2019-04-04 15:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04 15:19 Manasi Navare [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190404151913.5301-1-manasi.d.navare@intel.com \
    --to=manasi.d.navare@intel.com \
    --cc=aacid@kde.org \
    --cc=ilpanich@gmail.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ralgorfdb@compuspex.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.