OLD | NEW |
---|---|
1 /* | 1 /* |
2 * arch/arm/mach-tegra/tegra2_dvfs.c | 2 * arch/arm/mach-tegra/tegra2_dvfs.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 * | 8 * |
9 * This software is licensed under the terms of the GNU General Public | 9 * This software is licensed under the terms of the GNU General Public |
10 * License version 2, as published by the Free Software Foundation, and | 10 * License version 2, as published by the Free Software Foundation, and |
(...skipping 20 matching lines...) Expand all Loading... | |
31 #else | 31 #else |
32 static bool tegra_dvfs_core_disabled = true; | 32 static bool tegra_dvfs_core_disabled = true; |
33 #endif | 33 #endif |
34 #ifdef CONFIG_TEGRA_CPU_DVFS | 34 #ifdef CONFIG_TEGRA_CPU_DVFS |
35 static bool tegra_dvfs_cpu_disabled; | 35 static bool tegra_dvfs_cpu_disabled; |
36 #else | 36 #else |
37 static bool tegra_dvfs_cpu_disabled = true; | 37 static bool tegra_dvfs_cpu_disabled = true; |
38 #endif | 38 #endif |
39 | 39 |
40 static const int core_millivolts[MAX_DVFS_FREQS] = | 40 static const int core_millivolts[MAX_DVFS_FREQS] = |
41 » {950, 1000, 1100, 1200, 1275}; | 41 » {950, 1000, 1100, 1200, 1225, 1275, 1300}; |
42 static const int cpu_millivolts[MAX_DVFS_FREQS] = | 42 static const int cpu_millivolts[MAX_DVFS_FREQS] = |
43 {750, 775, 800, 825, 850, 875, 900, 925, 950, 975, 1000, 1025, 1050, 110 0, 1125}; | 43 {750, 775, 800, 825, 850, 875, 900, 925, 950, 975, 1000, 1025, 1050, 110 0, 1125}; |
44 | 44 |
45 static const int cpu_speedo_max_millivolts[NUM_SPEED_LEVELS] = | 45 static const int cpu_speedo_max_millivolts[NUM_SPEED_LEVELS] = |
46 { 1100, 1025, 1125 }; | 46 { 1100, 1025, 1125 }; |
47 | 47 |
48 static const int core_speedo_max_millivolts[NUM_SPEED_LEVELS] = | |
49 { 1225, 1225, 1300 }; | |
50 | |
48 #define KHZ 1000 | 51 #define KHZ 1000 |
49 #define MHZ 1000000 | 52 #define MHZ 1000000 |
50 | 53 |
51 static struct dvfs_rail tegra2_dvfs_rail_vdd_cpu = { | 54 static struct dvfs_rail tegra2_dvfs_rail_vdd_cpu = { |
52 .reg_id = "vdd_cpu", | 55 .reg_id = "vdd_cpu", |
53 .max_millivolts = 1100, | 56 .max_millivolts = 1100, |
54 .min_millivolts = 750, | 57 .min_millivolts = 750, |
55 .nominal_millivolts = 1100, | 58 .nominal_millivolts = 1100, |
56 }; | 59 }; |
57 | 60 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 }, | 163 }, |
161 { | 164 { |
162 CPU_DVFS("cpu", MHZ, 0, 0, 0, 0, 655, 655, 798, 798, 902, 902, 960, 1000, 1100, 1100, 1200), | 165 CPU_DVFS("cpu", MHZ, 0, 0, 0, 0, 655, 655, 798, 798, 902, 902, 960, 1000, 1100, 1100, 1200), |
163 CPU_DVFS("cpu", MHZ, 0, 0, 0, 0, 655, 760, 798, 798, 950, 950, 1015, 1015, 1100, 1200), | 166 CPU_DVFS("cpu", MHZ, 0, 0, 0, 0, 655, 760, 798, 798, 950, 950, 1015, 1015, 1100, 1200), |
164 CPU_DVFS("cpu", MHZ, 0, 0, 0, 0, 769, 769, 902, 902, 1026, 1026, 1140, 1140, 1200), | 167 CPU_DVFS("cpu", MHZ, 0, 0, 0, 0, 769, 769, 902, 902, 1026, 1026, 1140, 1140, 1200), |
165 CPU_DVFS("cpu", MHZ, 0, 0, 0, 0, 940, 1000, 1000, 1000, 1130, 1130, 1200), | 168 CPU_DVFS("cpu", MHZ, 0, 0, 0, 0, 940, 1000, 1000, 1000, 1130, 1130, 1200), |
166 }, | 169 }, |
167 }; | 170 }; |
168 | 171 |
169 static struct dvfs dvfs_init[] = { | 172 static struct dvfs dvfs_init[] = { |
170 » /* Core voltages (mV): 950, 1000, 1100, 1200, 1275 */ | 173 » /* Core voltages (mV): 950, 1000, 1100, 1200, 1225, 127 5, 1300*/ |
171 » CORE_DVFS("emc", 1, KHZ, 57000, 333000, 333000, 666000, 666000), | 174 » CORE_DVFS("emc", 1, KHZ, 57000, 333000, 380000, 666000, 666000, 666000, 760000), |
172 | 175 |
173 #if 0 | 176 #if 0 |
174 /* | 177 /* |
175 * The sdhci core calls the clock ops with a spinlock held, which | 178 * The sdhci core calls the clock ops with a spinlock held, which |
176 * conflicts with the sleeping dvfs api. | 179 * conflicts with the sleeping dvfs api. |
177 * For now, boards must ensure that the core voltage does not drop | 180 * For now, boards must ensure that the core voltage does not drop |
178 * below 1V, or that the sdmmc busses are set to 44 MHz or less. | 181 * below 1V, or that the sdmmc busses are set to 44 MHz or less. |
179 */ | 182 */ |
180 » CORE_DVFS("sdmmc1", 1, KHZ, 44000, 52000, 52000, 52000, 52000), | 183 » CORE_DVFS("sdmmc1", 1, KHZ, 44000, 52000, 52000, 52000, 52000, 520 00, 52000), |
181 » CORE_DVFS("sdmmc2", 1, KHZ, 44000, 52000, 52000, 52000, 52000), | 184 » CORE_DVFS("sdmmc2", 1, KHZ, 44000, 52000, 52000, 52000, 52000, 520 00, 52000), |
182 » CORE_DVFS("sdmmc3", 1, KHZ, 44000, 52000, 52000, 52000, 52000), | 185 » CORE_DVFS("sdmmc3", 1, KHZ, 44000, 52000, 52000, 52000, 52000, 520 00, 52000), |
183 » CORE_DVFS("sdmmc4", 1, KHZ, 44000, 52000, 52000, 52000, 52000), | 186 » CORE_DVFS("sdmmc4", 1, KHZ, 44000, 52000, 52000, 52000, 52000, 520 00, 52000), |
184 #endif | 187 #endif |
185 | 188 |
186 » CORE_DVFS("ndflash", 1, KHZ, 130000, 150000, 158000, 164000, 164000), | 189 » CORE_DVFS("ndflash", 1, KHZ, 130000, 150000, 158000, 164000, 164000, 164 000, 164000), |
187 » CORE_DVFS("nor", 1, KHZ, 0, 92000, 92000, 92000, 92000), | 190 » CORE_DVFS("nor", 1, KHZ, 0, 92000, 92000, 92000, 92000, 920 00, 92000), |
188 » CORE_DVFS("ide", 1, KHZ, 0, 0, 100000, 100000, 100000), | 191 » CORE_DVFS("ide", 1, KHZ, 0, 0, 100000, 100000, 100000, 100 000, 100000), |
189 » CORE_DVFS("mipi", 1, KHZ, 0, 40000, 40000, 40000, 60000), | 192 » CORE_DVFS("mipi", 1, KHZ, 0, 40000, 40000, 40000, 40000, 600 00, 60000), |
190 » CORE_DVFS("usbd", 1, KHZ, 0, 0, 480000, 480000, 480000), | 193 » CORE_DVFS("usbd", 1, KHZ, 0, 0, 480000, 480000, 480000, 480 000, 480000), |
191 » CORE_DVFS("usb2", 1, KHZ, 0, 0, 480000, 480000, 480000), | 194 » CORE_DVFS("usb2", 1, KHZ, 0, 0, 480000, 480000, 480000, 480 000, 480000), |
192 » CORE_DVFS("usb3", 1, KHZ, 0, 0, 480000, 480000, 480000), | 195 » CORE_DVFS("usb3", 1, KHZ, 0, 0, 480000, 480000, 480000, 480 000, 480000), |
193 » CORE_DVFS("pcie", 1, KHZ, 0, 0, 0, 250000, 250000), | 196 » CORE_DVFS("pcie", 1, KHZ, 0, 0, 0, 250000, 250000, 250 000, 250000), |
194 » CORE_DVFS("dsi", 1, KHZ, 100000, 100000, 100000, 500000, 500000), | 197 » CORE_DVFS("dsi", 1, KHZ, 100000, 100000, 100000, 500000, 500000, 500 000, 500000), |
195 » CORE_DVFS("tvo", 1, KHZ, 0, 0, 0, 250000, 250000), | 198 » CORE_DVFS("tvo", 1, KHZ, 0, 0, 0, 250000, 250000, 250 000, 250000), |
196 | 199 |
197 /* | 200 /* |
198 * The clock rate for the display controllers that determines the | 201 * The clock rate for the display controllers that determines the |
199 * necessary core voltage depends on a divider that is internal | 202 * necessary core voltage depends on a divider that is internal |
200 * to the display block. Disable auto-dvfs on the display clocks, | 203 * to the display block. Disable auto-dvfs on the display clocks, |
201 * and let the display driver call tegra_dvfs_set_rate manually | 204 * and let the display driver call tegra_dvfs_set_rate manually |
202 */ | 205 */ |
203 » CORE_DVFS("disp1", 0, KHZ, 158000, 158000, 190000, 190000, 190000), | 206 » CORE_DVFS("disp1", 0, KHZ, 158000, 158000, 190000, 190000, 190000, 190 000, 190000), |
204 » CORE_DVFS("disp2", 0, KHZ, 158000, 158000, 190000, 190000, 190000), | 207 » CORE_DVFS("disp2", 0, KHZ, 158000, 158000, 190000, 190000, 190000, 190 000, 190000), |
205 » CORE_DVFS("hdmi", 0, KHZ, 0, 0, 0, 148500, 148500), | 208 » CORE_DVFS("hdmi", 0, KHZ, 0, 0, 0, 148500, 148500, 148 500, 148500), |
206 | 209 |
207 /* | 210 /* |
208 * These clocks technically depend on the core process id, | 211 * These clocks technically depend on the core process id, |
209 * but just use the worst case value for now | 212 * but just use the worst case value for now |
210 */ | 213 */ |
211 » CORE_DVFS("host1x", 1, KHZ, 104500, 133000, 166000, 166000, 166000), | 214 » CORE_DVFS("host1x", 1, KHZ, 104500, 133000, 166000, 166000, 166000, 166 000, 166000), |
212 » CORE_DVFS("epp", 1, KHZ, 133000, 171000, 247000, 300000, 300000), | 215 » CORE_DVFS("epp", 1, KHZ, 133000, 171000, 247000, 300000, 300000, 300 000, 300000), |
213 » CORE_DVFS("2d", 1, KHZ, 133000, 171000, 247000, 300000, 300000), | 216 » CORE_DVFS("2d", 1, KHZ, 133000, 171000, 247000, 300000, 300000, 300 000, 300000), |
214 » CORE_DVFS("3d", 1, KHZ, 114000, 161500, 247000, 300000, 300000), | 217 » CORE_DVFS("vi", 1, KHZ, 85000, 100000, 150000, 150000, 150000, 150 000, 150000), |
215 » CORE_DVFS("mpe", 1, KHZ, 104500, 152000, 228000, 250000, 250000), | 218 |
216 » CORE_DVFS("vi", 1, KHZ, 85000, 100000, 150000, 150000, 150000), | |
217 » CORE_DVFS("sclk", 1, KHZ, 95000, 133000, 190000, 250000, 250000), | |
218 » CORE_DVFS("vde", 1, KHZ, 95000, 123500, 209000, 250000, 250000), | |
219 /* What is this? */ | 219 /* What is this? */ |
220 » CORE_DVFS("NVRM_DEVID_CLK_SRC", 1, MHZ, 480, 600, 800, 1067, 1067), | 220 » CORE_DVFS("NVRM_DEVID_CLK_SRC", 1, MHZ, 480, 600, 800, 1067, 1067, 1067, 1067), |
221 }; | |
222 | |
223 | |
224 static struct dvfs dvfs_init_misc[][NUM_PROCESS_CORNERS] = { | |
Olof Johansson
2011/03/07 01:01:57
This should be named "dvfs_core" to go with the ot
| |
225 » { | |
226 » » CORE_DVFS("mpe", 1, KHZ, 104500, 152000, 228000, 300000, 30 0000, 300000, 300000), | |
227 » » CORE_DVFS("mpe", 1, KHZ, 142500, 190000, 275500, 300000, 30 0000, 300000, 300000), | |
228 » » CORE_DVFS("mpe", 1, KHZ, 190000, 237500, 300000, 300000, 30 0000, 300000, 300000), | |
229 » » CORE_DVFS("mpe", 1, KHZ, 228000, 266000, 300000, 300000, 30 0000, 300000, 300000), | |
230 » }, | |
231 » { | |
232 » » CORE_DVFS("3d", 1, KHZ, 114000, 161500, 247000, 304000, 30 4000, 335000, 335000), | |
233 » » CORE_DVFS("3d", 1, KHZ, 161500, 209000, 285000, 333500, 33 3500, 361000, 361000), | |
234 » » CORE_DVFS("3d", 1, KHZ, 218500, 256500, 323000, 380000, 38 0000, 400000, 400000), | |
235 » » CORE_DVFS("3d", 1, KHZ, 247000, 285000, 351500, 400000, 40 0000, 400000, 400000), | |
236 » }, | |
237 » { | |
238 » » CORE_DVFS("sclk", 1, KHZ, 95000, 133000, 190000, 240000, 24 0000, 247000, 262000), | |
239 » » CORE_DVFS("sclk", 1, KHZ, 123500, 159500, 207000, 240000, 24 0000, 264000, 277500), | |
240 » » CORE_DVFS("sclk", 1, KHZ, 152000, 180500, 229500, 260000, 26 0000, 285000, 300000), | |
241 » » CORE_DVFS("sclk", 1, KHZ, 171000, 218500, 256500, 292500, 29 2500, 300000, 300000), | |
242 » }, | |
243 » { | |
244 » » CORE_DVFS("vde", 1, KHZ, 95000, 123500, 209000, 275500, 27 5500, 300000, 300000), | |
245 » » CORE_DVFS("vde", 1, KHZ, 123500, 152000, 237500, 300000, 30 0000, 300000, 300000), | |
246 » » CORE_DVFS("vde", 1, KHZ, 152000, 209000, 285000, 300000, 30 0000, 300000, 300000), | |
247 » » CORE_DVFS("vde", 1, KHZ, 171000, 218500, 300000, 300000, 30 0000, 300000, 300000), | |
248 » }, | |
221 }; | 249 }; |
222 | 250 |
223 int tegra_dvfs_disable_core_set(const char *arg, const struct kernel_param *kp) | 251 int tegra_dvfs_disable_core_set(const char *arg, const struct kernel_param *kp) |
224 { | 252 { |
225 int ret; | 253 int ret; |
226 | 254 |
227 ret = param_set_bool(arg, kp); | 255 ret = param_set_bool(arg, kp); |
228 if (ret) | 256 if (ret) |
229 return ret; | 257 return ret; |
230 | 258 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 pr_err("Warning: Unsupported DVFS speed level: %d\n", speedo_id) ; | 326 pr_err("Warning: Unsupported DVFS speed level: %d\n", speedo_id) ; |
299 return; | 327 return; |
300 } | 328 } |
301 | 329 |
302 if (tegra_cpu_process_id > NUM_PROCESS_CORNERS) { | 330 if (tegra_cpu_process_id > NUM_PROCESS_CORNERS) { |
303 pr_err("Warning: Unsupported DVFS cpu process id: %d\n", | 331 pr_err("Warning: Unsupported DVFS cpu process id: %d\n", |
304 tegra_cpu_process_id); | 332 tegra_cpu_process_id); |
305 return; | 333 return; |
306 } | 334 } |
307 | 335 |
336 if (tegra_core_process_id > NUM_PROCESS_CORNERS) { | |
337 pr_err("Warning: Unsupported DVFS core process id: %d\n", | |
338 tegra_core_process_id); | |
339 return; | |
340 } | |
341 | |
308 tegra2_dvfs_rail_vdd_cpu.nominal_millivolts = | 342 tegra2_dvfs_rail_vdd_cpu.nominal_millivolts = |
309 cpu_speedo_max_millivolts[speedo_id]; | 343 cpu_speedo_max_millivolts[speedo_id]; |
310 tegra2_dvfs_rail_vdd_cpu.max_millivolts = | 344 tegra2_dvfs_rail_vdd_cpu.max_millivolts = |
311 cpu_speedo_max_millivolts[speedo_id]; | 345 cpu_speedo_max_millivolts[speedo_id]; |
346 tegra2_dvfs_rail_vdd_core.nominal_millivolts = | |
347 core_speedo_max_millivolts[speedo_id]; | |
348 tegra2_dvfs_rail_vdd_core.max_millivolts = | |
349 core_speedo_max_millivolts[speedo_id]; | |
350 tegra2_dvfs_rail_vdd_aon.nominal_millivolts = | |
351 core_speedo_max_millivolts[speedo_id]; | |
352 tegra2_dvfs_rail_vdd_aon.max_millivolts = | |
353 core_speedo_max_millivolts[speedo_id]; | |
312 | 354 |
313 tegra_dvfs_init_rails(tegra2_dvfs_rails, ARRAY_SIZE(tegra2_dvfs_rails)); | 355 tegra_dvfs_init_rails(tegra2_dvfs_rails, ARRAY_SIZE(tegra2_dvfs_rails)); |
314 tegra_dvfs_add_relationships(tegra2_dvfs_relationships, | 356 tegra_dvfs_add_relationships(tegra2_dvfs_relationships, |
315 ARRAY_SIZE(tegra2_dvfs_relationships)); | 357 ARRAY_SIZE(tegra2_dvfs_relationships)); |
316 /* | 358 /* |
317 * VDD_CORE must always be at least 50 mV higher than VDD_CPU | 359 * VDD_CORE must always be at least 50 mV higher than VDD_CPU |
318 * Fill out cpu_core_millivolts based on cpu_millivolts | 360 * Fill out cpu_core_millivolts based on cpu_millivolts |
319 */ | 361 */ |
320 | 362 |
321 dvfs_init_one(&dvfs_cpu[speedo_id][tegra_cpu_process_id]); | 363 dvfs_init_one(&dvfs_cpu[speedo_id][tegra_cpu_process_id]); |
322 | 364 |
323 for (i = 0; i < ARRAY_SIZE(dvfs_init); i++) | 365 for (i = 0; i < ARRAY_SIZE(dvfs_init); i++) |
324 dvfs_init_one(&dvfs_init[i]); | 366 dvfs_init_one(&dvfs_init[i]); |
325 | 367 |
368 for (i = 0; i < ARRAY_SIZE(dvfs_init_misc); i++) | |
369 dvfs_init_one(&dvfs_init_misc[i][tegra_core_process_id]); | |
370 | |
326 if (tegra_dvfs_core_disabled) | 371 if (tegra_dvfs_core_disabled) |
327 tegra_dvfs_rail_disable(&tegra2_dvfs_rail_vdd_core); | 372 tegra_dvfs_rail_disable(&tegra2_dvfs_rail_vdd_core); |
328 | 373 |
329 if (tegra_dvfs_cpu_disabled) | 374 if (tegra_dvfs_cpu_disabled) |
330 tegra_dvfs_rail_disable(&tegra2_dvfs_rail_vdd_cpu); | 375 tegra_dvfs_rail_disable(&tegra2_dvfs_rail_vdd_cpu); |
331 } | 376 } |
OLD | NEW |