fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / cpufreq.h
index 910eca3..7f008f6 100644 (file)
@@ -14,7 +14,7 @@
 #ifndef _LINUX_CPUFREQ_H
 #define _LINUX_CPUFREQ_H
 
-#include <linux/config.h>
+#include <linux/mutex.h>
 #include <linux/notifier.h>
 #include <linux/threads.h>
 #include <linux/device.h>
@@ -23,6 +23,7 @@
 #include <linux/completion.h>
 #include <linux/workqueue.h>
 #include <linux/cpumask.h>
+#include <asm/div64.h>
 
 #define CPUFREQ_NAME_LEN 16
 
@@ -49,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.
  */
 
@@ -71,6 +72,8 @@ struct cpufreq_real_policy {
 
 struct cpufreq_policy {
        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 */
 
@@ -81,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
@@ -97,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 */
@@ -164,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);
@@ -199,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;
 };
@@ -211,7 +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_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);
@@ -252,6 +262,16 @@ 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);
 
+/* 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
+
 
 /*********************************************************************
  *                       CPUFREQ DEFAULT GOVERNOR                    *