|
|
Log in / Subscribe / Register

1/3 A dynamic cpufreq governor

From:  "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
To:  <linux-kernel@vger.kernel.org>, <cpufreq@www.linux.org.uk>, "Linus Torvalds" <torvalds@osdl.org>, <akpm@osdl.org>
Subject:  [PATCH] 1/3 A dynamic cpufreq governor
Date:  Sat, 25 Oct 2003 12:54:16 -0700
Cc:  "Pavel Machek" <pavel@ucw.cz>, "Dominik Brodowski" <linux@brodo.de>, "Nakajima, Jun" <jun.nakajima@intel.com>

ondemand1.patch - 'unit' related bugfixes in drivers. 

diffstat ondemand1.patch
 acpi.c               |   10 ++++++++--
 powernow-k7.c        |    3 ++-
 speedstep-centrino.c |    3 ++-
 3 files changed, 12 insertions(+), 4 deletions(-)


diff -purN linux-2.6.0-test8/arch/i386/kernel/cpu/cpufreq/acpi.c
linux-2.6.0-test8-dbs/arch/i386/kernel/cpu/cpufreq/acpi.c
--- linux-2.6.0-test8/arch/i386/kernel/cpu/cpufreq/acpi.c
2003-10-17 14:42:54.000000000 -0700
+++ linux-2.6.0-test8-dbs/arch/i386/kernel/cpu/cpufreq/acpi.c
2003-10-25 13:19:03.000000000 -0700
@@ -267,8 +267,12 @@ acpi_processor_set_performance (
 
 	/* cpufreq frequency struct */
 	cpufreq_freqs.cpu = perf->pr->id;
-	cpufreq_freqs.old = perf->states[perf->state].core_frequency;
-	cpufreq_freqs.new = perf->states[state].core_frequency;
+	/*
+	 * cpufreq_notifier needs to send the freq in KHz. But acpi
+	 * data we have is in MHz
+	 */
+	cpufreq_freqs.old = perf->states[perf->state].core_frequency *
1000;
+	cpufreq_freqs.new = perf->states[state].core_frequency * 1000;
 
 	/* notify cpufreq */
 	cpufreq_notify_transition(&cpufreq_freqs, CPUFREQ_PRECHANGE);
@@ -581,6 +585,8 @@ acpi_cpufreq_cpu_init (
 		if (perf->states[i].transition_latency >
policy->cpuinfo.transition_latency)
 			policy->cpuinfo.transition_latency =
perf->states[i].transition_latency;
 	}
+	/* policy transition latency is in terms of nS */
+	policy->cpuinfo.transition_latency *= 1000;
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
 	policy->cur = perf->states[pr->limit.state.px].core_frequency *
1000;
 
diff -purN linux-2.6.0-test8/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
linux-2.6.0-test8-dbs/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
--- linux-2.6.0-test8/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
2003-10-17 14:42:53.000000000 -0700
+++ linux-2.6.0-test8-dbs/arch/i386/kernel/cpu/cpufreq/powernow-k7.c
2003-10-25 13:19:03.000000000 -0700
@@ -386,7 +386,8 @@ static int __init powernow_cpu_init (str
 				minimum_speed, maximum_speed);
 
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
-	policy->cpuinfo.transition_latency = latency;
+	/* 'latency' is in terms of 10nS and policy latency in terms of
nS */
+	policy->cpuinfo.transition_latency = 10 * latency;
 	policy->cur = maximum_speed;
 
 	return cpufreq_frequency_table_cpuinfo(policy, powernow_table);
diff -purN
linux-2.6.0-test8/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
linux-2.6.0-test8-dbs/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
--- linux-2.6.0-test8/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
2003-10-17 14:43:03.000000000 -0700
+++
linux-2.6.0-test8-dbs/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
2003-10-25 13:19:03.000000000 -0700
@@ -202,7 +202,8 @@ static int centrino_cpu_init(struct cpuf
 	freq = get_cur_freq();
 
 	policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
-	policy->cpuinfo.transition_latency = 10; /* 10uS transition
latency */
+	/* 10uS - policy transition latency is in terms of nS */
+	policy->cpuinfo.transition_latency = 1000 * 10;
 	policy->cur = freq;
 
 	dprintk(KERN_INFO PFX "centrino_cpu_init: policy=%d
cur=%dkHz\n",


Copyright © 2003, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds