[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <sfni3vehkhotsqrrirklhzrxzkcxzkq6nbtqokeab5if3jgm53@frh7z3iowsfe>
Date: Mon, 12 Jun 2023 14:31:21 +0200
From: Maxime Ripard <maxime@...no.tech>
To: Frank Oltmanns <frank@...manns.dev>
Cc: Andre Przywara <andre.przywara@....com>,
Chen-Yu Tsai <wens@...e.org>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Michael Turquette <mturquette@...libre.com>,
Roman Beranek <me@...y.cz>,
Samuel Holland <samuel@...lland.org>,
Stephen Boyd <sboyd@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-clk@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH v2 1/2] clk: sunxi-ng: nkm: consider alternative parent
rates when finding rate
On Mon, Jun 12, 2023 at 10:51:52AM +0200, Frank Oltmanns wrote:
> > @@ -28,12 +68,17 @@ static unsigned long ccu_nkm_find_best(unsigned long parent, unsigned long rate,
> > for (_m = nkm->min_m; _m <= nkm->max_m; _m++) {
>
> According to the manual M/N has to be <= 3. Therefore we need a
> different maximum value for the _m-for-loop:
>
> unsigned long max_m = min(3 * _n, nkm->max_m);
> for (_m = nkm->min_m; _m <= max_m; _m++) {
>
> I suggest that I add an optional member max_mn_ratio to the structs
> ccu_nkm and _ccu_nkm. Optional meaning: Ignore if 0.
Which workload is affected by this restriction?
> > unsigned long tmp_rate;
> >
> > - tmp_rate = parent * _n * _k / _m;
> > -
> > + if (parent_hw) {
> > + tmp_parent = optimal_parent_rate(rate, _n, _k, _m);
> > + tmp_parent = clk_hw_round_rate(parent_hw, tmp_parent);
> > + }
>
> Another constraint is PLL-VIDEO0 rate / M >= 24 MHz. Therefore we also need:
> if (tmp_parent < 24000000 * _m)
> continue;
>
> So, we need another optional member min_m_times_parent or, for
> shortness, maybe min_m_parent. I could use help finding a good name for
> this.
Again, if it's not causing any harm I'd rather keep the code as simple
and maintainable as possible.
Maxime
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists