From 14a8254076eca87033c35dd16ad3d4c18db3da61 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Tue, 6 Mar 2012 21:17:28 +0200 Subject: [PATCH] gfx: drv: cleanup dsi pll lock loop in mdfld_restore_display_registers Use the already existing macro to wait for the HW flag becoming set. The current timeout value will change from the current 3 second. The actual PLL settling time according to measurement is < 100usec or 200 iterations of the busy wait loop. So the new timeout duration of 100000 iterations should be enough. Signed-off-by: Imre Deak Reviewed-by: Jani Nikula Signed-off-by: Kirill A. Shutemov --- drivers/staging/mrst/drv/psb_powermgmt.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/staging/mrst/drv/psb_powermgmt.c b/drivers/staging/mrst/drv/psb_powermgmt.c index 7bafa62..0f37348 100644 --- a/drivers/staging/mrst/drv/psb_powermgmt.c +++ b/drivers/staging/mrst/drv/psb_powermgmt.c @@ -598,7 +598,6 @@ static int mdfld_restore_display_registers(struct drm_device *dev, int pipe) struct mdfld_dsi_config * dsi_config = NULL; u32 i = 0; u32 dpll = 0; - u32 timeout = 0; /* regester */ u32 dpll_reg = MRST_DPLL_A; @@ -653,8 +652,6 @@ static int mdfld_restore_display_registers(struct drm_device *dev, int pipe) dpll = PSB_RVDC32(dpll_reg); if (!(dpll & DPLL_VCO_ENABLE)) { - unsigned long pipeconf_reg; - /* When ungating power of DPLL, needs to wait 0.5us before enable the VCO */ if (dpll & MDFLD_PWR_GATE_EN) { dpll &= ~MDFLD_PWR_GATE_EN; @@ -672,15 +669,9 @@ static int mdfld_restore_display_registers(struct drm_device *dev, int pipe) PSB_WVDC32(dpll_val, dpll_reg); PSB_RVDC32(dpll_reg); - pipeconf_reg = PSB_PIPECONF(pipe); - /* wait for DSI PLL to lock */ - while ((timeout < 20000) && !(PSB_RVDC32(pipeconf_reg) & PIPECONF_DSIPLL_LOCK)) { - udelay(150); - timeout ++; - } - - if (timeout == 20000) { - DRM_ERROR("%s, can't lock DSIPLL. \n", __FUNCTION__); + if (REG_FLAG_WAIT_SET(PSB_PIPECONF(pipe), + PIPECONF_DSIPLL_LOCK)) { + DRM_ERROR("%s, can't lock DSIPLL.\n", __func__); return -EINVAL; } } -- 2.7.4