[PATCH 04/31] clk: add clk_round_rate()

Simon Glass sjg at chromium.org
Sat Aug 29 23:20:34 CEST 2020


Hi Dario,

+Stephen Warren
On Tue, 25 Aug 2020 at 03:24, Dario Binacchi <dariobin at libero.it> wrote:
>
> It returns the rate which will be set if you ask clk_set_rate() to set
> that rate. It provides a way to query exactly what rate you'll get if
> you call clk_set_rate() with that same argument.
> So essentially, clk_round_rate() and clk_set_rate() are equivalent
> except the former does not modify the clock hardware in any way.
>
> Signed-off-by: Dario Binacchi <dariobin at libero.it>
> ---
>
>  arch/sandbox/include/asm/clk.h |  9 +++++++++
>  drivers/clk/clk-uclass.c       | 15 +++++++++++++++
>  drivers/clk/clk_sandbox.c      | 17 +++++++++++++++++
>  drivers/clk/clk_sandbox_test.c | 10 ++++++++++
>  include/clk-uclass.h           |  8 ++++++++
>  include/clk.h                  | 29 +++++++++++++++++++++++++++++
>  test/dm/clk.c                  | 22 ++++++++++++++++++++++
>  7 files changed, 110 insertions(+)
>

Reviewed-by: Simon Glass <sjg at chromium.org>

But I wonder if we should change the set_rate() uclass interface to
have a flag value, one of the flags being 'dry run' which doesn't
actually set the value?

You would still have the same call to the uclass functions
clk_set_rate() and clk_round_rate() but the driver API would implement
both with calls to set_rate()?


More information about the U-Boot mailing list