Commit 41c84759 authored by Dave Jones's avatar Dave Jones

Merge tetrachloride.(none):/mnt/raid/src/kernel/2.5/trees/bk-linus

into tetrachloride.(none):/mnt/raid/src/kernel/2.5/trees/cpufreq
parents eb40c469 8aa25a71
...@@ -41,16 +41,17 @@ on what is necessary: ...@@ -41,16 +41,17 @@ on what is necessary:
1.1 Initialization 1.1 Initialization
------------------ ------------------
First of all, in an __initcall level 7 or later (preferrably First of all, in an __initcall level 7 (module_init()) or later
module_init() so that your driver is modularized) function check function check whether this kernel runs on the right CPU and the right
whether this kernel runs on the right CPU and the right chipset. If chipset. If so, register a struct cpufreq_driver with the CPUfreq core
so, register a struct cpufreq_driver with the CPUfreq core using using cpufreq_register_driver()
cpufreq_register_driver()
What shall this struct cpufreq_driver contain? What shall this struct cpufreq_driver contain?
cpufreq_driver.name - The name of this driver. cpufreq_driver.name - The name of this driver.
cpufreq_driver.owner - THIS_MODULE;
cpufreq_driver.init - A pointer to the per-CPU initialization cpufreq_driver.init - A pointer to the per-CPU initialization
function. function.
...@@ -76,8 +77,7 @@ cpufreq driver registers itself, the per-CPU initialization function ...@@ -76,8 +77,7 @@ cpufreq driver registers itself, the per-CPU initialization function
cpufreq_driver.init is called. It takes a struct cpufreq_policy cpufreq_driver.init is called. It takes a struct cpufreq_policy
*policy as argument. What to do now? *policy as argument. What to do now?
If necessary, activate the CPUfreq support on your CPU (unlock that If necessary, activate the CPUfreq support on your CPU.
register etc.).
Then, the driver must fill in the following values: Then, the driver must fill in the following values:
......
...@@ -135,21 +135,21 @@ CPUfreq core to ensure proper locking. ...@@ -135,21 +135,21 @@ CPUfreq core to ensure proper locking.
The CPUfreq governor may call the CPU processor driver using one of The CPUfreq governor may call the CPU processor driver using one of
these two functions: these two functions:
inline int cpufreq_driver_target(struct cpufreq_policy *policy, int cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
inline int cpufreq_driver_target_l(struct cpufreq_policy *policy, int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
target_freq must be within policy->min and policy->max, of course. target_freq must be within policy->min and policy->max, of course.
What's the difference between these two functions? When your governor What's the difference between these two functions? When your governor
still is in a direct code path of a call to governor->governor, the still is in a direct code path of a call to governor->governor, the
cpufreq_driver_sem lock is still held in the cpufreq core, and there's per-CPU cpufreq lock is still held in the cpufreq core, and there's
no need to lock it again (in fact, this would cause a deadlock). So no need to lock it again (in fact, this would cause a deadlock). So
use cpufreq_driver_target only in these cases. In all other cases (for use __cpufreq_driver_target only in these cases. In all other cases
example, when there's a "daemonized" function that wakes up every (for example, when there's a "daemonized" function that wakes up
second), use cpufreq_driver_target_l to lock the cpufreq_driver_sem every second), use cpufreq_driver_target to lock the cpufreq per-CPU
before the command is passed to the cpufreq processor driver. lock before the command is passed to the cpufreq processor driver.
...@@ -132,7 +132,7 @@ the processor shall run at. ...@@ -132,7 +132,7 @@ the processor shall run at.
The preferred interface is located in the sysfs filesystem. If you The preferred interface is located in the sysfs filesystem. If you
mounted it at /sys, the cpufreq interface is located in a subdirectory mounted it at /sys, the cpufreq interface is located in a subdirectory
"cpufreq" within the cpu-device directory "cpufreq" within the cpu-device directory
(e.g. /sys/class/cpu/cpu0/cpufreq/ for the first CPU). (e.g. /sys/devices/system/cpu/cpu0/cpufreq/ for the first CPU).
cpuinfo_min_freq : this file shows the minimum operating cpuinfo_min_freq : this file shows the minimum operating
frequency the processor can run at(in kHz) frequency the processor can run at(in kHz)
......
...@@ -123,7 +123,7 @@ static int longrun_verify_policy(struct cpufreq_policy *policy) ...@@ -123,7 +123,7 @@ static int longrun_verify_policy(struct cpufreq_policy *policy)
policy->cpuinfo.max_freq); policy->cpuinfo.max_freq);
if (policy->policy == CPUFREQ_POLICY_GOVERNOR) if (policy->policy == CPUFREQ_POLICY_GOVERNOR)
policy->policy = longrun_driver.policy[0].policy; return -EINVAL;
return 0; return 0;
} }
......
...@@ -82,7 +82,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify) ...@@ -82,7 +82,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
return; return;
freqs.old = speedstep_get_processor_frequency(speedstep_processor); freqs.old = speedstep_get_processor_frequency(speedstep_processor);
freqs.new = speedstep_freqs[SPEEDSTEP_LOW].frequency; freqs.new = speedstep_freqs[state].frequency;
freqs.cpu = 0; /* speedstep.c is UP only driver */ freqs.cpu = 0; /* speedstep.c is UP only driver */
if (notify) if (notify)
...@@ -137,7 +137,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify) ...@@ -137,7 +137,7 @@ static void speedstep_set_state (unsigned int state, unsigned int notify)
dprintk(KERN_DEBUG "cpufreq: read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value); dprintk(KERN_DEBUG "cpufreq: read at pmbase 0x%x + 0x50 returned 0x%x\n", pmbase, value);
if (state == (value & 0x1)) { if (state == (value & 0x1)) {
dprintk (KERN_INFO "cpufreq: change to %u MHz succeeded\n", (freqs.new / 1000)); dprintk (KERN_INFO "cpufreq: change to %u MHz succeeded\n", (speedstep_get_processor_frequency(speedstep_processor) / 1000));
} else { } else {
printk (KERN_ERR "cpufreq: change failed - I/O error\n"); printk (KERN_ERR "cpufreq: change failed - I/O error\n");
} }
...@@ -295,7 +295,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) ...@@ -295,7 +295,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
return -EIO; return -EIO;
dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n", dprintk(KERN_INFO "cpufreq: currently at %s speed setting - %i MHz\n",
(speed == speedstep_low_freq) ? "low" : "high", (speed == speedstep_freqs[SPEEDSTEP_LOW].frequency) ? "low" : "high",
(speed / 1000)); (speed / 1000));
/* cpuinfo and default policy values */ /* cpuinfo and default policy values */
......
...@@ -524,10 +524,10 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy, ...@@ -524,10 +524,10 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
cpu_min_freq[cpu] = policy->min; cpu_min_freq[cpu] = policy->min;
cpu_max_freq[cpu] = policy->max; cpu_max_freq[cpu] = policy->max;
if (policy->max < cpu_cur_freq[cpu]) if (policy->max < cpu_cur_freq[cpu])
cpufreq_driver_target(&current_policy[cpu], policy->max, __cpufreq_driver_target(&current_policy[cpu], policy->max,
CPUFREQ_RELATION_H); CPUFREQ_RELATION_H);
else if (policy->min > cpu_cur_freq[cpu]) else if (policy->min > cpu_cur_freq[cpu])
cpufreq_driver_target(&current_policy[cpu], policy->min, __cpufreq_driver_target(&current_policy[cpu], policy->min,
CPUFREQ_RELATION_L); CPUFREQ_RELATION_L);
memcpy (&current_policy[cpu], policy, sizeof(struct cpufreq_policy)); memcpy (&current_policy[cpu], policy, sizeof(struct cpufreq_policy));
up(&userspace_sem); up(&userspace_sem);
......
...@@ -137,9 +137,13 @@ struct cpufreq_governor { ...@@ -137,9 +137,13 @@ struct cpufreq_governor {
/* pass a target to the cpufreq driver /* pass a target to the cpufreq driver
*/ */
inline int cpufreq_driver_target(struct cpufreq_policy *policy, extern int cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq, unsigned int target_freq,
unsigned int relation); unsigned int relation);
extern int __cpufreq_driver_target(struct cpufreq_policy *policy,
unsigned int target_freq,
unsigned int relation);
/* pass an event to the cpufreq governor */ /* pass an event to the cpufreq governor */
int cpufreq_governor(unsigned int cpu, unsigned int event); int cpufreq_governor(unsigned int cpu, unsigned int event);
...@@ -160,8 +164,6 @@ struct cpufreq_driver { ...@@ -160,8 +164,6 @@ struct cpufreq_driver {
struct module *owner; struct module *owner;
char name[CPUFREQ_NAME_LEN]; char name[CPUFREQ_NAME_LEN];
struct cpufreq_policy *policy;
/* needed by all drivers */ /* needed by all drivers */
int (*init) (struct cpufreq_policy *policy); int (*init) (struct cpufreq_policy *policy);
int (*verify) (struct cpufreq_policy *policy); int (*verify) (struct cpufreq_policy *policy);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment