[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: Dominik Brodowski diff -ruN linux-original/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c linux/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c --- linux-original/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c 2004-11-27 12:06:14.000000000 +0100 +++ linux/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c 2004-11-27 12:31:35.316359128 +0100 @@ -48,6 +48,7 @@ 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 @@ } 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 @@ 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 @@ .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,