| OLD | NEW |
| 1 /* | 1 /* |
| 2 * arch/arm/mach-tegra/cpu-tegra.c | 2 * arch/arm/mach-tegra/cpu-tegra.c |
| 3 * | 3 * |
| 4 * Copyright (C) 2010 Google, Inc. | 4 * Copyright (C) 2010 Google, Inc. |
| 5 * | 5 * |
| 6 * Author: | 6 * Author: |
| 7 * Colin Cross <ccross@google.com> | 7 * Colin Cross <ccross@google.com> |
| 8 * Based on arch/arm/plat-omap/cpu-omap.c, (C) 2005 Nokia Corporation | 8 * Based on arch/arm/plat-omap/cpu-omap.c, (C) 2005 Nokia Corporation |
| 9 * | 9 * |
| 10 * This software is licensed under the terms of the GNU General Public | 10 * This software is licensed under the terms of the GNU General Public |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include <linux/clk.h> | 29 #include <linux/clk.h> |
| 30 #include <linux/io.h> | 30 #include <linux/io.h> |
| 31 #include <linux/suspend.h> | 31 #include <linux/suspend.h> |
| 32 | 32 |
| 33 #include <asm/smp_twd.h> | 33 #include <asm/smp_twd.h> |
| 34 #include <asm/system.h> | 34 #include <asm/system.h> |
| 35 | 35 |
| 36 #include <mach/hardware.h> | 36 #include <mach/hardware.h> |
| 37 #include <mach/clk.h> | 37 #include <mach/clk.h> |
| 38 | 38 |
| 39 #include "fuse.h" |
| 40 |
| 39 /* Frequency table index must be sequential starting at 0 */ | 41 /* Frequency table index must be sequential starting at 0 */ |
| 40 static struct cpufreq_frequency_table freq_table[] = { | 42 static struct cpufreq_frequency_table freq_table_t20[] = { |
| 41 { 0, 216000 }, | 43 { 0, 216000 }, |
| 42 { 1, 312000 }, | 44 { 1, 312000 }, |
| 43 { 2, 456000 }, | 45 { 2, 456000 }, |
| 44 { 3, 608000 }, | 46 { 3, 608000 }, |
| 45 { 4, 760000 }, | 47 { 4, 760000 }, |
| 46 { 5, 816000 }, | 48 { 5, 816000 }, |
| 47 { 6, 912000 }, | 49 { 6, 912000 }, |
| 48 { 7, 1000000 }, | 50 { 7, 1000000 }, |
| 49 { 8, CPUFREQ_TABLE_END }, | 51 { 8, CPUFREQ_TABLE_END }, |
| 50 }; | 52 }; |
| 51 | 53 |
| 54 static struct cpufreq_frequency_table freq_table_t25[] = { |
| 55 { 0, 216000 }, |
| 56 { 1, 312000 }, |
| 57 { 2, 456000 }, |
| 58 { 3, 608000 }, |
| 59 { 4, 760000 }, |
| 60 { 5, 816000 }, |
| 61 { 6, 912000 }, |
| 62 { 7, 1000000 }, |
| 63 { 8, 1200000 }, |
| 64 { 9, CPUFREQ_TABLE_END }, |
| 65 }; |
| 66 |
| 67 static struct cpufreq_frequency_table *freq_table; |
| 68 |
| 52 #define NUM_CPUS 2 | 69 #define NUM_CPUS 2 |
| 53 | 70 |
| 54 static struct clk *cpu_clk; | 71 static struct clk *cpu_clk; |
| 55 | 72 |
| 56 static unsigned long target_cpu_speed[NUM_CPUS]; | 73 static unsigned long target_cpu_speed[NUM_CPUS]; |
| 57 static DEFINE_MUTEX(tegra_cpu_lock); | 74 static DEFINE_MUTEX(tegra_cpu_lock); |
| 58 static bool is_suspended; | 75 static bool is_suspended; |
| 59 | 76 |
| 60 int tegra_verify_speed(struct cpufreq_policy *policy) | 77 int tegra_verify_speed(struct cpufreq_policy *policy) |
| 61 { | 78 { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 202 |
| 186 static struct notifier_block tegra_cpu_pm_notifier = { | 203 static struct notifier_block tegra_cpu_pm_notifier = { |
| 187 .notifier_call = tegra_pm_notify, | 204 .notifier_call = tegra_pm_notify, |
| 188 }; | 205 }; |
| 189 | 206 |
| 190 static int tegra_cpu_init(struct cpufreq_policy *policy) | 207 static int tegra_cpu_init(struct cpufreq_policy *policy) |
| 191 { | 208 { |
| 192 if (policy->cpu >= NUM_CPUS) | 209 if (policy->cpu >= NUM_CPUS) |
| 193 return -EINVAL; | 210 return -EINVAL; |
| 194 | 211 |
| 212 if (tegra_sku_id() == SKU_ID_T25) |
| 213 freq_table = freq_table_t25; |
| 214 else |
| 215 freq_table = freq_table_t20; |
| 216 |
| 195 cpu_clk = clk_get_sys(NULL, "cpu"); | 217 cpu_clk = clk_get_sys(NULL, "cpu"); |
| 196 if (IS_ERR(cpu_clk)) | 218 if (IS_ERR(cpu_clk)) |
| 197 return PTR_ERR(cpu_clk); | 219 return PTR_ERR(cpu_clk); |
| 198 | 220 |
| 199 cpufreq_frequency_table_cpuinfo(policy, freq_table); | 221 cpufreq_frequency_table_cpuinfo(policy, freq_table); |
| 200 cpufreq_frequency_table_get_attr(freq_table, policy->cpu); | 222 cpufreq_frequency_table_get_attr(freq_table, policy->cpu); |
| 201 policy->cur = tegra_getspeed(policy->cpu); | 223 policy->cur = tegra_getspeed(policy->cpu); |
| 202 target_cpu_speed[policy->cpu] = policy->cur; | 224 target_cpu_speed[policy->cpu] = policy->cur; |
| 203 | 225 |
| 204 /* FIXME: what's the actual transition time? */ | 226 /* FIXME: what's the actual transition time? */ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 { | 266 { |
| 245 cpufreq_unregister_driver(&tegra_cpufreq_driver); | 267 cpufreq_unregister_driver(&tegra_cpufreq_driver); |
| 246 } | 268 } |
| 247 | 269 |
| 248 | 270 |
| 249 MODULE_AUTHOR("Colin Cross <ccross@android.com>"); | 271 MODULE_AUTHOR("Colin Cross <ccross@android.com>"); |
| 250 MODULE_DESCRIPTION("cpufreq driver for Nvidia Tegra2"); | 272 MODULE_DESCRIPTION("cpufreq driver for Nvidia Tegra2"); |
| 251 MODULE_LICENSE("GPL"); | 273 MODULE_LICENSE("GPL"); |
| 252 module_init(tegra_cpufreq_init); | 274 module_init(tegra_cpufreq_init); |
| 253 module_exit(tegra_cpufreq_exit); | 275 module_exit(tegra_cpufreq_exit); |
| OLD | NEW |