]> git.karo-electronics.de Git - linux-beck.git/commit
clk: rockchip: Make calculations use rounding
authorDouglas Anderson <dianders@chromium.org>
Wed, 30 Sep 2015 14:07:38 +0000 (16:07 +0200)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 26 Oct 2015 15:00:07 +0000 (16:00 +0100)
commit4351f19a337d48a780762d076408ebe9b0c1f945
tree903abc321be44907394e9d399066126c2f0db5de
parentf0232063fb64fc79bfb7b6b35d611b2e4a79ffe6
clk: rockchip: Make calculations use rounding

Let's use DIV_ROUND_CLOSEST for rounding, not just truncating
division.  This lets us get closer to the right rate.

Before this:
  set_phase(86) delay_nums=26 reg[0xf000420c]=0x468 actual_degrees=83
  set_phase(89) delay_nums=27 reg[0xf000420c]=0x46c actual_degrees=86

After this:
  set_phase(86) delay_nums=27 reg[0xf000420c]=0x46c actual_degrees=86
  set_phase(89) delay_nums=28 reg[0xf000420c]=0x470 actual_degrees=90

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/clk/rockchip/clk-mmc-phase.c