From: Maxime Ripard <maxime@cerno.tech>
To: Mike Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-clk@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
Tony Lindgren <tony@atomide.com>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Naresh Kamboju <naresh.kamboju@linaro.org>,
Jerome Brunet <jbrunet@baylibre.com>,
Neil Armstrong <narmstrong@baylibre.com>,
Alexander Stein <alexander.stein@ew.tq-group.com>,
Yassine Oudjana <y.oudjana@protonmail.com>,
Maxime Ripard <maxime@cerno.tech>
Subject: [PATCH v2 25/28] clk: Introduce the clk_hw_get_rate_range function
Date: Thu, 28 Apr 2022 18:43:35 +0200 [thread overview]
Message-ID: <20220428164338.717443-26-maxime@cerno.tech> (raw)
In-Reply-To: <20220428164338.717443-1-maxime@cerno.tech>
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>
---
drivers/clk/clk.c | 16 ++++++++++++++++
include/linux/clk-provider.h | 2 ++
2 files changed, 18 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index de2674e350b2..1773e715c4f1 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -683,6 +683,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)
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 7f4f34ff2b83..c0bcf72d5ecd 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -1235,6 +1235,8 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
struct clk_rate_request *req,
unsigned long flags);
void clk_hw_reparent(struct clk_hw *hw, struct clk_hw *new_parent);
+void clk_hw_get_rate_range(struct clk_hw *hw, unsigned long *min_rate,
+ unsigned long *max_rate);
void clk_hw_set_rate_range(struct clk_hw *hw, unsigned long min_rate,
unsigned long max_rate);
--
2.35.1
next prev parent reply other threads:[~2022-04-28 16:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 16:43 [PATCH v2 00/28] clk: More clock rate fixes and tests Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 01/28] clk: Drop the rate range on clk_put() Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 02/28] clk: Skip clamping when rounding if there's no boundaries Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 03/28] clk: Introduce clk_get_rate_range() Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 04/28] drm/vc4: hdmi: Rework hdmi_enable_4kp60 detection Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 05/28] clk: Mention that .recalc_rate can return 0 on error Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 06/28] clk: Clarify clk_get_rate() expectations Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 07/28] clk: tests: Add test suites description Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 08/28] clk: tests: Add reference to the orphan mux bug report Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 09/28] clk: tests: Add tests for uncached clock Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 10/28] clk: tests: Add tests for single parent mux Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 11/28] clk: tests: Add tests for mux with multiple parents Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 12/28] clk: tests: Add some tests for orphan " Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 13/28] clk: Take into account uncached clocks in clk_set_rate_range() Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 14/28] clk: Fix clk_get_parent() documentation Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 15/28] clk: Set req_rate on reparenting Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 16/28] clk: Change clk_core_init_rate_req prototype Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 17/28] clk: Move clk_core_init_rate_req() from clk_core_round_rate_nolock() to its caller Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 18/28] clk: Introduce clk_hw_init_rate_request() Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 19/28] clk: Add our request boundaries in clk_core_init_rate_req Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 20/28] clk: Switch from __clk_determine_rate to clk_core_round_rate_nolock Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 21/28] clk: Introduce clk_core_has_parent() Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 22/28] clk: Stop forwarding clk_rate_requests to the parent Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 23/28] clk: Zero the clk_rate_request structure Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 24/28] clk: Test the clock pointer in clk_hw_get_name() Maxime Ripard
2022-04-28 16:43 ` Maxime Ripard [this message]
2022-04-28 16:43 ` [PATCH v2 26/28] clk: qcom: clk-rcg2: Take clock boundaries into consideration for gfx3d Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 27/28] clk: tests: Add some tests for clk_get_rate_range() Maxime Ripard
2022-04-28 16:43 ` [PATCH v2 28/28] clk: tests: Add missing test case for ranges Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220428164338.717443-26-maxime@cerno.tech \
--to=maxime@cerno.tech \
--cc=alexander.stein@ew.tq-group.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=jbrunet@baylibre.com \
--cc=linux-clk@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mturquette@baylibre.com \
--cc=naresh.kamboju@linaro.org \
--cc=narmstrong@baylibre.com \
--cc=sboyd@kernel.org \
--cc=tony@atomide.com \
--cc=y.oudjana@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.