summaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorChunyan Zhang <chunyan.zhang@unisoc.com>2020-03-30 05:16:40 +0300
committerStephen Boyd <sboyd@kernel.org>2020-04-03 04:07:58 +0300
commit39d1c90665e3ee471b3005780a7df58bb1ba622d (patch)
treefaf3b899c2ec1eb12c93e05439fe0870a48dc177 /drivers/clk
parent0e4b8a2349f3aa9b54c217b338ee65d8b2b6b739 (diff)
downloadlinux-39d1c90665e3ee471b3005780a7df58bb1ba622d.tar.xz
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: 3e37b005580b ("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>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/sprd/pll.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/clk/sprd/pll.c b/drivers/clk/sprd/pll.c
index 640270f51aa5..15791484388f 100644
--- a/drivers/clk/sprd/pll.c
+++ b/drivers/clk/sprd/pll.c
@@ -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,