Commit d705116f authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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
parents d1db0eea 6712d293
...@@ -242,7 +242,7 @@ static void do_powersaver(int cx_address, unsigned int mults_index, ...@@ -242,7 +242,7 @@ static void do_powersaver(int cx_address, unsigned int mults_index,
* Sets a new clock ratio. * Sets a new clock ratio.
*/ */
static void longhaul_setstate(struct cpufreq_policy *policy, static int longhaul_setstate(struct cpufreq_policy *policy,
unsigned int table_index) unsigned int table_index)
{ {
unsigned int mults_index; unsigned int mults_index;
...@@ -258,10 +258,12 @@ static void longhaul_setstate(struct cpufreq_policy *policy, ...@@ -258,10 +258,12 @@ static void longhaul_setstate(struct cpufreq_policy *policy,
/* Safety precautions */ /* Safety precautions */
mult = mults[mults_index & 0x1f]; mult = mults[mults_index & 0x1f];
if (mult == -1) if (mult == -1)
return; return -EINVAL;
speed = calc_speed(mult); speed = calc_speed(mult);
if ((speed > highest_speed) || (speed < lowest_speed)) if ((speed > highest_speed) || (speed < lowest_speed))
return; return -EINVAL;
/* Voltage transition before frequency transition? */ /* Voltage transition before frequency transition? */
if (can_scale_voltage && longhaul_index < table_index) if (can_scale_voltage && longhaul_index < table_index)
dir = 1; dir = 1;
...@@ -269,8 +271,6 @@ static void longhaul_setstate(struct cpufreq_policy *policy, ...@@ -269,8 +271,6 @@ static void longhaul_setstate(struct cpufreq_policy *policy,
freqs.old = calc_speed(longhaul_get_cpu_mult()); freqs.old = calc_speed(longhaul_get_cpu_mult());
freqs.new = speed; freqs.new = speed;
cpufreq_freq_transition_begin(policy, &freqs);
pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n", pr_debug("Setting to FSB:%dMHz Mult:%d.%dx (%s)\n",
fsb, mult/10, mult%10, print_speed(speed/1000)); fsb, mult/10, mult%10, print_speed(speed/1000));
retry_loop: retry_loop:
...@@ -385,12 +385,14 @@ static void longhaul_setstate(struct cpufreq_policy *policy, ...@@ -385,12 +385,14 @@ static void longhaul_setstate(struct cpufreq_policy *policy,
goto retry_loop; goto retry_loop;
} }
} }
/* Report true CPU frequency */
cpufreq_freq_transition_end(policy, &freqs, 0);
if (!bm_timeout) if (!bm_timeout) {
printk(KERN_INFO PFX "Warning: Timeout while waiting for " printk(KERN_INFO PFX "Warning: Timeout while waiting for "
"idle PCI bus.\n"); "idle PCI bus.\n");
return -EBUSY;
}
return 0;
} }
/* /*
...@@ -631,9 +633,10 @@ static int longhaul_target(struct cpufreq_policy *policy, ...@@ -631,9 +633,10 @@ static int longhaul_target(struct cpufreq_policy *policy,
unsigned int i; unsigned int i;
unsigned int dir = 0; unsigned int dir = 0;
u8 vid, current_vid; u8 vid, current_vid;
int retval = 0;
if (!can_scale_voltage) if (!can_scale_voltage)
longhaul_setstate(policy, table_index); retval = longhaul_setstate(policy, table_index);
else { else {
/* On test system voltage transitions exceeding single /* On test system voltage transitions exceeding single
* step up or down were turning motherboard off. Both * step up or down were turning motherboard off. Both
...@@ -648,7 +651,7 @@ static int longhaul_target(struct cpufreq_policy *policy, ...@@ -648,7 +651,7 @@ static int longhaul_target(struct cpufreq_policy *policy,
while (i != table_index) { while (i != table_index) {
vid = (longhaul_table[i].driver_data >> 8) & 0x1f; vid = (longhaul_table[i].driver_data >> 8) & 0x1f;
if (vid != current_vid) { if (vid != current_vid) {
longhaul_setstate(policy, i); retval = longhaul_setstate(policy, i);
current_vid = vid; current_vid = vid;
msleep(200); msleep(200);
} }
...@@ -657,10 +660,11 @@ static int longhaul_target(struct cpufreq_policy *policy, ...@@ -657,10 +660,11 @@ static int longhaul_target(struct cpufreq_policy *policy,
else else
i--; i--;
} }
longhaul_setstate(policy, table_index); retval = longhaul_setstate(policy, table_index);
} }
longhaul_index = table_index; longhaul_index = table_index;
return 0; return retval;
} }
...@@ -968,7 +972,15 @@ static void __exit longhaul_exit(void) ...@@ -968,7 +972,15 @@ static void __exit longhaul_exit(void)
for (i = 0; i < numscales; i++) { for (i = 0; i < numscales; i++) {
if (mults[i] == maxmult) { if (mults[i] == maxmult) {
struct cpufreq_freqs freqs;
freqs.old = policy->cur;
freqs.new = longhaul_table[i].frequency;
freqs.flags = 0;
cpufreq_freq_transition_begin(policy, &freqs);
longhaul_setstate(policy, i); longhaul_setstate(policy, i);
cpufreq_freq_transition_end(policy, &freqs, 0);
break; break;
} }
} }
......
...@@ -138,22 +138,14 @@ static void powernow_k6_set_cpu_multiplier(unsigned int best_i) ...@@ -138,22 +138,14 @@ static void powernow_k6_set_cpu_multiplier(unsigned int best_i)
static int powernow_k6_target(struct cpufreq_policy *policy, static int powernow_k6_target(struct cpufreq_policy *policy,
unsigned int best_i) unsigned int best_i)
{ {
struct cpufreq_freqs freqs;
if (clock_ratio[best_i].driver_data > max_multiplier) { if (clock_ratio[best_i].driver_data > max_multiplier) {
printk(KERN_ERR PFX "invalid target frequency\n"); printk(KERN_ERR PFX "invalid target frequency\n");
return -EINVAL; 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); powernow_k6_set_cpu_multiplier(best_i);
cpufreq_freq_transition_end(policy, &freqs, 0);
return 0; return 0;
} }
...@@ -227,9 +219,20 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy) ...@@ -227,9 +219,20 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
static int powernow_k6_cpu_exit(struct cpufreq_policy *policy) static int powernow_k6_cpu_exit(struct cpufreq_policy *policy)
{ {
unsigned int i; 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); powernow_k6_target(policy, i);
cpufreq_freq_transition_end(policy, &freqs, 0);
break;
}
} }
return 0; return 0;
} }
......
...@@ -269,8 +269,6 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) ...@@ -269,8 +269,6 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index)
freqs.new = powernow_table[index].frequency; freqs.new = powernow_table[index].frequency;
cpufreq_freq_transition_begin(policy, &freqs);
/* Now do the magic poking into the MSRs. */ /* Now do the magic poking into the MSRs. */
if (have_a0 == 1) /* A0 errata 5 */ if (have_a0 == 1) /* A0 errata 5 */
...@@ -290,8 +288,6 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) ...@@ -290,8 +288,6 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index)
if (have_a0 == 1) if (have_a0 == 1)
local_irq_enable(); local_irq_enable();
cpufreq_freq_transition_end(policy, &freqs, 0);
return 0; return 0;
} }
......
...@@ -138,6 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -138,6 +138,7 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
struct cpufreq_frequency_table *table; struct cpufreq_frequency_table *table;
struct cpu_data *data; struct cpu_data *data;
unsigned int cpu = policy->cpu; unsigned int cpu = policy->cpu;
u64 transition_latency_hz;
np = of_get_cpu_node(cpu, NULL); np = of_get_cpu_node(cpu, NULL);
if (!np) if (!np)
...@@ -205,8 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy) ...@@ -205,8 +206,10 @@ static int corenet_cpufreq_cpu_init(struct cpufreq_policy *policy)
for_each_cpu(i, per_cpu(cpu_mask, cpu)) for_each_cpu(i, per_cpu(cpu_mask, cpu))
per_cpu(cpu_data, i) = data; per_cpu(cpu_data, i) = data;
transition_latency_hz = 12ULL * NSEC_PER_SEC;
policy->cpuinfo.transition_latency = policy->cpuinfo.transition_latency =
(12ULL * NSEC_PER_SEC) / fsl_get_sys_freq(); do_div(transition_latency_hz, fsl_get_sys_freq());
of_node_put(np); of_node_put(np);
return 0; return 0;
......
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