]> www.infradead.org Git - users/hch/misc.git/commitdiff
drm/i915/dsi-pll: use generic poll_timeout_us() instead of wait_for()
authorJani Nikula <jani.nikula@intel.com>
Thu, 28 Aug 2025 12:20:47 +0000 (15:20 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 4 Sep 2025 11:02:58 +0000 (14:02 +0300)
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>
drivers/gpu/drm/i915/display/vlv_dsi_pll.c

index 83afe1315e9667251ca2a9b679c220cc2f058516..f078b9cda96cdb70475553bbd325a713d53228fd 100644 (file)
  *     Yogesh Mohan Marimuthu <yogesh.mohan.marimuthu@intel.com>
  */
 
+#include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/string_helpers.h>
 
 #include <drm/drm_print.h>
 
-#include "i915_utils.h"
 #include "intel_de.h"
 #include "intel_display_types.h"
 #include "intel_dsi.h"
@@ -214,6 +214,8 @@ void vlv_dsi_pll_enable(struct intel_encoder *encoder,
                        const struct intel_crtc_state *config)
 {
        struct intel_display *display = to_intel_display(encoder);
+       u32 val;
+       int ret;
 
        drm_dbg_kms(display->drm, "\n");
 
@@ -231,9 +233,10 @@ void vlv_dsi_pll_enable(struct intel_encoder *encoder,
 
        vlv_cck_write(display->drm, CCK_REG_DSI_PLL_CONTROL, config->dsi_pll.ctrl);
 
-       if (wait_for(vlv_cck_read(display->drm, CCK_REG_DSI_PLL_CONTROL) &
-                                               DSI_PLL_LOCK, 20)) {
-
+       ret = poll_timeout_us(val = vlv_cck_read(display->drm, CCK_REG_DSI_PLL_CONTROL),
+                             val & DSI_PLL_LOCK,
+                             500, 20 * 1000, false);
+       if (ret) {
                vlv_cck_put(display->drm);
                drm_err(display->drm, "DSI PLL lock failed\n");
                return;