public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Chuan Liu <chuan.liu@amlogic.com>
Cc: Chuan Liu via B4 Relay <devnull+chuan.liu.amlogic.com@kernel.org>,
	 Neil Armstrong <neil.armstrong@linaro.org>,
	 Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>,
	 Kevin Hilman <khilman@baylibre.com>,
	 Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	 linux-amlogic@lists.infradead.org, linux-clk@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] clk: meson: Support PLL with fixed fractional denominators
Date: Mon, 09 Sep 2024 10:50:30 +0200	[thread overview]
Message-ID: <1jikv5tdm1.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <a84c8ffb-8eda-434a-834c-a023563ac8cd@amlogic.com> (Chuan Liu's message of "Mon, 9 Sep 2024 16:46:35 +0800")

On Mon 09 Sep 2024 at 16:46, Chuan Liu <chuan.liu@amlogic.com> wrote:

> Hi, Jerome:
>
>         Thank you for your meticulous explanation.
>
>
> On 2024/9/9 15:40, Jerome Brunet wrote:
>> [ EXTERNAL EMAIL ]
>>
>> On Mon 09 Sep 2024 at 09:55, Chuan Liu <chuan.liu@amlogic.com> wrote:
>>
>>> Sorry, I don't quite understand this one. Is it because you suggest keeping
>>>
>>> "(1 << pll->frac_max)" here, followed by "if" to determine whether to assign
>>>
>>> "pll->frac_max"?
>>>
>>>
>>> "unlikely" is used here. My idea is that it will be possible to determine
>>> the value
>>>
>>> of "frac_max" at compile time, which will result in one less "if" judgment
>>> and
>>>
>>> slightly improve drive performance.
>> I'll rephrase.
>>
>> Please drop the 'unlikely()' call.
>>
>> You may add that :
>>   * in a separate change
>>   * if you really really wish to
>>   * if you provide profiling numbers for the different supported
>>     platforms and PLLs, not just the one targeted by this patchset.
>
>
> Okay, Understood. So you suggest like this?

No. drop the call to unlikely(). Keep the rest. That's it.

>
> static unsigned long __pll_params_to_rate(unsigned long parent_rate,
>                                           struct meson_clk_pll_data *pll)
>  {
>         u64 rate = (u64)parent_rate * m;
> +       unsigned int frac_max = (1 << pll->frac.width);
>
>         if (frac && MESON_PARM_APPLICABLE(&pll->frac)) {
>                 u64 frac_rate = (u64)parent_rate * frac;
>
> -               rate += DIV_ROUND_UP_ULL(frac_rate,
> -                                        (1 << pll->frac.width));
> +               if (pll->frac_max)
> +                       frac_max = pll->frac_max;
> +
> +               rate += DIV_ROUND_UP_ULL(frac_rate, frac_max);
>
>
> In my opinion, this change seems more logical, but the amount of
>
> change is larger?😮

-- 
Jerome

  reply	other threads:[~2024-09-09  8:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 10:34 [PATCH v2 0/3] clk: meson: Fix an issue with inaccurate hifi_pll frequency Chuan Liu via B4 Relay
2024-09-06 10:34 ` [PATCH v2 1/3] clk: meson: Support PLL with fixed fractional denominators Chuan Liu via B4 Relay
2024-09-06 11:22   ` Jerome Brunet
2024-09-09  1:55     ` Chuan Liu
2024-09-09  7:40       ` Jerome Brunet
2024-09-09  8:46         ` Chuan Liu
2024-09-09  8:50           ` Jerome Brunet [this message]
2024-09-06 10:34 ` [PATCH v2 2/3] clk: meson: c3: pll: fix frac maximum value for hifi_pll Chuan Liu via B4 Relay
2024-09-06 10:34 ` [PATCH v2 3/3] clk: meson: s4: " Chuan Liu via B4 Relay

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=1jikv5tdm1.fsf@starbuckisacylon.baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=chuan.liu@amlogic.com \
    --cc=devnull+chuan.liu.amlogic.com@kernel.org \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=mturquette@baylibre.com \
    --cc=neil.armstrong@linaro.org \
    --cc=sboyd@kernel.org \
    /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