diff options
31 files changed, 119 insertions, 86 deletions
diff --git a/arch/arm/mach-imx/cpufreq.c b/arch/arm/mach-imx/cpufreq.c index 467d899fbe75..e548ba74a4d2 100644 --- a/arch/arm/mach-imx/cpufreq.c +++ b/arch/arm/mach-imx/cpufreq.c | |||
| @@ -269,7 +269,6 @@ static int __init imx_cpufreq_driver_init(struct cpufreq_policy *policy) | |||
| 269 | return -EINVAL; | 269 | return -EINVAL; |
| 270 | 270 | ||
| 271 | policy->cur = policy->min = policy->max = imx_get_speed(0); | 271 | policy->cur = policy->min = policy->max = imx_get_speed(0); |
| 272 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 273 | policy->cpuinfo.min_freq = 8000; | 272 | policy->cpuinfo.min_freq = 8000; |
| 274 | policy->cpuinfo.max_freq = 200000; | 273 | policy->cpuinfo.max_freq = 200000; |
| 275 | /* Manual states, that PLL stabilizes in two CLK32 periods */ | 274 | /* Manual states, that PLL stabilizes in two CLK32 periods */ |
diff --git a/arch/arm/mach-sa1100/cpu-sa1110.c b/arch/arm/mach-sa1100/cpu-sa1110.c index 78f4c1346044..36b47ff5af11 100644 --- a/arch/arm/mach-sa1100/cpu-sa1110.c +++ b/arch/arm/mach-sa1100/cpu-sa1110.c | |||
| @@ -331,7 +331,6 @@ static int __init sa1110_cpu_init(struct cpufreq_policy *policy) | |||
| 331 | if (policy->cpu != 0) | 331 | if (policy->cpu != 0) |
| 332 | return -EINVAL; | 332 | return -EINVAL; |
| 333 | policy->cur = policy->min = policy->max = sa11x0_getspeed(0); | 333 | policy->cur = policy->min = policy->max = sa11x0_getspeed(0); |
| 334 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 335 | policy->cpuinfo.min_freq = 59000; | 334 | policy->cpuinfo.min_freq = 59000; |
| 336 | policy->cpuinfo.max_freq = 287000; | 335 | policy->cpuinfo.max_freq = 287000; |
| 337 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 336 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c index a0c71dca2373..c0d63b0c61c9 100644 --- a/arch/arm/plat-omap/cpu-omap.c +++ b/arch/arm/plat-omap/cpu-omap.c | |||
| @@ -108,7 +108,6 @@ static int __init omap_cpu_init(struct cpufreq_policy *policy) | |||
| 108 | if (policy->cpu != 0) | 108 | if (policy->cpu != 0) |
| 109 | return -EINVAL; | 109 | return -EINVAL; |
| 110 | policy->cur = policy->min = policy->max = omap_getspeed(0); | 110 | policy->cur = policy->min = policy->max = omap_getspeed(0); |
| 111 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 112 | policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000; | 111 | policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000; |
| 113 | policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, VERY_HI_RATE) / 1000; | 112 | policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, VERY_HI_RATE) / 1000; |
| 114 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 113 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
diff --git a/arch/blackfin/mach-bf533/cpu.c b/arch/blackfin/mach-bf533/cpu.c index 6fd9cfd0a31b..b7a0e0fbd9af 100644 --- a/arch/blackfin/mach-bf533/cpu.c +++ b/arch/blackfin/mach-bf533/cpu.c | |||
| @@ -118,8 +118,6 @@ static int __init __bf533_cpu_init(struct cpufreq_policy *policy) | |||
| 118 | if (policy->cpu != 0) | 118 | if (policy->cpu != 0) |
| 119 | return -EINVAL; | 119 | return -EINVAL; |
| 120 | 120 | ||
| 121 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 122 | |||
| 123 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 121 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
| 124 | /*Now ,only support one cpu */ | 122 | /*Now ,only support one cpu */ |
| 125 | policy->cur = bf533_getfreq(0); | 123 | policy->cur = bf533_getfreq(0); |
diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c index 8c6ec7070844..b8498ea62068 100644 --- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c +++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c | |||
| @@ -321,8 +321,6 @@ acpi_cpufreq_cpu_init ( | |||
| 321 | data->acpi_data.states[i].transition_latency * 1000; | 321 | data->acpi_data.states[i].transition_latency * 1000; |
| 322 | } | 322 | } |
| 323 | } | 323 | } |
| 324 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 325 | |||
| 326 | policy->cur = processor_get_freq(data, policy->cpu); | 324 | policy->cur = processor_get_freq(data, policy->cpu); |
| 327 | 325 | ||
| 328 | /* table init */ | 326 | /* table init */ |
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c index 901236fa0f07..5123e9d4164b 100644 --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c | |||
| @@ -107,8 +107,6 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 107 | pr_debug("%d: %d\n", i, cbe_freqs[i].frequency); | 107 | pr_debug("%d: %d\n", i, cbe_freqs[i].frequency); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 111 | |||
| 112 | /* if DEBUG is enabled set_pmode() measures the latency | 110 | /* if DEBUG is enabled set_pmode() measures the latency |
| 113 | * of a transition */ | 111 | * of a transition */ |
| 114 | policy->cpuinfo.transition_latency = 25000; | 112 | policy->cpuinfo.transition_latency = 25000; |
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c index 3ae083851b01..1cfb8b0c8fec 100644 --- a/arch/powerpc/platforms/pasemi/cpufreq.c +++ b/arch/powerpc/platforms/pasemi/cpufreq.c | |||
| @@ -195,8 +195,6 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 195 | pr_debug("%d: %d\n", i, pas_freqs[i].frequency); | 195 | pr_debug("%d: %d\n", i, pas_freqs[i].frequency); |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 199 | |||
| 200 | policy->cpuinfo.transition_latency = get_gizmo_latency(); | 198 | policy->cpuinfo.transition_latency = get_gizmo_latency(); |
| 201 | 199 | ||
| 202 | cur_astate = get_cur_astate(policy->cpu); | 200 | cur_astate = get_cur_astate(policy->cpu); |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c index 1fe35dab0e9e..c04abcc28a7a 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_32.c +++ b/arch/powerpc/platforms/powermac/cpufreq_32.c | |||
| @@ -410,7 +410,6 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 410 | if (policy->cpu != 0) | 410 | if (policy->cpu != 0) |
| 411 | return -ENODEV; | 411 | return -ENODEV; |
| 412 | 412 | ||
| 413 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 414 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 413 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
| 415 | policy->cur = cur_freq; | 414 | policy->cur = cur_freq; |
| 416 | 415 | ||
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c index 00f50298c342..4dfb4bc242b5 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_64.c +++ b/arch/powerpc/platforms/powermac/cpufreq_64.c | |||
| @@ -357,7 +357,6 @@ static unsigned int g5_cpufreq_get_speed(unsigned int cpu) | |||
| 357 | 357 | ||
| 358 | static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy) | 358 | static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy) |
| 359 | { | 359 | { |
| 360 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 361 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 360 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
| 362 | policy->cur = g5_cpu_freqs[g5_query_freq()].frequency; | 361 | policy->cur = g5_cpu_freqs[g5_query_freq()].frequency; |
| 363 | /* secondary CPUs are tied to the primary one by the | 362 | /* secondary CPUs are tied to the primary one by the |
diff --git a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c index e61890217c50..71d1c427b907 100644 --- a/arch/sh/kernel/cpufreq.c +++ b/arch/sh/kernel/cpufreq.c | |||
| @@ -93,7 +93,6 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 93 | policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; | 93 | policy->cpuinfo.max_freq = (clk_round_rate(cpuclk, ~0UL) + 500) / 1000; |
| 94 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 94 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
| 95 | 95 | ||
| 96 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 97 | policy->cur = sh_cpufreq_get(policy->cpu); | 96 | policy->cur = sh_cpufreq_get(policy->cpu); |
| 98 | policy->min = policy->cpuinfo.min_freq; | 97 | policy->min = policy->cpuinfo.min_freq; |
| 99 | policy->max = policy->cpuinfo.max_freq; | 98 | policy->max = policy->cpuinfo.max_freq; |
diff --git a/arch/sparc64/kernel/us2e_cpufreq.c b/arch/sparc64/kernel/us2e_cpufreq.c index 1f83fe6a82d6..791c15138f3a 100644 --- a/arch/sparc64/kernel/us2e_cpufreq.c +++ b/arch/sparc64/kernel/us2e_cpufreq.c | |||
| @@ -326,7 +326,6 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy) | |||
| 326 | table[2].index = 5; | 326 | table[2].index = 5; |
| 327 | table[3].frequency = CPUFREQ_TABLE_END; | 327 | table[3].frequency = CPUFREQ_TABLE_END; |
| 328 | 328 | ||
| 329 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 330 | policy->cpuinfo.transition_latency = 0; | 329 | policy->cpuinfo.transition_latency = 0; |
| 331 | policy->cur = clock_tick; | 330 | policy->cur = clock_tick; |
| 332 | 331 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c index b6434a7ef8b2..ffd01e5dcb52 100644 --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c | |||
| @@ -646,7 +646,6 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
| 646 | policy->cpuinfo.transition_latency = | 646 | policy->cpuinfo.transition_latency = |
| 647 | perf->states[i].transition_latency * 1000; | 647 | perf->states[i].transition_latency * 1000; |
| 648 | } | 648 | } |
| 649 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 650 | 649 | ||
| 651 | data->max_freq = perf->states[0].core_frequency * 1000; | 650 | data->max_freq = perf->states[0].core_frequency * 1000; |
| 652 | /* table init */ | 651 | /* table init */ |
diff --git a/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c index 66acd5039918..32f0bda3fc95 100644 --- a/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c +++ b/arch/x86/kernel/cpu/cpufreq/cpufreq-nforce2.c | |||
| @@ -363,7 +363,6 @@ static int nforce2_cpu_init(struct cpufreq_policy *policy) | |||
| 363 | policy->cur = nforce2_get(policy->cpu); | 363 | policy->cur = nforce2_get(policy->cpu); |
| 364 | policy->min = policy->cpuinfo.min_freq; | 364 | policy->min = policy->cpuinfo.min_freq; |
| 365 | policy->max = policy->cpuinfo.max_freq; | 365 | policy->max = policy->cpuinfo.max_freq; |
| 366 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 367 | 366 | ||
| 368 | return 0; | 367 | return 0; |
| 369 | } | 368 | } |
diff --git a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c index f43d98e11cc7..c11baaf9f2b4 100644 --- a/arch/x86/kernel/cpu/cpufreq/e_powersaver.c +++ b/arch/x86/kernel/cpu/cpufreq/e_powersaver.c | |||
| @@ -253,7 +253,6 @@ static int eps_cpu_init(struct cpufreq_policy *policy) | |||
| 253 | f_table[k].frequency = CPUFREQ_TABLE_END; | 253 | f_table[k].frequency = CPUFREQ_TABLE_END; |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 257 | policy->cpuinfo.transition_latency = 140000; /* 844mV -> 700mV in ns */ | 256 | policy->cpuinfo.transition_latency = 140000; /* 844mV -> 700mV in ns */ |
| 258 | policy->cur = fsb * current_multiplier; | 257 | policy->cur = fsb * current_multiplier; |
| 259 | 258 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/elanfreq.c b/arch/x86/kernel/cpu/cpufreq/elanfreq.c index f317276afa7a..1e7ae7dafcf6 100644 --- a/arch/x86/kernel/cpu/cpufreq/elanfreq.c +++ b/arch/x86/kernel/cpu/cpufreq/elanfreq.c | |||
| @@ -219,7 +219,6 @@ static int elanfreq_cpu_init(struct cpufreq_policy *policy) | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | /* cpuinfo and default policy values */ | 221 | /* cpuinfo and default policy values */ |
| 222 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 223 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 222 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
| 224 | policy->cur = elanfreq_get_cpu_frequency(0); | 223 | policy->cur = elanfreq_get_cpu_frequency(0); |
| 225 | 224 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c b/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c index 461dabc4e495..ed2bda127c44 100644 --- a/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c +++ b/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c | |||
| @@ -420,7 +420,6 @@ static int cpufreq_gx_cpu_init(struct cpufreq_policy *policy) | |||
| 420 | policy->min = maxfreq / POLICY_MIN_DIV; | 420 | policy->min = maxfreq / POLICY_MIN_DIV; |
| 421 | policy->max = maxfreq; | 421 | policy->max = maxfreq; |
| 422 | policy->cur = curfreq; | 422 | policy->cur = curfreq; |
| 423 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 424 | policy->cpuinfo.min_freq = maxfreq / max_duration; | 423 | policy->cpuinfo.min_freq = maxfreq / max_duration; |
| 425 | policy->cpuinfo.max_freq = maxfreq; | 424 | policy->cpuinfo.max_freq = maxfreq; |
| 426 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 425 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c index f0cce3c2dc3a..5045f5d583c8 100644 --- a/arch/x86/kernel/cpu/cpufreq/longhaul.c +++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c | |||
| @@ -710,6 +710,10 @@ static int enable_arbiter_disable(void) | |||
| 710 | reg = 0x78; | 710 | reg = 0x78; |
| 711 | dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, | 711 | dev = pci_get_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8601_0, |
| 712 | NULL); | 712 | NULL); |
| 713 | /* Find PM133/VT8605 host bridge */ | ||
| 714 | if (dev == NULL) | ||
| 715 | dev = pci_get_device(PCI_VENDOR_ID_VIA, | ||
| 716 | PCI_DEVICE_ID_VIA_8605_0, NULL); | ||
| 713 | /* Find CLE266 host bridge */ | 717 | /* Find CLE266 host bridge */ |
| 714 | if (dev == NULL) { | 718 | if (dev == NULL) { |
| 715 | reg = 0x76; | 719 | reg = 0x76; |
| @@ -918,7 +922,6 @@ static int __init longhaul_cpu_init(struct cpufreq_policy *policy) | |||
| 918 | if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0)) | 922 | if ((longhaul_version != TYPE_LONGHAUL_V1) && (scale_voltage != 0)) |
| 919 | longhaul_setup_voltagescaling(); | 923 | longhaul_setup_voltagescaling(); |
| 920 | 924 | ||
| 921 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 922 | policy->cpuinfo.transition_latency = 200000; /* nsec */ | 925 | policy->cpuinfo.transition_latency = 200000; /* nsec */ |
| 923 | policy->cur = calc_speed(longhaul_get_cpu_mult()); | 926 | policy->cur = calc_speed(longhaul_get_cpu_mult()); |
| 924 | 927 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c index 4c76b511e194..8eb414b906d2 100644 --- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c +++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c | |||
| @@ -229,7 +229,6 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy) | |||
| 229 | cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu); | 229 | cpufreq_frequency_table_get_attr(p4clockmod_table, policy->cpu); |
| 230 | 230 | ||
| 231 | /* cpuinfo and default policy values */ | 231 | /* cpuinfo and default policy values */ |
| 232 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 233 | policy->cpuinfo.transition_latency = 1000000; /* assumed */ | 232 | policy->cpuinfo.transition_latency = 1000000; /* assumed */ |
| 234 | policy->cur = stock_freq; | 233 | policy->cur = stock_freq; |
| 235 | 234 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c index f89524051e4a..6d0285339317 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c | |||
| @@ -160,7 +160,6 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy) | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | /* cpuinfo and default policy values */ | 162 | /* cpuinfo and default policy values */ |
| 163 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 164 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 163 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
| 165 | policy->cur = busfreq * max_multiplier; | 164 | policy->cur = busfreq * max_multiplier; |
| 166 | 165 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c index ca3e1d341889..7decd6a50ffa 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c | |||
| @@ -637,8 +637,6 @@ static int __init powernow_cpu_init (struct cpufreq_policy *policy) | |||
| 637 | printk (KERN_INFO PFX "Minimum speed %d MHz. Maximum speed %d MHz.\n", | 637 | printk (KERN_INFO PFX "Minimum speed %d MHz. Maximum speed %d MHz.\n", |
| 638 | minimum_speed/1000, maximum_speed/1000); | 638 | minimum_speed/1000, maximum_speed/1000); |
| 639 | 639 | ||
| 640 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 641 | |||
| 642 | policy->cpuinfo.transition_latency = cpufreq_scale(2000000UL, fsb, latency); | 640 | policy->cpuinfo.transition_latency = cpufreq_scale(2000000UL, fsb, latency); |
| 643 | 641 | ||
| 644 | policy->cur = powernow_get(0); | 642 | policy->cur = powernow_get(0); |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index 34ed53a06730..b273b69cfddf 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
| @@ -76,7 +76,10 @@ static u32 find_khz_freq_from_fid(u32 fid) | |||
| 76 | /* Return a frequency in MHz, given an input fid and did */ | 76 | /* Return a frequency in MHz, given an input fid and did */ |
| 77 | static u32 find_freq_from_fiddid(u32 fid, u32 did) | 77 | static u32 find_freq_from_fiddid(u32 fid, u32 did) |
| 78 | { | 78 | { |
| 79 | return 100 * (fid + 0x10) >> did; | 79 | if (current_cpu_data.x86 == 0x10) |
| 80 | return 100 * (fid + 0x10) >> did; | ||
| 81 | else | ||
| 82 | return 100 * (fid + 0x8) >> did; | ||
| 80 | } | 83 | } |
| 81 | 84 | ||
| 82 | static u32 find_khz_freq_from_fiddid(u32 fid, u32 did) | 85 | static u32 find_khz_freq_from_fiddid(u32 fid, u32 did) |
| @@ -1208,7 +1211,6 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
| 1208 | /* run on any CPU again */ | 1211 | /* run on any CPU again */ |
| 1209 | set_cpus_allowed(current, oldmask); | 1212 | set_cpus_allowed(current, oldmask); |
| 1210 | 1213 | ||
| 1211 | pol->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 1212 | if (cpu_family == CPU_HW_PSTATE) | 1214 | if (cpu_family == CPU_HW_PSTATE) |
| 1213 | pol->cpus = cpumask_of_cpu(pol->cpu); | 1215 | pol->cpus = cpumask_of_cpu(pol->cpu); |
| 1214 | else | 1216 | else |
| @@ -1325,21 +1327,16 @@ static struct cpufreq_driver cpufreq_amd64_driver = { | |||
| 1325 | static int __cpuinit powernowk8_init(void) | 1327 | static int __cpuinit powernowk8_init(void) |
| 1326 | { | 1328 | { |
| 1327 | unsigned int i, supported_cpus = 0; | 1329 | unsigned int i, supported_cpus = 0; |
| 1328 | unsigned int booted_cores = 1; | ||
| 1329 | 1330 | ||
| 1330 | for_each_online_cpu(i) { | 1331 | for_each_online_cpu(i) { |
| 1331 | if (check_supported_cpu(i)) | 1332 | if (check_supported_cpu(i)) |
| 1332 | supported_cpus++; | 1333 | supported_cpus++; |
| 1333 | } | 1334 | } |
| 1334 | 1335 | ||
| 1335 | #ifdef CONFIG_SMP | ||
| 1336 | booted_cores = cpu_data[0].booted_cores; | ||
| 1337 | #endif | ||
| 1338 | |||
| 1339 | if (supported_cpus == num_online_cpus()) { | 1336 | if (supported_cpus == num_online_cpus()) { |
| 1340 | printk(KERN_INFO PFX "Found %d %s " | 1337 | printk(KERN_INFO PFX "Found %d %s " |
| 1341 | "processors (%d cpu cores) (" VERSION ")\n", | 1338 | "processors (%d cpu cores) (" VERSION ")\n", |
| 1342 | supported_cpus/booted_cores, | 1339 | num_online_nodes(), |
| 1343 | boot_cpu_data.x86_model_id, supported_cpus); | 1340 | boot_cpu_data.x86_model_id, supported_cpus); |
| 1344 | return cpufreq_register_driver(&cpufreq_amd64_driver); | 1341 | return cpufreq_register_driver(&cpufreq_amd64_driver); |
| 1345 | } | 1342 | } |
diff --git a/arch/x86/kernel/cpu/cpufreq/sc520_freq.c b/arch/x86/kernel/cpu/cpufreq/sc520_freq.c index b8fb4b521c62..d9f3e90a7ae0 100644 --- a/arch/x86/kernel/cpu/cpufreq/sc520_freq.c +++ b/arch/x86/kernel/cpu/cpufreq/sc520_freq.c | |||
| @@ -111,7 +111,6 @@ static int sc520_freq_cpu_init(struct cpufreq_policy *policy) | |||
| 111 | return -ENODEV; | 111 | return -ENODEV; |
| 112 | 112 | ||
| 113 | /* cpuinfo and default policy values */ | 113 | /* cpuinfo and default policy values */ |
| 114 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 115 | policy->cpuinfo.transition_latency = 1000000; /* 1ms */ | 114 | policy->cpuinfo.transition_latency = 1000000; /* 1ms */ |
| 116 | policy->cur = sc520_freq_get_cpu_frequency(0); | 115 | policy->cur = sc520_freq_get_cpu_frequency(0); |
| 117 | 116 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c index 6c5dc2c85aeb..811d47438546 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c | |||
| @@ -393,7 +393,6 @@ static int centrino_cpu_init(struct cpufreq_policy *policy) | |||
| 393 | 393 | ||
| 394 | freq = get_cur_freq(policy->cpu); | 394 | freq = get_cur_freq(policy->cpu); |
| 395 | 395 | ||
| 396 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 397 | policy->cpuinfo.transition_latency = 10000; /* 10uS transition latency */ | 396 | policy->cpuinfo.transition_latency = 10000; /* 10uS transition latency */ |
| 398 | policy->cur = freq; | 397 | policy->cur = freq; |
| 399 | 398 | ||
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c index a5b2346faf1f..36685e8f7be1 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c | |||
| @@ -348,7 +348,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
| 348 | (speed / 1000)); | 348 | (speed / 1000)); |
| 349 | 349 | ||
| 350 | /* cpuinfo and default policy values */ | 350 | /* cpuinfo and default policy values */ |
| 351 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 352 | policy->cur = speed; | 351 | policy->cur = speed; |
| 353 | 352 | ||
| 354 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); | 353 | result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); |
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c index e1c509aa3054..f2b5a621d27b 100644 --- a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c | |||
| @@ -290,7 +290,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) | |||
| 290 | (speed / 1000)); | 290 | (speed / 1000)); |
| 291 | 291 | ||
| 292 | /* cpuinfo and default policy values */ | 292 | /* cpuinfo and default policy values */ |
| 293 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 294 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 293 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
| 295 | policy->cur = speed; | 294 | policy->cur = speed; |
| 296 | 295 | ||
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 993fa7b89253..721f86f4f008 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
| @@ -56,10 +56,6 @@ config CPU_FREQ_STAT_DETAILS | |||
| 56 | 56 | ||
| 57 | If in doubt, say N. | 57 | If in doubt, say N. |
| 58 | 58 | ||
| 59 | # Note that it is not currently possible to set the other governors (such as ondemand) | ||
| 60 | # as the default, since if they fail to initialise, cpufreq will be | ||
| 61 | # left in an undefined state. | ||
| 62 | |||
| 63 | choice | 59 | choice |
| 64 | prompt "Default CPUFreq governor" | 60 | prompt "Default CPUFreq governor" |
| 65 | default CPU_FREQ_DEFAULT_GOV_USERSPACE if CPU_FREQ_SA1100 || CPU_FREQ_SA1110 | 61 | default CPU_FREQ_DEFAULT_GOV_USERSPACE if CPU_FREQ_SA1100 || CPU_FREQ_SA1110 |
| @@ -85,6 +81,29 @@ config CPU_FREQ_DEFAULT_GOV_USERSPACE | |||
| 85 | program shall be able to set the CPU dynamically without having | 81 | program shall be able to set the CPU dynamically without having |
| 86 | to enable the userspace governor manually. | 82 | to enable the userspace governor manually. |
| 87 | 83 | ||
| 84 | config CPU_FREQ_DEFAULT_GOV_ONDEMAND | ||
| 85 | bool "ondemand" | ||
| 86 | select CPU_FREQ_GOV_ONDEMAND | ||
| 87 | select CPU_FREQ_GOV_PERFORMANCE | ||
| 88 | help | ||
| 89 | Use the CPUFreq governor 'ondemand' as default. This allows | ||
| 90 | you to get a full dynamic frequency capable system by simply | ||
| 91 | loading your cpufreq low-level hardware driver. | ||
| 92 | Be aware that not all cpufreq drivers support the ondemand | ||
| 93 | governor. If unsure have a look at the help section of the | ||
| 94 | driver. Fallback governor will be the performance governor. | ||
| 95 | |||
| 96 | config CPU_FREQ_DEFAULT_GOV_CONSERVATIVE | ||
| 97 | bool "conservative" | ||
| 98 | select CPU_FREQ_GOV_CONSERVATIVE | ||
| 99 | select CPU_FREQ_GOV_PERFORMANCE | ||
| 100 | help | ||
| 101 | Use the CPUFreq governor 'conservative' as default. This allows | ||
| 102 | you to get a full dynamic frequency capable system by simply | ||
| 103 | loading your cpufreq low-level hardware driver. | ||
| 104 | Be aware that not all cpufreq drivers support the conservative | ||
| 105 | governor. If unsure have a look at the help section of the | ||
| 106 | driver. Fallback governor will be the performance governor. | ||
| 88 | endchoice | 107 | endchoice |
| 89 | 108 | ||
| 90 | config CPU_FREQ_GOV_PERFORMANCE | 109 | config CPU_FREQ_GOV_PERFORMANCE |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 2f6a73c01b71..f7b9d6fce123 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
| @@ -763,6 +763,8 @@ static int cpufreq_add_dev (struct sys_device * sys_dev) | |||
| 763 | init_completion(&policy->kobj_unregister); | 763 | init_completion(&policy->kobj_unregister); |
| 764 | INIT_WORK(&policy->update, handle_update); | 764 | INIT_WORK(&policy->update, handle_update); |
| 765 | 765 | ||
| 766 | /* Set governor before ->init, so that driver could check it */ | ||
| 767 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
| 766 | /* call driver. From then on the cpufreq must be able | 768 | /* call driver. From then on the cpufreq must be able |
| 767 | * to accept all calls to ->verify and ->setpolicy for this CPU | 769 | * to accept all calls to ->verify and ->setpolicy for this CPU |
| 768 | */ | 770 | */ |
| @@ -1109,12 +1111,7 @@ unsigned int cpufreq_quick_get(unsigned int cpu) | |||
| 1109 | unsigned int ret_freq = 0; | 1111 | unsigned int ret_freq = 0; |
| 1110 | 1112 | ||
| 1111 | if (policy) { | 1113 | if (policy) { |
| 1112 | if (unlikely(lock_policy_rwsem_read(cpu))) | ||
| 1113 | return ret_freq; | ||
| 1114 | |||
| 1115 | ret_freq = policy->cur; | 1114 | ret_freq = policy->cur; |
| 1116 | |||
| 1117 | unlock_policy_rwsem_read(cpu); | ||
| 1118 | cpufreq_cpu_put(policy); | 1115 | cpufreq_cpu_put(policy); |
| 1119 | } | 1116 | } |
| 1120 | 1117 | ||
| @@ -1483,6 +1480,31 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, | |||
| 1483 | { | 1480 | { |
| 1484 | int ret; | 1481 | int ret; |
| 1485 | 1482 | ||
| 1483 | /* Only must be defined when default governor is known to have latency | ||
| 1484 | restrictions, like e.g. conservative or ondemand. | ||
| 1485 | That this is the case is already ensured in Kconfig | ||
| 1486 | */ | ||
| 1487 | #ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE | ||
| 1488 | struct cpufreq_governor *gov = &cpufreq_gov_performance; | ||
| 1489 | #else | ||
| 1490 | struct cpufreq_governor *gov = NULL; | ||
| 1491 | #endif | ||
| 1492 | |||
| 1493 | if (policy->governor->max_transition_latency && | ||
| 1494 | policy->cpuinfo.transition_latency > | ||
| 1495 | policy->governor->max_transition_latency) { | ||
| 1496 | if (!gov) | ||
| 1497 | return -EINVAL; | ||
| 1498 | else { | ||
| 1499 | printk(KERN_WARNING "%s governor failed, too long" | ||
| 1500 | " transition latency of HW, fallback" | ||
| 1501 | " to %s governor\n", | ||
| 1502 | policy->governor->name, | ||
| 1503 | gov->name); | ||
| 1504 | policy->governor = gov; | ||
| 1505 | } | ||
| 1506 | } | ||
| 1507 | |||
| 1486 | if (!try_module_get(policy->governor->owner)) | 1508 | if (!try_module_get(policy->governor->owner)) |
| 1487 | return -EINVAL; | 1509 | return -EINVAL; |
| 1488 | 1510 | ||
| @@ -1703,7 +1725,7 @@ int cpufreq_update_policy(unsigned int cpu) | |||
| 1703 | } | 1725 | } |
| 1704 | EXPORT_SYMBOL(cpufreq_update_policy); | 1726 | EXPORT_SYMBOL(cpufreq_update_policy); |
| 1705 | 1727 | ||
| 1706 | static int cpufreq_cpu_callback(struct notifier_block *nfb, | 1728 | static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb, |
| 1707 | unsigned long action, void *hcpu) | 1729 | unsigned long action, void *hcpu) |
| 1708 | { | 1730 | { |
| 1709 | unsigned int cpu = (unsigned long)hcpu; | 1731 | unsigned int cpu = (unsigned long)hcpu; |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 26f440ccc3fb..4bd33ce8a6f3 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
| @@ -58,7 +58,7 @@ static unsigned int def_sampling_rate; | |||
| 58 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) | 58 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
| 59 | #define DEF_SAMPLING_DOWN_FACTOR (1) | 59 | #define DEF_SAMPLING_DOWN_FACTOR (1) |
| 60 | #define MAX_SAMPLING_DOWN_FACTOR (10) | 60 | #define MAX_SAMPLING_DOWN_FACTOR (10) |
| 61 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) | 61 | #define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000) |
| 62 | 62 | ||
| 63 | static void do_dbs_timer(struct work_struct *work); | 63 | static void do_dbs_timer(struct work_struct *work); |
| 64 | 64 | ||
| @@ -466,9 +466,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 466 | (!policy->cur)) | 466 | (!policy->cur)) |
| 467 | return -EINVAL; | 467 | return -EINVAL; |
| 468 | 468 | ||
| 469 | if (policy->cpuinfo.transition_latency > | ||
| 470 | (TRANSITION_LATENCY_LIMIT * 1000)) | ||
| 471 | return -EINVAL; | ||
| 472 | if (this_dbs_info->enable) /* Already enabled */ | 469 | if (this_dbs_info->enable) /* Already enabled */ |
| 473 | break; | 470 | break; |
| 474 | 471 | ||
| @@ -551,15 +548,17 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 551 | return 0; | 548 | return 0; |
| 552 | } | 549 | } |
| 553 | 550 | ||
| 554 | static struct cpufreq_governor cpufreq_gov_dbs = { | 551 | struct cpufreq_governor cpufreq_gov_conservative = { |
| 555 | .name = "conservative", | 552 | .name = "conservative", |
| 556 | .governor = cpufreq_governor_dbs, | 553 | .governor = cpufreq_governor_dbs, |
| 557 | .owner = THIS_MODULE, | 554 | .max_transition_latency = TRANSITION_LATENCY_LIMIT, |
| 555 | .owner = THIS_MODULE, | ||
| 558 | }; | 556 | }; |
| 557 | EXPORT_SYMBOL(cpufreq_gov_conservative); | ||
| 559 | 558 | ||
| 560 | static int __init cpufreq_gov_dbs_init(void) | 559 | static int __init cpufreq_gov_dbs_init(void) |
| 561 | { | 560 | { |
| 562 | return cpufreq_register_governor(&cpufreq_gov_dbs); | 561 | return cpufreq_register_governor(&cpufreq_gov_conservative); |
| 563 | } | 562 | } |
| 564 | 563 | ||
| 565 | static void __exit cpufreq_gov_dbs_exit(void) | 564 | static void __exit cpufreq_gov_dbs_exit(void) |
| @@ -567,7 +566,7 @@ static void __exit cpufreq_gov_dbs_exit(void) | |||
| 567 | /* Make sure that the scheduled work is indeed not running */ | 566 | /* Make sure that the scheduled work is indeed not running */ |
| 568 | flush_scheduled_work(); | 567 | flush_scheduled_work(); |
| 569 | 568 | ||
| 570 | cpufreq_unregister_governor(&cpufreq_gov_dbs); | 569 | cpufreq_unregister_governor(&cpufreq_gov_conservative); |
| 571 | } | 570 | } |
| 572 | 571 | ||
| 573 | 572 | ||
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index e794527e4925..369f44595150 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
| @@ -47,7 +47,7 @@ static unsigned int def_sampling_rate; | |||
| 47 | (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) | 47 | (def_sampling_rate / MIN_SAMPLING_RATE_RATIO) |
| 48 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) | 48 | #define MAX_SAMPLING_RATE (500 * def_sampling_rate) |
| 49 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) | 49 | #define DEF_SAMPLING_RATE_LATENCY_MULTIPLIER (1000) |
| 50 | #define TRANSITION_LATENCY_LIMIT (10 * 1000) | 50 | #define TRANSITION_LATENCY_LIMIT (10 * 1000 * 1000) |
| 51 | 51 | ||
| 52 | static void do_dbs_timer(struct work_struct *work); | 52 | static void do_dbs_timer(struct work_struct *work); |
| 53 | 53 | ||
| @@ -508,12 +508,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 508 | if ((!cpu_online(cpu)) || (!policy->cur)) | 508 | if ((!cpu_online(cpu)) || (!policy->cur)) |
| 509 | return -EINVAL; | 509 | return -EINVAL; |
| 510 | 510 | ||
| 511 | if (policy->cpuinfo.transition_latency > | ||
| 512 | (TRANSITION_LATENCY_LIMIT * 1000)) { | ||
| 513 | printk(KERN_WARNING "ondemand governor failed to load " | ||
| 514 | "due to too long transition latency\n"); | ||
| 515 | return -EINVAL; | ||
| 516 | } | ||
| 517 | if (this_dbs_info->enable) /* Already enabled */ | 511 | if (this_dbs_info->enable) /* Already enabled */ |
| 518 | break; | 512 | break; |
| 519 | 513 | ||
| @@ -585,11 +579,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
| 585 | return 0; | 579 | return 0; |
| 586 | } | 580 | } |
| 587 | 581 | ||
| 588 | static struct cpufreq_governor cpufreq_gov_dbs = { | 582 | struct cpufreq_governor cpufreq_gov_ondemand = { |
| 589 | .name = "ondemand", | 583 | .name = "ondemand", |
| 590 | .governor = cpufreq_governor_dbs, | 584 | .governor = cpufreq_governor_dbs, |
| 591 | .owner = THIS_MODULE, | 585 | .max_transition_latency = TRANSITION_LATENCY_LIMIT, |
| 586 | .owner = THIS_MODULE, | ||
| 592 | }; | 587 | }; |
| 588 | EXPORT_SYMBOL(cpufreq_gov_ondemand); | ||
| 593 | 589 | ||
| 594 | static int __init cpufreq_gov_dbs_init(void) | 590 | static int __init cpufreq_gov_dbs_init(void) |
| 595 | { | 591 | { |
| @@ -598,12 +594,12 @@ static int __init cpufreq_gov_dbs_init(void) | |||
| 598 | printk(KERN_ERR "Creation of kondemand failed\n"); | 594 | printk(KERN_ERR "Creation of kondemand failed\n"); |
| 599 | return -EFAULT; | 595 | return -EFAULT; |
| 600 | } | 596 | } |
| 601 | return cpufreq_register_governor(&cpufreq_gov_dbs); | 597 | return cpufreq_register_governor(&cpufreq_gov_ondemand); |
| 602 | } | 598 | } |
| 603 | 599 | ||
| 604 | static void __exit cpufreq_gov_dbs_exit(void) | 600 | static void __exit cpufreq_gov_dbs_exit(void) |
| 605 | { | 601 | { |
| 606 | cpufreq_unregister_governor(&cpufreq_gov_dbs); | 602 | cpufreq_unregister_governor(&cpufreq_gov_ondemand); |
| 607 | destroy_workqueue(kondemand_wq); | 603 | destroy_workqueue(kondemand_wq); |
| 608 | } | 604 | } |
| 609 | 605 | ||
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 917b9bab9ccb..8a45d0f93e26 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
| @@ -164,8 +164,7 @@ freq_table_get_index(struct cpufreq_stats *stat, unsigned int freq) | |||
| 164 | return -1; | 164 | return -1; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | static void | 167 | static void __cpuexit cpufreq_stats_free_table(unsigned int cpu) |
| 168 | cpufreq_stats_free_table (unsigned int cpu) | ||
| 169 | { | 168 | { |
| 170 | struct cpufreq_stats *stat = cpufreq_stats_table[cpu]; | 169 | struct cpufreq_stats *stat = cpufreq_stats_table[cpu]; |
| 171 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); | 170 | struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); |
| @@ -305,8 +304,9 @@ cpufreq_stat_notifier_trans (struct notifier_block *nb, unsigned long val, | |||
| 305 | return 0; | 304 | return 0; |
| 306 | } | 305 | } |
| 307 | 306 | ||
| 308 | static int cpufreq_stat_cpu_callback(struct notifier_block *nfb, | 307 | static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb, |
| 309 | unsigned long action, void *hcpu) | 308 | unsigned long action, |
| 309 | void *hcpu) | ||
| 310 | { | 310 | { |
| 311 | unsigned int cpu = (unsigned long)hcpu; | 311 | unsigned int cpu = (unsigned long)hcpu; |
| 312 | 312 | ||
| @@ -323,7 +323,7 @@ static int cpufreq_stat_cpu_callback(struct notifier_block *nfb, | |||
| 323 | return NOTIFY_OK; | 323 | return NOTIFY_OK; |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | static struct notifier_block cpufreq_stat_cpu_notifier = | 326 | static struct notifier_block cpufreq_stat_cpu_notifier __cpuinitdata = |
| 327 | { | 327 | { |
| 328 | .notifier_call = cpufreq_stat_cpu_callback, | 328 | .notifier_call = cpufreq_stat_cpu_callback, |
| 329 | }; | 329 | }; |
| @@ -356,8 +356,7 @@ __init cpufreq_stats_init(void) | |||
| 356 | 356 | ||
| 357 | register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | 357 | register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
| 358 | for_each_online_cpu(cpu) { | 358 | for_each_online_cpu(cpu) { |
| 359 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, | 359 | cpufreq_update_policy(cpu); |
| 360 | CPU_ONLINE, (void *)(long)cpu); | ||
| 361 | } | 360 | } |
| 362 | return 0; | 361 | return 0; |
| 363 | } | 362 | } |
| @@ -372,13 +371,12 @@ __exit cpufreq_stats_exit(void) | |||
| 372 | CPUFREQ_TRANSITION_NOTIFIER); | 371 | CPUFREQ_TRANSITION_NOTIFIER); |
| 373 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); | 372 | unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); |
| 374 | for_each_online_cpu(cpu) { | 373 | for_each_online_cpu(cpu) { |
| 375 | cpufreq_stat_cpu_callback(&cpufreq_stat_cpu_notifier, | 374 | cpufreq_stats_free_table(cpu); |
| 376 | CPU_DEAD, (void *)(long)cpu); | ||
| 377 | } | 375 | } |
| 378 | } | 376 | } |
| 379 | 377 | ||
| 380 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); | 378 | MODULE_AUTHOR ("Zou Nan hai <nanhai.zou@intel.com>"); |
| 381 | MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats" | 379 | MODULE_DESCRIPTION ("'cpufreq_stats' - A driver to export cpufreq stats " |
| 382 | "through sysfs filesystem"); | 380 | "through sysfs filesystem"); |
| 383 | MODULE_LICENSE ("GPL"); | 381 | MODULE_LICENSE ("GPL"); |
| 384 | 382 | ||
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 3ec6e7ff5fbd..23932d7741a9 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h | |||
| @@ -32,12 +32,24 @@ | |||
| 32 | * CPUFREQ NOTIFIER INTERFACE * | 32 | * CPUFREQ NOTIFIER INTERFACE * |
| 33 | *********************************************************************/ | 33 | *********************************************************************/ |
| 34 | 34 | ||
| 35 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); | ||
| 36 | int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); | ||
| 37 | |||
| 38 | #define CPUFREQ_TRANSITION_NOTIFIER (0) | 35 | #define CPUFREQ_TRANSITION_NOTIFIER (0) |
| 39 | #define CPUFREQ_POLICY_NOTIFIER (1) | 36 | #define CPUFREQ_POLICY_NOTIFIER (1) |
| 40 | 37 | ||
| 38 | #ifdef CONFIG_CPU_FREQ | ||
| 39 | int cpufreq_register_notifier(struct notifier_block *nb, unsigned int list); | ||
| 40 | int cpufreq_unregister_notifier(struct notifier_block *nb, unsigned int list); | ||
| 41 | #else /* CONFIG_CPU_FREQ */ | ||
| 42 | static inline int cpufreq_register_notifier(struct notifier_block *nb, | ||
| 43 | unsigned int list) | ||
| 44 | { | ||
| 45 | return 0; | ||
| 46 | } | ||
| 47 | static inline int cpufreq_unregister_notifier(struct notifier_block *nb, | ||
| 48 | unsigned int list) | ||
| 49 | { | ||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | #endif /* CONFIG_CPU_FREQ */ | ||
| 41 | 53 | ||
| 42 | /* if (cpufreq_driver->target) exists, the ->governor decides what frequency | 54 | /* if (cpufreq_driver->target) exists, the ->governor decides what frequency |
| 43 | * within the limits is used. If (cpufreq_driver->setpolicy> exists, these | 55 | * within the limits is used. If (cpufreq_driver->setpolicy> exists, these |
| @@ -155,6 +167,9 @@ struct cpufreq_governor { | |||
| 155 | char name[CPUFREQ_NAME_LEN]; | 167 | char name[CPUFREQ_NAME_LEN]; |
| 156 | int (*governor) (struct cpufreq_policy *policy, | 168 | int (*governor) (struct cpufreq_policy *policy, |
| 157 | unsigned int event); | 169 | unsigned int event); |
| 170 | unsigned int max_transition_latency; /* HW must be able to switch to | ||
| 171 | next freq faster than this value in nano secs or we | ||
| 172 | will fallback to performance governor */ | ||
| 158 | struct list_head governor_list; | 173 | struct list_head governor_list; |
| 159 | struct module *owner; | 174 | struct module *owner; |
| 160 | }; | 175 | }; |
| @@ -279,12 +294,24 @@ static inline unsigned int cpufreq_quick_get(unsigned int cpu) | |||
| 279 | *********************************************************************/ | 294 | *********************************************************************/ |
| 280 | 295 | ||
| 281 | 296 | ||
| 282 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE | 297 | /* |
| 298 | Performance governor is fallback governor if any other gov failed to | ||
| 299 | auto load due latency restrictions | ||
| 300 | */ | ||
| 301 | #ifdef CONFIG_CPU_FREQ_GOV_PERFORMANCE | ||
| 283 | extern struct cpufreq_governor cpufreq_gov_performance; | 302 | extern struct cpufreq_governor cpufreq_gov_performance; |
| 284 | #define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_performance | 303 | #endif |
| 304 | #ifdef CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE | ||
| 305 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_performance) | ||
| 285 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) | 306 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE) |
| 286 | extern struct cpufreq_governor cpufreq_gov_userspace; | 307 | extern struct cpufreq_governor cpufreq_gov_userspace; |
| 287 | #define CPUFREQ_DEFAULT_GOVERNOR &cpufreq_gov_userspace | 308 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_userspace) |
| 309 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND) | ||
| 310 | extern struct cpufreq_governor cpufreq_gov_ondemand; | ||
| 311 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_ondemand) | ||
| 312 | #elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE) | ||
| 313 | extern struct cpufreq_governor cpufreq_gov_conservative; | ||
| 314 | #define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) | ||
| 288 | #endif | 315 | #endif |
| 289 | 316 | ||
| 290 | 317 | ||
