Skip to content

Commit a975fea

Browse files
committed
drm/i915/power: use intel_de_wait_for_clear() instead of wait_for()
Prefer the register read specific wait function over i915 wait_for_us(). The existing condition is quite complicated. Simplify by checking for requesters first, and determine timeout based on that. Refresh requesters in case of timeouts, should one have popped up during the wait. The downside is that this does not cut the wait short if requesters show up *during* the wait, but we're talking about 1 ms so shouldn't be an issue. v2: Refresh requesters only if there were none before (Imre) Cc: Imre Deak <[email protected]> Reviewed-by: Imre Deak <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jani Nikula <[email protected]>
1 parent 95f2dec commit a975fea

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ static void hsw_wait_for_power_well_disable(struct intel_display *display,
320320
{
321321
const struct i915_power_well_regs *regs = power_well->desc->ops->regs;
322322
int pw_idx = i915_power_well_instance(power_well)->hsw.idx;
323-
bool disabled;
324323
u32 reqs;
324+
int ret;
325325

326326
/*
327327
* Bspec doesn't require waiting for PWs to get disabled, but still do
@@ -332,12 +332,18 @@ static void hsw_wait_for_power_well_disable(struct intel_display *display,
332332
* Skip the wait in case any of the request bits are set and print a
333333
* diagnostic message.
334334
*/
335-
wait_for((disabled = !(intel_de_read(display, regs->driver) &
336-
HSW_PWR_WELL_CTL_STATE(pw_idx))) ||
337-
(reqs = hsw_power_well_requesters(display, regs, pw_idx)), 1);
338-
if (disabled)
335+
reqs = hsw_power_well_requesters(display, regs, pw_idx);
336+
337+
ret = intel_de_wait_for_clear(display, regs->driver,
338+
HSW_PWR_WELL_CTL_STATE(pw_idx),
339+
reqs ? 0 : 1);
340+
if (!ret)
339341
return;
340342

343+
/* Refresh requesters in case they popped up during the wait. */
344+
if (!reqs)
345+
reqs = hsw_power_well_requesters(display, regs, pw_idx);
346+
341347
drm_dbg_kms(display->drm,
342348
"%s forced on (bios:%d driver:%d kvmr:%d debug:%d)\n",
343349
intel_power_well_name(power_well),

0 commit comments

Comments
 (0)