Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] drm/i915/lt_phy: Fix the ML to TX mapping
  2026-11-20  6:06 [PATCH] drm/i915/lt_phy: Fix the main link to TX mapping Kandpal, Suraj
@ 2026-11-20  6:34 ` Eriksen Xie
  0 siblings, 0 replies; 4+ messages in thread
From: Eriksen Xie @ 2026-11-20  6:34 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

v2: Split into two patches as requested by Suraj Kandpal.

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] 4+ messages in thread

* [PATCH v2 0/2] drm/i915/lt_phy: Fix the ML to TX mapping
@ 2026-11-20  6:58 Eriksen Xie
  2026-11-20  6:58 ` [PATCH v2 1/2] drm/i915/lt_phy: Enable TX2 for single lane DP-alt links Eriksen Xie
  2026-11-20  6:58 ` [PATCH v2 2/2] drm/i915/lt_phy: Fix the ML to TX mapping for voltage swing Eriksen Xie
  0 siblings, 2 replies; 4+ 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] 4+ messages in thread

* [PATCH v2 1/2] drm/i915/lt_phy: Enable TX2 for single lane DP-alt links
  2026-11-20  6:58 [PATCH v2 0/2] drm/i915/lt_phy: Fix the ML to TX mapping Eriksen Xie
@ 2026-11-20  6:58 ` Eriksen Xie
  2026-11-20  6:58 ` [PATCH v2 2/2] drm/i915/lt_phy: Fix the ML to TX mapping for voltage swing Eriksen Xie
  1 sibling, 0 replies; 4+ 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

ML0 always uses TX2 of PHY lane 0 in DP-alt mode, regardless of the
TC pin assignment. The driver incorrectly enables TX1 instead of TX2
for pin assignment D on single lane DP-alt links.

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 | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_lt_phy.c b/drivers/gpu/drm/i915/display/intel_lt_phy.c
index 86492651b01..7af03e5b364 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);
-- 
2.43.0


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

* [PATCH v2 2/2] drm/i915/lt_phy: Fix the ML to TX mapping for voltage swing
  2026-11-20  6:58 [PATCH v2 0/2] drm/i915/lt_phy: Fix the ML to TX mapping Eriksen Xie
  2026-11-20  6:58 ` [PATCH v2 1/2] drm/i915/lt_phy: Enable TX2 for single lane DP-alt links Eriksen Xie
@ 2026-11-20  6:58 ` Eriksen Xie
  1 sibling, 0 replies; 4+ 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

Each main link (ML) is routed to a specific PHY lane and transmitter
(TX). The mapping depends on the connection type and lane reversal, see
the PHY Lane and Transmitter Usage table in Bspec.

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.

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

Add a helper returning the TX index of a ML and use it to program the
signal levels correctly.

Fixes: 13ba213f921f ("drm/i915/ltphy: Program LT Phy Voltage Swing")
Bspec: 74701
Signed-off-by: Eriksen Xie <xiaolu.xie@intel.com>
---
 drivers/gpu/drm/i915/display/intel_lt_phy.c | 22 +++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_lt_phy.c b/drivers/gpu/drm/i915/display/intel_lt_phy.c
index 7af03e5b364..2e2fa8fa64a 100644
--- a/drivers/gpu/drm/i915/display/intel_lt_phy.c
+++ b/drivers/gpu/drm/i915/display/intel_lt_phy.c
@@ -2110,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)
 {
@@ -2135,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] 4+ messages in thread

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20  6:58 [PATCH v2 0/2] drm/i915/lt_phy: Fix the ML to TX mapping Eriksen Xie
2026-11-20  6:58 ` [PATCH v2 1/2] drm/i915/lt_phy: Enable TX2 for single lane DP-alt links Eriksen Xie
2026-11-20  6:58 ` [PATCH v2 2/2] drm/i915/lt_phy: Fix the ML to TX mapping for voltage swing Eriksen Xie
  -- strict thread matches above, loose matches on Subject: below --
2026-11-20  6:06 [PATCH] drm/i915/lt_phy: Fix the main link to TX mapping Kandpal, Suraj
2026-11-20  6:34 ` [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