diff options
author | Colin Cross <ccross@android.com> | 2010-12-07 18:24:55 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2010-12-08 18:12:08 -0800 |
commit | a8f05581f7aa230d07517e2d7e9ec33c5d3cb552 (patch) | |
tree | 3ef1995aa221eb37689855bcaab034e2f302bf90 /arch | |
parent | 0e3fe9b3944d3dad3b2268d4acdbd77fd727dcd5 (diff) |
ARM: tegra: clock: Round rate before dvfs
Call the clock's round_rate op, if it exists, before setting
dvfs rate. Ensures dvfs is set to the rate the clock will
be at after the later call to set_rate.
Change-Id: I4c8e85991238492adc3c37aed57c7269f3b41a2c
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/clock.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index 124af0f78782..e3936af38356 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -350,6 +350,7 @@ int clk_set_rate(struct clk *c, unsigned long rate) int ret = 0; unsigned long flags; unsigned long old_rate; + long new_rate; clk_lock_save(c, flags); @@ -363,6 +364,17 @@ int clk_set_rate(struct clk *c, unsigned long rate) if (rate > c->max_rate) rate = c->max_rate; + if (c->ops && c->ops->round_rate) { + new_rate = c->ops->round_rate(c, rate); + + if (new_rate < 0) { + ret = new_rate; + goto out; + } + + rate = new_rate; + } + if (clk_is_auto_dvfs(c) && rate > old_rate && c->refcnt > 0) { ret = tegra_dvfs_set_rate(c, rate); if (ret) |