* [PATCH] media: tc358746: fix the pll calculating function
@ 2023-10-15 0:19 Duc-Long, Le
0 siblings, 0 replies; only message in thread
From: Duc-Long, Le @ 2023-10-15 0:19 UTC (permalink / raw)
To: Mauro Carvalho Chehab, linux-media, linux-kernel
Following formula of Pll_clk in 5.2 section, 50th page of
TC358746AXBG/748XBG/748IXBG Functional Specification Rev 1.1 document.
The formula of fout is as below:
fout = refclk * mul / (prediv * postdiv)
Remove "p" to avoid using 2 times of prediv in pll calculating function.
Signed-off-by: Duc-Long, Le <duclong.linux@gmail.com>
---
drivers/media/i2c/tc358746.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/tc358746.c b/drivers/media/i2c/tc358746.c
index 566f5eaddd57..4f54773886cc 100644
--- a/drivers/media/i2c/tc358746.c
+++ b/drivers/media/i2c/tc358746.c
@@ -839,14 +839,14 @@ static unsigned long tc358746_find_pll_settings(struct tc358746 *tc358746,
if (fin < 4 * HZ_PER_MHZ || fin > 40 * HZ_PER_MHZ)
continue;
- tmp = fout * p * postdiv;
+ tmp = fout * postdiv;
do_div(tmp, fin);
mul = tmp;
if (mul > 511)
continue;
tmp = mul * fin;
- do_div(tmp, p * postdiv);
+ do_div(tmp, postdiv);
delta = abs(fout - tmp);
if (delta < min_delta) {
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-15 0:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-15 0:19 [PATCH] media: tc358746: fix the pll calculating function Duc-Long, Le
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox