* [PATCH] clk: composite: .determine_rate support
@ 2013-09-15 0:37 Emilio López
2013-10-03 0:24 ` Emilio López
0 siblings, 1 reply; 3+ messages in thread
From: Emilio López @ 2013-09-15 0:37 UTC (permalink / raw)
To: linux-arm-kernel
This commit adds .determine_rate support to the composite clock. It will
use the .determine_rate callback from the rate component if available,
and fall back on the mux component otherwise. This allows composite
clocks to enjoy the benefits of automatic clock reparenting.
Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>
---
Hi Mike,
This is a prerequisite patch for the sunxi driver changes that I'll send
shortly; I believe you already looked at this diff on IRC and agreed it
was sensible, so I hope it can be merged early for the 3.13 cycle
(unless someone else has any objections to the patch, that is).
Cheers,
Emilio
drivers/clk/clk-composite.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
index a33f46f..753d0b7 100644
--- a/drivers/clk/clk-composite.c
+++ b/drivers/clk/clk-composite.c
@@ -55,6 +55,30 @@ static unsigned long clk_composite_recalc_rate(struct clk_hw *hw,
return rate_ops->recalc_rate(rate_hw, parent_rate);
}
+static long clk_composite_determine_rate(struct clk_hw *hw, unsigned long rate,
+ unsigned long *best_parent_rate,
+ struct clk **best_parent_p)
+{
+ struct clk_composite *composite = to_clk_composite(hw);
+ const struct clk_ops *rate_ops = composite->rate_ops;
+ const struct clk_ops *mux_ops = composite->mux_ops;
+ struct clk_hw *rate_hw = composite->rate_hw;
+ struct clk_hw *mux_hw = composite->mux_hw;
+
+ if (rate_hw && rate_ops && rate_ops->determine_rate) {
+ rate_hw->clk = hw->clk;
+ return rate_ops->determine_rate(rate_hw, rate, best_parent_rate,
+ best_parent_p);
+ } else if (mux_hw && mux_ops && mux_ops->determine_rate) {
+ mux_hw->clk = hw->clk;
+ return mux_ops->determine_rate(rate_hw, rate, best_parent_rate,
+ best_parent_p);
+ } else {
+ pr_err("clk: clk_composite_determine_rate function called, but no mux or rate callback set!\n");
+ return 0;
+ }
+}
+
static long clk_composite_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
@@ -147,6 +171,8 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
composite->mux_ops = mux_ops;
clk_composite_ops->get_parent = clk_composite_get_parent;
clk_composite_ops->set_parent = clk_composite_set_parent;
+ if (mux_ops->determine_rate)
+ clk_composite_ops->determine_rate = clk_composite_determine_rate;
}
if (rate_hw && rate_ops) {
@@ -170,6 +196,8 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
composite->rate_hw = rate_hw;
composite->rate_ops = rate_ops;
clk_composite_ops->recalc_rate = clk_composite_recalc_rate;
+ if (rate_ops->determine_rate)
+ clk_composite_ops->determine_rate = clk_composite_determine_rate;
}
if (gate_hw && gate_ops) {
--
1.8.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] clk: composite: .determine_rate support
2013-09-15 0:37 [PATCH] clk: composite: .determine_rate support Emilio López
@ 2013-10-03 0:24 ` Emilio López
2013-10-31 12:15 ` Emilio López
0 siblings, 1 reply; 3+ messages in thread
From: Emilio López @ 2013-10-03 0:24 UTC (permalink / raw)
To: linux-arm-kernel
Hi Mike,
El 14/09/13 21:37, Emilio L?pez escribi?:
> This commit adds .determine_rate support to the composite clock. It will
> use the .determine_rate callback from the rate component if available,
> and fall back on the mux component otherwise. This allows composite
> clocks to enjoy the benefits of automatic clock reparenting.
>
> Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>
> ---
>
> Hi Mike,
>
> This is a prerequisite patch for the sunxi driver changes that I'll send
> shortly; I believe you already looked at this diff on IRC and agreed it
> was sensible, so I hope it can be merged early for the 3.13 cycle
> (unless someone else has any objections to the patch, that is).
A couple of weeks have passed now; can you please review and apply this
to your tree for 3.13 if you are ok with it?
Thanks!
Emilio
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] clk: composite: .determine_rate support
2013-10-03 0:24 ` Emilio López
@ 2013-10-31 12:15 ` Emilio López
0 siblings, 0 replies; 3+ messages in thread
From: Emilio López @ 2013-10-31 12:15 UTC (permalink / raw)
To: linux-arm-kernel
El 02/10/13 21:24, Emilio L?pez escribi?:
> Hi Mike,
>
> El 14/09/13 21:37, Emilio L?pez escribi?:
>> This commit adds .determine_rate support to the composite clock. It will
>> use the .determine_rate callback from the rate component if available,
>> and fall back on the mux component otherwise. This allows composite
>> clocks to enjoy the benefits of automatic clock reparenting.
>>
>> Signed-off-by: Emilio L?pez <emilio@elopez.com.ar>
>> ---
>>
>> Hi Mike,
>>
>> This is a prerequisite patch for the sunxi driver changes that I'll send
>> shortly; I believe you already looked at this diff on IRC and agreed it
>> was sensible, so I hope it can be merged early for the 3.13 cycle
>> (unless someone else has any objections to the patch, that is).
>
> A couple of weeks have passed now; can you please review and apply this
> to your tree for 3.13 if you are ok with it?
Mike?
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-31 12:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-15 0:37 [PATCH] clk: composite: .determine_rate support Emilio López
2013-10-03 0:24 ` Emilio López
2013-10-31 12:15 ` Emilio López
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.