mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 19:47:08 +02:00
drm/i915/gmbus: use generic poll_timeout*() instead of wait_for*()
Prefer generic poll helpers over i915 custom helpers.
The "two tier" wait_for_us() + wait_for() combination appeared without
much explanation in commit 4e6c2d58ba ("drm/i915: Take forcewake once
for the entire GMBUS transaction"). Try to mimic roughly the same with
the generic helpers.
wait_for_us() with 10 us or shorter timeouts ends up in
_wait_for_atomic(). Thus use poll_timeout_us_atomic() for the first try,
with the same 2 us timeout and no sleep.
For the fallback, the functional change is losing the exponentially
growing sleep of wait_for(), which used to be 10, 20, 40, ..., 640, and
1280 us. Use an arbitrary constant 500 us sleep instead. The timeout
remains at 50 ms.
Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/564b397352c53a1116519fb2d53050c0426bc0dc.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
parent
0399a33685
commit
11080a5ea8
|
|
@ -30,13 +30,13 @@
|
|||
#include <linux/export.h>
|
||||
#include <linux/i2c-algo-bit.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/iopoll.h>
|
||||
|
||||
#include <drm/display/drm_hdcp_helper.h>
|
||||
|
||||
#include "i915_drv.h"
|
||||
#include "i915_irq.h"
|
||||
#include "i915_reg.h"
|
||||
#include "i915_utils.h"
|
||||
#include "intel_de.h"
|
||||
#include "intel_display_regs.h"
|
||||
#include "intel_display_types.h"
|
||||
|
|
@ -415,11 +415,14 @@ static int gmbus_wait(struct intel_display *display, u32 status, u32 irq_en)
|
|||
intel_de_write_fw(display, GMBUS4(display), irq_en);
|
||||
|
||||
status |= GMBUS_SATOER;
|
||||
ret = wait_for_us((gmbus2 = intel_de_read_fw(display, GMBUS2(display))) & status,
|
||||
2);
|
||||
|
||||
ret = poll_timeout_us_atomic(gmbus2 = intel_de_read_fw(display, GMBUS2(display)),
|
||||
gmbus2 & status,
|
||||
0, 2, false);
|
||||
if (ret)
|
||||
ret = wait_for((gmbus2 = intel_de_read_fw(display, GMBUS2(display))) & status,
|
||||
50);
|
||||
ret = poll_timeout_us(gmbus2 = intel_de_read_fw(display, GMBUS2(display)),
|
||||
gmbus2 & status,
|
||||
500, 50 * 1000, false);
|
||||
|
||||
intel_de_write_fw(display, GMBUS4(display), 0);
|
||||
remove_wait_queue(&display->gmbus.wait_queue, &wait);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user