aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/cpufreq.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/cpufreq.h')
-rw-r--r--include/linux/cpufreq.h50
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 */
73extern struct kobject *cpufreq_global_kobject; 72extern struct kobject *cpufreq_global_kobject;
73int cpufreq_get_global_kobject(void);
74void cpufreq_put_global_kobject(void);
75int cpufreq_sysfs_create_file(const struct attribute *attr);
76void cpufreq_sysfs_remove_file(const struct attribute *attr);
74 77
75#define CPUFREQ_ETERNAL (-1) 78#define CPUFREQ_ETERNAL (-1)
76struct cpufreq_cpuinfo { 79struct 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 */
161static inline unsigned long cpufreq_scale(unsigned long old, u_int div, u_int mult) 165static 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
215extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy, 219extern int __cpufreq_driver_getavg(struct cpufreq_policy *policy,
216 unsigned int cpu); 220 unsigned int cpu);
217 221
218int cpufreq_register_governor(struct cpufreq_governor *governor); 222int cpufreq_register_governor(struct cpufreq_governor *governor);
219void cpufreq_unregister_governor(struct cpufreq_governor *governor); 223void 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);
229struct freq_attr; 232struct freq_attr;
230 233
231struct cpufreq_driver { 234struct 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 {
277int cpufreq_register_driver(struct cpufreq_driver *driver_data); 280int cpufreq_register_driver(struct cpufreq_driver *driver_data);
278int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); 281int cpufreq_unregister_driver(struct cpufreq_driver *driver_data);
279 282
280
281void cpufreq_notify_transition(struct cpufreq_policy *policy, 283void 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
284static inline void cpufreq_verify_within_limits(struct cpufreq_policy *policy, unsigned int min, unsigned int max) 286static 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 *********************************************************************/
343u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy);
340int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 344int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
341int cpufreq_update_policy(unsigned int cpu); 345int cpufreq_update_policy(unsigned int cpu);
342bool have_governor_per_policy(void); 346bool have_governor_per_policy(void);
347struct 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 */
346unsigned int cpufreq_get(unsigned int cpu); 353unsigned int cpufreq_get(unsigned int cpu);
347#else 354#else
348static inline unsigned int cpufreq_get(unsigned int cpu) 355static 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
356unsigned int cpufreq_quick_get(unsigned int cpu); 365unsigned int cpufreq_quick_get(unsigned int cpu);
357unsigned int cpufreq_quick_get_max(unsigned int cpu); 366unsigned 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
380extern struct cpufreq_governor cpufreq_gov_performance; 387extern 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
406struct cpufreq_frequency_table { 412struct 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};