void * nv04_pm_clocks_pre(struct drm_device *dev, struct nouveau_pm_level *perflvl) { struct nv04_pm_state *info; int ret; info = kzalloc(sizeof(*info), GFP_KERNEL); if (!info) return ERR_PTR(-ENOMEM); ret = calc_pll(dev, PLL_CORE, perflvl->core, &info->core); if (ret) goto error; if (perflvl->memory) { ret = calc_pll(dev, PLL_MEMORY, perflvl->memory, &info->memory); if (ret) goto error; } return info; error: kfree(info); return ERR_PTR(ret); }
static void update_clocks(IMXCCMState *s) { /* * If we ever emulate more clocks, this should switch to a data-driven * approach */ if ((s->ccmr & CCMR_PRCS) == 1) { s->pll_refclk_freq = CKIL_FREQ * 1024; } else { s->pll_refclk_freq = CKIH_FREQ; } /* ipg_clk_arm aka MCU clock */ if ((s->ccmr & CCMR_MDS) || !(s->ccmr & CCMR_MPE)) { s->mcu_clk_freq = s->pll_refclk_freq; } else { s->mcu_clk_freq = calc_pll(s->mpctl, s->pll_refclk_freq); } /* High-speed clock */ s->hsp_clk_freq = s->mcu_clk_freq / (1 + EXTRACT(s->pdr0, HSP)); s->ipg_clk_freq = s->hsp_clk_freq / (1 + EXTRACT(s->pdr0, IPG)); DPRINTF("Clocks: mcu %uMHz, HSP %uMHz, IPG %uHz\n", s->mcu_clk_freq / 1000000, s->hsp_clk_freq / 1000000, s->ipg_clk_freq); }