X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Flinux%2Fcpufreq.h;h=7f008f6bfdc36e2d1b430bf2b13bd876f43de1ff;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=b4204dc7e304f675dde629596516c800ba81cfc7;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index b4204dc7e..7f008f6bf 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -14,7 +14,7 @@ #ifndef _LINUX_CPUFREQ_H #define _LINUX_CPUFREQ_H -#include +#include #include #include #include @@ -22,6 +22,8 @@ #include #include #include +#include +#include #define CPUFREQ_NAME_LEN 16 @@ -48,7 +50,7 @@ int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); /* Frequency values here are CPU kHz so that hardware which doesn't run * with some frequencies can complain without having to guess what per * cent / per mille means. - * Maximum transition latency is in microseconds - if it's unknown, + * Maximum transition latency is in nanoseconds - if it's unknown, * CPUFREQ_ETERNAL shall be used. */ @@ -69,7 +71,10 @@ struct cpufreq_real_policy { }; struct cpufreq_policy { - unsigned int cpu; /* cpu nr */ + cpumask_t cpus; /* affected CPUs */ + unsigned int shared_type; /* ANY or ALL affected CPUs + should set cpufreq */ + unsigned int cpu; /* cpu nr of registered CPU */ struct cpufreq_cpuinfo cpuinfo;/* see above */ unsigned int min; /* in kHz */ @@ -79,7 +84,7 @@ struct cpufreq_policy { unsigned int policy; /* see above */ struct cpufreq_governor *governor; /* see below */ - struct semaphore lock; /* CPU ->setpolicy or ->target may + struct mutex lock; /* CPU ->setpolicy or ->target may only be called once a time */ struct work_struct update; /* if update_policy() needs to be @@ -95,12 +100,17 @@ struct cpufreq_policy { #define CPUFREQ_INCOMPATIBLE (1) #define CPUFREQ_NOTIFY (2) +#define CPUFREQ_SHARED_TYPE_NONE (0) /* None */ +#define CPUFREQ_SHARED_TYPE_HW (1) /* HW does needed coordination */ +#define CPUFREQ_SHARED_TYPE_ALL (2) /* All dependent CPUs should set freq */ +#define CPUFREQ_SHARED_TYPE_ANY (3) /* Freq can be set from any dependent CPU*/ /******************** cpufreq transition notifiers *******************/ #define CPUFREQ_PRECHANGE (0) #define CPUFREQ_POSTCHANGE (1) #define CPUFREQ_RESUMECHANGE (8) +#define CPUFREQ_SUSPENDCHANGE (9) struct cpufreq_freqs { unsigned int cpu; /* cpu nr */ @@ -162,8 +172,7 @@ extern int __cpufreq_driver_target(struct cpufreq_policy *policy, unsigned int relation); -/* pass an event to the cpufreq governor */ -int cpufreq_governor(unsigned int cpu, unsigned int event); +extern int cpufreq_driver_getavg(struct cpufreq_policy *policy); int cpufreq_register_governor(struct cpufreq_governor *governor); void cpufreq_unregister_governor(struct cpufreq_governor *governor); @@ -197,7 +206,9 @@ struct cpufreq_driver { unsigned int (*get) (unsigned int cpu); /* optional */ + unsigned int (*getavg) (unsigned int cpu); int (*exit) (struct cpufreq_policy *policy); + int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); int (*resume) (struct cpufreq_policy *policy); struct freq_attr **attr; }; @@ -209,14 +220,8 @@ struct cpufreq_driver { #define CPUFREQ_CONST_LOOPS 0x02 /* loops_per_jiffy or other kernel * "constants" aren't affected by * frequency transitions */ -#define CPUFREQ_PANIC_OUTOFSYNC 0x04 /* panic if cpufreq's opinion of - * current frequency differs from - * actual frequency */ -#define CPUFREQ_PANIC_RESUME_OUTOFSYNC 0x08 /* panic if cpufreq's opinion of - * current frequency differs from - * actual frequency on resume - * from sleep. */ - +#define CPUFREQ_PM_NO_WARN 0x04 /* don't warn on suspend/resume speed + * mismatches */ int cpufreq_register_driver(struct cpufreq_driver *driver_data); int cpufreq_unregister_driver(struct cpufreq_driver *driver_data); @@ -257,64 +262,15 @@ int cpufreq_update_policy(unsigned int cpu); /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ unsigned int cpufreq_get(unsigned int cpu); -/* the proc_intf.c needs this */ -int cpufreq_parse_governor (char *str_governor, unsigned int *policy, struct cpufreq_governor **governor); - - -/********************************************************************* - * CPUFREQ USERSPACE GOVERNOR * - *********************************************************************/ -#ifdef CONFIG_CPU_FREQ_24_API - -int cpufreq_setmax(unsigned int cpu); -int cpufreq_set(unsigned int kHz, unsigned int cpu); - - -/* /proc/sys/cpu */ -enum { - CPU_NR = 1, /* compatibilty reasons */ - CPU_NR_0 = 1, - CPU_NR_1 = 2, - CPU_NR_2 = 3, - CPU_NR_3 = 4, - CPU_NR_4 = 5, - CPU_NR_5 = 6, - CPU_NR_6 = 7, - CPU_NR_7 = 8, - CPU_NR_8 = 9, - CPU_NR_9 = 10, - CPU_NR_10 = 11, - CPU_NR_11 = 12, - CPU_NR_12 = 13, - CPU_NR_13 = 14, - CPU_NR_14 = 15, - CPU_NR_15 = 16, - CPU_NR_16 = 17, - CPU_NR_17 = 18, - CPU_NR_18 = 19, - CPU_NR_19 = 20, - CPU_NR_20 = 21, - CPU_NR_21 = 22, - CPU_NR_22 = 23, - CPU_NR_23 = 24, - CPU_NR_24 = 25, - CPU_NR_25 = 26, - CPU_NR_26 = 27, - CPU_NR_27 = 28, - CPU_NR_28 = 29, - CPU_NR_29 = 30, - CPU_NR_30 = 31, - CPU_NR_31 = 32, -}; - -/* /proc/sys/cpu/{0,1,...,(NR_CPUS-1)} */ -enum { - CPU_NR_FREQ_MAX = 1, - CPU_NR_FREQ_MIN = 2, - CPU_NR_FREQ = 3, -}; - -#endif /* CONFIG_CPU_FREQ_24_API */ +/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ +#ifdef CONFIG_CPU_FREQ +unsigned int cpufreq_quick_get(unsigned int cpu); +#else +static inline unsigned int cpufreq_quick_get(unsigned int cpu) +{ + return 0; +} +#endif /********************************************************************* @@ -356,6 +312,11 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, unsigned int relation, unsigned int *index); +/* the following 3 funtions are for cpufreq core use only */ +struct cpufreq_frequency_table *cpufreq_frequency_get_table(unsigned int cpu); +struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); +void cpufreq_cpu_put (struct cpufreq_policy *data); + /* the following are really really optional */ extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs; @@ -365,4 +326,23 @@ void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, void cpufreq_frequency_table_put_attr(unsigned int cpu); +/********************************************************************* + * UNIFIED DEBUG HELPERS * + *********************************************************************/ + +#define CPUFREQ_DEBUG_CORE 1 +#define CPUFREQ_DEBUG_DRIVER 2 +#define CPUFREQ_DEBUG_GOVERNOR 4 + +#ifdef CONFIG_CPU_FREQ_DEBUG + +extern void cpufreq_debug_printk(unsigned int type, const char *prefix, + const char *fmt, ...); + +#else + +#define cpufreq_debug_printk(msg...) do { } while(0) + +#endif /* CONFIG_CPU_FREQ_DEBUG */ + #endif /* _LINUX_CPUFREQ_H */