Merge branch 'pm-fixes'

* pm-fixes:
  cpufreq: cpufreq-cpu0: use the exact frequency for clk_set_rate()
  cpufreq: protect 'policy->cpus' from offlining during __gov_queue_work()
  acpi-cpufreq: set current frequency based on target P-State
This commit is contained in:
Rafael J. Wysocki 2013-06-07 12:35:43 +02:00
commit c6617b39c3
3 changed files with 8 additions and 4 deletions

View File

@ -347,11 +347,11 @@ static u32 get_cur_val(const struct cpumask *mask)
switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) { switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) {
case SYSTEM_INTEL_MSR_CAPABLE: case SYSTEM_INTEL_MSR_CAPABLE:
cmd.type = SYSTEM_INTEL_MSR_CAPABLE; cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
break; break;
case SYSTEM_AMD_MSR_CAPABLE: case SYSTEM_AMD_MSR_CAPABLE:
cmd.type = SYSTEM_AMD_MSR_CAPABLE; cmd.type = SYSTEM_AMD_MSR_CAPABLE;
cmd.addr.msr.reg = MSR_AMD_PERF_STATUS; cmd.addr.msr.reg = MSR_AMD_PERF_CTL;
break; break;
case SYSTEM_IO_CAPABLE: case SYSTEM_IO_CAPABLE:
cmd.type = SYSTEM_IO_CAPABLE; cmd.type = SYSTEM_IO_CAPABLE;

View File

@ -45,7 +45,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
struct opp *opp; struct opp *opp;
unsigned long volt = 0, volt_old = 0, tol = 0; unsigned long volt = 0, volt_old = 0, tol = 0;
long freq_Hz; long freq_Hz, freq_exact;
unsigned int index; unsigned int index;
int ret; int ret;
@ -60,6 +60,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000); freq_Hz = clk_round_rate(cpu_clk, freq_table[index].frequency * 1000);
if (freq_Hz < 0) if (freq_Hz < 0)
freq_Hz = freq_table[index].frequency * 1000; freq_Hz = freq_table[index].frequency * 1000;
freq_exact = freq_Hz;
freqs.new = freq_Hz / 1000; freqs.new = freq_Hz / 1000;
freqs.old = clk_get_rate(cpu_clk) / 1000; freqs.old = clk_get_rate(cpu_clk) / 1000;
@ -98,7 +99,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
} }
} }
ret = clk_set_rate(cpu_clk, freqs.new * 1000); ret = clk_set_rate(cpu_clk, freq_exact);
if (ret) { if (ret) {
pr_err("failed to set clock rate: %d\n", ret); pr_err("failed to set clock rate: %d\n", ret);
if (cpu_reg) if (cpu_reg)

View File

@ -26,6 +26,7 @@
#include <linux/tick.h> #include <linux/tick.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/cpu.h>
#include "cpufreq_governor.h" #include "cpufreq_governor.h"
@ -180,8 +181,10 @@ void gov_queue_work(struct dbs_data *dbs_data, struct cpufreq_policy *policy,
if (!all_cpus) { if (!all_cpus) {
__gov_queue_work(smp_processor_id(), dbs_data, delay); __gov_queue_work(smp_processor_id(), dbs_data, delay);
} else { } else {
get_online_cpus();
for_each_cpu(i, policy->cpus) for_each_cpu(i, policy->cpus)
__gov_queue_work(i, dbs_data, delay); __gov_queue_work(i, dbs_data, delay);
put_online_cpus();
} }
} }
EXPORT_SYMBOL_GPL(gov_queue_work); EXPORT_SYMBOL_GPL(gov_queue_work);