Lines Matching refs:cpuclk

68 			    struct rockchip_cpuclk *cpuclk, unsigned long rate)  in rockchip_get_cpuclk_settings()  argument
71 cpuclk->rate_table; in rockchip_get_cpuclk_settings()
74 for (i = 0; i < cpuclk->rate_count; i++) { in rockchip_get_cpuclk_settings()
85 struct rockchip_cpuclk *cpuclk = to_rockchip_cpuclk_hw(hw); in rockchip_cpuclk_recalc_rate() local
86 const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; in rockchip_cpuclk_recalc_rate()
87 u32 clksel0 = readl_relaxed(cpuclk->reg_base + reg_data->core_reg[0]); in rockchip_cpuclk_recalc_rate()
98 static void rockchip_cpuclk_set_dividers(struct rockchip_cpuclk *cpuclk, in rockchip_cpuclk_set_dividers() argument
112 writel(clksel->val, cpuclk->reg_base + clksel->reg); in rockchip_cpuclk_set_dividers()
116 static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk, in rockchip_cpuclk_pre_rate_change() argument
119 const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; in rockchip_cpuclk_pre_rate_change()
126 rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate); in rockchip_cpuclk_pre_rate_change()
133 alt_prate = clk_get_rate(cpuclk->alt_parent); in rockchip_cpuclk_pre_rate_change()
135 spin_lock_irqsave(cpuclk->lock, flags); in rockchip_cpuclk_pre_rate_change()
165 cpuclk->reg_base + reg_data->core_reg[i]); in rockchip_cpuclk_pre_rate_change()
172 cpuclk->reg_base + reg_data->core_reg[0]); in rockchip_cpuclk_pre_rate_change()
174 spin_unlock_irqrestore(cpuclk->lock, flags); in rockchip_cpuclk_pre_rate_change()
178 static int rockchip_cpuclk_post_rate_change(struct rockchip_cpuclk *cpuclk, in rockchip_cpuclk_post_rate_change() argument
181 const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data; in rockchip_cpuclk_post_rate_change()
186 rate = rockchip_get_cpuclk_settings(cpuclk, ndata->new_rate); in rockchip_cpuclk_post_rate_change()
193 spin_lock_irqsave(cpuclk->lock, flags); in rockchip_cpuclk_post_rate_change()
196 rockchip_cpuclk_set_dividers(cpuclk, rate); in rockchip_cpuclk_post_rate_change()
208 cpuclk->reg_base + reg_data->core_reg[0]); in rockchip_cpuclk_post_rate_change()
214 cpuclk->reg_base + reg_data->core_reg[i]); in rockchip_cpuclk_post_rate_change()
218 rockchip_cpuclk_set_dividers(cpuclk, rate); in rockchip_cpuclk_post_rate_change()
220 spin_unlock_irqrestore(cpuclk->lock, flags); in rockchip_cpuclk_post_rate_change()
234 struct rockchip_cpuclk *cpuclk = to_rockchip_cpuclk_nb(nb); in rockchip_cpuclk_notifier_cb() local
240 ret = rockchip_cpuclk_pre_rate_change(cpuclk, ndata); in rockchip_cpuclk_notifier_cb()
242 ret = rockchip_cpuclk_post_rate_change(cpuclk, ndata); in rockchip_cpuclk_notifier_cb()
253 struct rockchip_cpuclk *cpuclk; in rockchip_clk_register_cpuclk() local
263 cpuclk = kzalloc(sizeof(*cpuclk), GFP_KERNEL); in rockchip_clk_register_cpuclk()
264 if (!cpuclk) in rockchip_clk_register_cpuclk()
280 cpuclk->reg_base = reg_base; in rockchip_clk_register_cpuclk()
281 cpuclk->lock = lock; in rockchip_clk_register_cpuclk()
282 cpuclk->reg_data = reg_data; in rockchip_clk_register_cpuclk()
283 cpuclk->clk_nb.notifier_call = rockchip_cpuclk_notifier_cb; in rockchip_clk_register_cpuclk()
284 cpuclk->hw.init = &init; in rockchip_clk_register_cpuclk()
286 cpuclk->alt_parent = __clk_lookup(parent_names[reg_data->mux_core_alt]); in rockchip_clk_register_cpuclk()
287 if (!cpuclk->alt_parent) { in rockchip_clk_register_cpuclk()
294 ret = clk_prepare_enable(cpuclk->alt_parent); in rockchip_clk_register_cpuclk()
310 ret = clk_notifier_register(clk, &cpuclk->clk_nb); in rockchip_clk_register_cpuclk()
318 cpuclk->rate_count = nrates; in rockchip_clk_register_cpuclk()
319 cpuclk->rate_table = kmemdup(rates, in rockchip_clk_register_cpuclk()
322 if (!cpuclk->rate_table) { in rockchip_clk_register_cpuclk()
328 cclk = clk_register(NULL, &cpuclk->hw); in rockchip_clk_register_cpuclk()
338 kfree(cpuclk->rate_table); in rockchip_clk_register_cpuclk()
340 clk_notifier_unregister(clk, &cpuclk->clk_nb); in rockchip_clk_register_cpuclk()
342 clk_disable_unprepare(cpuclk->alt_parent); in rockchip_clk_register_cpuclk()
344 kfree(cpuclk); in rockchip_clk_register_cpuclk()