Skip to content

Commit

Permalink
clk: sprd: fix to get a correct ibias of pll
Browse files Browse the repository at this point in the history
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 <chunyan.zhang@unisoc.com>
Link: https://lkml.kernel.org/r/20200330021640.14133-1-zhang.lyra@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
  • Loading branch information
Chunyan Zhang authored and Stephen Boyd committed Apr 3, 2020
1 parent 0e4b8a2 commit 39d1c90
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/clk/sprd/pll.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,12 @@ static u32 pll_get_ibias(u64 rate, const u64 *table)
{
u32 i, num = table[0];

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

return (i == num + 1) ? num : i;
return i == num ? num - 1 : i;
}

static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll,
Expand Down

0 comments on commit 39d1c90

Please sign in to comment.