diff options
author | Alex Frid <afrid@nvidia.com> | 2011-03-30 18:02:13 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:42:28 -0800 |
commit | c9d858f72439e17ec152664f9164c99878ce4b65 (patch) | |
tree | a14913065d68c1a99d68d3210122aa299c272c59 | |
parent | 8d8a6fb8d0455174bd6619dd0ea5a97ef92fffb1 (diff) |
ARM: tegra: clock: Add Tegra3 CPU clock round rate operation
Original-Change-Id: I9e10c8d4ed074f915769ae7c77d915d6b021e2c9
Reviewed-on: http://git-master/r/24892
Reviewed-by: Aleksandr Frid <afrid@nvidia.com>
Tested-by: Aleksandr Frid <afrid@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Original-Change-Id: I23820e1557d304d7a99417b99afaeb4a36c9d18f
Rebase-Id: Re1b1e4f589376f52c1e9cf903ceaee7efe798ba1
-rw-r--r-- | arch/arm/mach-tegra/cpu-tegra.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-tegra/tegra3_clocks.c | 11 |
2 files changed, 16 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c index fbca349a9fe4..afdec503f034 100644 --- a/arch/arm/mach-tegra/cpu-tegra.c +++ b/arch/arm/mach-tegra/cpu-tegra.c @@ -211,6 +211,10 @@ static int tegra_update_cpu_speed(unsigned long rate) freqs.old = tegra_getspeed(0); freqs.new = rate; + rate = clk_round_rate(cpu_clk, rate * 1000); + if (!IS_ERR_VALUE(rate)) + freqs.new = rate / 1000; + if (freqs.old == freqs.new) return ret; @@ -218,7 +222,7 @@ static int tegra_update_cpu_speed(unsigned long rate) * Vote on memory bus frequency based on cpu frequency * This sets the minimum frequency, display or avp may request higher */ - clk_set_rate(emc_clk, tegra_emc_to_cpu_ratio(rate)); + clk_set_rate(emc_clk, tegra_emc_to_cpu_ratio(freqs.new)); for_each_online_cpu(freqs.cpu) cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); diff --git a/arch/arm/mach-tegra/tegra3_clocks.c b/arch/arm/mach-tegra/tegra3_clocks.c index fa2f1e04de1a..b5cd2ecd3869 100644 --- a/arch/arm/mach-tegra/tegra3_clocks.c +++ b/arch/arm/mach-tegra/tegra3_clocks.c @@ -812,12 +812,23 @@ static int tegra3_cpu_cmplx_clk_set_parent(struct clk *c, struct clk *p) return 0; } +static long tegra3_cpu_cmplx_round_rate(struct clk *c, + unsigned long rate) +{ + if (rate > c->parent->max_rate) + rate = c->parent->max_rate; + else if (rate < c->parent->min_rate) + rate = c->parent->min_rate; + return rate; +} + static struct clk_ops tegra_cpu_cmplx_ops = { .init = tegra3_cpu_cmplx_clk_init, .enable = tegra3_cpu_cmplx_clk_enable, .disable = tegra3_cpu_cmplx_clk_disable, .set_rate = tegra3_cpu_cmplx_clk_set_rate, .set_parent = tegra3_cpu_cmplx_clk_set_parent, + .round_rate = tegra3_cpu_cmplx_round_rate, }; /* virtual cop clock functions. Used to acquire the fake 'cop' clock to |