aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/clk/mmp/clk-frac.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/clk/mmp/clk-frac.c b/drivers/clk/mmp/clk-frac.c
index 5863a37ec84d..23a56f561812 100644
--- a/drivers/clk/mmp/clk-frac.c
+++ b/drivers/clk/mmp/clk-frac.c
@@ -45,10 +45,14 @@ static long clk_factor_round_rate(struct clk_hw *hw, unsigned long drate,
45 if (rate > drate) 45 if (rate > drate)
46 break; 46 break;
47 } 47 }
48 if ((i == 0) || (i == factor->ftbl_cnt)) 48 if ((i == 0) || (i == factor->ftbl_cnt)) {
49 return rate; 49 return rate;
50 else 50 } else {
51 return prev_rate; 51 if ((drate - prev_rate) > (rate - drate))
52 return rate;
53 else
54 return prev_rate;
55 }
52} 56}
53 57
54static unsigned long clk_factor_recalc_rate(struct clk_hw *hw, 58static unsigned long clk_factor_recalc_rate(struct clk_hw *hw,