Commit 5d26c15d authored by Chao Xie's avatar Chao Xie Committed by Mike Turquette

clk: mmp: try to use closer one when do round rate

The orignal code will use the bigger rate between
"previous rate" and "current rate" when caculate the
In fact, hardware cares about the closest one.
So choose the closer rate between "previous rate" and
"current rate".
Signed-off-by: default avatarChao Xie <>
Signed-off-by: default avatarMike Turquette <>
parent c45693a6
......@@ -45,10 +45,14 @@ static long clk_factor_round_rate(struct clk_hw *hw, unsigned long drate,
if (rate > drate)
if ((i == 0) || (i == factor->ftbl_cnt))
if ((i == 0) || (i == factor->ftbl_cnt)) {
return rate;
return prev_rate;
} else {
if ((drate - prev_rate) > (rate - drate))
return rate;
return prev_rate;
static unsigned long clk_factor_recalc_rate(struct clk_hw *hw,
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment