diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-02 18:19:56 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-05-02 18:19:56 -0400 |
commit | d705116f278fb5417ef6092f2f9c858975464991 (patch) | |
tree | 5409ea5f79f6fd8d99496b8a5874cdbbf33a3cd3 | |
parent | d1db0eea852497762cab43b905b879dfcd3b8987 (diff) | |
parent | 6712d2931933ada259b82f06c03a855b19937074 (diff) |
Merge branch 'pm-cpufreq'
* pm-cpufreq:
cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error
cpufreq: powernow-k7: Fix double invocation of cpufreq_freq_transition_begin/end
cpufreq: powernow-k6: Fix double invocation of cpufreq_freq_transition_begin/end
cpufreq: powernow-k6: Fix incorrect comparison with max_multipler
cpufreq: longhaul: Fix double invocation of cpufreq_freq_transition_begin/end
-rw-r--r-- | drivers/cpufreq/longhaul.c | 36 | ||||
-rw-r--r-- | drivers/cpufreq/powernow-k6.c | 23 | ||||
-rw-r--r-- | drivers/cpufreq/powernow-k7.c | 4 | ||||
-rw-r--r-- | drivers/cpufreq/ppc-corenet-cpufreq.c | 5 |
4 files changed, 41 insertions, 27 deletions
diff --git a/drivers/cpufreq/longhaul.c b/drivers/cpufreq/longhaul.c index d00e5d1abd25..5c4369b5d834 100644 --- a/drivers/cpufreq/longhaul.c +++ b/drivers/cpufreq/longhaul.c | |||
@@ -242,7 +242,7 @@ static void do_powersaver(int cx_address, unsigned int mults_index, | |||
242 | * Sets a new clock ratio. | 242 | * Sets a new clock ratio. |
243 | */ | 243 | */ |
244 | 244 | ||
245 | static void longhaul_setstate(struct cpufreq_policy *policy, | 245 | static int longhaul_setstate(struct cpufreq_policy *policy, |
246 | unsigned int table_index) | 246 | unsigned int table_index) |
247 | { | 247 | { |
248 | unsigned int mults_index; | 248 | unsigned int mults_index; |
@@ -258,10 +258,12 @@ static void longhaul_setstate(struct cpufreq_policy *policy, | |||
258 | /* Safety precautions */ | 258 | /* Safety precautions */ |
259 | mult = mults[mults_index & 0x1f]; | 259 | mult = mults[mults_index & 0x1f]; |
260 | if (mult == -1) | 260 | if (mult == -1) |
261 | return; | 261 | return -EINVAL; |
262 | |||
262 | speed = calc_speed(mult); | 263 | speed = calc_speed(mult); |
263 | if ((speed > highest_speed) || (speed < lowest_speed)) | 264 | if ((speed > highest_speed) || (speed < lowest_speed)) |
264 | return; | 265 | return -EINVAL; |
266 | |||
265 | /* Voltage transition before frequency transition? */ | 267 | /* Voltage transition before frequency transition? */ |
266 | if (can_scale_voltage && longhaul_index < table_index) | 268 | if (can_scale_voltage && longhaul_index < table_index) |
267 | dir = 1; | 269 | dir = 1; |
@@ -269,8 +271,6 @@ static void longhaul_setstate(struct cpufreq_policy *policy, | |||
269 | freqs.old = calc_speed(longhaul_get_cpu_mult()); | 271 | freqs.old = calc_speed(longhaul_get_cpu_mult()); |
270 | freqs.new = speed; | 272 | freqs.new = speed; |
271 | 273 | ||
272 | cpufreq_freq_transition_begin(policy, &freqs); | ||
273 | |||
274 | pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", | 274 | pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", |
275 | fsb, mult/10, mult%10, print_speed(speed/1000)); | 275 | fsb, mult/10, mult%10, print_speed(speed/1000)); |
276 | retry_loop: | 276 | retry_loop: |
@@ -385,12 +385,14 @@ retry_loop: | |||
385 | goto retry_loop; | 385 | goto retry_loop; |
386 | } | 386 | } |
387 | } | 387 | } |
388 | /* Report true CPU frequency */ | ||
389 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
390 | 388 | ||
391 | if (!bm_timeout) | 389 | if (!bm_timeout) { |
392 | printk(KERN_INFO PFX "Warning: Timeout while waiting for " | 390 | printk(KERN_INFO PFX "Warning: Timeout while waiting for " |
393 | "idle PCI bus.\n"); | 391 | "idle PCI bus.\n"); |
392 | return -EBUSY; | ||
393 | } | ||
394 | |||
395 | return 0; | ||
394 | } | 396 | } |
395 | 397 | ||
396 | /* | 398 | /* |
@@ -631,9 +633,10 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
631 | unsigned int i; | 633 | unsigned int i; |
632 | unsigned int dir = 0; | 634 | unsigned int dir = 0; |
633 | u8 vid, current_vid; | 635 | u8 vid, current_vid; |
636 | int retval = 0; | ||
634 | 637 | ||
635 | if (!can_scale_voltage) | 638 | if (!can_scale_voltage) |
636 | longhaul_setstate(policy, table_index); | 639 | retval = longhaul_setstate(policy, table_index); |
637 | else { | 640 | else { |
638 | /* On test system voltage transitions exceeding single | 641 | /* On test system voltage transitions exceeding single |
639 | * step up or down were turning motherboard off. Both | 642 | * step up or down were turning motherboard off. Both |
@@ -648,7 +651,7 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
648 | while (i != table_index) { | 651 | while (i != table_index) { |
649 | vid = (longhaul_table[i].driver_data >> 8) & 0x1f; | 652 | vid = (longhaul_table[i].driver_data >> 8) & 0x1f; |
650 | if (vid != current_vid) { | 653 | if (vid != current_vid) { |
651 | longhaul_setstate(policy, i); | 654 | retval = longhaul_setstate(policy, i); |
652 | current_vid = vid; | 655 | current_vid = vid; |
653 | msleep(200); | 656 | msleep(200); |
654 | } | 657 | } |
@@ -657,10 +660,11 @@ static int longhaul_target(struct cpufreq_policy *policy, | |||
657 | else | 660 | else |
658 | i--; | 661 | i--; |
659 | } | 662 | } |
660 | longhaul_setstate(policy, table_index); | 663 | retval = longhaul_setstate(policy, table_index); |
661 | } | 664 | } |
665 | |||
662 | longhaul_index = table_index; | 666 | longhaul_index = table_index; |
663 | return 0; | 667 | return retval; |
664 | } | 668 | } |
665 | 669 | ||
666 | 670 | ||
@@ -968,7 +972,15 @@ static void __exit longhaul_exit(void) | |||
968 | 972 | ||
969 | for (i = 0; i < numscales; i++) { | 973 | for (i = 0; i < numscales; i++) { |
970 | if (mults[i] == maxmult) { | 974 | if (mults[i] == maxmult) { |
975 | struct cpufreq_freqs freqs; | ||
976 | |||
977 | freqs.old = policy->cur; | ||
978 | freqs.new = longhaul_table[i].frequency; | ||
979 | freqs.flags = 0; | ||
980 | |||
981 | cpufreq_freq_transition_begin(policy, &freqs); | ||
971 | longhaul_setstate(policy, i); | 982 | longhaul_setstate(policy, i); |
983 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
972 | break; | 984 | break; |
973 | } | 985 | } |
974 | } | 986 | } |
diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index 49f120e1bc7b..78904e6ca4a0 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c | |||
@@ -138,22 +138,14 @@ static void powernow_k6_set_cpu_multiplier(unsigned int best_i) | |||
138 | static int powernow_k6_target(struct cpufreq_policy *policy, | 138 | static int powernow_k6_target(struct cpufreq_policy *policy, |
139 | unsigned int best_i) | 139 | unsigned int best_i) |
140 | { | 140 | { |
141 | struct cpufreq_freqs freqs; | ||
142 | 141 | ||
143 | if (clock_ratio[best_i].driver_data > max_multiplier) { | 142 | if (clock_ratio[best_i].driver_data > max_multiplier) { |
144 | printk(KERN_ERR PFX "invalid target frequency\n"); | 143 | printk(KERN_ERR PFX "invalid target frequency\n"); |
145 | return -EINVAL; | 144 | return -EINVAL; |
146 | } | 145 | } |
147 | 146 | ||
148 | freqs.old = busfreq * powernow_k6_get_cpu_multiplier(); | ||
149 | freqs.new = busfreq * clock_ratio[best_i].driver_data; | ||
150 | |||
151 | cpufreq_freq_transition_begin(policy, &freqs); | ||
152 | |||
153 | powernow_k6_set_cpu_multiplier(best_i); | 147 | powernow_k6_set_cpu_multiplier(best_i); |
154 | 148 | ||
155 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
156 | |||
157 | return 0; | 149 | return 0; |
158 | } | 150 | } |
159 | 151 | ||
@@ -227,9 +219,20 @@ have_busfreq: | |||
227 | static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) | 219 | static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) |
228 | { | 220 | { |
229 | unsigned int i; | 221 | unsigned int i; |
230 | for (i = 0; i < 8; i++) { | 222 | |
231 | if (i == max_multiplier) | 223 | for (i = 0; (clock_ratio[i].frequency != CPUFREQ_TABLE_END); i++) { |
224 | if (clock_ratio[i].driver_data == max_multiplier) { | ||
225 | struct cpufreq_freqs freqs; | ||
226 | |||
227 | freqs.old = policy->cur; | ||
228 | freqs.new = clock_ratio[i].frequency; | ||
229 | freqs.flags = 0; | ||
230 | |||
231 | cpufreq_freq_transition_begin(policy, &freqs); | ||
232 | powernow_k6_target(policy, i); | 232 | powernow_k6_target(policy, i); |
233 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
234 | break; | ||
235 | } | ||
233 | } | 236 | } |
234 | return 0; | 237 | return 0; |
235 | } | 238 | } |
diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c index f911645c3f6d..e61e224475ad 100644 --- a/drivers/cpufreq/powernow-k7.c +++ b/drivers/cpufreq/powernow-k7.c | |||
@@ -269,8 +269,6 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) | |||
269 | 269 | ||
270 | freqs.new = powernow_table[index].frequency; | 270 | freqs.new = powernow_table[index].frequency; |
271 | 271 | ||
272 | cpufreq_freq_transition_begin(policy, &freqs); | ||
273 | |||
274 | /* Now do the magic poking into the MSRs. */ | 272 | /* Now do the magic poking into the MSRs. */ |
275 | 273 | ||
276 | if (have_a0 == 1) /* A0 errata 5 */ | 274 | if (have_a0 == 1) /* A0 errata 5 */ |
@@ -290,8 +288,6 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) | |||
290 | if (have_a0 == 1) | 288 | if (have_a0 == 1) |
291 | local_irq_enable(); | 289 | local_irq_enable(); |
292 | 290 | ||
293 | cpufreq_freq_transition_end(policy, &freqs, 0); | ||
294 | |||
295 | return 0; | 291 | return 0; |
296 | } | 292 | } |
297 | 293 | ||
diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c b/drivers/cpufreq/ppc-corenet-cpufreq.c index a1ca3dd04a8e..0af618abebaf 100644 --- a/drivers/cpufreq/ppc-corenet-cpufreq.c +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c | |||
@@ -138,6 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
138 | struct cpufreq_frequency_table *table; | 138 | struct cpufreq_frequency_table *table; |
139 | struct cpu_data *data; | 139 | struct cpu_data *data; |
140 | unsigned int cpu = policy->cpu; | 140 | unsigned int cpu = policy->cpu; |
141 | u64 transition_latency_hz; | ||
141 | 142 | ||
142 | np = of_get_cpu_node(cpu, NULL); | 143 | np = of_get_cpu_node(cpu, NULL); |
143 | if (!np) | 144 | if (!np) |
@@ -205,8 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
205 | for_each_cpu(i, per_cpu(cpu_mask, cpu)) | 206 | for_each_cpu(i, per_cpu(cpu_mask, cpu)) |
206 | per_cpu(cpu_data, i) = data; | 207 | per_cpu(cpu_data, i) = data; |
207 | 208 | ||
209 | transition_latency_hz = 12ULL * NSEC_PER_SEC; | ||
208 | policy->cpuinfo.transition_latency = | 210 | policy->cpuinfo.transition_latency = |
209 | (12ULL * NSEC_PER_SEC) / fsl_get_sys_freq(); | 211 | do_div(transition_latency_hz, fsl_get_sys_freq()); |
212 | |||
210 | of_node_put(np); | 213 | of_node_put(np); |
211 | 214 | ||
212 | return 0; | 215 | return 0; |