diff mbox

clk: ingenic: Fix recalc_rate for clocks with fixed divider

Message ID 20161101095836.22210-1-paul@crapouillou.net (mailing list archive)
State Awaiting Upstream, archived
Delegated to: Stephen Boyd
Headers show

Commit Message

Paul Cercueil Nov. 1, 2016, 9:58 a.m. UTC
Previously, the clocks with a fixed divider would report their rate
as being the same as the one of their parent, independently of the
divider in use. This commit fixes this behaviour.

This went unnoticed as neither the jz4740 nor the jz4780 CGU code
have clocks with fixed dividers yet.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/clk/ingenic/cgu.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Stephen Boyd Dec. 8, 2016, 11:17 p.m. UTC | #1
On 11/01, Paul Cercueil wrote:
> Previously, the clocks with a fixed divider would report their rate
> as being the same as the one of their parent, independently of the
> divider in use. This commit fixes this behaviour.
> 
> This went unnoticed as neither the jz4740 nor the jz4780 CGU code
> have clocks with fixed dividers yet.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---

Nobody replied or reviewed it so I'll bite. Do we have a user of
this code path? If not, please reserve this patch until such a
time and then include it in the series.
diff mbox

Patch

diff --git a/drivers/clk/ingenic/cgu.c b/drivers/clk/ingenic/cgu.c
index e8248f9..eb9002c 100644
--- a/drivers/clk/ingenic/cgu.c
+++ b/drivers/clk/ingenic/cgu.c
@@ -328,6 +328,8 @@  ingenic_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
 		div *= clk_info->div.div;
 
 		rate /= div;
+	} else if (clk_info->type & CGU_CLK_FIXDIV) {
+		rate /= clk_info->fixdiv.div;
 	}
 
 	return rate;