aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/i386/kernel/cpu/cpufreq/longhaul.c21
-rw-r--r--arch/i386/kernel/cpu/cpufreq/p4-clockmod.c31
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c6
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c10
-rw-r--r--arch/x86_64/kernel/cpufreq/Kconfig19
-rw-r--r--drivers/acpi/processor_perflib.c46
-rw-r--r--drivers/cpufreq/Kconfig61
-rw-r--r--drivers/cpufreq/cpufreq.c47
-rw-r--r--include/linux/cpufreq.h1
10 files changed, 101 insertions, 143 deletions
diff --git a/arch/i386/kernel/cpu/cpufreq/longhaul.c b/arch/i386/kernel/cpu/cpufreq/longhaul.c
index 2b030d6ccbf7..a3df9c039bd4 100644
--- a/arch/i386/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/i386/kernel/cpu/cpufreq/longhaul.c
@@ -590,20 +590,23 @@ static acpi_status longhaul_walk_callback(acpi_handle obj_handle,
590static int enable_arbiter_disable(void) 590static int enable_arbiter_disable(void)
591{ 591{
592 struct pci_dev *dev; 592 struct pci_dev *dev;
593 int status;
593 int reg; 594 int reg;
594 u8 pci_cmd; 595 u8 pci_cmd;
595 596
597 status = 1;
596 /* Find PLE133 host bridge */ 598 /* Find PLE133 host bridge */
597 reg = 0x78; 599 reg = 0x78;
598 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, NULL); 600 dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0,
601 NULL);
599 /* Find CLE266 host bridge */ 602 /* Find CLE266 host bridge */
600 if (dev == NULL) { 603 if (dev == NULL) {
601 reg = 0x76; 604 reg = 0x76;
602 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_862X_0, NULL); 605 dev = pci_get_device(PCI_VENDOR_ID_VIA,
606 PCI_DEVICE_ID_VIA_862X_0, NULL);
603 /* Find CN400 V-Link host bridge */ 607 /* Find CN400 V-Link host bridge */
604 if (dev == NULL) 608 if (dev == NULL)
605 dev = pci_find_device(PCI_VENDOR_ID_VIA, 0x7259, NULL); 609 dev = pci_get_device(PCI_VENDOR_ID_VIA, 0x7259, NULL);
606
607 } 610 }
608 if (dev != NULL) { 611 if (dev != NULL) {
609 /* Enable access to port 0x22 */ 612 /* Enable access to port 0x22 */
@@ -615,10 +618,11 @@ static int enable_arbiter_disable(void)
615 if (!(pci_cmd & 1<<7)) { 618 if (!(pci_cmd & 1<<7)) {
616 printk(KERN_ERR PFX 619 printk(KERN_ERR PFX
617 "Can't enable access to port 0x22.\n"); 620 "Can't enable access to port 0x22.\n");
618 return 0; 621 status = 0;
619 } 622 }
620 } 623 }
621 return 1; 624 pci_dev_put(dev);
625 return status;
622 } 626 }
623 return 0; 627 return 0;
624} 628}
@@ -629,7 +633,7 @@ static int longhaul_setup_vt8235(void)
629 u8 pci_cmd; 633 u8 pci_cmd;
630 634
631 /* Find VT8235 southbridge */ 635 /* Find VT8235 southbridge */
632 dev = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, NULL); 636 dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, NULL);
633 if (dev != NULL) { 637 if (dev != NULL) {
634 /* Set transition time to max */ 638 /* Set transition time to max */
635 pci_read_config_byte(dev, 0xec, &pci_cmd); 639 pci_read_config_byte(dev, 0xec, &pci_cmd);
@@ -641,6 +645,7 @@ static int longhaul_setup_vt8235(void)
641 pci_read_config_byte(dev, 0xe5, &pci_cmd); 645 pci_read_config_byte(dev, 0xe5, &pci_cmd);
642 pci_cmd |= 1 << 7; 646 pci_cmd |= 1 << 7;
643 pci_write_config_byte(dev, 0xe5, pci_cmd); 647 pci_write_config_byte(dev, 0xe5, pci_cmd);
648 pci_dev_put(dev);
644 return 1; 649 return 1;
645 } 650 }
646 return 0; 651 return 0;
@@ -678,7 +683,7 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy)
678 sizeof(samuel2_eblcr)); 683 sizeof(samuel2_eblcr));
679 break; 684 break;
680 case 1 ... 15: 685 case 1 ... 15:
681 longhaul_version = TYPE_LONGHAUL_V2; 686 longhaul_version = TYPE_LONGHAUL_V1;
682 if (c->x86_mask < 8) { 687 if (c->x86_mask < 8) {
683 cpu_model = CPU_SAMUEL2; 688 cpu_model = CPU_SAMUEL2;
684 cpuname = "C3 'Samuel 2' [C5B]"; 689 cpuname = "C3 'Samuel 2' [C5B]";
diff --git a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
index 4786fedca6eb..4c76b511e194 100644
--- a/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/p4-clockmod.c
@@ -27,7 +27,6 @@
27#include <linux/cpufreq.h> 27#include <linux/cpufreq.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/cpumask.h> 29#include <linux/cpumask.h>
30#include <linux/sched.h> /* current / set_cpus_allowed() */
31 30
32#include <asm/processor.h> 31#include <asm/processor.h>
33#include <asm/msr.h> 32#include <asm/msr.h>
@@ -62,7 +61,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
62 if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV)) 61 if (!cpu_online(cpu) || (newstate > DC_DISABLE) || (newstate == DC_RESV))
63 return -EINVAL; 62 return -EINVAL;
64 63
65 rdmsr(MSR_IA32_THERM_STATUS, l, h); 64 rdmsr_on_cpu(cpu, MSR_IA32_THERM_STATUS, &l, &h);
66 65
67 if (l & 0x01) 66 if (l & 0x01)
68 dprintk("CPU#%d currently thermal throttled\n", cpu); 67 dprintk("CPU#%d currently thermal throttled\n", cpu);
@@ -70,10 +69,10 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
70 if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT)) 69 if (has_N44_O17_errata[cpu] && (newstate == DC_25PT || newstate == DC_DFLT))
71 newstate = DC_38PT; 70 newstate = DC_38PT;
72 71
73 rdmsr(MSR_IA32_THERM_CONTROL, l, h); 72 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h);
74 if (newstate == DC_DISABLE) { 73 if (newstate == DC_DISABLE) {
75 dprintk("CPU#%d disabling modulation\n", cpu); 74 dprintk("CPU#%d disabling modulation\n", cpu);
76 wrmsr(MSR_IA32_THERM_CONTROL, l & ~(1<<4), h); 75 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, l & ~(1<<4), h);
77 } else { 76 } else {
78 dprintk("CPU#%d setting duty cycle to %d%%\n", 77 dprintk("CPU#%d setting duty cycle to %d%%\n",
79 cpu, ((125 * newstate) / 10)); 78 cpu, ((125 * newstate) / 10));
@@ -84,7 +83,7 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
84 */ 83 */
85 l = (l & ~14); 84 l = (l & ~14);
86 l = l | (1<<4) | ((newstate & 0x7)<<1); 85 l = l | (1<<4) | ((newstate & 0x7)<<1);
87 wrmsr(MSR_IA32_THERM_CONTROL, l, h); 86 wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, l, h);
88 } 87 }
89 88
90 return 0; 89 return 0;
@@ -111,7 +110,6 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
111{ 110{
112 unsigned int newstate = DC_RESV; 111 unsigned int newstate = DC_RESV;
113 struct cpufreq_freqs freqs; 112 struct cpufreq_freqs freqs;
114 cpumask_t cpus_allowed;
115 int i; 113 int i;
116 114
117 if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate)) 115 if (cpufreq_frequency_table_target(policy, &p4clockmod_table[0], target_freq, relation, &newstate))
@@ -132,17 +130,8 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
132 /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software 130 /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software
133 * Developer's Manual, Volume 3 131 * Developer's Manual, Volume 3
134 */ 132 */
135 cpus_allowed = current->cpus_allowed; 133 for_each_cpu_mask(i, policy->cpus)
136
137 for_each_cpu_mask(i, policy->cpus) {
138 cpumask_t this_cpu = cpumask_of_cpu(i);
139
140 set_cpus_allowed(current, this_cpu);
141 BUG_ON(smp_processor_id() != i);
142
143 cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); 134 cpufreq_p4_setdc(i, p4clockmod_table[newstate].index);
144 }
145 set_cpus_allowed(current, cpus_allowed);
146 135
147 /* notifiers */ 136 /* notifiers */
148 for_each_cpu_mask(i, policy->cpus) { 137 for_each_cpu_mask(i, policy->cpus) {
@@ -256,17 +245,9 @@ static int cpufreq_p4_cpu_exit(struct cpufreq_policy *policy)
256 245
257static unsigned int cpufreq_p4_get(unsigned int cpu) 246static unsigned int cpufreq_p4_get(unsigned int cpu)
258{ 247{
259 cpumask_t cpus_allowed;
260 u32 l, h; 248 u32 l, h;
261 249
262 cpus_allowed = current->cpus_allowed; 250 rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, &l, &h);
263
264 set_cpus_allowed(current, cpumask_of_cpu(cpu));
265 BUG_ON(smp_processor_id() != cpu);
266
267 rdmsr(MSR_IA32_THERM_CONTROL, l, h);
268
269 set_cpus_allowed(current, cpus_allowed);
270 251
271 if (l & 0x10) { 252 if (l & 0x10) {
272 l = l >> 1; 253 l = l >> 1;
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index fe3b67005ebb..7cf3d207b6b3 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -661,7 +661,8 @@ static int fill_powernow_table(struct powernow_k8_data *data, struct pst_s *pst,
661 661
662 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid); 662 dprintk("cfid 0x%x, cvid 0x%x\n", data->currfid, data->currvid);
663 data->powernow_table = powernow_table; 663 data->powernow_table = powernow_table;
664 print_basics(data); 664 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu)
665 print_basics(data);
665 666
666 for (j = 0; j < data->numps; j++) 667 for (j = 0; j < data->numps; j++)
667 if ((pst[j].fid==data->currfid) && (pst[j].vid==data->currvid)) 668 if ((pst[j].fid==data->currfid) && (pst[j].vid==data->currvid))
@@ -814,7 +815,8 @@ static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data)
814 815
815 /* fill in data */ 816 /* fill in data */
816 data->numps = data->acpi_data.state_count; 817 data->numps = data->acpi_data.state_count;
817 print_basics(data); 818 if (first_cpu(cpu_core_map[data->cpu]) == data->cpu)
819 print_basics(data);
818 powernow_k8_acpi_pst_values(data, 0); 820 powernow_k8_acpi_pst_values(data, 0);
819 821
820 /* notify BIOS that we exist */ 822 /* notify BIOS that we exist */
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index 0fb2a3001ba5..95be5013c984 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -215,8 +215,10 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid);
215 215
216static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); 216static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index);
217 217
218#ifdef CONFIG_X86_POWERNOW_K8_ACPI
218static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table); 219static int fill_powernow_table_pstate(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
219static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table); 220static int fill_powernow_table_fidvid(struct powernow_k8_data *data, struct cpufreq_frequency_table *powernow_table);
221#endif
220 222
221#ifdef CONFIG_SMP 223#ifdef CONFIG_SMP
222static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) 224static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[])
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index f43b987f952b..35489fd68852 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -720,6 +720,7 @@ static int centrino_target (struct cpufreq_policy *policy,
720 cpu_set(j, set_mask); 720 cpu_set(j, set_mask);
721 721
722 set_cpus_allowed(current, set_mask); 722 set_cpus_allowed(current, set_mask);
723 preempt_disable();
723 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) { 724 if (unlikely(!cpu_isset(smp_processor_id(), set_mask))) {
724 dprintk("couldn't limit to CPUs in this domain\n"); 725 dprintk("couldn't limit to CPUs in this domain\n");
725 retval = -EAGAIN; 726 retval = -EAGAIN;
@@ -727,6 +728,7 @@ static int centrino_target (struct cpufreq_policy *policy,
727 /* We haven't started the transition yet. */ 728 /* We haven't started the transition yet. */
728 goto migrate_end; 729 goto migrate_end;
729 } 730 }
731 preempt_enable();
730 break; 732 break;
731 } 733 }
732 734
@@ -761,10 +763,13 @@ static int centrino_target (struct cpufreq_policy *policy,
761 } 763 }
762 764
763 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h); 765 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
764 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 766 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
767 preempt_enable();
765 break; 768 break;
769 }
766 770
767 cpu_set(j, covered_cpus); 771 cpu_set(j, covered_cpus);
772 preempt_enable();
768 } 773 }
769 774
770 for_each_cpu_mask(k, online_policy_cpus) { 775 for_each_cpu_mask(k, online_policy_cpus) {
@@ -796,8 +801,11 @@ static int centrino_target (struct cpufreq_policy *policy,
796 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 801 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
797 } 802 }
798 } 803 }
804 set_cpus_allowed(current, saved_mask);
805 return 0;
799 806
800migrate_end: 807migrate_end:
808 preempt_enable();
801 set_cpus_allowed(current, saved_mask); 809 set_cpus_allowed(current, saved_mask);
802 return 0; 810 return 0;
803} 811}
diff --git a/arch/x86_64/kernel/cpufreq/Kconfig b/arch/x86_64/kernel/cpufreq/Kconfig
index 40acb67fb882..c0749d2479f5 100644
--- a/arch/x86_64/kernel/cpufreq/Kconfig
+++ b/arch/x86_64/kernel/cpufreq/Kconfig
@@ -16,6 +16,9 @@ config X86_POWERNOW_K8
16 help 16 help
17 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors. 17 This adds the CPUFreq driver for mobile AMD Opteron/Athlon64 processors.
18 18
19 To compile this driver as a module, choose M here: the
20 module will be called powernow-k8.
21
19 For details, take a look at <file:Documentation/cpu-freq/>. 22 For details, take a look at <file:Documentation/cpu-freq/>.
20 23
21 If in doubt, say N. 24 If in doubt, say N.
@@ -38,6 +41,9 @@ config X86_SPEEDSTEP_CENTRINO
38 mobile CPUs. This means Intel Pentium M (Centrino) CPUs 41 mobile CPUs. This means Intel Pentium M (Centrino) CPUs
39 or 64bit enabled Intel Xeons. 42 or 64bit enabled Intel Xeons.
40 43
44 To compile this driver as a module, choose M here: the
45 module will be called speedstep-centrino.
46
41 For details, take a look at <file:Documentation/cpu-freq/>. 47 For details, take a look at <file:Documentation/cpu-freq/>.
42 48
43 If in doubt, say N. 49 If in doubt, say N.
@@ -55,6 +61,9 @@ config X86_ACPI_CPUFREQ
55 Processor Performance States. 61 Processor Performance States.
56 This driver also supports Intel Enhanced Speedstep. 62 This driver also supports Intel Enhanced Speedstep.
57 63
64 To compile this driver as a module, choose M here: the
65 module will be called acpi-cpufreq.
66
58 For details, take a look at <file:Documentation/cpu-freq/>. 67 For details, take a look at <file:Documentation/cpu-freq/>.
59 68
60 If in doubt, say N. 69 If in doubt, say N.
@@ -62,7 +71,7 @@ config X86_ACPI_CPUFREQ
62comment "shared options" 71comment "shared options"
63 72
64config X86_ACPI_CPUFREQ_PROC_INTF 73config X86_ACPI_CPUFREQ_PROC_INTF
65 bool "/proc/acpi/processor/../performance interface (deprecated)" 74 bool "/proc/acpi/processor/../performance interface (deprecated)"
66 depends on PROC_FS 75 depends on PROC_FS
67 depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K8_ACPI 76 depends on X86_ACPI_CPUFREQ || X86_SPEEDSTEP_CENTRINO_ACPI || X86_POWERNOW_K8_ACPI
68 help 77 help
@@ -86,16 +95,18 @@ config X86_P4_CLOCKMOD
86 slowdowns and noticeable latencies. Normally Speedstep should be used 95 slowdowns and noticeable latencies. Normally Speedstep should be used
87 instead. 96 instead.
88 97
98 To compile this driver as a module, choose M here: the
99 module will be called p4-clockmod.
100
89 For details, take a look at <file:Documentation/cpu-freq/>. 101 For details, take a look at <file:Documentation/cpu-freq/>.
90 102
91 Unless you are absolutely sure say N. 103 Unless you are absolutely sure say N.
92 104
93 105
94config X86_SPEEDSTEP_LIB 106config X86_SPEEDSTEP_LIB
95 tristate 107 tristate
96 default X86_P4_CLOCKMOD 108 default X86_P4_CLOCKMOD
97 109
98endif 110endif
99 111
100endmenu 112endmenu
101
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
436static ssize_t
437acpi_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
479static void acpi_cpufreq_add_file(struct acpi_processor *pr) 436static 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
16if CPU_FREQ 19if CPU_FREQ
17 20
18config CPU_FREQ_TABLE 21config CPU_FREQ_TABLE
19 tristate 22 tristate
20 23
21config CPU_FREQ_DEBUG 24config 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
34config CPU_FREQ_STAT 37config 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
42config CPU_FREQ_STAT_DETAILS 50config 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
78endchoice 88endchoice
79 89
80config CPU_FREQ_GOV_PERFORMANCE 90config 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
88config CPU_FREQ_GOV_POWERSAVE 101config 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
96config CPU_FREQ_GOV_USERSPACE 112config 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 */
1628int 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}
1656EXPORT_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 *
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 0899e2cdcdd1..3ec6e7ff5fbd 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -257,7 +257,6 @@ struct freq_attr {
257/********************************************************************* 257/*********************************************************************
258 * CPUFREQ 2.6. INTERFACE * 258 * CPUFREQ 2.6. INTERFACE *
259 *********************************************************************/ 259 *********************************************************************/
260int cpufreq_set_policy(struct cpufreq_policy *policy);
261int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); 260int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);
262int cpufreq_update_policy(unsigned int cpu); 261int cpufreq_update_policy(unsigned int cpu);
263 262