summaryrefslogtreecommitdiff
path: root/drivers/clk/clk_sandbox_test.c
diff options
context:
space:
mode:
authorDario Binacchi <dariobin@libero.it>2020-12-30 00:06:31 +0100
committerLokesh Vutla <lokeshvutla@ti.com>2021-01-12 10:58:04 +0530
commit2983ad55a13e9afcdf1a3d8f55eea038c0a0e8a3 (patch)
treed586303823a6aa0aa980451e53610dc20e7e66b5 /drivers/clk/clk_sandbox_test.c
parent6337d53fdf45df764bc9946d927172397f183d37 (diff)
clk: add clk_round_rate()
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@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com>
Diffstat (limited to 'drivers/clk/clk_sandbox_test.c')
-rw-r--r--drivers/clk/clk_sandbox_test.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/clk/clk_sandbox_test.c b/drivers/clk/clk_sandbox_test.c
index e9eb738684b..c4e44815084 100644
--- a/drivers/clk/clk_sandbox_test.c
+++ b/drivers/clk/clk_sandbox_test.c
@@ -86,6 +86,16 @@ ulong sandbox_clk_test_get_rate(struct udevice *dev, int id)
return clk_get_rate(sbct->clkps[id]);
}
+ulong sandbox_clk_test_round_rate(struct udevice *dev, int id, ulong rate)
+{
+ struct sandbox_clk_test *sbct = dev_get_priv(dev);
+
+ if (id < 0 || id >= SANDBOX_CLK_TEST_ID_COUNT)
+ return -EINVAL;
+
+ return clk_round_rate(sbct->clkps[id], rate);
+}
+
ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate)
{
struct sandbox_clk_test *sbct = dev_get_priv(dev);