RE: [PATCH v15 05/10] clk: Add Sunplus SP7021 clock driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > > +
> > > > +                               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





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux