All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] cpufreq: e_powersaver: Fix checking brand for EPS_BRAND_C3
@ 2011-07-08  8:37 Axel Lin
  2011-07-11 16:36   ` Rafał Bilski
  2011-07-11 22:08   ` Rafał Bilski
  0 siblings, 2 replies; 18+ messages in thread
From: Axel Lin @ 2011-07-08  8:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rafal Bilski, Dave Jones, cpufreq

Do not return -ENODEV for EPS_BRAND_C3.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
I just found the code is suspect. 
I don't have this hardware handy.
Anyone can help to confirm and test if this patch works?
Axel

 drivers/cpufreq/e_powersaver.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c
index 35a257d..637f055 100644
--- a/drivers/cpufreq/e_powersaver.c
+++ b/drivers/cpufreq/e_powersaver.c
@@ -199,8 +199,9 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
 		break;
 	case EPS_BRAND_C3:
 		printk(KERN_CONT "C3\n");
-		return -ENODEV;
 		break;
+	default:
+		return -ENODEV;
 	}
 	/* Enable Enhanced PowerSaver */
 	rdmsrl(MSR_IA32_MISC_ENABLE, val);
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 18+ messages in thread
* [PATCH] e_powersaver: Add sanity checks to code provided by VIA
@ 2011-07-14 21:58 Rafal Bilski
  0 siblings, 0 replies; 18+ messages in thread
From: Rafal Bilski @ 2011-07-14 21:58 UTC (permalink / raw)
  To: Dave Jones; +Cc: cpufreq, Rafal Bilski

Patch from VIA is forcing "e_powersaver" to accept any processor >=A, 
but code supports only A and D.
Patch from VIA is forcing "e_powersaver" to support new brand, but code 
was intended for 2 bits only.
Looks like model D is using 8 bits for brand. Compensate.

Thanks to Axel Lin for pointing it out!

Signed-off-by: Rafal Bilski <rafalbilski@interia.pl>
---
 drivers/cpufreq/e_powersaver.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/cpufreq/e_powersaver.c b/drivers/cpufreq/e_powersaver.c
index 35a257d..7883ffa 100644
--- a/drivers/cpufreq/e_powersaver.c
+++ b/drivers/cpufreq/e_powersaver.c
@@ -179,9 +179,13 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
 		break;
 	case 13:
 		rdmsr(0x1154, lo, hi);
-		brand = (((lo >> 4) ^ (lo >> 2))) & 0x000000ff;
+		brand = (((lo >> 4) ^ (lo >> 2))) & 0xff;
 		printk(KERN_CONT "Model D ");
 		break;
+	default:
+		printk(KERN_CONT "unknown processor\n");
+		return -ENODEV;
+		break;
 	}
 
 	switch (brand) {
@@ -194,14 +198,19 @@ static int eps_cpu_init(struct cpufreq_policy *policy)
 	case EPS_BRAND_EDEN:
 		printk(KERN_CONT "Eden\n");
 		break;
+	case EPS_BRAND_C3:
+		printk(KERN_CONT "C3\n");
+		return -ENODEV;
+		break;
 	case EPS_BRAND_C7D:
 		printk(KERN_CONT "C7-D\n");
 		break;
-	case EPS_BRAND_C3:
-		printk(KERN_CONT "C3\n");
+	default:
+		printk(KERN_CONT "unsupported brand\n");
 		return -ENODEV;
 		break;
 	}
+
 	/* Enable Enhanced PowerSaver */
 	rdmsrl(MSR_IA32_MISC_ENABLE, val);
 	if (!(val & MSR_IA32_MISC_ENABLE_ENHANCED_SPEEDSTEP)) {
-- 
1.7.6


----------------------------------------------------------------
Znajdz samochod idealny dla siebie!
Szukaj >> http://linkint.pl/f29e2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2011-07-14 21:58 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-08  8:37 [RFC][PATCH] cpufreq: e_powersaver: Fix checking brand for EPS_BRAND_C3 Axel Lin
2011-07-11 16:36 ` Rafał Bilski
2011-07-11 16:36   ` Rafał Bilski
2011-07-11 22:08 ` [PATCH] e_powersaver: Add sanity checks to code provided by VIA Rafał Bilski
2011-07-11 22:08   ` Rafał Bilski
2011-07-11 23:15   ` [PATCH] e_powersaver: Underclock checks Rafał Bilski
2011-07-11 23:15     ` Rafał Bilski
2011-07-11 23:25     ` Dave Jones
2011-07-11 23:25       ` Dave Jones
2011-07-12 17:00       ` Rafał Bilski
2011-07-12 17:00         ` Rafał Bilski
2011-07-13 16:40         ` Rafał Bilski
2011-07-13 16:40           ` Rafał Bilski
2011-07-13 16:45           ` Dave Jones
2011-07-13 16:45             ` Dave Jones
2011-07-13 22:24   ` [PATCH] e_powersaver: Add sanity checks to code provided by VIA Dave Jones
2011-07-13 23:01     ` Rafał Bilski
  -- strict thread matches above, loose matches on Subject: below --
2011-07-14 21:58 Rafal Bilski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.