[PATCH 08/29] clk: implement clk_round_rate
Sascha Hauer
s.hauer at pengutronix.de
Fri Mar 14 10:32:28 EDT 2014
Instead of returning just the current rate implement clk_round_rate
properly.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/clk/clk.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 31d73c0..c67b2f4 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -104,9 +104,19 @@ unsigned long clk_get_rate(struct clk *clk)
long clk_round_rate(struct clk *clk, unsigned long rate)
{
+ unsigned long parent_rate = 0;
+ struct clk *parent;
+
if (IS_ERR(clk))
return 0;
+ parent = clk_get_parent(clk);
+ if (parent)
+ parent_rate = clk_get_rate(parent);
+
+ if (clk->ops->round_rate)
+ return clk->ops->round_rate(clk, rate, &parent_rate);
+
return clk_get_rate(clk);
}
--
1.9.0
More information about the barebox
mailing list