cpufreq Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Starikovskiy <alexey_y_starikovskiy@linux.intel.com>
To: "Brown, Len" <len.brown@intel.com>, Dave Jones <davej@redhat.com>
Cc: cpufreq@lists.linux.org.uk
Subject: [PATCH 5/8] acpi-cpufreq: add strict mode to acpi-cpufreq driver
Date: Mon, 31 Jul 2006 22:49:09 +0400	[thread overview]
Message-ID: <44CE50A5.20002@linux.intel.com> (raw)

 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);

                 reply	other threads:[~2006-07-31 18:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44CE50A5.20002@linux.intel.com \
    --to=alexey_y_starikovskiy@linux.intel.com \
    --cc=cpufreq@lists.linux.org.uk \
    --cc=davej@redhat.com \
    --cc=len.brown@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox