* [PATCH 07/10 v2] sh: clkfwk: add clk_rate_mult_range_round()
@ 2011-09-20 1:51 Kuninori Morimoto
0 siblings, 0 replies; 2+ messages in thread
From: Kuninori Morimoto @ 2011-09-20 1:51 UTC (permalink / raw)
To: linux-sh
Some llock pulse generator has PLL multiplication.
clk_rate_mult_range_round() will be good helper for it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2
o xx_multi_xx -> xx_mult_xx
o div_xxx -> mult_xxx
drivers/sh/clk/core.c | 20 ++++++++++++++++++++
include/linux/sh_clk.h | 3 +++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/drivers/sh/clk/core.c b/drivers/sh/clk/core.c
index dc8d022..352036b 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,
return clk_rate_round_helper(&div_range_round);
}
+static long clk_rate_mult_range_iter(unsigned int pos,
+ struct clk_rate_round_data *rounder)
+{
+ return clk_get_rate(rounder->arg) * pos;
+}
+
+long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
+ unsigned int mult_max, unsigned long rate)
+{
+ struct clk_rate_round_data mult_range_round = {
+ .min = mult_min,
+ .max = mult_max,
+ .func = clk_rate_mult_range_iter,
+ .arg = clk_get_parent(clk),
+ .rate = rate,
+ };
+
+ return clk_rate_round_helper(&mult_range_round);
+}
+
int clk_rate_table_find(struct clk *clk,
struct cpufreq_frequency_table *freq_table,
unsigned long rate)
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h
index 3ccf186..9237c29 100644
--- a/include/linux/sh_clk.h
+++ b/include/linux/sh_clk.h
@@ -94,6 +94,9 @@ int clk_rate_table_find(struct clk *clk,
long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
unsigned int div_max, unsigned long rate);
+long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
+ unsigned int mult_max, unsigned long rate);
+
long clk_round_parent(struct clk *clk, unsigned long target,
unsigned long *best_freq, unsigned long *parent_freq,
unsigned int div_min, unsigned int div_max);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 07/10 v2] sh: clkfwk: add clk_rate_mult_range_round()
@ 2011-11-04 16:05 Paul Mundt
0 siblings, 0 replies; 2+ messages in thread
From: Paul Mundt @ 2011-11-04 16:05 UTC (permalink / raw)
To: linux-sh
On Mon, Sep 19, 2011 at 06:51:13PM -0700, Kuninori Morimoto wrote:
> Some llock pulse generator has PLL multiplication.
> clk_rate_mult_range_round() will be good helper for it.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
> v1 -> v2
>
> o xx_multi_xx -> xx_mult_xx
> o div_xxx -> mult_xxx
>
> drivers/sh/clk/core.c | 20 ++++++++++++++++++++
> include/linux/sh_clk.h | 3 +++
> 2 files changed, 23 insertions(+), 0 deletions(-)
>
I've applied this one now, though it will take a bit to get the rest of
the series sorted out.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-04 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04 16:05 [PATCH 07/10 v2] sh: clkfwk: add clk_rate_mult_range_round() Paul Mundt
-- strict thread matches above, loose matches on Subject: below --
2011-09-20 1:51 Kuninori Morimoto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.