Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/dsi-pll: use generic poll_timeout_us() instead of wait_for()

Prefer generic poll helpers over i915 custom helpers.

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
20 ms.

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
Link: https://lore.kernel.org/r/476fcc5aad9e2ddbf6d8c14bd5ff5cbf071c5dca.1756383233.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+7 -4
+7 -4
drivers/gpu/drm/i915/display/vlv_dsi_pll.c
··· 25 25 * Yogesh Mohan Marimuthu <yogesh.mohan.marimuthu@intel.com> 26 26 */ 27 27 28 + #include <linux/iopoll.h> 28 29 #include <linux/kernel.h> 29 30 #include <linux/string_helpers.h> 30 31 31 32 #include <drm/drm_print.h> 32 33 33 - #include "i915_utils.h" 34 34 #include "intel_de.h" 35 35 #include "intel_display_types.h" 36 36 #include "intel_dsi.h" ··· 214 214 const struct intel_crtc_state *config) 215 215 { 216 216 struct intel_display *display = to_intel_display(encoder); 217 + u32 val; 218 + int ret; 217 219 218 220 drm_dbg_kms(display->drm, "\n"); 219 221 ··· 233 231 234 232 vlv_cck_write(display->drm, CCK_REG_DSI_PLL_CONTROL, config->dsi_pll.ctrl); 235 233 236 - if (wait_for(vlv_cck_read(display->drm, CCK_REG_DSI_PLL_CONTROL) & 237 - DSI_PLL_LOCK, 20)) { 238 - 234 + ret = poll_timeout_us(val = vlv_cck_read(display->drm, CCK_REG_DSI_PLL_CONTROL), 235 + val & DSI_PLL_LOCK, 236 + 500, 20 * 1000, false); 237 + if (ret) { 239 238 vlv_cck_put(display->drm); 240 239 drm_err(display->drm, "DSI PLL lock failed\n"); 241 240 return;