 Chromium Code Reviews
 Chromium Code Reviews Issue 6116004:
  Add 1.2GHz cpu clock support for T25  (Closed) 
  Base URL: http://git.chromium.org/git/kernel-next.git@chromeos-2.6.36
    
  
    Issue 6116004:
  Add 1.2GHz cpu clock support for T25  (Closed) 
  Base URL: http://git.chromium.org/git/kernel-next.git@chromeos-2.6.36| 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 | |
| 41 #define SKU_ID_T20 0x08 | |
| 42 #define SKU_ID_T25 0x18 | |
| 43 | |
| 39 /* Frequency table index must be sequential starting at 0 */ | 44 /* Frequency table index must be sequential starting at 0 */ | 
| 40 static struct cpufreq_frequency_table freq_table[] = { | 45 static struct cpufreq_frequency_table freq_table_t20[] = { | 
| 41 { 0, 216000 }, | 46 { 0, 216000 }, | 
| 42 { 1, 312000 }, | 47 { 1, 312000 }, | 
| 43 { 2, 456000 }, | 48 { 2, 456000 }, | 
| 44 { 3, 608000 }, | 49 { 3, 608000 }, | 
| 45 { 4, 760000 }, | 50 { 4, 760000 }, | 
| 46 { 5, 816000 }, | 51 { 5, 816000 }, | 
| 47 { 6, 912000 }, | 52 { 6, 912000 }, | 
| 48 { 7, 1000000 }, | 53 { 7, 1000000 }, | 
| 49 { 8, CPUFREQ_TABLE_END }, | 54 { 8, CPUFREQ_TABLE_END }, | 
| 50 }; | 55 }; | 
| 51 | 56 | 
| 57 static struct cpufreq_frequency_table freq_table_t25[] = { | |
| 58 { 0, 216000 }, | |
| 59 { 1, 312000 }, | |
| 60 { 2, 456000 }, | |
| 61 { 3, 608000 }, | |
| 62 { 4, 760000 }, | |
| 63 { 5, 816000 }, | |
| 64 { 6, 912000 }, | |
| 65 { 7, 1000000 }, | |
| 66 { 8, 1200000 }, | |
| 67 { 9, CPUFREQ_TABLE_END }, | |
| 68 }; | |
| 69 | |
| 70 static struct cpufreq_frequency_table *freq_table; | |
| 71 | |
| 52 #define NUM_CPUS 2 | 72 #define NUM_CPUS 2 | 
| 53 | 73 | 
| 54 static struct clk *cpu_clk; | 74 static struct clk *cpu_clk; | 
| 55 | 75 | 
| 56 static unsigned long target_cpu_speed[NUM_CPUS]; | 76 static unsigned long target_cpu_speed[NUM_CPUS]; | 
| 57 static DEFINE_MUTEX(tegra_cpu_lock); | 77 static DEFINE_MUTEX(tegra_cpu_lock); | 
| 58 static bool is_suspended; | 78 static bool is_suspended; | 
| 59 | 79 | 
| 60 int tegra_verify_speed(struct cpufreq_policy *policy) | 80 int tegra_verify_speed(struct cpufreq_policy *policy) | 
| 61 { | 81 { | 
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 | 205 | 
| 186 static struct notifier_block tegra_cpu_pm_notifier = { | 206 static struct notifier_block tegra_cpu_pm_notifier = { | 
| 187 .notifier_call = tegra_pm_notify, | 207 .notifier_call = tegra_pm_notify, | 
| 188 }; | 208 }; | 
| 189 | 209 | 
| 190 static int tegra_cpu_init(struct cpufreq_policy *policy) | 210 static int tegra_cpu_init(struct cpufreq_policy *policy) | 
| 191 { | 211 { | 
| 192 if (policy->cpu >= NUM_CPUS) | 212 if (policy->cpu >= NUM_CPUS) | 
| 193 return -EINVAL; | 213 return -EINVAL; | 
| 194 | 214 | 
| 215 freq_table = (tegra_sku_id() == SKU_ID_T25) ? freq_table_t25 : | |
| 216 freq_table_t20; | |
| 
Olof Johansson
2011/01/12 01:05:28
I would prefer to see this as a regular if/else.
 
jimmzhang
2011/01/12 01:22:56
Sure, I can change it to that way.
 | |
| 217 | |
| 195 cpu_clk = clk_get_sys(NULL, "cpu"); | 218 cpu_clk = clk_get_sys(NULL, "cpu"); | 
| 196 if (IS_ERR(cpu_clk)) | 219 if (IS_ERR(cpu_clk)) | 
| 197 return PTR_ERR(cpu_clk); | 220 return PTR_ERR(cpu_clk); | 
| 198 | 221 | 
| 199 cpufreq_frequency_table_cpuinfo(policy, freq_table); | 222 cpufreq_frequency_table_cpuinfo(policy, freq_table); | 
| 200 cpufreq_frequency_table_get_attr(freq_table, policy->cpu); | 223 cpufreq_frequency_table_get_attr(freq_table, policy->cpu); | 
| 201 policy->cur = tegra_getspeed(policy->cpu); | 224 policy->cur = tegra_getspeed(policy->cpu); | 
| 202 target_cpu_speed[policy->cpu] = policy->cur; | 225 target_cpu_speed[policy->cpu] = policy->cur; | 
| 203 | 226 | 
| 204 /* FIXME: what's the actual transition time? */ | 227 /* FIXME: what's the actual transition time? */ | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 { | 267 { | 
| 245 cpufreq_unregister_driver(&tegra_cpufreq_driver); | 268 cpufreq_unregister_driver(&tegra_cpufreq_driver); | 
| 246 } | 269 } | 
| 247 | 270 | 
| 248 | 271 | 
| 249 MODULE_AUTHOR("Colin Cross <ccross@android.com>"); | 272 MODULE_AUTHOR("Colin Cross <ccross@android.com>"); | 
| 250 MODULE_DESCRIPTION("cpufreq driver for Nvidia Tegra2"); | 273 MODULE_DESCRIPTION("cpufreq driver for Nvidia Tegra2"); | 
| 251 MODULE_LICENSE("GPL"); | 274 MODULE_LICENSE("GPL"); | 
| 252 module_init(tegra_cpufreq_init); | 275 module_init(tegra_cpufreq_init); | 
| 253 module_exit(tegra_cpufreq_exit); | 276 module_exit(tegra_cpufreq_exit); | 
| OLD | NEW |