Re: [PATCH] clk: divider: fix rate calculation for fractional rates
From: Russell King - ARM Linux
Date: Wed Nov 06 2013 - 06:15:55 EST
On Wed, Nov 06, 2013 at 01:06:48PM +0200, Tomi Valkeinen wrote:
> This means that the following code works a bit oddly:
>
> rate = clk_round_rate(clk, 123428572);
> clk_set_rate(clk, rate);
You're right, but the above sequence is quite a crass thing to do. Why?
clk_round_rate() returns the clock rate that clk_set_rate() would give
you if you were to use this sequence:
clk_rate_rate(clk, 123428572);
rate = clk_get_rate(clk);
The difference is that it doesn't change the actual clock rate itself;
clk_round_rate() is meant to answer the question:
"If I were to set _this_ rate, what clock rate would
the clock give me?"
thereby providing a method for drivers to inquire what the effect would
be when changing such a clock without actually affecting it.
So please, don't use clk_round_rate() followed by clk_set_rate().
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/