[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <be4m7h45d2mjp7q32ovtg3pj7e3ut7clmclnlbwftohpnvl4yy@msdzcqqoinwi>
Date: Mon, 17 Jul 2023 16:10:10 +0200
From: Maxime Ripard <mripard@...nel.org>
To: Frank Oltmanns <frank@...manns.dev>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Samuel Holland <samuel@...lland.org>,
Andre Przywara <andre.przywara@....com>,
Roman Beranek <me@...y.cz>, linux-clk@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 03/11] clk: sunxi-ng: nkm: Improve determine rate when
setting parent
Hi,
On Mon, Jul 17, 2023 at 03:34:27PM +0200, Frank Oltmanns wrote:
> Make the SET_PARENT_RATE flag independent of the parents round_rate or
> determine_rate implementation.
>
> Currently, the algorithm for ccu_nkm_find_best_with_parent_adj simply
> calculates the optimal parent rate as
> (1) parent = rate * m / (n * k)
>
> Due to integer division (1) might return a parent rate that is too low.
> So using this value for asking the parent for a rate it supports via
> clk_hw_round_rate causes problems on
> a) parents that only support finding rates that are lower than the
> requested rate - which is the default for sunxi-ng ccu's.
> b) parents that incidentally also support the truncated rate.
>
> In those cases ccu_nkm_determine_rate might return A' when A is
> requested and A'' when rate A' is requested.
>
> Prevent this by trying to find a parent rate so that
> (2) _rate = parent * n * k / m
> matches the requested rate exactly, if possible.
>
> Background:
> ===========
> determine_rate may be called multiple times by the clk framework when
> setting a clock's rate. But the clk framework expects that the values
> determine_rate returns (i.e. the rate and parent_rate) are consistent
> with previous calls.
>
> Specifically, clock's have to ensure that if determine_rate is called
> with requested rate A and the best rate it can find is A', it must also
> return A' when called with requested rate A'.
>
> Signed-off-by: Frank Oltmanns <frank@...manns.dev>
As stated in my earlier mail, I still disagree with that patch.
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists