提交 100890c5 编写于 作者: P Paul Mundt

sh: clkfwk: Provide a generic clk_set_rate_ex() path for root clocks.

In the case of root clocks (such as clkin oscillators, extal, etc.), the
rate information is entirely platform dependent and needs to be lazily
set and propagated from the platform code. This provides a method for
establishing the rate update on these types of clocks that define no
set_rate() op of their own.
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 d672fef0
...@@ -265,20 +265,27 @@ EXPORT_SYMBOL_GPL(clk_set_rate); ...@@ -265,20 +265,27 @@ EXPORT_SYMBOL_GPL(clk_set_rate);
int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id) int clk_set_rate_ex(struct clk *clk, unsigned long rate, int algo_id)
{ {
int ret = -EOPNOTSUPP; int ret = -EOPNOTSUPP;
unsigned long flags;
if (likely(clk->ops && clk->ops->set_rate)) { spin_lock_irqsave(&clock_lock, flags);
unsigned long flags;
spin_lock_irqsave(&clock_lock, flags); if (likely(clk->ops && clk->ops->set_rate)) {
ret = clk->ops->set_rate(clk, rate, algo_id); ret = clk->ops->set_rate(clk, rate, algo_id);
if (ret == 0) { if (ret != 0)
if (clk->ops->recalc) goto out_unlock;
clk->rate = clk->ops->recalc(clk); } else {
propagate_rate(clk); clk->rate = rate;
} ret = 0;
spin_unlock_irqrestore(&clock_lock, flags);
} }
if (clk->ops && clk->ops->recalc)
clk->rate = clk->ops->recalc(clk);
propagate_rate(clk);
out_unlock:
spin_unlock_irqrestore(&clock_lock, flags);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(clk_set_rate_ex); EXPORT_SYMBOL_GPL(clk_set_rate_ex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册