Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/lt_phy: Fix the main link to TX mapping
@ 2026-11-19  7:04 Eriksen Xie
  2026-11-19  9:04 ` ✓ CI.KUnit: success for " Patchwork
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Eriksen Xie @ 2026-11-19  7:04 UTC (permalink / raw)
  To: intel-gfx, intel-xe
  Cc: Suraj Kandpal, Arun R Murthy, Mika Kahola, Ankit Nautiyal,
	Ville Syrjälä, Imre Deak, Eriksen Xie

Each main link (ML) is routed to a specific PHY lane and transmitter
(TX). The mapping depends on the connection type, on the lane reversal
and, in DP-alt mode, on the pin assignment, see the PHY Lane and
Transmitter Usage table in the LT PHY Bspec page. The driver gets it
wrong in two places.

The signal levels (voltage swing, pre- and post-cursor) of an ML are
programmed to TX (ML % 2) of PHY lane (ML / 2). This is correct only on
native ports without lane reversal:

- In DP-alt mode ML0 uses TX2 and ML1 uses TX1 of PHY lane 0, so the
  parameters of the two end up on each other's transmitter. With a
  single lane the only enabled TX, TX2, is not programmed at all while
  the unused TX1 is. Reading the PHY registers back on a DP-alt x1 link
  showed the cursor values on TX1 and TX2 still at its reset values.

- On lane reversed native ports ML n uses TX (3 - n), but the lane
  reversal was not taken into account.

Also, on a single lane DP-alt link with pin assignment D the driver
enables TX1, whereas ML0 uses TX2 with every pin assignment.

Add a helper returning the TX of a ML and use it to program the signal
levels, and enable TX2 for single lane DP-alt links regardless of the
pin assignment. The orientation flip in DP-alt mode is handled by the
FIA, so it does not need to be accounted for.

Fixes: 13ba213f921f ("drm/i915/ltphy: Program LT Phy Voltage Swing")
Fixes: a54bdcb7142d ("drm/i915/ltphy: Enable/Disable Tx after Non TBT Enable sequence")
Bspec: 74701
Signed-off-by: Eriksen Xie <xiaolu.xie@intel.com>
---
 drivers/gpu/drm/i915/display/intel_lt_phy.c | 32 ++++++++++++++-------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_lt_phy.c b/drivers/gpu/drm/i915/display/intel_lt_phy.c
index 86492651b0..2e2fa8fa64 100644
--- a/drivers/gpu/drm/i915/display/intel_lt_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_lt_phy.c
@@ -1827,8 +1827,6 @@ intel_lt_phy_enable_disable_tx(struct intel_encoder *encoder,
 	u8 lane_count = ltpll->lane_count;
 	bool is_dp_alt =
 		intel_tc_port_in_dp_alt_mode(dig_port);
-	enum intel_tc_pin_assignment tc_pin =
-		intel_tc_port_get_pin_assignment(dig_port);
 	u8 transmitter_mask = 0;
 
 	/*
@@ -1841,12 +1839,8 @@ intel_lt_phy_enable_disable_tx(struct intel_encoder *encoder,
 	switch (lane_count) {
 	case 1:
 		transmitter_mask = lane_reversal ? REG_BIT8(3) : REG_BIT8(0);
-		if (is_dp_alt) {
-			if (tc_pin == INTEL_TC_PIN_ASSIGNMENT_D)
-				transmitter_mask = REG_BIT8(0);
-			else
-				transmitter_mask = REG_BIT8(1);
-		}
+		if (is_dp_alt)
+			transmitter_mask = REG_BIT8(1);
 		break;
 	case 2:
 		transmitter_mask = lane_reversal ? REG_GENMASK8(3, 2) : REG_GENMASK8(1, 0);
@@ -2116,6 +2110,23 @@ void intel_lt_phy_pll_disable(struct intel_encoder *encoder)
 	intel_lt_phy_transaction_end(encoder, wakeref);
 }
 
+/*
+ * Get the transmitter (lane * 2 + TX - 1) used by a main link, which is also
+ * the lane and TX to program the voltage swing for, see "PHY Lane and
+ * Transmitter Usage" in Bspec.
+ */
+static int intel_lt_phy_ml_to_tx_idx(struct intel_encoder *encoder, int ml)
+{
+	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
+	static const u8 dp_alt_tx_idx[] = { 1, 0, 2, 3 };
+
+	/* The FIA muxing handles the orientation flip in DP-alt mode. */
+	if (intel_tc_port_in_dp_alt_mode(dig_port))
+		return dp_alt_tx_idx[ml];
+
+	return dig_port->lane_reversal ? 3 - ml : ml;
+}
+
 void intel_lt_phy_set_signal_levels(struct intel_encoder *encoder,
 				    const struct intel_crtc_state *crtc_state)
 {
@@ -2141,8 +2152,9 @@ void intel_lt_phy_set_signal_levels(struct intel_encoder *encoder,
 
 	for (ln = 0; ln < crtc_state->lane_count; ln++) {
 		int level = intel_ddi_level(encoder, crtc_state, ln);
-		int lane = ln / 2;
-		int tx = ln % 2;
+		int tx_idx = intel_lt_phy_ml_to_tx_idx(encoder, ln);
+		int lane = tx_idx / 2;
+		int tx = tx_idx % 2;
 		u8 lane_mask = lane == 0 ? INTEL_LT_PHY_LANE0 : INTEL_LT_PHY_LANE1;
 
 		if (!(lane_mask & owned_lane_mask))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread
* [PATCH v2 0/2] drm/i915/lt_phy: Fix the ML to TX mapping
@ 2026-11-20  6:58 Eriksen Xie
  0 siblings, 0 replies; 9+ messages in thread
From: Eriksen Xie @ 2026-11-20  6:58 UTC (permalink / raw)
  To: intel-gfx, intel-xe
  Cc: Suraj Kandpal, Arun R Murthy, Mika Kahola, Nautiyal, Ankit K,
	Ville Syrjälä, Imre Deak, Eriksen Xie

The signal levels of a main link are programmed to the wrong LT PHY
transmitter in DP-alt mode and on lane reversed native ports, and a
single lane DP-alt link with pin assignment D enables TX1 instead of
TX2.

v2: Split the patch into two as requested by Suraj Kandpal, one for the
    TX enable and one for the voltage swing programming.

v1: https://lore.kernel.org/r/20261119070444.2106229-1-xiaolu.xie@intel.com
    Review: https://lists.freedesktop.org/archives/intel-gfx/2026-November/401118.html

Eriksen Xie (2):
  drm/i915/lt_phy: Enable TX2 for single lane DP-alt links
  drm/i915/lt_phy: Fix the ML to TX mapping for voltage swing

 drivers/gpu/drm/i915/display/intel_lt_phy.c | 32 ++++++++++++++-------
 1 file changed, 22 insertions(+), 10 deletions(-)

-- 
2.43.0


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

end of thread, other threads:[~2026-11-20  7:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  7:04 [PATCH] drm/i915/lt_phy: Fix the main link to TX mapping Eriksen Xie
2026-11-19  9:04 ` ✓ CI.KUnit: success for " Patchwork
2026-11-19  9:44 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-20  6:06 ` [PATCH] " Kandpal, Suraj
2026-11-20  6:34   ` [PATCH v2 0/2] drm/i915/lt_phy: Fix the ML " Eriksen Xie
2026-11-20  6:34     ` [PATCH v2 1/2] drm/i915/lt_phy: Enable TX2 for single lane DP-alt links Eriksen Xie
2026-11-20  6:34     ` [PATCH v2 2/2] drm/i915/lt_phy: Fix the ML to TX mapping for voltage swing Eriksen Xie
2026-11-20  7:02   ` [PATCH] drm/i915/lt_phy: Fix the main link to TX mapping Eriksen Xie
  -- strict thread matches above, loose matches on Subject: below --
2026-11-20  6:58 [PATCH v2 0/2] drm/i915/lt_phy: Fix the ML " Eriksen Xie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox