[PATCH 05/10] clk: Add support for simple dividers

Russell King - ARM Linux linux at arm.linux.org.uk
Thu Apr 28 11:14:48 EDT 2011


On Mon, Apr 18, 2011 at 07:45:53PM -0700, Saravana Kannan wrote:
> On 04/18/2011 03:07 AM, Sascha Hauer wrote:
>> AFAIK there are two different implementation types in the tree. Some
>> implementations only allow to set to the exact rate round_rate returns
>> while others round down in set_rate.
>>
>> Has this been specified what behaviour is expected?
>>
>
> This is something I have nagged Russell once or twice about and then  
> sent out an email to the list for which there was very limited response.  
> I think clk_round_rate() is too generic and not very useful.

As I've always said, clk_round_rate() returns the rate which you will
get if you ask clk_set_rate() to set the same rate.  It's not ment to
be "tell me the clock rate which I'd like to then pass to clk_set_rate(),
oh that's not good enough, so lets tweak it a bit and try again".

For example, take a video driver.  The user passes in the pixel clock as
a picosecond argument.  This gets converted to Hz.  We can then use
clk_round_rate() to find out what clock rate we _actually_ end up with
when we set that rate using clk_set_rate(), and return that rate (again
as ps) back to the user before we alter anything.  The user can then
make a decision whether they want to actually set it.

Having some sort of range stuff doesn't help you there because you're
not supplied a range from userspace.  You're just asked to set a 39752ps
clock rate.



More information about the linux-arm-kernel mailing list