summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/powernow-k6.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2013-12-11 19:39:19 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-01-06 09:53:07 -0500
commit22c73795b101597051924556dce019385a1e2fa0 (patch)
tree0e93ea4d3a6845850d2d41f5699068ef19bc8ef9 /drivers/cpufreq/powernow-k6.c
parentd82b922a4acc1781d368aceac2f9da43b038cab2 (diff)
powernow-k6: reorder frequencies
This patch reorders reported frequencies from the highest to the lowest, just like in other frequency drivers. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/powernow-k6.c')
-rw-r--r--drivers/cpufreq/powernow-k6.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c
index 16359ab2c459..b9a444e358b5 100644
--- a/drivers/cpufreq/powernow-k6.c
+++ b/drivers/cpufreq/powernow-k6.c
@@ -37,17 +37,20 @@ MODULE_PARM_DESC(bus_frequency, "Bus frequency in kHz");
37 37
38/* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */ 38/* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */
39static struct cpufreq_frequency_table clock_ratio[] = { 39static struct cpufreq_frequency_table clock_ratio[] = {
40 {45, /* 000 -> 4.5x */ 0}, 40 {60, /* 110 -> 6.0x */ 0},
41 {55, /* 011 -> 5.5x */ 0},
41 {50, /* 001 -> 5.0x */ 0}, 42 {50, /* 001 -> 5.0x */ 0},
43 {45, /* 000 -> 4.5x */ 0},
42 {40, /* 010 -> 4.0x */ 0}, 44 {40, /* 010 -> 4.0x */ 0},
43 {55, /* 011 -> 5.5x */ 0},
44 {20, /* 100 -> 2.0x */ 0},
45 {30, /* 101 -> 3.0x */ 0},
46 {60, /* 110 -> 6.0x */ 0},
47 {35, /* 111 -> 3.5x */ 0}, 45 {35, /* 111 -> 3.5x */ 0},
46 {30, /* 101 -> 3.0x */ 0},
47 {20, /* 100 -> 2.0x */ 0},
48 {0, CPUFREQ_TABLE_END} 48 {0, CPUFREQ_TABLE_END}
49}; 49};
50 50
51static const u8 index_to_register[8] = { 6, 3, 1, 0, 2, 7, 5, 4 };
52static const u8 register_to_index[8] = { 3, 2, 4, 1, 7, 6, 0, 5 };
53
51static const struct { 54static const struct {
52 unsigned freq; 55 unsigned freq;
53 unsigned mult; 56 unsigned mult;
@@ -91,7 +94,7 @@ static int powernow_k6_get_cpu_multiplier(void)
91 94
92 local_irq_enable(); 95 local_irq_enable();
93 96
94 return clock_ratio[(invalue >> 5)&7].driver_data; 97 return clock_ratio[register_to_index[(invalue >> 5)&7]].driver_data;
95} 98}
96 99
97static void powernow_k6_set_cpu_multiplier(unsigned int best_i) 100static void powernow_k6_set_cpu_multiplier(unsigned int best_i)
@@ -111,7 +114,7 @@ static void powernow_k6_set_cpu_multiplier(unsigned int best_i)
111 write_cr0(cr0 | X86_CR0_CD); 114 write_cr0(cr0 | X86_CR0_CD);
112 wbinvd(); 115 wbinvd();
113 116
114 outvalue = (1<<12) | (1<<10) | (1<<9) | (best_i<<5); 117 outvalue = (1<<12) | (1<<10) | (1<<9) | (index_to_register[best_i]<<5);
115 118
116 msrval = POWERNOW_IOPORT + 0x1; 119 msrval = POWERNOW_IOPORT + 0x1;
117 wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */ 120 wrmsr(MSR_K6_EPMR, msrval, 0); /* enable the PowerNow port */