diff mbox series

drm/i915: Add enable_lttpr param to select between different LTTPR modes

Message ID 20210609231133.1471989-1-khaled.almahallawy@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915: Add enable_lttpr param to select between different LTTPR modes | expand

Commit Message

Almahallawy, Khaled June 9, 2021, 11:11 p.m. UTC
As LTTPR usage increases in newer platforms, and because not all LTTPRs (located
on board, Docking, active cables, or Monitors) are created equal. We face
challenges in debugging issues because of it. So we need an easy way to switch
between different LTTPR modes (at least non-LTTPR and non-transparent modes) to
debug. This patch allows us to do that by just setting driver parameters instead
of sending patches to ODMs to switch between LTTPR modes.

Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Khaled Almahallawy <khaled.almahallawy@intel.com>
---
 drivers/gpu/drm/i915/display/intel_dp_link_training.c | 7 +++++++
 drivers/gpu/drm/i915/i915_params.c                    | 4 ++++
 drivers/gpu/drm/i915/i915_params.h                    | 1 +
 3 files changed, 12 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index 08bceae40aa8..c29c1e005c6f 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -92,6 +92,9 @@  static bool intel_dp_read_lttpr_common_caps(struct intel_dp *intel_dp)
 	if (intel_dp_is_edp(intel_dp))
 		return false;
 
+	if (!i915->params.enable_lttpr)
+		return 0;
+
 	/*
 	 * Detecting LTTPRs must be avoided on platforms with an AUX timeout
 	 * period < 3.2ms. (see DP Standard v2.0, 2.11.2, 3.6.6.1).
@@ -132,6 +135,7 @@  static int intel_dp_init_lttpr(struct intel_dp *intel_dp)
 {
 	int lttpr_count;
 	int i;
+	struct drm_i915_private *i915 = dp_to_i915(intel_dp);
 
 	if (!intel_dp_read_lttpr_common_caps(intel_dp))
 		return 0;
@@ -152,6 +156,9 @@  static int intel_dp_init_lttpr(struct intel_dp *intel_dp)
 	 */
 	intel_dp_set_lttpr_transparent_mode(intel_dp, true);
 
+	if (i915->params.enable_lttpr > 0)
+		return 0;
+
 	/*
 	 * In case of unsupported number of LTTPRs or failing to switch to
 	 * non-transparent mode fall-back to transparent link training mode,
diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index e07f4cfea63a..67d030774ced 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -178,6 +178,10 @@  i915_param_named_unsafe(dmc_firmware_path, charp, 0400,
 i915_param_named_unsafe(enable_dp_mst, bool, 0400,
 	"Enable multi-stream transport (MST) for new DisplayPort sinks. (default: true)");
 
+i915_param_named_unsafe(enable_lttpr, int, 0400,
+	"Enable LTTPR "
+	"(-1= non-transparent mode [default], 0=Non-LTTPR, 1=transparent-mode)");
+
 #if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
 i915_param_named_unsafe(inject_probe_failure, uint, 0400,
 	"Force an error after a number of failure check points (0:disabled (default), N:force failure at the Nth failure check point)");
diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index f27eceb82c0f..40f15a6db153 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -61,6 +61,7 @@  struct drm_printer;
 	param(int, invert_brightness, 0, 0600) \
 	param(int, enable_guc, -1, 0400) \
 	param(int, guc_log_level, -1, 0400) \
+	param(int, enable_lttpr, -1, 0600) \
 	param(char *, guc_firmware_path, NULL, 0400) \
 	param(char *, huc_firmware_path, NULL, 0400) \
 	param(char *, dmc_firmware_path, NULL, 0400) \