Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH 6/9] drm/i915/dp: Move intel_dp_training_pattern()
Date: Mon, 24 Feb 2025 19:26:42 +0200	[thread overview]
Message-ID: <20250224172645.15763-7-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20250224172645.15763-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Move intel_dp_training_pattern() upwards to avoid the forward
declaration for the POST_LT_ADJ_REQ stuff.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 .../drm/i915/display/intel_dp_link_training.c | 112 +++++++++---------
 1 file changed, 54 insertions(+), 58 deletions(-)

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 8863fc2c44ff..f208b947ef92 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -767,9 +767,62 @@ void intel_dp_link_training_set_bw(struct intel_dp *intel_dp,
 	}
 }
 
+/*
+ * Pick Training Pattern Sequence (TPS) for channel equalization. 128b/132b TPS2
+ * for UHBR+, TPS4 for HBR3 or for 1.4 devices that support it, TPS3 for HBR2 or
+ * 1.2 devices that support it, TPS2 otherwise.
+ */
 static u32 intel_dp_training_pattern(struct intel_dp *intel_dp,
 				     const struct intel_crtc_state *crtc_state,
-				     enum drm_dp_phy dp_phy);
+				     enum drm_dp_phy dp_phy)
+{
+	struct intel_display *display = to_intel_display(intel_dp);
+	bool source_tps3, sink_tps3, source_tps4, sink_tps4;
+
+	/* UHBR+ use separate 128b/132b TPS2 */
+	if (intel_dp_is_uhbr(crtc_state))
+		return DP_TRAINING_PATTERN_2;
+
+	/*
+	 * TPS4 support is mandatory for all downstream devices that
+	 * support HBR3. There are no known eDP panels that support
+	 * TPS4 as of Feb 2018 as per VESA eDP_v1.4b_E1 specification.
+	 * LTTPRs must support TPS4.
+	 */
+	source_tps4 = intel_dp_source_supports_tps4(display);
+	sink_tps4 = dp_phy != DP_PHY_DPRX ||
+		    drm_dp_tps4_supported(intel_dp->dpcd);
+	if (source_tps4 && sink_tps4) {
+		return DP_TRAINING_PATTERN_4;
+	} else if (crtc_state->port_clock == 810000) {
+		if (!source_tps4)
+			lt_dbg(intel_dp, dp_phy,
+			       "8.1 Gbps link rate without source TPS4 support\n");
+		if (!sink_tps4)
+			lt_dbg(intel_dp, dp_phy,
+			       "8.1 Gbps link rate without sink TPS4 support\n");
+	}
+
+	/*
+	 * TPS3 support is mandatory for downstream devices that
+	 * support HBR2. However, not all sinks follow the spec.
+	 */
+	source_tps3 = intel_dp_source_supports_tps3(display);
+	sink_tps3 = dp_phy != DP_PHY_DPRX ||
+		    drm_dp_tps3_supported(intel_dp->dpcd);
+	if (source_tps3 && sink_tps3) {
+		return  DP_TRAINING_PATTERN_3;
+	} else if (crtc_state->port_clock >= 540000) {
+		if (!source_tps3)
+			lt_dbg(intel_dp, dp_phy,
+			       ">=5.4/6.48 Gbps link rate without source TPS3 support\n");
+		if (!sink_tps3)
+			lt_dbg(intel_dp, dp_phy,
+			       ">=5.4/6.48 Gbps link rate without sink TPS3 support\n");
+	}
+
+	return DP_TRAINING_PATTERN_2;
+}
 
 static bool intel_dp_use_post_lt_adj_req(struct intel_dp *intel_dp,
 					 const struct intel_crtc_state *crtc_state)
@@ -971,63 +1024,6 @@ intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp,
 	return false;
 }
 
-/*
- * Pick Training Pattern Sequence (TPS) for channel equalization. 128b/132b TPS2
- * for UHBR+, TPS4 for HBR3 or for 1.4 devices that support it, TPS3 for HBR2 or
- * 1.2 devices that support it, TPS2 otherwise.
- */
-static u32 intel_dp_training_pattern(struct intel_dp *intel_dp,
-				     const struct intel_crtc_state *crtc_state,
-				     enum drm_dp_phy dp_phy)
-{
-	struct intel_display *display = to_intel_display(intel_dp);
-	bool source_tps3, sink_tps3, source_tps4, sink_tps4;
-
-	/* UHBR+ use separate 128b/132b TPS2 */
-	if (intel_dp_is_uhbr(crtc_state))
-		return DP_TRAINING_PATTERN_2;
-
-	/*
-	 * TPS4 support is mandatory for all downstream devices that
-	 * support HBR3. There are no known eDP panels that support
-	 * TPS4 as of Feb 2018 as per VESA eDP_v1.4b_E1 specification.
-	 * LTTPRs must support TPS4.
-	 */
-	source_tps4 = intel_dp_source_supports_tps4(display);
-	sink_tps4 = dp_phy != DP_PHY_DPRX ||
-		    drm_dp_tps4_supported(intel_dp->dpcd);
-	if (source_tps4 && sink_tps4) {
-		return DP_TRAINING_PATTERN_4;
-	} else if (crtc_state->port_clock == 810000) {
-		if (!source_tps4)
-			lt_dbg(intel_dp, dp_phy,
-			       "8.1 Gbps link rate without source TPS4 support\n");
-		if (!sink_tps4)
-			lt_dbg(intel_dp, dp_phy,
-			       "8.1 Gbps link rate without sink TPS4 support\n");
-	}
-
-	/*
-	 * TPS3 support is mandatory for downstream devices that
-	 * support HBR2. However, not all sinks follow the spec.
-	 */
-	source_tps3 = intel_dp_source_supports_tps3(display);
-	sink_tps3 = dp_phy != DP_PHY_DPRX ||
-		    drm_dp_tps3_supported(intel_dp->dpcd);
-	if (source_tps3 && sink_tps3) {
-		return  DP_TRAINING_PATTERN_3;
-	} else if (crtc_state->port_clock >= 540000) {
-		if (!source_tps3)
-			lt_dbg(intel_dp, dp_phy,
-			       ">=5.4/6.48 Gbps link rate without source TPS3 support\n");
-		if (!sink_tps3)
-			lt_dbg(intel_dp, dp_phy,
-			       ">=5.4/6.48 Gbps link rate without sink TPS3 support\n");
-	}
-
-	return DP_TRAINING_PATTERN_2;
-}
-
 /*
  * Perform the link training channel equalization phase on the given DP PHY
  * using one of training pattern 2, 3 or 4 depending on the source and
-- 
2.45.3


  parent reply	other threads:[~2025-02-24 17:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 17:26 [PATCH 0/9] drm/i915/dp: Implement POST_LT_ADJ_REQ Ville Syrjala
2025-02-24 17:26 ` [PATCH 1/9] drm/dp: Add definitions for POST_LT_ADJ training sequence Ville Syrjala
2025-02-25 15:55   ` Jani Nikula
2025-02-27 20:42   ` [PATCH v2 " Ville Syrjala
2025-06-16 16:28     ` Imre Deak
2025-02-24 17:26 ` [PATCH 2/9] drm/dp: Add POST_LT_ADJ_REQ helpers Ville Syrjala
2025-02-24 17:26 ` [PATCH 3/9] drm/i915/dp: Clear DPCD training pattern before transmitting the idle pattern Ville Syrjala
2025-02-24 17:26 ` [PATCH 4/9] drm/i915/dp: Have intel_dp_get_adjust_train() tell us if anything changed Ville Syrjala
2025-02-24 17:26 ` [PATCH 5/9] drm/i915/dp: Implement the POST_LT_ADJ_REQ sequence Ville Syrjala
2025-06-16 16:30   ` Imre Deak
2025-02-24 17:26 ` Ville Syrjala [this message]
2025-02-24 17:26 ` [PATCH 7/9] drm/i915/dp: Implement .set_idle_link_train() for everyone Ville Syrjala
2025-06-16 16:31   ` Imre Deak
2025-02-24 17:26 ` [PATCH 8/9] drm/i915/dp: Make .set_idle_link_train() mandatory Ville Syrjala
2025-02-24 17:26 ` [PATCH 9/9] hax: drm/i915: Disable TPS4 support to force POST_LT_ADJ_REQ usage Ville Syrjala
2025-02-25  1:06 ` ✓ CI.Patch_applied: success for drm/i915/dp: Implement POST_LT_ADJ_REQ Patchwork
2025-02-25  1:06 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-25  1:07 ` ✓ CI.KUnit: success " Patchwork
2025-02-25  1:24 ` ✓ CI.Build: " Patchwork
2025-02-25  1:26 ` ✓ CI.Hooks: " Patchwork
2025-02-25  1:28 ` ✗ CI.checksparse: warning " Patchwork
2025-02-25  1:46 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-25  4:34 ` ✗ Xe.CI.Full: failure " Patchwork
2025-02-27 22:35 ` ✓ CI.Patch_applied: success for drm/i915/dp: Implement POST_LT_ADJ_REQ (rev2) Patchwork
2025-02-27 22:35 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-27 22:37 ` ✓ CI.KUnit: success " Patchwork
2025-02-27 22:53 ` ✓ CI.Build: " Patchwork
2025-02-27 22:56 ` ✓ CI.Hooks: " Patchwork
2025-02-27 22:57 ` ✗ CI.checksparse: warning " Patchwork
2025-02-27 23:15 ` ✓ Xe.CI.BAT: success " Patchwork
2025-02-28  3:23 ` ✗ Xe.CI.Full: failure " Patchwork
2025-06-16 16:25 ` [PATCH 0/9] drm/i915/dp: Implement POST_LT_ADJ_REQ Imre Deak

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=20250224172645.15763-7-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox