summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/clock.c
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-01-11 16:59:55 -0800
committerColin Cross <ccross@android.com>2011-01-11 16:59:55 -0800
commit55bfef75ea06908d4f30ccfec8f7e239a5592705 (patch)
tree8cada21544c787f140c0f414ca1a273ee4c79d1d /arch/arm/mach-tegra/clock.c
parent4ce07d6140b09aa49bfa823edbdd182ee74fa04e (diff)
ARM: tegra: clock: Round frequency up in clock dividers
When picking clock divider values, the clock framework picks the closest frequency that is lower than the requested frequency. If the value from a clock divider rounds down, and then the new rounded down frequency is requested, it will get rounded down again, resulting in a frequency two steps lower than the original requested frequency. Fix the problem by rounding up when calculating the frequency coming out of a clock divider, so if that frequency is requested again, the same divider value will be picked. Change-Id: Ieaf74448f67d91aeb7ba08226e48c092d8afaa2b Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-tegra/clock.c')
-rw-r--r--arch/arm/mach-tegra/clock.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index f55697765cdf..e97cc2532aef 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -143,6 +143,7 @@ static unsigned long clk_predict_rate_from_parent(struct clk *c, struct clk *p)
if (c->mul != 0 && c->div != 0) {
rate *= c->mul;
+ rate += c->div / 2; /* round up */
do_div(rate, c->div);
}