[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20BB6D852C5C87DF+aVHXSI7Mn5GH-xBF@kernel.org>
Date: Mon, 29 Dec 2025 09:20:08 +0800
From: Troy Mitchell <troy.mitchell@...ux.spacemit.com>
To: Alex Elder <elder@...cstar.com>,
Troy Mitchell <troy.mitchell@...ux.spacemit.com>,
Lee Jones <lee@...nel.org>, Yixun Lan <dlan@...too.org>,
Andi Shyti <andi.shyti@...nel.org>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
spacemit@...ts.linux.dev, linux-i2c@...r.kernel.org,
linux-rtc@...r.kernel.org
Subject: Re: [PATCH v3 1/4] i2c: spacemit: configure ILCR for accurate SCL
frequency
On Sun, Dec 28, 2025 at 06:58:00PM -0600, Alex Elder wrote:
> On 12/26/25 1:52 AM, Troy Mitchell wrote:
> > > > > +static int spacemit_i2c_clk_set_rate(struct clk_hw *hw, unsigned long rate,
> > > > > + unsigned long parent_rate)
> > > > > +{
> > > > > + struct spacemit_i2c_dev *i2c = container_of(hw, struct spacemit_i2c_dev, scl_clk_hw);
> > > > > + u32 lv, lcr, mask, shift, max_lv;
> > > > > +
> > > > > + lv = DIV_ROUND_UP(parent_rate, rate);
> > > >
> > > > Would DIV_ROUND_CLOSEST() give a more accurate value?
> > > I'll test it.
> > Same result. So I'll keep it.
>
> Is that true for all clock rates?
I only test 400k.
> Anyway, it's not
> a huge deal, but especially when the number of rates
> isn't very high this can make a difference.
I'll test more. Thanks!
- Troy
Powered by blists - more mailing lists