clk: frac-divider: fix up some frac clk freq setting error

ie:
clk_i2s set rate 11289600(get rate = 11289600)
clk_i2s set rate 8192000(get rate = 8192000)
clk_i2s set rate 11289600(get rate = 11214954)

Change-Id: I042d2acdd22b56b5d8571921f63702aabffcacdd
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
This commit is contained in:
Elaine Zhang
2018-05-24 09:33:31 +08:00
committed by Tao Huang
parent e8dae2d0a9
commit 8637d2656e

View File

@@ -77,13 +77,16 @@ static long clk_fd_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long m, n;
u64 ret;
if (!rate || rate >= *parent_rate)
if (!rate)
return *parent_rate;
if (fd->approximation)
if (fd->approximation) {
fd->approximation(hw, rate, parent_rate, &m, &n);
else
} else {
if (rate >= *parent_rate)
return *parent_rate;
clk_fd_general_approximation(hw, rate, parent_rate, &m, &n);
}
ret = (u64)*parent_rate * m;
do_div(ret, n);