int dsim_reg_enable_pll(u32 id, u32 en) { u32 cnt; struct dsim_device *dsim0 = get_dsim_drvdata(0); struct dsim_device *dsim1 = get_dsim_drvdata(1); if ((dsim0 != NULL) && (dsim1 != NULL)) { if ((dsim0->state == DSIM_STATE_SUSPEND) && (dsim1->state == DSIM_STATE_SUSPEND)) id = 0; else goto exit_enable_pll; } if (en) { cnt = 1000; dsim_reg_clear_int(id, DSIM_INTSRC_PLL_STABLE); dsim_reg_set_pll(id, 1); while (1) { cnt--; if (dsim_reg_is_pll_stable(id)) return 0; if (cnt == 0) return -EBUSY; } } else { dsim_reg_set_pll(id, 0); } exit_enable_pll: return 0; }
int dsim_reg_enable_pll(u32 id, u32 en) { u32 cnt; if (en) { cnt = 1000; dsim_reg_clear_int(id, DSIM_INTSRC_PLL_STABLE); dsim_reg_set_pll(id, 1); while (1) { cnt--; if (dsim_reg_is_pll_stable(id)) return 0; if (cnt == 0) return -EBUSY; } } else { dsim_reg_set_pll(id, 0); } return 0; }
int dsim_reg_enable_pll(u32 en) { u32 cnt = 1000; if (en) { dsim_reg_clear_int(DSIM_INTSRC_PLL_STABLE); dsim_reg_set_pll(1); udelay(200); /* should be wait 200us to stable PLL */ while (1) { cnt--; if (dsim_reg_is_pll_stable()) return 0; if (cnt == 0) return -EBUSY; } } else { dsim_reg_set_pll(0); } return 0; }