Thread (1 message) 1 message, 1 author, 2022-05-19

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

From: qinjian[覃健] <qinjian@cqplus1.com>
Date: 2022-05-19 02:29:50
Also in: linux-arm-kernel, linux-clk, lkml

quoted
quoted
quoted
+
+                               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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help