aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:18:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:18:49 -0400
commit44473d991332053eb3fea1e08f8a6ee2c6fb409c (patch)
tree3f1ace2e7e6d3917870c6c0e91ffa1899f01a326
parentbd5d435a96837c3495e62eef37cbe4cb728b79ae (diff)
parent6501faf8c1bbaa51dc493f3681df016d2ebce833 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
* git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq: [CPUFREQ] state info wrong after resume [CPUFREQ] allow use of the powersave governor as the default one [CPUFREQ] document the currently undocumented parts of the sysfs interface [CPUFREQ] expose cpufreq coordination requirements regardless of coordination mechanism
-rw-r--r--Documentation/cpu-freq/user-guide.txt14
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c1
-rw-r--r--drivers/cpufreq/Kconfig9
-rw-r--r--drivers/cpufreq/cpufreq.c29
-rw-r--r--drivers/cpufreq/cpufreq_powersave.c8
-rw-r--r--drivers/cpufreq/cpufreq_stats.c2
-rw-r--r--include/linux/cpufreq.h6
7 files changed, 60 insertions, 9 deletions
diff --git a/Documentation/cpu-freq/user-guide.txt b/Documentation/cpu-freq/user-guide.txt
index af3b925ece08..6c442d8426b5 100644
--- a/Documentation/cpu-freq/user-guide.txt
+++ b/Documentation/cpu-freq/user-guide.txt
@@ -154,6 +154,11 @@ scaling_governor, and by "echoing" the name of another
154 that some governors won't load - they only 154 that some governors won't load - they only
155 work on some specific architectures or 155 work on some specific architectures or
156 processors. 156 processors.
157
158cpuinfo_cur_freq : Current speed of the CPU, in KHz.
159
160scaling_available_frequencies : List of available frequencies, in KHz.
161
157scaling_min_freq and 162scaling_min_freq and
158scaling_max_freq show the current "policy limits" (in 163scaling_max_freq show the current "policy limits" (in
159 kHz). By echoing new values into these 164 kHz). By echoing new values into these
@@ -162,6 +167,15 @@ scaling_max_freq show the current "policy limits" (in
162 first set scaling_max_freq, then 167 first set scaling_max_freq, then
163 scaling_min_freq. 168 scaling_min_freq.
164 169
170affected_cpus : List of CPUs that require software coordination
171 of frequency.
172
173related_cpus : List of CPUs that need some sort of frequency
174 coordination, whether software or hardware.
175
176scaling_driver : Hardware driver for cpufreq.
177
178scaling_cur_freq : Current frequency of the CPU, in KHz.
165 179
166If you have selected the "userspace" governor which allows you to 180If you have selected the "userspace" governor which allows you to
167set the CPU operating frequency to a specific value, you can read out 181set the CPU operating frequency to a specific value, you can read out
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 8db8f73503b3..b0c8208df9fa 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -601,6 +601,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
601 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { 601 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
602 policy->cpus = perf->shared_cpu_map; 602 policy->cpus = perf->shared_cpu_map;
603 } 603 }
604 policy->related_cpus = perf->shared_cpu_map;
604 605
605#ifdef CONFIG_SMP 606#ifdef CONFIG_SMP
606 dmi_check_system(sw_any_bug_dmi_table); 607 dmi_check_system(sw_any_bug_dmi_table);
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig
index c159ae64eeb2..5f076aef74fa 100644
--- a/drivers/cpufreq/Kconfig
+++ b/drivers/cpufreq/Kconfig
@@ -69,6 +69,15 @@ config CPU_FREQ_DEFAULT_GOV_PERFORMANCE
69 the frequency statically to the highest frequency supported by 69 the frequency statically to the highest frequency supported by
70 the CPU. 70 the CPU.
71 71
72config CPU_FREQ_DEFAULT_GOV_POWERSAVE
73 bool "powersave"
74 depends on EMBEDDED
75 select CPU_FREQ_GOV_POWERSAVE
76 help
77 Use the CPUFreq governor 'powersave' as default. This sets
78 the frequency statically to the lowest frequency supported by
79 the CPU.
80
72config CPU_FREQ_DEFAULT_GOV_USERSPACE 81config CPU_FREQ_DEFAULT_GOV_USERSPACE
73 bool "userspace" 82 bool "userspace"
74 select CPU_FREQ_GOV_USERSPACE 83 select CPU_FREQ_GOV_USERSPACE
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index d3575f5ec6d2..7fce038fa57e 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -583,15 +583,13 @@ out:
583 i += sprintf(&buf[i], "\n"); 583 i += sprintf(&buf[i], "\n");
584 return i; 584 return i;
585} 585}
586/** 586
587 * show_affected_cpus - show the CPUs affected by each transition 587static ssize_t show_cpus(cpumask_t mask, char *buf)
588 */
589static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf)
590{ 588{
591 ssize_t i = 0; 589 ssize_t i = 0;
592 unsigned int cpu; 590 unsigned int cpu;
593 591
594 for_each_cpu_mask(cpu, policy->cpus) { 592 for_each_cpu_mask(cpu, mask) {
595 if (i) 593 if (i)
596 i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), " "); 594 i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), " ");
597 i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), "%u", cpu); 595 i += scnprintf(&buf[i], (PAGE_SIZE - i - 2), "%u", cpu);
@@ -602,6 +600,25 @@ static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf)
602 return i; 600 return i;
603} 601}
604 602
603/**
604 * show_related_cpus - show the CPUs affected by each transition even if
605 * hw coordination is in use
606 */
607static ssize_t show_related_cpus(struct cpufreq_policy *policy, char *buf)
608{
609 if (cpus_empty(policy->related_cpus))
610 return show_cpus(policy->cpus, buf);
611 return show_cpus(policy->related_cpus, buf);
612}
613
614/**
615 * show_affected_cpus - show the CPUs affected by each transition
616 */
617static ssize_t show_affected_cpus(struct cpufreq_policy *policy, char *buf)
618{
619 return show_cpus(policy->cpus, buf);
620}
621
605static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy, 622static ssize_t store_scaling_setspeed(struct cpufreq_policy *policy,
606 const char *buf, size_t count) 623 const char *buf, size_t count)
607{ 624{
@@ -646,6 +663,7 @@ define_one_ro(cpuinfo_max_freq);
646define_one_ro(scaling_available_governors); 663define_one_ro(scaling_available_governors);
647define_one_ro(scaling_driver); 664define_one_ro(scaling_driver);
648define_one_ro(scaling_cur_freq); 665define_one_ro(scaling_cur_freq);
666define_one_ro(related_cpus);
649define_one_ro(affected_cpus); 667define_one_ro(affected_cpus);
650define_one_rw(scaling_min_freq); 668define_one_rw(scaling_min_freq);
651define_one_rw(scaling_max_freq); 669define_one_rw(scaling_max_freq);
@@ -658,6 +676,7 @@ static struct attribute *default_attrs[] = {
658 &scaling_min_freq.attr, 676 &scaling_min_freq.attr,
659 &scaling_max_freq.attr, 677 &scaling_max_freq.attr,
660 &affected_cpus.attr, 678 &affected_cpus.attr,
679 &related_cpus.attr,
661 &scaling_governor.attr, 680 &scaling_governor.attr,
662 &scaling_driver.attr, 681 &scaling_driver.attr,
663 &scaling_available_governors.attr, 682 &scaling_available_governors.attr,
diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c
index 13fe06b94b0a..88d2f44fba48 100644
--- a/drivers/cpufreq/cpufreq_powersave.c
+++ b/drivers/cpufreq/cpufreq_powersave.c
@@ -35,12 +35,12 @@ static int cpufreq_governor_powersave(struct cpufreq_policy *policy,
35 return 0; 35 return 0;
36} 36}
37 37
38static struct cpufreq_governor cpufreq_gov_powersave = { 38struct cpufreq_governor cpufreq_gov_powersave = {
39 .name = "powersave", 39 .name = "powersave",
40 .governor = cpufreq_governor_powersave, 40 .governor = cpufreq_governor_powersave,
41 .owner = THIS_MODULE, 41 .owner = THIS_MODULE,
42}; 42};
43 43EXPORT_SYMBOL(cpufreq_gov_powersave);
44 44
45static int __init cpufreq_gov_powersave_init(void) 45static int __init cpufreq_gov_powersave_init(void)
46{ 46{
@@ -58,5 +58,9 @@ MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
58MODULE_DESCRIPTION("CPUfreq policy governor 'powersave'"); 58MODULE_DESCRIPTION("CPUfreq policy governor 'powersave'");
59MODULE_LICENSE("GPL"); 59MODULE_LICENSE("GPL");
60 60
61#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
62fs_initcall(cpufreq_gov_powersave_init);
63#else
61module_init(cpufreq_gov_powersave_init); 64module_init(cpufreq_gov_powersave_init);
65#endif
62module_exit(cpufreq_gov_powersave_exit); 66module_exit(cpufreq_gov_powersave_exit);
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index ef09e069433b..ae70d63a8b26 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -288,7 +288,7 @@ cpufreq_stat_notifier_trans (struct notifier_block *nb, unsigned long val,
288 if (!stat) 288 if (!stat)
289 return 0; 289 return 0;
290 290
291 old_index = freq_table_get_index(stat, freq->old); 291 old_index = stat->last_index;
292 new_index = freq_table_get_index(stat, freq->new); 292 new_index = freq_table_get_index(stat, freq->new);
293 293
294 cpufreq_stats_update(freq->cpu); 294 cpufreq_stats_update(freq->cpu);
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index ddd8652fc3f3..e7e91dbfde0f 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -83,7 +83,8 @@ struct cpufreq_real_policy {
83}; 83};
84 84
85struct cpufreq_policy { 85struct cpufreq_policy {
86 cpumask_t cpus; /* affected CPUs */ 86 cpumask_t cpus; /* CPUs requiring sw coordination */
87 cpumask_t related_cpus; /* CPUs with any coordination */
87 unsigned int shared_type; /* ANY or ALL affected CPUs 88 unsigned int shared_type; /* ANY or ALL affected CPUs
88 should set cpufreq */ 89 should set cpufreq */
89 unsigned int cpu; /* cpu nr of registered CPU */ 90 unsigned int cpu; /* cpu nr of registered CPU */
@@ -307,6 +308,9 @@ extern struct cpufreq_governor cpufreq_gov_performance;
307#endif 308#endif
308#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE 309#ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE
309#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) 310#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance)
311#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE)
312extern struct cpufreq_governor cpufreq_gov_powersave;
313#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_powersave)
310#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) 314#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE)
311extern struct cpufreq_governor cpufreq_gov_userspace; 315extern struct cpufreq_governor cpufreq_gov_userspace;
312#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace) 316#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace)