diff options
Diffstat (limited to 'include/linux/cpufreq.h')
-rw-r--r-- | include/linux/cpufreq.h | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 037d36ae63e5..3c7ee2f90370 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/cpufreq.h | 2 | * linux/include/linux/cpufreq.h |
3 | * | 3 | * |
4 | * Copyright (C) 2001 Russell King | 4 | * Copyright (C) 2001 Russell King |
5 | * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> | 5 | * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 8 | * it under the terms of the GNU General Public License version 2 as |
@@ -26,7 +26,6 @@ | |||
26 | /* Print length for names. Extra 1 space for accomodating '\n' in prints */ | 26 | /* Print length for names. Extra 1 space for accomodating '\n' in prints */ |
27 | #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) | 27 | #define CPUFREQ_NAME_PLEN (CPUFREQ_NAME_LEN + 1) |
28 | 28 | ||
29 | |||
30 | /********************************************************************* | 29 | /********************************************************************* |
31 | * CPUFREQ NOTIFIER INTERFACE * | 30 | * CPUFREQ NOTIFIER INTERFACE * |
32 | *********************************************************************/ | 31 | *********************************************************************/ |
@@ -71,6 +70,10 @@ struct cpufreq_governor; | |||
71 | 70 | ||
72 | /* /sys/devices/system/cpu/cpufreq: entry point for global variables */ | 71 | /* /sys/devices/system/cpu/cpufreq: entry point for global variables */ |
73 | extern struct kobject *cpufreq_global_kobject; | 72 | extern struct kobject *cpufreq_global_kobject; |
73 | int cpufreq_get_global_kobject(void); | ||
74 | void cpufreq_put_global_kobject(void); | ||
75 | int cpufreq_sysfs_create_file(const struct attribute *attr); | ||
76 | void cpufreq_sysfs_remove_file(const struct attribute *attr); | ||
74 | 77 | ||
75 | #define CPUFREQ_ETERNAL (-1) | 78 | #define CPUFREQ_ETERNAL (-1) |
76 | struct cpufreq_cpuinfo { | 79 | struct cpufreq_cpuinfo { |
@@ -107,6 +110,7 @@ struct cpufreq_policy { | |||
107 | unsigned int policy; /* see above */ | 110 | unsigned int policy; /* see above */ |
108 | struct cpufreq_governor *governor; /* see below */ | 111 | struct cpufreq_governor *governor; /* see below */ |
109 | void *governor_data; | 112 | void *governor_data; |
113 | bool governor_enabled; /* governor start/stop flag */ | ||
110 | 114 | ||
111 | struct work_struct update; /* if update_policy() needs to be | 115 | struct work_struct update; /* if update_policy() needs to be |
112 | * called, but you're in IRQ context */ | 116 | * called, but you're in IRQ context */ |
@@ -148,17 +152,18 @@ struct cpufreq_freqs { | |||
148 | u8 flags; /* flags of cpufreq_driver, see below. */ | 152 | u8 flags; /* flags of cpufreq_driver, see below. */ |
149 | }; | 153 | }; |
150 | 154 | ||
151 | |||
152 | /** | 155 | /** |
153 | * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch safe) | 156 | * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch |
157 | * safe) | ||
154 | * @old: old value | 158 | * @old: old value |
155 | * @div: divisor | 159 | * @div: divisor |
156 | * @mult: multiplier | 160 | * @mult: multiplier |
157 | * | 161 | * |
158 | * | 162 | * |
159 | * new = old * mult / div | 163 | * new = old * mult / div |
160 | */ | 164 | */ |
161 | static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mult) | 165 | static inline unsigned long cpufreq_scale(unsigned long old, u_int div, |
166 | u_int mult) | ||
162 | { | 167 | { |
163 | #if BITS_PER_LONG == 32 | 168 | #if BITS_PER_LONG == 32 |
164 | 169 | ||
@@ -211,14 +216,12 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy, | |||
211 | unsigned int target_freq, | 216 | unsigned int target_freq, |
212 | unsigned int relation); | 217 | unsigned int relation); |
213 | 218 | ||
214 | |||
215 | extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, | 219 | extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, |
216 | unsigned int cpu); | 220 | unsigned int cpu); |
217 | 221 | ||
218 | int cpufreq_register_governor(struct cpufreq_governor *governor); | 222 | int cpufreq_register_governor(struct cpufreq_governor *governor); |
219 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); | 223 | void cpufreq_unregister_governor(struct cpufreq_governor *governor); |
220 | 224 | ||
221 | |||
222 | /********************************************************************* | 225 | /********************************************************************* |
223 | * CPUFREQ DRIVER INTERFACE * | 226 | * CPUFREQ DRIVER INTERFACE * |
224 | *********************************************************************/ | 227 | *********************************************************************/ |
@@ -229,7 +232,7 @@ void cpufreq_unregister_governor(struct cpufreq_governor *governor); | |||
229 | struct freq_attr; | 232 | struct freq_attr; |
230 | 233 | ||
231 | struct cpufreq_driver { | 234 | struct cpufreq_driver { |
232 | struct module *owner; | 235 | struct module *owner; |
233 | char name[CPUFREQ_NAME_LEN]; | 236 | char name[CPUFREQ_NAME_LEN]; |
234 | u8 flags; | 237 | u8 flags; |
235 | /* | 238 | /* |
@@ -277,11 +280,11 @@ struct cpufreq_driver { | |||
277 | int cpufreq_register_driver(struct cpufreq_driver *driver_data); | 280 | int cpufreq_register_driver(struct cpufreq_driver *driver_data); |
278 | int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); | 281 | int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); |
279 | 282 | ||
280 | |||
281 | void cpufreq_notify_transition(struct cpufreq_policy *policy, | 283 | void cpufreq_notify_transition(struct cpufreq_policy *policy, |
282 | struct cpufreq_freqs *freqs, unsigned int state); | 284 | struct cpufreq_freqs *freqs, unsigned int state); |
283 | 285 | ||
284 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) | 286 | static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, |
287 | unsigned int min, unsigned int max) | ||
285 | { | 288 | { |
286 | if (policy->min < min) | 289 | if (policy->min < min) |
287 | policy->min = min; | 290 | policy->min = min; |
@@ -337,12 +340,16 @@ const char *cpufreq_get_current_driver(void); | |||
337 | /********************************************************************* | 340 | /********************************************************************* |
338 | * CPUFREQ 2.6. INTERFACE * | 341 | * CPUFREQ 2.6. INTERFACE * |
339 | *********************************************************************/ | 342 | *********************************************************************/ |
343 | u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy); | ||
340 | int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); | 344 | int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); |
341 | int cpufreq_update_policy(unsigned int cpu); | 345 | int cpufreq_update_policy(unsigned int cpu); |
342 | bool have_governor_per_policy(void); | 346 | bool have_governor_per_policy(void); |
347 | struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); | ||
343 | 348 | ||
344 | #ifdef CONFIG_CPU_FREQ | 349 | #ifdef CONFIG_CPU_FREQ |
345 | /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ | 350 | /* |
351 | * query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it | ||
352 | */ | ||
346 | unsigned int cpufreq_get(unsigned int cpu); | 353 | unsigned int cpufreq_get(unsigned int cpu); |
347 | #else | 354 | #else |
348 | static inline unsigned int cpufreq_get(unsigned int cpu) | 355 | static inline unsigned int cpufreq_get(unsigned int cpu) |
@@ -351,7 +358,9 @@ static inline unsigned int cpufreq_get(unsigned int cpu) | |||
351 | } | 358 | } |
352 | #endif | 359 | #endif |
353 | 360 | ||
354 | /* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ | 361 | /* |
362 | * query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it | ||
363 | */ | ||
355 | #ifdef CONFIG_CPU_FREQ | 364 | #ifdef CONFIG_CPU_FREQ |
356 | unsigned int cpufreq_quick_get(unsigned int cpu); | 365 | unsigned int cpufreq_quick_get(unsigned int cpu); |
357 | unsigned int cpufreq_quick_get_max(unsigned int cpu); | 366 | unsigned int cpufreq_quick_get_max(unsigned int cpu); |
@@ -366,16 +375,14 @@ static inline unsigned int cpufreq_quick_get_max(unsigned int cpu) | |||
366 | } | 375 | } |
367 | #endif | 376 | #endif |
368 | 377 | ||
369 | |||
370 | /********************************************************************* | 378 | /********************************************************************* |
371 | * CPUFREQ DEFAULT GOVERNOR * | 379 | * CPUFREQ DEFAULT GOVERNOR * |
372 | *********************************************************************/ | 380 | *********************************************************************/ |
373 | 381 | ||
374 | |||
375 | /* | 382 | /* |
376 | Performance governor is fallback governor if any other gov failed to | 383 | * Performance governor is fallback governor if any other gov failed to auto |
377 | auto load due latency restrictions | 384 | * load due latency restrictions |
378 | */ | 385 | */ |
379 | #ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE | 386 | #ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE |
380 | extern struct cpufreq_governor cpufreq_gov_performance; | 387 | extern struct cpufreq_governor cpufreq_gov_performance; |
381 | #endif | 388 | #endif |
@@ -395,7 +402,6 @@ extern struct cpufreq_governor cpufreq_gov_conservative; | |||
395 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) | 402 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) |
396 | #endif | 403 | #endif |
397 | 404 | ||
398 | |||
399 | /********************************************************************* | 405 | /********************************************************************* |
400 | * FREQUENCY TABLE HELPERS * | 406 | * FREQUENCY TABLE HELPERS * |
401 | *********************************************************************/ | 407 | *********************************************************************/ |
@@ -404,7 +410,7 @@ extern struct cpufreq_governor cpufreq_gov_conservative; | |||
404 | #define CPUFREQ_TABLE_END ~1 | 410 | #define CPUFREQ_TABLE_END ~1 |
405 | 411 | ||
406 | struct cpufreq_frequency_table { | 412 | struct cpufreq_frequency_table { |
407 | unsigned int index; /* any */ | 413 | unsigned int driver_data; /* driver specific data, not used by core */ |
408 | unsigned int frequency; /* kHz - doesn't need to be in ascending | 414 | unsigned int frequency; /* kHz - doesn't need to be in ascending |
409 | * order */ | 415 | * order */ |
410 | }; | 416 | }; |