diff options
author | Maxime Ripard <maxime@cerno.tech> | 2022-08-16 13:25:28 +0200 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2022-09-15 09:32:25 -0700 |
commit | 253993253466ba7187730b196174146d5247e97b (patch) | |
tree | c95b6a391a5d65bb4a709263cb951ad9b1abac4c /drivers/clk | |
parent | b46fd8dbe8ad3fe6dcd44dcdf01a736c50d90a68 (diff) | |
download | linux-stable-253993253466ba7187730b196174146d5247e97b.tar.gz linux-stable-253993253466ba7187730b196174146d5247e97b.tar.bz2 linux-stable-253993253466ba7187730b196174146d5247e97b.zip |
clk: Introduce the clk_hw_get_rate_range function
Some clock providers are hand-crafting their clk_rate_request, and need
to figure out the current boundaries of their clk_hw to fill it
properly.
Let's create such a function for clock providers.
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://lore.kernel.org/r/20220816112530.1837489-24-maxime@cerno.tech
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/clk.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 6b358448885b..ec518dc5d462 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -684,6 +684,22 @@ static void clk_core_get_boundaries(struct clk_core *core, *max_rate = min(*max_rate, clk_user->max_rate); } +/* + * clk_hw_get_rate_range() - returns the clock rate range for a hw clk + * @hw: the hw clk we want to get the range from + * @min_rate: pointer to the variable that will hold the minimum + * @max_rate: pointer to the variable that will hold the maximum + * + * Fills the @min_rate and @max_rate variables with the minimum and + * maximum that clock can reach. + */ +void clk_hw_get_rate_range(struct clk_hw *hw, unsigned long *min_rate, + unsigned long *max_rate) +{ + clk_core_get_boundaries(hw->core, min_rate, max_rate); +} +EXPORT_SYMBOL_GPL(clk_hw_get_rate_range); + static bool clk_core_check_boundaries(struct clk_core *core, unsigned long min_rate, unsigned long max_rate) |