[PATCH 6/8] drm/i915/sbi: convert to intel_de_*()

Jani Nikula jani.nikula at intel.com
Tue May 13 12:17:05 UTC 2025


Convert SBI to use the intel_de_*() interface. This allows us to drop
the dependency in i915_drv.h while at it.

The fast timeout for the status wait drops from 100 us to 2 us on i915,
but that should be of no consequence. The slow timeout remains the same.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 drivers/gpu/drm/i915/display/intel_sbi.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_sbi.c b/drivers/gpu/drm/i915/display/intel_sbi.c
index ced504f26ac1..aea5e12519b9 100644
--- a/drivers/gpu/drm/i915/display/intel_sbi.c
+++ b/drivers/gpu/drm/i915/display/intel_sbi.c
@@ -5,30 +5,28 @@
  * LPT/WPT IOSF sideband.
  */
 
-#include "i915_drv.h"
-#include "intel_sbi.h"
+#include <drm/drm_print.h>
+
 #include "i915_reg.h"
+#include "intel_de.h"
+#include "intel_sbi.h"
 
 /* SBI access */
 static int intel_sbi_rw(struct intel_display *display, u16 reg,
 			enum intel_sbi_destination destination,
 			u32 *val, bool is_read)
 {
-	struct drm_i915_private *i915 = to_i915(display->drm);
-	struct intel_uncore *uncore = &i915->uncore;
 	u32 cmd;
 
 	lockdep_assert_held(&display->sbi.lock);
 
-	if (intel_wait_for_register_fw(uncore,
-				       SBI_CTL_STAT, SBI_BUSY, 0,
-				       100, NULL)) {
+	if (intel_de_wait_fw(display, SBI_CTL_STAT, SBI_BUSY, 0, 100, NULL)) {
 		drm_err(display->drm, "timeout waiting for SBI to become ready\n");
 		return -EBUSY;
 	}
 
-	intel_uncore_write_fw(uncore, SBI_ADDR, (u32)reg << 16);
-	intel_uncore_write_fw(uncore, SBI_DATA, is_read ? 0 : *val);
+	intel_de_write_fw(display, SBI_ADDR, (u32)reg << 16);
+	intel_de_write_fw(display, SBI_DATA, is_read ? 0 : *val);
 
 	if (destination == SBI_ICLK)
 		cmd = SBI_CTL_DEST_ICLK | SBI_CTL_OP_CRRD;
@@ -36,11 +34,9 @@ static int intel_sbi_rw(struct intel_display *display, u16 reg,
 		cmd = SBI_CTL_DEST_MPHY | SBI_CTL_OP_IORD;
 	if (!is_read)
 		cmd |= BIT(8);
-	intel_uncore_write_fw(uncore, SBI_CTL_STAT, cmd | SBI_BUSY);
+	intel_de_write_fw(display, SBI_CTL_STAT, cmd | SBI_BUSY);
 
-	if (__intel_wait_for_register_fw(uncore,
-					 SBI_CTL_STAT, SBI_BUSY, 0,
-					 100, 100, &cmd)) {
+	if (intel_de_wait_fw(display, SBI_CTL_STAT, SBI_BUSY, 0, 100, &cmd)) {
 		drm_err(display->drm, "timeout waiting for SBI to complete read\n");
 		return -ETIMEDOUT;
 	}
@@ -51,7 +47,7 @@ static int intel_sbi_rw(struct intel_display *display, u16 reg,
 	}
 
 	if (is_read)
-		*val = intel_uncore_read_fw(uncore, SBI_DATA);
+		*val = intel_de_read_fw(display, SBI_DATA);
 
 	return 0;
 }
-- 
2.39.5



More information about the Intel-gfx mailing list