Skip to content

Commit 2206c5b

Browse files
committed
drm/i915/de: Replace __intel_de_rmw_nowl() with intel_de_rmw_fw()
We already have the lower level intel_de_*_fw() stuff, so use that instead of hand rolling something custom for the DMC wakelock stuff. As the wakelock stuff exists only on platforms supported by the xe driver this doesn't even result in any functional changes since xe doesn't have uncore.lock nor unclaimed register access detection. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20251110172756.2132-13-ville.syrjala@linux.intel.com Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com> Acked-by: Jani Nikula <jani.nikula@intel.com>
1 parent 864787d commit 2206c5b

2 files changed

Lines changed: 18 additions & 14 deletions

File tree

drivers/gpu/drm/i915/display/intel_de.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,14 @@ intel_de_write(struct intel_display *display, i915_reg_t reg, u32 val)
8383
intel_dmc_wl_put(display, reg);
8484
}
8585

86-
static inline u32
87-
__intel_de_rmw_nowl(struct intel_display *display, i915_reg_t reg,
88-
u32 clear, u32 set)
89-
{
90-
return intel_uncore_rmw(__to_uncore(display), reg, clear, set);
91-
}
92-
9386
static inline u32
9487
intel_de_rmw(struct intel_display *display, i915_reg_t reg, u32 clear, u32 set)
9588
{
9689
u32 val;
9790

9891
intel_dmc_wl_get(display, reg);
9992

100-
val = __intel_de_rmw_nowl(display, reg, clear, set);
93+
val = intel_uncore_rmw(__to_uncore(display), reg, clear, set);
10194

10295
intel_dmc_wl_put(display, reg);
10396

@@ -219,6 +212,18 @@ intel_de_write_fw(struct intel_display *display, i915_reg_t reg, u32 val)
219212
intel_uncore_write_fw(__to_uncore(display), reg, val);
220213
}
221214

215+
static inline u32
216+
intel_de_rmw_fw(struct intel_display *display, i915_reg_t reg, u32 clear, u32 set)
217+
{
218+
u32 old, val;
219+
220+
old = intel_de_read_fw(display, reg);
221+
val = (old & ~clear) | set;
222+
intel_de_write_fw(display, reg, val);
223+
224+
return old;
225+
}
226+
222227
static inline u32
223228
intel_de_read_notrace(struct intel_display *display, i915_reg_t reg)
224229
{

drivers/gpu/drm/i915/display/intel_dmc_wl.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ static void intel_dmc_wl_work(struct work_struct *work)
179179
if (refcount_read(&wl->refcount))
180180
goto out_unlock;
181181

182-
__intel_de_rmw_nowl(display, DMC_WAKELOCK1_CTL, DMC_WAKELOCK_CTL_REQ, 0);
182+
intel_de_rmw_fw(display, DMC_WAKELOCK1_CTL, DMC_WAKELOCK_CTL_REQ, 0);
183183

184184
if (__intel_de_wait_for_register_atomic_nowl(display, DMC_WAKELOCK1_CTL,
185185
DMC_WAKELOCK_CTL_ACK, 0,
@@ -207,8 +207,7 @@ static void __intel_dmc_wl_take(struct intel_display *display)
207207
if (wl->taken)
208208
return;
209209

210-
__intel_de_rmw_nowl(display, DMC_WAKELOCK1_CTL, 0,
211-
DMC_WAKELOCK_CTL_REQ);
210+
intel_de_rmw_fw(display, DMC_WAKELOCK1_CTL, 0, DMC_WAKELOCK_CTL_REQ);
212211

213212
/*
214213
* We need to use the atomic variant of the waiting routine
@@ -360,7 +359,7 @@ void intel_dmc_wl_enable(struct intel_display *display, u32 dc_state)
360359
* wakelock, because we're just enabling it, so call the
361360
* non-locking version directly here.
362361
*/
363-
__intel_de_rmw_nowl(display, DMC_WAKELOCK_CFG, 0, DMC_WAKELOCK_CFG_ENABLE);
362+
intel_de_rmw_fw(display, DMC_WAKELOCK_CFG, 0, DMC_WAKELOCK_CFG_ENABLE);
364363

365364
wl->enabled = true;
366365

@@ -402,7 +401,7 @@ void intel_dmc_wl_disable(struct intel_display *display)
402401
goto out_unlock;
403402

404403
/* Disable wakelock in DMC */
405-
__intel_de_rmw_nowl(display, DMC_WAKELOCK_CFG, DMC_WAKELOCK_CFG_ENABLE, 0);
404+
intel_de_rmw_fw(display, DMC_WAKELOCK_CFG, DMC_WAKELOCK_CFG_ENABLE, 0);
406405

407406
wl->enabled = false;
408407

@@ -414,7 +413,7 @@ void intel_dmc_wl_disable(struct intel_display *display)
414413
*
415414
* TODO: Get the correct expectation from the hardware team.
416415
*/
417-
__intel_de_rmw_nowl(display, DMC_WAKELOCK1_CTL, DMC_WAKELOCK_CTL_REQ, 0);
416+
intel_de_rmw_fw(display, DMC_WAKELOCK1_CTL, DMC_WAKELOCK_CTL_REQ, 0);
418417

419418
wl->taken = false;
420419

0 commit comments

Comments
 (0)