From: Christian Marangi <ansuelsmth@gmail.com>
To: Luca Weiss <luca@z3ntu.xyz>
Cc: ~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org,
Bjorn Andersson <andersson@kernel.org>,
Andy Gross <agross@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] clk: qcom: clk-krait: switch to .determine_rate
Date: Sun, 12 Feb 2023 10:09:29 +0100 [thread overview]
Message-ID: <63eabd30.050a0220.7ac8f.d6d2@mx.google.com> (raw)
In-Reply-To: <20230212-clk-qcom-determine_rate-v1-1-b4e447d4926e@z3ntu.xyz>
On Sun, Feb 12, 2023 at 03:11:08PM +0100, Luca Weiss wrote:
> .determine_rate is meant to replace .round_rate. The former comes with a
> benefit which is especially relevant on 32-bit systems: since
> .determine_rate uses an "unsigned long" (compared to a "signed long"
> which is used by .round_rate) the maximum value on 32-bit systems
> increases from 2^31 (or approx. 2.14GHz) to 2^32 (or approx. 4.29GHz).
>
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Hi, found time to test this on ipq806x and seems to work correctly by
scaling to each freq and checking the hfpll reported freq.
Tested-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
> drivers/clk/qcom/clk-krait.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/qcom/clk-krait.c b/drivers/clk/qcom/clk-krait.c
> index 293a9dfa7151..f5ce403e1e27 100644
> --- a/drivers/clk/qcom/clk-krait.c
> +++ b/drivers/clk/qcom/clk-krait.c
> @@ -97,11 +97,11 @@ const struct clk_ops krait_mux_clk_ops = {
> EXPORT_SYMBOL_GPL(krait_mux_clk_ops);
>
> /* The divider can divide by 2, 4, 6 and 8. But we only really need div-2. */
> -static long krait_div2_round_rate(struct clk_hw *hw, unsigned long rate,
> - unsigned long *parent_rate)
> +static int krait_div2_determine_rate(struct clk_hw *hw, struct clk_rate_request *req)
> {
> - *parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), rate * 2);
> - return DIV_ROUND_UP(*parent_rate, 2);
> + req->best_parent_rate = clk_hw_round_rate(clk_hw_get_parent(hw), req->rate * 2);
> + req->rate = DIV_ROUND_UP(req->best_parent_rate, 2);
> + return 0;
> }
>
> static int krait_div2_set_rate(struct clk_hw *hw, unsigned long rate,
> @@ -142,7 +142,7 @@ krait_div2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
> }
>
> const struct clk_ops krait_div2_clk_ops = {
> - .round_rate = krait_div2_round_rate,
> + .determine_rate = krait_div2_determine_rate,
> .set_rate = krait_div2_set_rate,
> .recalc_rate = krait_div2_recalc_rate,
> };
>
> --
> 2.39.1
>
--
Ansuel
next prev parent reply other threads:[~2023-02-13 22:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-12 14:11 [PATCH 0/2] Switch hfpll & krait clock drivers to .determine_rate Luca Weiss
2023-02-12 14:11 ` [PATCH 1/2] clk: qcom: clk-krait: switch " Luca Weiss
2023-02-12 9:09 ` Christian Marangi [this message]
2023-02-12 14:11 ` [PATCH 2/2] clk: qcom: clk-hfpll: " Luca Weiss
2023-02-12 9:09 ` Christian Marangi
2023-03-15 23:35 ` (subset) [PATCH 0/2] Switch hfpll & krait clock drivers " Bjorn Andersson
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=63eabd30.050a0220.7ac8f.d6d2@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca@z3ntu.xyz \
--cc=mturquette@baylibre.com \
--cc=phone-devel@vger.kernel.org \
--cc=sboyd@kernel.org \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox