diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-07-20 00:29:09 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2007-07-20 00:29:09 -0400 |
commit | f6991b0456416186b578d38717efcda2b012b79c (patch) | |
tree | 6adebd4c26abed39fe5b4db65dc3398cd09b9236 | |
parent | 39c7aa9ea9b6175f4313f69ef9f8e0a3a9bba5bb (diff) |
sh: Implement clk_round_rate() in the clock framework.
This is an optional component of the clock framework. However,
as we're going to be using this in the cpufreq drivers, add
support for it to the framework.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/kernel/cpu/clock.c | 16 | ||||
-rw-r--r-- | include/asm-sh/clock.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c index 63251549e9a8..92807ffa8e20 100644 --- a/arch/sh/kernel/cpu/clock.c +++ b/arch/sh/kernel/cpu/clock.c | |||
@@ -229,6 +229,22 @@ void clk_recalc_rate(struct clk *clk) | |||
229 | } | 229 | } |
230 | EXPORT_SYMBOL_GPL(clk_recalc_rate); | 230 | EXPORT_SYMBOL_GPL(clk_recalc_rate); |
231 | 231 | ||
232 | long clk_round_rate(struct clk *clk, unsigned long rate) | ||
233 | { | ||
234 | if (likely(clk->ops && clk->ops->round_rate)) { | ||
235 | unsigned long flags, rounded; | ||
236 | |||
237 | spin_lock_irqsave(&clock_lock, flags); | ||
238 | rounded = clk->ops->round_rate(clk, rate); | ||
239 | spin_unlock_irqrestore(&clock_lock, flags); | ||
240 | |||
241 | return rounded; | ||
242 | } | ||
243 | |||
244 | return clk_get_rate(clk); | ||
245 | } | ||
246 | EXPORT_SYMBOL_GPL(clk_round_rate); | ||
247 | |||
232 | /* | 248 | /* |
233 | * Returns a clock. Note that we first try to use device id on the bus | 249 | * Returns a clock. Note that we first try to use device id on the bus |
234 | * and clock name. If this fails, we try to use clock name only. | 250 | * and clock name. If this fails, we try to use clock name only. |
diff --git a/include/asm-sh/clock.h b/include/asm-sh/clock.h index 386d797d86b7..b550a27a7042 100644 --- a/include/asm-sh/clock.h +++ b/include/asm-sh/clock.h | |||
@@ -14,6 +14,7 @@ struct clk_ops { | |||
14 | void (*disable)(struct clk *clk); | 14 | void (*disable)(struct clk *clk); |
15 | void (*recalc)(struct clk *clk); | 15 | void (*recalc)(struct clk *clk); |
16 | int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id); | 16 | int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id); |
17 | long (*round_rate)(struct clk *clk, unsigned long rate); | ||
17 | }; | 18 | }; |
18 | 19 | ||
19 | struct clk { | 20 | struct clk { |