diff options
author | Colin Cross <ccross@android.com> | 2010-11-22 21:54:36 -0500 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-02-21 03:16:46 -0500 |
commit | 7a281284125fe8704ea16fd1ca243971b7c0a105 (patch) | |
tree | 4c3e2e7fbad7844b52e7682dcd91bdbd9ef8ad7f /arch/arm/mach-tegra/cpu-tegra.c | |
parent | 6d2968284f63efa1d1849165f9e3a80402509212 (diff) |
ARM: tegra: cpufreq: Adjust memory frequency with cpu frequency
Adjusts the minimum memory frequency when the cpu frequency
changes. The values are currently hardcoded to a reasonable
default. If memory frequency scaling is not enabled this
patch will have no effect.
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-tegra/cpu-tegra.c')
-rw-r--r-- | arch/arm/mach-tegra/cpu-tegra.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c index f02ba603ceb7..0e1016a827ac 100644 --- a/arch/arm/mach-tegra/cpu-tegra.c +++ b/arch/arm/mach-tegra/cpu-tegra.c | |||
@@ -51,6 +51,7 @@ static struct cpufreq_frequency_table freq_table[] = { | |||
51 | #define NUM_CPUS 2 | 51 | #define NUM_CPUS 2 |
52 | 52 | ||
53 | static struct clk *cpu_clk; | 53 | static struct clk *cpu_clk; |
54 | static struct clk *emc_clk; | ||
54 | 55 | ||
55 | static unsigned long target_cpu_speed[NUM_CPUS]; | 56 | static unsigned long target_cpu_speed[NUM_CPUS]; |
56 | static DEFINE_MUTEX(tegra_cpu_lock); | 57 | static DEFINE_MUTEX(tegra_cpu_lock); |
@@ -83,6 +84,17 @@ static int tegra_update_cpu_speed(unsigned long rate) | |||
83 | if (freqs.old == freqs.new) | 84 | if (freqs.old == freqs.new) |
84 | return ret; | 85 | return ret; |
85 | 86 | ||
87 | /* | ||
88 | * Vote on memory bus frequency based on cpu frequency | ||
89 | * This sets the minimum frequency, display or avp may request higher | ||
90 | */ | ||
91 | if (rate >= 816000) | ||
92 | clk_set_rate(emc_clk, 600000000); /* cpu 816 MHz, emc max */ | ||
93 | else if (rate >= 456000) | ||
94 | clk_set_rate(emc_clk, 300000000); /* cpu 456 MHz, emc 150Mhz */ | ||
95 | else | ||
96 | clk_set_rate(emc_clk, 100000000); /* emc 50Mhz */ | ||
97 | |||
86 | for_each_online_cpu(freqs.cpu) | 98 | for_each_online_cpu(freqs.cpu) |
87 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 99 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
88 | 100 | ||
@@ -173,6 +185,13 @@ static int tegra_cpu_init(struct cpufreq_policy *policy) | |||
173 | if (IS_ERR(cpu_clk)) | 185 | if (IS_ERR(cpu_clk)) |
174 | return PTR_ERR(cpu_clk); | 186 | return PTR_ERR(cpu_clk); |
175 | 187 | ||
188 | emc_clk = clk_get_sys("cpu", "emc"); | ||
189 | if (IS_ERR(emc_clk)) { | ||
190 | clk_put(cpu_clk); | ||
191 | return PTR_ERR(emc_clk); | ||
192 | } | ||
193 | |||
194 | clk_enable(emc_clk); | ||
176 | clk_enable(cpu_clk); | 195 | clk_enable(cpu_clk); |
177 | 196 | ||
178 | cpufreq_frequency_table_cpuinfo(policy, freq_table); | 197 | cpufreq_frequency_table_cpuinfo(policy, freq_table); |
@@ -195,6 +214,8 @@ static int tegra_cpu_init(struct cpufreq_policy *policy) | |||
195 | static int tegra_cpu_exit(struct cpufreq_policy *policy) | 214 | static int tegra_cpu_exit(struct cpufreq_policy *policy) |
196 | { | 215 | { |
197 | cpufreq_frequency_table_cpuinfo(policy, freq_table); | 216 | cpufreq_frequency_table_cpuinfo(policy, freq_table); |
217 | clk_disable(emc_clk); | ||
218 | clk_put(emc_clk); | ||
198 | clk_put(cpu_clk); | 219 | clk_put(cpu_clk); |
199 | return 0; | 220 | return 0; |
200 | } | 221 | } |