Commit 8e65826d authored by Dave Jones's avatar Dave Jones

[CPUFREQ] acpi-cpufreq: force setting of P-State upon resume

Upon resuming from sleep or swsusp, the ACPI P-States driver can't determine
the current CPU frequency, as the ACPI specification doesn't contain a method
to determine the current P-State.

Therefore, _always_ re-set the CPU to the P-State it was before suspending,
and don't abort early if this is the same state as the CPU was put to
before (like it does make sense when using the ondemand governor, for example).
Signed-off-by: default avatarDominik Brodowski <linux@brodo.de>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 50fd3c51
......@@ -48,6 +48,7 @@ MODULE_LICENSE("GPL");
struct cpufreq_acpi_io {
struct acpi_processor_performance acpi_data;
struct cpufreq_frequency_table *freq_table;
unsigned int resume;
};
static struct cpufreq_acpi_io *acpi_io_data[NR_CPUS];
......@@ -119,9 +120,14 @@ acpi_processor_set_performance (
}
if (state == data->acpi_data.state) {
dprintk("Already at target state (P%d)\n", state);
retval = 0;
goto migrate_end;
if (unlikely(data->resume)) {
dprintk("Called after resume, resetting to P%d\n", state);
data->resume = 0;
} else {
dprintk("Already at target state (P%d)\n", state);
retval = 0;
goto migrate_end;
}
}
dprintk("Transitioning from P%d to P%d\n",
......@@ -462,6 +468,20 @@ acpi_cpufreq_cpu_exit (
return (0);
}
static int
acpi_cpufreq_resume (
struct cpufreq_policy *policy)
{
struct cpufreq_acpi_io *data = acpi_io_data[policy->cpu];
dprintk("acpi_cpufreq_resume\n");
data->resume = 1;
return (0);
}
static struct freq_attr* acpi_cpufreq_attr[] = {
&cpufreq_freq_attr_scaling_available_freqs,
......@@ -473,6 +493,7 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
.target = acpi_cpufreq_target,
.init = acpi_cpufreq_cpu_init,
.exit = acpi_cpufreq_cpu_exit,
.resume = acpi_cpufreq_resume,
.name = "acpi-cpufreq",
.owner = THIS_MODULE,
.attr = acpi_cpufreq_attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment