From: Pavel Machek <pavel@ucw.cz>
To: cpufreq@www.linux.org.uk,
kernel list <linux-kernel@vger.kernel.org>,
torvalds@transmeta.com
Subject: cpufreq: allow user to specify voltage
Date: Mon, 24 Feb 2003 23:55:45 +0100 [thread overview]
Message-ID: <20030224225545.GA16991@elf.ucw.cz> (raw)
Hi!
This allows user to specify voltage manually. This gives me 40 extra
minutes (1h50m -> 2h30m) on HP omnibook which appears to have broken
bios tables. Please apply,
Pavel
--- clean/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2003-02-15 18:51:11.000000000 +0100
+++ linux/arch/i386/kernel/cpu/cpufreq/powernow-k7.c 2003-02-18 17:36:29.000000000 +0100
@@ -210,7 +210,7 @@
}
-static void change_speed (unsigned int index)
+static void change_speed (unsigned int index, unsigned int voltage)
{
u8 fid, vid;
struct cpufreq_freqs freqs;
@@ -226,6 +226,14 @@
fid = powernow_table[index].index & 0xFF;
vid = (powernow_table[index].index & 0xFF00) >> 8;
+ if (voltage) {
+ int i;
+ for (i=0; i<32; i++)
+ if (mobile_vid_table[i] == voltage)
+ vid = i;
+ printk("Voltage overriden to %d mV, index 0x%x\n", voltage, vid);
+ }
+
freqs.cpu = 0;
rdmsrl (MSR_K7_FID_VID_STATUS, fidvidstatus.val);
@@ -338,7 +346,7 @@
if (cpufreq_frequency_table_target(policy, powernow_table, target_freq, relation, &newstate))
return -EINVAL;
- change_speed(newstate);
+ change_speed(newstate, policy->voltage);
return 0;
}
--- clean/drivers/cpufreq/proc_intf.c 2003-02-18 12:24:32.000000000 +0100
+++ linux/drivers/cpufreq/proc_intf.c 2003-02-18 14:23:48.000000000 +0100
@@ -28,6 +28,7 @@
unsigned int min = 0;
unsigned int max = 0;
unsigned int cpu = 0;
+ unsigned int voltage = 0;
char str_governor[16];
struct cpufreq_policy current_policy;
unsigned int result = -EFAULT;
@@ -37,9 +38,24 @@
policy->min = 0;
policy->max = 0;
+ policy->voltage = 0;
policy->policy = 0;
policy->cpu = CPUFREQ_ALL_CPUS;
+ if (sscanf(input_string, "%d:%d:%d:%15s", &cpu, &min, &voltage, str_governor) == 4)
+ {
+ if (!strcmp(str_governor, "mVforce")) {
+ printk("Have request to go to %d mV\n", voltage);
+ policy->min = min;
+ policy->max = min;
+ policy->voltage = voltage;
+ policy->cpu = cpu;
+ result = 0;
+ policy->policy = CPUFREQ_POLICY_PERFORMANCE;
+ return 0;
+ }
+ }
+
if (sscanf(input_string, "%d:%d:%d:%15s", &cpu, &min, &max, str_governor) == 4)
{
policy->min = min;
--- clean/include/linux/cpufreq.h 2003-02-18 12:24:38.000000000 +0100
+++ linux/include/linux/cpufreq.h 2003-02-18 12:25:10.000000000 +0100
@@ -63,6 +63,7 @@
unsigned int min; /* in kHz */
unsigned int max; /* in kHz */
unsigned int policy; /* see above */
+ unsigned int voltage;/* in mV, 0 == trust bios */
struct cpufreq_governor *governor; /* see below */
struct cpufreq_cpuinfo cpuinfo; /* see above */
struct intf_data intf; /* interface data */
--- clean/kernel/cpufreq.c 2003-02-18 12:24:39.000000000 +0100
+++ linux/kernel/cpufreq.c 2003-02-18 17:24:04.000000000 +0100
@@ -1103,11 +1103,12 @@
cpufreq_driver->policy[policy->cpu].min = policy->min;
cpufreq_driver->policy[policy->cpu].max = policy->max;
+ cpufreq_driver->policy[policy->cpu].voltage= policy->voltage;
#ifdef CONFIG_CPU_FREQ_24_API
cpu_cur_freq[policy->cpu] = policy->max;
#endif
if (cpufreq_driver->setpolicy) {
cpufreq_driver->policy[policy->cpu].policy = policy->policy;
ret = cpufreq_driver->setpolicy(policy);
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
next reply other threads:[~2003-02-24 22:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-24 22:55 Pavel Machek [this message]
2003-02-25 0:41 ` cpufreq: allow user to specify voltage Dominik Brodowski
2003-02-25 18:03 ` Pavel Machek
2003-02-25 18:24 ` Dominik Brodowski
2003-02-25 19:09 ` Pavel Machek
2003-02-25 19:28 ` John Clemens
2003-02-25 19:33 ` Pavel Machek
2003-02-28 21:16 ` [PATCH][RFC] " Dominik Brodowski
2003-03-06 0:29 ` Pavel Machek
2003-03-06 0:36 ` Pavel Machek
2003-03-06 20:42 ` Pavel Machek
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=20030224225545.GA16991@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=cpufreq@www.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.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