cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 5/8] acpi-cpufreq: add strict mode to acpi-cpufreq driver
@ 2006-07-31 18:49 Alexey Starikovskiy
  0 siblings, 0 replies; only message in thread
From: Alexey Starikovskiy @ 2006-07-31 18:49 UTC (permalink / raw)
  To: Brown, Len, Dave Jones; +Cc: cpufreq

 acpi-cpufreq.c |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

strict mode is added to “acpi-cpufreq.c”, that allows to switch to “strict mode”, when after each attempt to set new processor performance the driver checks that frequency has been changed.

Signed-off: Denis Sadykov <denis.m.sadykov@intel.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi at intel.com>
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy at intel.com>

Index: linux-2.6.17/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
===================================================================
--- linux-2.6.17.orig/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	2006-07-17 17:06:46.000000000 +0000
+++ linux-2.6.17/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c	2006-07-17 17:09:27.000000000 +0000
@@ -66,6 +66,9 @@
 
 static struct cpufreq_driver			acpi_cpufreq_driver;
 
+/* module params */
+static unsigned int	use_acpi_strict;
+
 static int check_speedstep_cpu(unsigned int cpuid)
 {
 	struct cpuinfo_x86 *cpu = &cpu_data[cpuid];
@@ -273,6 +276,20 @@
 	return (freq);
 }
 
+static unsigned int check_freqs(cpumask_t mask, unsigned int freq,
+				struct acpi_cpufreq_data *data)
+{
+	unsigned int		cur_freq;
+	unsigned int		i;
+
+	for (i = 0; i < 100; i++) {
+		cur_freq = extract_freq(get_cur_val(mask), data);
+		if (cur_freq == freq)
+			return (1);
+		udelay(10);
+	}
+	return (0);
+}
 
 static int acpi_cpufreq_target(struct cpufreq_policy *policy,
 				unsigned int target_freq,
@@ -349,6 +366,13 @@
 
 	drv_write(&cmd);
 
+	if (use_acpi_strict) {	
+		if (!check_freqs(cmd.mask, freqs.new, data)) {
+			dprintk("acpi_cpufreq_target failed (%d)\n", policy->cpu);
+			return -EAGAIN;
+		}
+	}
+
 	for_each_cpu_mask(i, cmd.mask) {
 		freqs.cpu = i;
 		cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
@@ -620,6 +644,9 @@
 	return;
 }
 
+module_param(use_acpi_strict, uint, 0644);
+MODULE_PARM_DESC(use_acpi_strict, "value 0 or non-zero.");
+
 late_initcall(acpi_cpufreq_init);
 module_exit(acpi_cpufreq_exit);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-31 18:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-31 18:49 [PATCH 5/8] acpi-cpufreq: add strict mode to acpi-cpufreq driver Alexey Starikovskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox