Intel-XE 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 09/11] drm/i915/ddi: Unify the platform specific functions disabling a port
Date: Fri, 14 Feb 2025 16:19:59 +0200	[thread overview]
Message-ID: <20250214142001.552916-10-imre.deak@intel.com> (raw)
In-Reply-To: <20250214142001.552916-1-imre.deak@intel.com>

The functions disabling a port for MTL+ and earlier platforms only
differ by an extra step on MTL+ (to disable the D2D link) and the point
at which the port's idle state is waited for. Combine the two functions
accounting for the above differences, removing the duplication.

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 | 43 ++++--------------------
 1 file changed, 7 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
index 0cb6c95315fcd..56094a33b0c4a 100644
--- a/drivers/gpu/drm/i915/display/intel_ddi.c
+++ b/drivers/gpu/drm/i915/display/intel_ddi.c
@@ -3076,58 +3076,29 @@ mtl_ddi_disable_d2d(struct intel_encoder *encoder)
 			port_name(port));
 }
 
-static void mtl_disable_ddi_buf(struct intel_encoder *encoder,
-				const struct intel_crtc_state *crtc_state)
+static void intel_disable_ddi_buf(struct intel_encoder *encoder,
+				  const struct intel_crtc_state *crtc_state)
 {
+	struct intel_display *display = to_intel_display(encoder);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	enum port port = encoder->port;
 
-	/* 3.b Clear DDI_CTL_DE Enable to 0. */
 	intel_de_rmw(dev_priv, DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE, 0);
 
-	/* 3.c Poll for PORT_BUF_CTL Idle Status == 1, timeout after 100us */
-	intel_wait_ddi_buf_idle(dev_priv, port);
+	if (DISPLAY_VER(display) >= 14)
+		intel_wait_ddi_buf_idle(dev_priv, port);
 
-	/* 3.d Disable D2D Link */
 	mtl_ddi_disable_d2d(encoder);
 
-	/* 3.e Disable DP_TP_CTL */
 	if (intel_crtc_has_dp_encoder(crtc_state)) {
 		intel_de_rmw(dev_priv, dp_tp_ctl_reg(encoder, crtc_state),
 			     DP_TP_CTL_ENABLE, 0);
 	}
-}
-
-static void disable_ddi_buf(struct intel_encoder *encoder,
-			    const struct intel_crtc_state *crtc_state)
-{
-	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-	enum port port = encoder->port;
-
-	intel_de_rmw(dev_priv, DDI_BUF_CTL(port), DDI_BUF_CTL_ENABLE, 0);
-
-	if (intel_crtc_has_dp_encoder(crtc_state))
-		intel_de_rmw(dev_priv, dp_tp_ctl_reg(encoder, crtc_state),
-			     DP_TP_CTL_ENABLE, 0);
 
 	intel_ddi_disable_fec(encoder, crtc_state);
 
-	intel_wait_ddi_buf_idle(dev_priv, port);
-}
-
-static void intel_disable_ddi_buf(struct intel_encoder *encoder,
-				  const struct intel_crtc_state *crtc_state)
-{
-	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-
-	if (DISPLAY_VER(dev_priv) >= 14) {
-		mtl_disable_ddi_buf(encoder, crtc_state);
-
-		/* 3.f Disable DP_TP_CTL FEC Enable if it is needed */
-		intel_ddi_disable_fec(encoder, crtc_state);
-	} else {
-		disable_ddi_buf(encoder, crtc_state);
-	}
+	if (DISPLAY_VER(display) < 14)
+		intel_wait_ddi_buf_idle(dev_priv, port);
 
 	intel_ddi_wait_for_fec_status(encoder, crtc_state, false);
 }
-- 
2.44.2


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

Thread overview: 21+ 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 ` [PATCH v2 04/11] drm/i915/ddi: Set missing TC DP PHY lane stagger delay in DDI_BUF_CTL Imre Deak
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 ` Imre Deak [this message]
2025-02-14 14:20 ` [PATCH v2 10/11] drm/i915/ddi: Add a helper to enable a port 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:09 ` ✓ CI.Patch_applied: success for drm/i915/ddi: Fix/simplify port enabling/disabling (rev2) Patchwork
2025-02-14 15:09 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-14 15:10 ` ✓ CI.KUnit: success " Patchwork
2025-02-14 15:27 ` ✓ CI.Build: " Patchwork
2025-02-14 15:29 ` ✓ CI.Hooks: " Patchwork
2025-02-14 15:31 ` ✗ CI.checksparse: warning " Patchwork
2025-02-14 15:37 ` [PATCH v2 00/11] drm/i915/ddi: Fix/simplify port enabling/disabling Jani Nikula
2025-02-14 15:50 ` ✓ Xe.CI.BAT: success for drm/i915/ddi: Fix/simplify port enabling/disabling (rev2) Patchwork
2025-02-15 14:55 ` ✗ Xe.CI.Full: failure " Patchwork

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-10-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