Skip to content

Commit 39d1c90

Browse files
Chunyan Zhangbebarino
authored andcommitted
clk: sprd: fix to get a correct ibias of pll
The current driver is getting a wrong ibias index of pll clocks from number 1. This patch fix that issue, then getting ibias index from 0. Fixes: 3e37b00 ("clk: sprd: add adjustable pll support") Signed-off-by: Chunyan Zhang <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 0e4b8a2 commit 39d1c90

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/clk/sprd/pll.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,12 @@ static u32 pll_get_ibias(u64 rate, const u64 *table)
8787
{
8888
u32 i, num = table[0];
8989

90-
for (i = 1; i < num + 1; i++)
91-
if (rate <= table[i])
90+
/* table[0] indicates the number of items in this table */
91+
for (i = 0; i < num; i++)
92+
if (rate <= table[i + 1])
9293
break;
9394

94-
return (i == num + 1) ? num : i;
95+
return i == num ? num - 1 : i;
9596
}
9697

9798
static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll,

0 commit comments

Comments
 (0)