lkml.org 
[lkml]   [2003]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectSelect voltage manually in cpufreq
Hi!

I've added possibility to manualy force specified frequency and
voltage... That's fairly usefull for testing, and I believe this (or
something equivalent) is needed because every 2nd bios seems to be
b0rken.

Take a look and apply if you want to...
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 */
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:33    [W:0.052 / U:4.844 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site