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.

Signed-off-by: Jani Nikula <[email protected]>
---
 drivers/gpu/drm/i915/display/vlv_dsi_pll.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/vlv_dsi_pll.c 
b/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
index d42b61e6f076..059a1cd9a4e6 100644
--- a/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
+++ b/drivers/gpu/drm/i915/display/vlv_dsi_pll.c
@@ -25,6 +25,7 @@
  *     Yogesh Mohan Marimuthu <[email protected]>
  */
 
+#include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <linux/string_helpers.h>
 
@@ -216,6 +217,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");
 
@@ -233,8 +236,11 @@ 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 = read_poll_timeout(vlv_cck_read, val,
+                               val & DSI_PLL_LOCK,
+                               500, 20 * 1000, false,
+                               display->drm, CCK_REG_DSI_PLL_CONTROL);
+       if (ret) {
 
                vlv_cck_put(display->drm);
                drm_err(display->drm, "DSI PLL lock failed\n");
-- 
2.39.5

Reply via email to