aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-09-19 21:51:13 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-11-04 11:49:27 -0400
commitdd2c0ca1b153b555c09fd8e08f6842e12cf8e87b (patch)
tree1c7490f128aa6153d8d42f9bb735cd4bd3aa16f2 /drivers
parent1a67a573b8d9f02211f36fbab50f6265dc49384a (diff)
sh: clkfwk: add clk_rate_mult_range_round()
This provides a clk_rate_mult_range_round() helper for use by some of the CPG PLL ranged multipliers, following the same approach as used by the div ranges. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/sh/clk/core.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
index dc8d022c07a1..352036b1f9a2 100644
--- a/drivers/sh/clk/core.c
+++ b/drivers/sh/clk/core.c
@@ -173,6 +173,26 @@ long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
173 return clk_rate_round_helper(&div_range_round); 173 return clk_rate_round_helper(&div_range_round);
174} 174}
175 175
176static long clk_rate_mult_range_iter(unsigned int pos,
177 struct clk_rate_round_data *rounder)
178{
179 return clk_get_rate(rounder->arg) * pos;
180}
181
182long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
183 unsigned int mult_max, unsigned long rate)
184{
185 struct clk_rate_round_data mult_range_round = {
186 .min = mult_min,
187 .max = mult_max,
188 .func = clk_rate_mult_range_iter,
189 .arg = clk_get_parent(clk),
190 .rate = rate,
191 };
192
193 return clk_rate_round_helper(&mult_range_round);
194}
195
176int clk_rate_table_find(struct clk *clk, 196int clk_rate_table_find(struct clk *clk,
177 struct cpufreq_frequency_table *freq_table, 197 struct cpufreq_frequency_table *freq_table,
178 unsigned long rate) 198 unsigned long rate)