Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [PATCH v2 04/11] drm/i915/ddi: Set missing TC DP PHY lane stagger delay in DDI_BUF_CTL
Date: Fri, 14 Feb 2025 16:19:54 +0200	[thread overview]
Message-ID: <20250214142001.552916-5-imre.deak@intel.com> (raw)
In-Reply-To: <20250214142001.552916-1-imre.deak@intel.com>

Add the missing PHY lane stagger delay programming for ICL-ADL
platforms on TypeC DP outputs.

v2: (Jani)
- Clarify code comment about lane stagger programming.
- Robustify macro calls with parens.

Bspec: 7534, 49533
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/gpu/drm/i915/display/intel_ddi.c | 29 ++++++++++++++++++++++++
 drivers/gpu/drm/i915/i915_reg.h          |  3 +++
 2 files changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index a09363e5dc148..1e7ae93340ff4 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -328,9 +328,32 @@ static u32 ddi_buf_phy_link_rate(int port_clock)
 	}
 }
 
+static int dp_phy_lane_stagger_delay(int port_clock)
+{
+	/*
+	 * Return the number of symbol clocks delay used to stagger the
+	 * assertion/desassertion of the port lane enables. The target delay
+	 * time is 100 ns or greater, return the number of symbols specific to
+	 * the provided port_clock (aka link clock) corresponding to this delay
+	 * time, i.e. so that
+	 *
+	 * number_of_symbols * duration_of_one_symbol >= 100 ns
+	 *
+	 * The delay must be applied only on TypeC DP outputs, for everything else
+	 * the delay must be set to 0.
+	 *
+	 * Return the number of link symbols per 100 ns:
+	 * port_clock (10 kHz) -> bits    / 100 us
+	 * / symbol_size       -> symbols / 100 us
+	 * / 1000              -> symbols / 100 ns
+	 */
+	return DIV_ROUND_UP(port_clock, intel_dp_link_symbol_size(port_clock) * 1000);
+}
+
 static void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder,
 				      const struct intel_crtc_state *crtc_state)
 {
+	struct intel_display *display = to_intel_display(encoder);
 	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
 	struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
 	struct intel_digital_port *dig_port = enc_to_dig_port(encoder);
@@ -356,6 +379,12 @@ static void intel_ddi_init_dp_buf_reg(struct intel_encoder *encoder,
 		if (!intel_tc_port_in_tbt_alt_mode(dig_port))
 			intel_dp->DP |= DDI_BUF_CTL_TC_PHY_OWNERSHIP;
 	}
+
+	if (IS_DISPLAY_VER(display, 11, 13) && intel_encoder_is_tc(encoder)) {
+		int delay = dp_phy_lane_stagger_delay(crtc_state->port_clock);
+
+		intel_dp->DP |= DDI_BUF_LANE_STAGGER_DELAY(delay);
+	}
 }
 
 static int icl_calc_tbt_pll_link(struct intel_display *display,
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3eea191f20175..50efaab3b5536 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -3636,6 +3636,9 @@ enum skl_power_gate {
 #define  DDI_BUF_PORT_DATA_20BIT		REG_FIELD_PREP(DDI_BUF_PORT_DATA_MASK, 1)
 #define  DDI_BUF_PORT_DATA_40BIT		REG_FIELD_PREP(DDI_BUF_PORT_DATA_MASK, 2)
 #define  DDI_BUF_PORT_REVERSAL			(1 << 16)
+#define  DDI_BUF_LANE_STAGGER_DELAY_MASK	REG_GENMASK(15, 8)
+#define  DDI_BUF_LANE_STAGGER_DELAY(symbols)	REG_FIELD_PREP(DDI_BUF_LANE_STAGGER_DELAY_MASK, \
+							       (symbols))
 #define  DDI_BUF_IS_IDLE			(1 << 7)
 #define  DDI_BUF_CTL_TC_PHY_OWNERSHIP		REG_BIT(6)
 #define  DDI_A_4_LANES				(1 << 4)
-- 
2.44.2


  parent reply	other threads:[~2025-02-14 14:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14 14:19 [PATCH v2 00/11] drm/i915/ddi: Fix/simplify port enabling/disabling Imre Deak
2025-02-14 14:19 ` [PATCH v2 01/11] drm/i915/dsi: Use TRANS_DDI_FUNC_CTL's own port width macro Imre Deak
2025-02-14 14:19 ` [PATCH v2 02/11] drm/i915/ddi: Fix HDMI port width programming in DDI_BUF_CTL Imre Deak
2025-02-14 14:19 ` [PATCH v2 03/11] drm/i915/ddi: Make all the PORT_WIDTH macros work the same way Imre Deak
2025-02-14 14:19 ` Imre Deak [this message]
2025-02-14 14:19 ` [PATCH v2 05/11] drm/i915/ddi: Simplify the port enabling via DDI_BUF_CTL Imre Deak
2025-02-14 14:19 ` [PATCH v2 06/11] drm/i915/ddi: Simplify the port disabling " Imre Deak
2025-02-14 14:19 ` [PATCH v2 07/11] drm/i915/ddi: Simplify waiting for a port to get active/idle " Imre Deak
2025-02-14 14:19 ` [PATCH v2 08/11] drm/i915/ddi: Move platform checks within mtl_ddi_enable/disable_d2d_link() Imre Deak
2025-02-14 14:19 ` [PATCH v2 09/11] drm/i915/ddi: Unify the platform specific functions disabling a port Imre Deak
2025-02-14 14:20 ` [PATCH v2 10/11] drm/i915/ddi: Add a helper to enable " Imre Deak
2025-02-14 14:20 ` [PATCH v2 11/11] drm/i915/ddi: Sanitize DDI_BUF_CTL register definitions Imre Deak
2025-02-14 15:14 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/ddi: Fix/simplify port enabling/disabling (rev2) Patchwork
2025-02-14 15:14 ` ✗ Fi.CI.SPARSE: " Patchwork
2025-02-14 15:33 ` ✓ i915.CI.BAT: success " Patchwork
2025-02-14 15:37 ` [PATCH v2 00/11] drm/i915/ddi: Fix/simplify port enabling/disabling Jani Nikula
2025-02-14 17:18 ` ✗ i915.CI.Full: failure for drm/i915/ddi: Fix/simplify port enabling/disabling (rev2) Patchwork
2025-02-14 20:15   ` Imre Deak
2025-02-14 20:22     ` 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=20250214142001.552916-5-imre.deak@intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /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