]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/cpufreq/powernow-k6.c
Merge tag 'edac_for_3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/bp/bp...
[karo-tx-linux.git] / drivers / cpufreq / powernow-k6.c
index 62c6f2e5afced391ee7260e6ab6065c73954fa58..78904e6ca4a020d53a60f4139711441a069ad447 100644 (file)
@@ -37,15 +37,15 @@ MODULE_PARM_DESC(bus_frequency, "Bus frequency in kHz");
 
 /* Clock ratio multiplied by 10 - see table 27 in AMD#23446 */
 static struct cpufreq_frequency_table clock_ratio[] = {
-       {60,  /* 110 -> 6.0x */ 0},
-       {55,  /* 011 -> 5.5x */ 0},
-       {50,  /* 001 -> 5.0x */ 0},
-       {45,  /* 000 -> 4.5x */ 0},
-       {40,  /* 010 -> 4.0x */ 0},
-       {35,  /* 111 -> 3.5x */ 0},
-       {30,  /* 101 -> 3.0x */ 0},
-       {20,  /* 100 -> 2.0x */ 0},
-       {0, CPUFREQ_TABLE_END}
+       {0, 60,  /* 110 -> 6.0x */ 0},
+       {0, 55,  /* 011 -> 5.5x */ 0},
+       {0, 50,  /* 001 -> 5.0x */ 0},
+       {0, 45,  /* 000 -> 4.5x */ 0},
+       {0, 40,  /* 010 -> 4.0x */ 0},
+       {0, 35,  /* 111 -> 3.5x */ 0},
+       {0, 30,  /* 101 -> 3.0x */ 0},
+       {0, 20,  /* 100 -> 2.0x */ 0},
+       {0, 0, CPUFREQ_TABLE_END}
 };
 
 static const u8 index_to_register[8] = { 6, 3, 1, 0, 2, 7, 5, 4 };
@@ -138,22 +138,14 @@ static void powernow_k6_set_cpu_multiplier(unsigned int best_i)
 static int powernow_k6_target(struct cpufreq_policy *policy,
                unsigned int best_i)
 {
-       struct cpufreq_freqs freqs;
 
        if (clock_ratio[best_i].driver_data > max_multiplier) {
                printk(KERN_ERR PFX "invalid target frequency\n");
                return -EINVAL;
        }
 
-       freqs.old = busfreq * powernow_k6_get_cpu_multiplier();
-       freqs.new = busfreq * clock_ratio[best_i].driver_data;
-
-       cpufreq_freq_transition_begin(policy, &freqs);
-
        powernow_k6_set_cpu_multiplier(best_i);
 
-       cpufreq_freq_transition_end(policy, &freqs, 0);
-
        return 0;
 }
 
@@ -227,9 +219,20 @@ have_busfreq:
 static int powernow_k6_cpu_exit(struct cpufreq_policy *policy)
 {
        unsigned int i;
-       for (i = 0; i < 8; i++) {
-               if (i == max_multiplier)
+
+       for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) {
+               if (clock_ratio[i].driver_data == max_multiplier) {
+                       struct cpufreq_freqs freqs;
+
+                       freqs.old = policy->cur;
+                       freqs.new = clock_ratio[i].frequency;
+                       freqs.flags = 0;
+
+                       cpufreq_freq_transition_begin(policy, &freqs);
                        powernow_k6_target(policy, i);
+                       cpufreq_freq_transition_end(policy, &freqs, 0);
+                       break;
+               }
        }
        return 0;
 }