[RFC v2 3/4] drm/i915/display: use wakelock in register waiting functions

Luca Coelho luciano.coelho at intel.com
Thu Jan 11 09:16:21 UTC 2024


Add the wakelock functonality to the functions that help wait for
register bits to be set.

Signed-off-by: Luca Coelho <luciano.coelho at intel.com>
---
 drivers/gpu/drm/i915/display/intel_de.h | 52 ++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_de.h b/drivers/gpu/drm/i915/display/intel_de.h
index c7c00bebb3eb..220907442bad 100644
--- a/drivers/gpu/drm/i915/display/intel_de.h
+++ b/drivers/gpu/drm/i915/display/intel_de.h
@@ -97,14 +97,30 @@ static inline int
 intel_de_wait_for_register(struct drm_i915_private *i915, i915_reg_t reg,
 			   u32 mask, u32 value, unsigned int timeout)
 {
-	return intel_wait_for_register(&i915->uncore, reg, mask, value, timeout);
+	int ret;
+
+	intel_display_wl_get(i915, reg);
+
+	ret = intel_wait_for_register(&i915->uncore, reg, mask, value, timeout);
+
+	intel_display_wl_put(i915, reg);
+
+	return ret;
 }
 
 static inline int
 intel_de_wait_for_register_fw(struct drm_i915_private *i915, i915_reg_t reg,
 			      u32 mask, u32 value, unsigned int timeout)
 {
-	return intel_wait_for_register_fw(&i915->uncore, reg, mask, value, timeout);
+	int ret;
+
+	intel_display_wl_get(i915, reg);
+
+	ret = intel_wait_for_register_fw(&i915->uncore, reg, mask, value, timeout);
+
+	intel_display_wl_put(i915, reg);
+
+	return ret;
 }
 
 static inline int
@@ -113,22 +129,46 @@ __intel_de_wait_for_register(struct drm_i915_private *i915, i915_reg_t reg,
 			     unsigned int fast_timeout_us,
 			     unsigned int slow_timeout_ms, u32 *out_value)
 {
-	return __intel_wait_for_register(&i915->uncore, reg, mask, value,
-					 fast_timeout_us, slow_timeout_ms, out_value);
+	int ret;
+
+	intel_display_wl_get(i915, reg);
+
+	ret = __intel_wait_for_register(&i915->uncore, reg, mask, value,
+					fast_timeout_us, slow_timeout_ms, out_value);
+
+	intel_display_wl_put(i915, reg);
+
+	return ret;
 }
 
 static inline int
 intel_de_wait_for_set(struct drm_i915_private *i915, i915_reg_t reg,
 		      u32 mask, unsigned int timeout)
 {
-	return intel_de_wait_for_register(i915, reg, mask, mask, timeout);
+	int ret;
+
+	intel_display_wl_get(i915, reg);
+
+	ret = intel_de_wait_for_register(i915, reg, mask, mask, timeout);
+
+	intel_display_wl_put(i915, reg);
+
+	return ret;
 }
 
 static inline int
 intel_de_wait_for_clear(struct drm_i915_private *i915, i915_reg_t reg,
 			u32 mask, unsigned int timeout)
 {
-	return intel_de_wait_for_register(i915, reg, mask, 0, timeout);
+	int ret;
+
+	intel_display_wl_get(i915, reg);
+
+	ret = intel_de_wait_for_register(i915, reg, mask, 0, timeout);
+
+	intel_display_wl_put(i915, reg);
+
+	return ret;
 }
 
 /*
-- 
2.39.2



More information about the Intel-xe mailing list