Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 235249
b: refs/heads/master
c: 7a28128
h: refs/heads/master
i:
  235247: 2a2f600
v: v3
  • Loading branch information
Colin Cross committed Feb 21, 2011
1 parent 8f9c877 commit 353ea06
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d2968284f63efa1d1849165f9e3a80402509212
refs/heads/master: 7a281284125fe8704ea16fd1ca243971b7c0a105
21 changes: 21 additions & 0 deletions trunk/arch/arm/mach-tegra/cpu-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ static struct cpufreq_frequency_table freq_table[] = {
#define NUM_CPUS 2

static struct clk *cpu_clk;
static struct clk *emc_clk;

static unsigned long target_cpu_speed[NUM_CPUS];
static DEFINE_MUTEX(tegra_cpu_lock);
Expand Down Expand Up @@ -83,6 +84,17 @@ static int tegra_update_cpu_speed(unsigned long rate)
if (freqs.old == freqs.new)
return ret;

/*
* Vote on memory bus frequency based on cpu frequency
* This sets the minimum frequency, display or avp may request higher
*/
if (rate >= 816000)
clk_set_rate(emc_clk, 600000000); /* cpu 816 MHz, emc max */
else if (rate >= 456000)
clk_set_rate(emc_clk, 300000000); /* cpu 456 MHz, emc 150Mhz */
else
clk_set_rate(emc_clk, 100000000); /* emc 50Mhz */

for_each_online_cpu(freqs.cpu)
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);

Expand Down Expand Up @@ -173,6 +185,13 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)
if (IS_ERR(cpu_clk))
return PTR_ERR(cpu_clk);

emc_clk = clk_get_sys("cpu", "emc");
if (IS_ERR(emc_clk)) {
clk_put(cpu_clk);
return PTR_ERR(emc_clk);
}

clk_enable(emc_clk);
clk_enable(cpu_clk);

cpufreq_frequency_table_cpuinfo(policy, freq_table);
Expand All @@ -195,6 +214,8 @@ static int tegra_cpu_init(struct cpufreq_policy *policy)
static int tegra_cpu_exit(struct cpufreq_policy *policy)
{
cpufreq_frequency_table_cpuinfo(policy, freq_table);
clk_disable(emc_clk);
clk_put(emc_clk);
clk_put(cpu_clk);
return 0;
}
Expand Down

0 comments on commit 353ea06

Please sign in to comment.