Commit 535ae38c authored by Jesse Ahrens's avatar Jesse Ahrens Committed by Dave Jones

[CPUFREQ] Support Model D parts and newer in e_powersaver

Patch by VIA that updates e_powersaver.c to work with our model D parts
and newer.

From: Jesse Ahrens <jahrens@centtech.com>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
parent 6c9cda78
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define EPS_BRAND_C7 1 #define EPS_BRAND_C7 1
#define EPS_BRAND_EDEN 2 #define EPS_BRAND_EDEN 2
#define EPS_BRAND_C3 3 #define EPS_BRAND_C3 3
#define EPS_BRAND_C7D 4
struct eps_cpu_data { struct eps_cpu_data {
u32 fsb; u32 fsb;
...@@ -54,6 +55,7 @@ static int eps_set_state(struct eps_cpu_data *centaur, ...@@ -54,6 +55,7 @@ static int eps_set_state(struct eps_cpu_data *centaur,
{ {
struct cpufreq_freqs freqs; struct cpufreq_freqs freqs;
u32 lo, hi; u32 lo, hi;
u8 current_multiplier, current_voltage;
int err = 0; int err = 0;
int i; int i;
...@@ -93,6 +95,15 @@ static int eps_set_state(struct eps_cpu_data *centaur, ...@@ -93,6 +95,15 @@ static int eps_set_state(struct eps_cpu_data *centaur,
rdmsr(MSR_IA32_PERF_STATUS, lo, hi); rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
freqs.new = centaur->fsb * ((lo >> 8) & 0xff); freqs.new = centaur->fsb * ((lo >> 8) & 0xff);
/* Print voltage and multiplier */
rdmsr(MSR_IA32_PERF_STATUS, lo, hi);
current_voltage = lo & 0xff;
printk(KERN_INFO "eps: Current voltage = %dmV\n",
current_voltage * 16 + 700);
current_multiplier = (lo >> 8) & 0xff;
printk(KERN_INFO "eps: Current multiplier = %d\n",
current_multiplier);
cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
return err; return err;
} }
...@@ -141,9 +152,10 @@ static int eps_cpu_init(struct cpufreq_policy *policy) ...@@ -141,9 +152,10 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
u8 current_multiplier, current_voltage; u8 current_multiplier, current_voltage;
u8 max_multiplier, max_voltage; u8 max_multiplier, max_voltage;
u8 min_multiplier, min_voltage; u8 min_multiplier, min_voltage;
u8 brand; u8 brand = 0;
u32 fsb; u32 fsb;
struct eps_cpu_data *centaur; struct eps_cpu_data *centaur;
struct cpuinfo_x86 *c = &cpu_data(0);
struct cpufreq_frequency_table *f_table; struct cpufreq_frequency_table *f_table;
int k, step, voltage; int k, step, voltage;
int ret; int ret;
...@@ -154,8 +166,20 @@ static int eps_cpu_init(struct cpufreq_policy *policy) ...@@ -154,8 +166,20 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
/* Check brand */ /* Check brand */
printk("eps: Detected VIA "); printk("eps: Detected VIA ");
rdmsr(0x1153, lo, hi);
brand = (((lo >> 2) ^ lo) >> 18) & 3; switch (c->x86_model) {
case 10:
rdmsr(0x1153, lo, hi);
brand = (((lo >> 2) ^ lo) >> 18) & 3;
printk(KERN_CONT "Model A ");
break;
case 13:
rdmsr(0x1154, lo, hi);
brand = (((lo >> 4) ^ (lo >> 2))) & 0x000000ff;
printk(KERN_CONT "Model D ");
break;
}
switch(brand) { switch(brand) {
case EPS_BRAND_C7M: case EPS_BRAND_C7M:
printk("C7-M\n"); printk("C7-M\n");
...@@ -166,6 +190,9 @@ static int eps_cpu_init(struct cpufreq_policy *policy) ...@@ -166,6 +190,9 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
case EPS_BRAND_EDEN: case EPS_BRAND_EDEN:
printk("Eden\n"); printk("Eden\n");
break; break;
case EPS_BRAND_C7D:
printk(KERN_CONT "C7-D\n");
break;
case EPS_BRAND_C3: case EPS_BRAND_C3:
printk("C3\n"); printk("C3\n");
return -ENODEV; return -ENODEV;
...@@ -208,7 +235,7 @@ static int eps_cpu_init(struct cpufreq_policy *policy) ...@@ -208,7 +235,7 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
if (current_multiplier > max_multiplier if (current_multiplier > max_multiplier
|| max_multiplier <= min_multiplier) || max_multiplier <= min_multiplier)
return -EINVAL; return -EINVAL;
if (current_voltage > 0x1c || max_voltage > 0x1c) if (current_voltage > 0x1f || max_voltage > 0x1f)
return -EINVAL; return -EINVAL;
if (max_voltage < min_voltage) if (max_voltage < min_voltage)
return -EINVAL; return -EINVAL;
...@@ -310,7 +337,7 @@ static int __init eps_init(void) ...@@ -310,7 +337,7 @@ static int __init eps_init(void)
/* This driver will work only on Centaur C7 processors with /* This driver will work only on Centaur C7 processors with
* Enhanced SpeedStep/PowerSaver registers */ * Enhanced SpeedStep/PowerSaver registers */
if (c->x86_vendor != X86_VENDOR_CENTAUR if (c->x86_vendor != X86_VENDOR_CENTAUR
|| c->x86 != 6 || c->x86_model != 10) || c->x86 != 6 || c->x86_model < 10)
return -ENODEV; return -ENODEV;
if (!cpu_has(c, X86_FEATURE_EST)) if (!cpu_has(c, X86_FEATURE_EST))
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment