diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-04 20:38:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-04 20:38:48 -0400 |
commit | ded1504dfa0083661fdd1a0a5f021cb7313ffe04 (patch) | |
tree | 5af71c440627225138518669653c427e901d8e33 /drivers | |
parent | 98b96173c777c67daaa7d163a35e591e1928a164 (diff) | |
parent | 2e4976206396274cf66590328c6913811c271495 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
* master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq:
[CPUFREQ] Report the number of processors in PowerNow-k8 correctly
[CPUFREQ] do not declare undefined functions
[CPUFREQ] cleanup kconfig options
[CPUFREQ] Longhaul - Revert Longhaul ver. 2
[CPUFREQ] Remove deprecated /proc/acpi/processor/performance write support
[CPUFREQ] Fix limited cpufreq when booted on battery
Fix preemption warnings in speedstep-centrino.c
[CPUFREQ] Longhaul - Correct PCI code
[CPUFREQ] p4-clockmod: switch to rdmsr_on_cpu/wrmsr_on_cpu
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/processor_perflib.c | 46 | ||||
-rw-r--r-- | drivers/cpufreq/Kconfig | 61 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 47 |
3 files changed, 52 insertions, 102 deletions
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 2f2e7964226d..c4efc0c17f8f 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -433,49 +433,6 @@ static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) | |||
433 | PDE(inode)->data); | 433 | PDE(inode)->data); |
434 | } | 434 | } |
435 | 435 | ||
436 | static ssize_t | ||
437 | acpi_processor_write_performance(struct file *file, | ||
438 | const char __user * buffer, | ||
439 | size_t count, loff_t * data) | ||
440 | { | ||
441 | int result = 0; | ||
442 | struct seq_file *m = file->private_data; | ||
443 | struct acpi_processor *pr = m->private; | ||
444 | struct acpi_processor_performance *perf; | ||
445 | char state_string[12] = { '\0' }; | ||
446 | unsigned int new_state = 0; | ||
447 | struct cpufreq_policy policy; | ||
448 | |||
449 | |||
450 | if (!pr || (count > sizeof(state_string) - 1)) | ||
451 | return -EINVAL; | ||
452 | |||
453 | perf = pr->performance; | ||
454 | if (!perf) | ||
455 | return -EINVAL; | ||
456 | |||
457 | if (copy_from_user(state_string, buffer, count)) | ||
458 | return -EFAULT; | ||
459 | |||
460 | state_string[count] = '\0'; | ||
461 | new_state = simple_strtoul(state_string, NULL, 0); | ||
462 | |||
463 | if (new_state >= perf->state_count) | ||
464 | return -EINVAL; | ||
465 | |||
466 | cpufreq_get_policy(&policy, pr->id); | ||
467 | |||
468 | policy.cpu = pr->id; | ||
469 | policy.min = perf->states[new_state].core_frequency * 1000; | ||
470 | policy.max = perf->states[new_state].core_frequency * 1000; | ||
471 | |||
472 | result = cpufreq_set_policy(&policy); | ||
473 | if (result) | ||
474 | return result; | ||
475 | |||
476 | return count; | ||
477 | } | ||
478 | |||
479 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) | 436 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) |
480 | { | 437 | { |
481 | struct proc_dir_entry *entry = NULL; | 438 | struct proc_dir_entry *entry = NULL; |
@@ -487,10 +444,9 @@ static void acpi_cpufreq_add_file(struct acpi_processor *pr) | |||
487 | 444 | ||
488 | /* add file 'performance' [R/W] */ | 445 | /* add file 'performance' [R/W] */ |
489 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, | 446 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, |
490 | S_IFREG | S_IRUGO | S_IWUSR, | 447 | S_IFREG | S_IRUGO, |
491 | acpi_device_dir(device)); | 448 | acpi_device_dir(device)); |
492 | if (entry){ | 449 | if (entry){ |
493 | acpi_processor_perf_fops.write = acpi_processor_write_performance; | ||
494 | entry->proc_fops = &acpi_processor_perf_fops; | 450 | entry->proc_fops = &acpi_processor_perf_fops; |
495 | entry->data = acpi_driver_data(device); | 451 | entry->data = acpi_driver_data(device); |
496 | entry->owner = THIS_MODULE; | 452 | entry->owner = THIS_MODULE; |
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index d155e81b5c97..993fa7b89253 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
@@ -9,6 +9,9 @@ config CPU_FREQ | |||
9 | clock speed, you need to either enable a dynamic cpufreq governor | 9 | clock speed, you need to either enable a dynamic cpufreq governor |
10 | (see below) after boot, or use a userspace tool. | 10 | (see below) after boot, or use a userspace tool. |
11 | 11 | ||
12 | To compile this driver as a module, choose M here: the | ||
13 | module will be called cpufreq. | ||
14 | |||
12 | For details, take a look at <file:Documentation/cpu-freq>. | 15 | For details, take a look at <file:Documentation/cpu-freq>. |
13 | 16 | ||
14 | If in doubt, say N. | 17 | If in doubt, say N. |
@@ -16,7 +19,7 @@ config CPU_FREQ | |||
16 | if CPU_FREQ | 19 | if CPU_FREQ |
17 | 20 | ||
18 | config CPU_FREQ_TABLE | 21 | config CPU_FREQ_TABLE |
19 | tristate | 22 | tristate |
20 | 23 | ||
21 | config CPU_FREQ_DEBUG | 24 | config CPU_FREQ_DEBUG |
22 | bool "Enable CPUfreq debugging" | 25 | bool "Enable CPUfreq debugging" |
@@ -32,19 +35,26 @@ config CPU_FREQ_DEBUG | |||
32 | 4 to activate CPUfreq governor debugging | 35 | 4 to activate CPUfreq governor debugging |
33 | 36 | ||
34 | config CPU_FREQ_STAT | 37 | config CPU_FREQ_STAT |
35 | tristate "CPU frequency translation statistics" | 38 | tristate "CPU frequency translation statistics" |
36 | select CPU_FREQ_TABLE | 39 | select CPU_FREQ_TABLE |
37 | default y | 40 | default y |
38 | help | 41 | help |
39 | This driver exports CPU frequency statistics information through sysfs | 42 | This driver exports CPU frequency statistics information through sysfs |
40 | file system | 43 | file system. |
44 | |||
45 | To compile this driver as a module, choose M here: the | ||
46 | module will be called cpufreq_stats. | ||
47 | |||
48 | If in doubt, say N. | ||
41 | 49 | ||
42 | config CPU_FREQ_STAT_DETAILS | 50 | config CPU_FREQ_STAT_DETAILS |
43 | bool "CPU frequency translation statistics details" | 51 | bool "CPU frequency translation statistics details" |
44 | depends on CPU_FREQ_STAT | 52 | depends on CPU_FREQ_STAT |
45 | help | 53 | help |
46 | This will show detail CPU frequency translation table in sysfs file | 54 | This will show detail CPU frequency translation table in sysfs file |
47 | system | 55 | system. |
56 | |||
57 | If in doubt, say N. | ||
48 | 58 | ||
49 | # Note that it is not currently possible to set the other governors (such as ondemand) | 59 | # Note that it is not currently possible to set the other governors (such as ondemand) |
50 | # as the default, since if they fail to initialise, cpufreq will be | 60 | # as the default, since if they fail to initialise, cpufreq will be |
@@ -78,29 +88,38 @@ config CPU_FREQ_DEFAULT_GOV_USERSPACE | |||
78 | endchoice | 88 | endchoice |
79 | 89 | ||
80 | config CPU_FREQ_GOV_PERFORMANCE | 90 | config CPU_FREQ_GOV_PERFORMANCE |
81 | tristate "'performance' governor" | 91 | tristate "'performance' governor" |
82 | help | 92 | help |
83 | This cpufreq governor sets the frequency statically to the | 93 | This cpufreq governor sets the frequency statically to the |
84 | highest available CPU frequency. | 94 | highest available CPU frequency. |
85 | 95 | ||
96 | To compile this driver as a module, choose M here: the | ||
97 | module will be called cpufreq_performance. | ||
98 | |||
86 | If in doubt, say Y. | 99 | If in doubt, say Y. |
87 | 100 | ||
88 | config CPU_FREQ_GOV_POWERSAVE | 101 | config CPU_FREQ_GOV_POWERSAVE |
89 | tristate "'powersave' governor" | 102 | tristate "'powersave' governor" |
90 | help | 103 | help |
91 | This cpufreq governor sets the frequency statically to the | 104 | This cpufreq governor sets the frequency statically to the |
92 | lowest available CPU frequency. | 105 | lowest available CPU frequency. |
93 | 106 | ||
107 | To compile this driver as a module, choose M here: the | ||
108 | module will be called cpufreq_powersave. | ||
109 | |||
94 | If in doubt, say Y. | 110 | If in doubt, say Y. |
95 | 111 | ||
96 | config CPU_FREQ_GOV_USERSPACE | 112 | config CPU_FREQ_GOV_USERSPACE |
97 | tristate "'userspace' governor for userspace frequency scaling" | 113 | tristate "'userspace' governor for userspace frequency scaling" |
98 | help | 114 | help |
99 | Enable this cpufreq governor when you either want to set the | 115 | Enable this cpufreq governor when you either want to set the |
100 | CPU frequency manually or when an userspace program shall | 116 | CPU frequency manually or when an userspace program shall |
101 | be able to set the CPU dynamically, like on LART | 117 | be able to set the CPU dynamically, like on LART |
102 | <http://www.lartmaker.nl/>. | 118 | <http://www.lartmaker.nl/>. |
103 | 119 | ||
120 | To compile this driver as a module, choose M here: the | ||
121 | module will be called cpufreq_userspace. | ||
122 | |||
104 | For details, take a look at <file:Documentation/cpu-freq/>. | 123 | For details, take a look at <file:Documentation/cpu-freq/>. |
105 | 124 | ||
106 | If in doubt, say Y. | 125 | If in doubt, say Y. |
@@ -116,6 +135,9 @@ config CPU_FREQ_GOV_ONDEMAND | |||
116 | do fast frequency switching (i.e, very low latency frequency | 135 | do fast frequency switching (i.e, very low latency frequency |
117 | transitions). | 136 | transitions). |
118 | 137 | ||
138 | To compile this driver as a module, choose M here: the | ||
139 | module will be called cpufreq_ondemand. | ||
140 | |||
119 | For details, take a look at linux/Documentation/cpu-freq. | 141 | For details, take a look at linux/Documentation/cpu-freq. |
120 | 142 | ||
121 | If in doubt, say N. | 143 | If in doubt, say N. |
@@ -136,6 +158,9 @@ config CPU_FREQ_GOV_CONSERVATIVE | |||
136 | step-by-step latency issues between the minimum and maximum frequency | 158 | step-by-step latency issues between the minimum and maximum frequency |
137 | transitions in the CPU) you will probably want to use this governor. | 159 | transitions in the CPU) you will probably want to use this governor. |
138 | 160 | ||
161 | To compile this driver as a module, choose M here: the | ||
162 | module will be called cpufreq_conservative. | ||
163 | |||
139 | For details, take a look at linux/Documentation/cpu-freq. | 164 | For details, take a look at linux/Documentation/cpu-freq. |
140 | 165 | ||
141 | If in doubt, say N. | 166 | If in doubt, say N. |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 3162010900c9..893dbaf386fb 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -768,6 +768,9 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
768 | unlock_policy_rwsem_write(cpu); | 768 | unlock_policy_rwsem_write(cpu); |
769 | goto err_out; | 769 | goto err_out; |
770 | } | 770 | } |
771 | policy->user_policy.min = policy->cpuinfo.min_freq; | ||
772 | policy->user_policy.max = policy->cpuinfo.max_freq; | ||
773 | policy->user_policy.governor = policy->governor; | ||
771 | 774 | ||
772 | #ifdef CONFIG_SMP | 775 | #ifdef CONFIG_SMP |
773 | for_each_cpu_mask(j, policy->cpus) { | 776 | for_each_cpu_mask(j, policy->cpus) { |
@@ -858,10 +861,13 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
858 | 861 | ||
859 | policy->governor = NULL; /* to assure that the starting sequence is | 862 | policy->governor = NULL; /* to assure that the starting sequence is |
860 | * run in cpufreq_set_policy */ | 863 | * run in cpufreq_set_policy */ |
861 | unlock_policy_rwsem_write(cpu); | ||
862 | 864 | ||
863 | /* set default policy */ | 865 | /* set default policy */ |
864 | ret = cpufreq_set_policy(&new_policy); | 866 | ret = __cpufreq_set_policy(policy, &new_policy); |
867 | policy->user_policy.policy = policy->policy; | ||
868 | |||
869 | unlock_policy_rwsem_write(cpu); | ||
870 | |||
865 | if (ret) { | 871 | if (ret) { |
866 | dprintk("setting policy failed\n"); | 872 | dprintk("setting policy failed\n"); |
867 | goto err_out_unregister; | 873 | goto err_out_unregister; |
@@ -1620,43 +1626,6 @@ error_out: | |||
1620 | } | 1626 | } |
1621 | 1627 | ||
1622 | /** | 1628 | /** |
1623 | * cpufreq_set_policy - set a new CPUFreq policy | ||
1624 | * @policy: policy to be set. | ||
1625 | * | ||
1626 | * Sets a new CPU frequency and voltage scaling policy. | ||
1627 | */ | ||
1628 | int cpufreq_set_policy(struct cpufreq_policy *policy) | ||
1629 | { | ||
1630 | int ret = 0; | ||
1631 | struct cpufreq_policy *data; | ||
1632 | |||
1633 | if (!policy) | ||
1634 | return -EINVAL; | ||
1635 | |||
1636 | data = cpufreq_cpu_get(policy->cpu); | ||
1637 | if (!data) | ||
1638 | return -EINVAL; | ||
1639 | |||
1640 | if (unlikely(lock_policy_rwsem_write(policy->cpu))) | ||
1641 | return -EINVAL; | ||
1642 | |||
1643 | |||
1644 | ret = __cpufreq_set_policy(data, policy); | ||
1645 | data->user_policy.min = data->min; | ||
1646 | data->user_policy.max = data->max; | ||
1647 | data->user_policy.policy = data->policy; | ||
1648 | data->user_policy.governor = data->governor; | ||
1649 | |||
1650 | unlock_policy_rwsem_write(policy->cpu); | ||
1651 | |||
1652 | cpufreq_cpu_put(data); | ||
1653 | |||
1654 | return ret; | ||
1655 | } | ||
1656 | EXPORT_SYMBOL(cpufreq_set_policy); | ||
1657 | |||
1658 | |||
1659 | /** | ||
1660 | * cpufreq_update_policy - re-evaluate an existing cpufreq policy | 1629 | * cpufreq_update_policy - re-evaluate an existing cpufreq policy |
1661 | * @cpu: CPU which shall be re-evaluated | 1630 | * @cpu: CPU which shall be re-evaluated |
1662 | * | 1631 | * |