[<prev] [next>] [day] [month] [year] [list]
Message-ID: <7fcb969a0d0740459a9ebc403aeb556f@cqplus1.com>
Date: Thu, 19 May 2022 02:16:50 +0000
From: qinjian[覃健] <qinjian@...lus1.com>
To: Stephen Boyd <sboyd@...nel.org>
CC: "krzysztof.kozlowski@...aro.org" <krzysztof.kozlowski@...aro.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"mturquette@...libre.com" <mturquette@...libre.com>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"maz@...nel.org" <maz@...nel.org>,
"p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
"linux@...linux.org.uk" <linux@...linux.org.uk>,
"arnd@...db.de" <arnd@...db.de>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>
Subject: RE: [PATCH v15 05/10] clk: Add Sunplus SP7021 clock driver
> > > > +
> > > > + df_quotient = df / m;
> > > > + df_remainder = ((df % m) * 1000) / m;
> > > > +
> > > > + if (freq > df_quotient) {
> > > > + df_quotient = freq - df_quotient - 1;
> > > > + df_remainder = 1000 - df_remainder;
> > >
> > > Where does 1000 come from?
> >
> > 1000 is come from "borrow 1" in last operation.
>
> It's scaling the value right? What is being scaled? Are we converting
> units to Hz from kHz?
Here just using integer replacement floating point operation, for example:
df = 13, m = 3
13 / 3 = 4.33333333
df_quotient = 4
df_remainder = 0.3333333 * 1000 (accurate to 3 decimal places) = 333
Powered by blists - more mailing lists