diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-05-27 15:52:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-28 14:13:59 -0400 |
commit | d6649bc76a57523209a6b2ee4844c9078a4dd8bb (patch) | |
tree | b27a01d3dabacdf6524b96ca9d32efe83cf3061e /arch/ppc/platforms/pmac_cpufreq.c | |
parent | c5924b7d97430657fa07ebf1a208c7e8cf135ef3 (diff) |
[PATCH] ppc32: small cpufreq update
This patch adds a missing attribute to pmac cpufreq so that
"scaling_available_frequencies" works. It also cleans up the duplicate
definitions for low and high speed constants.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: John Clemens <clemej@alum.rpi.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc/platforms/pmac_cpufreq.c')
-rw-r--r-- | arch/ppc/platforms/pmac_cpufreq.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c index f7fb2786cd50..48e482c8bd0d 100644 --- a/arch/ppc/platforms/pmac_cpufreq.c +++ b/arch/ppc/platforms/pmac_cpufreq.c | |||
@@ -85,14 +85,11 @@ static int no_schedule; | |||
85 | static int has_cpu_l2lve; | 85 | static int has_cpu_l2lve; |
86 | 86 | ||
87 | 87 | ||
88 | #define PMAC_CPU_LOW_SPEED 1 | ||
89 | #define PMAC_CPU_HIGH_SPEED 0 | ||
90 | |||
91 | /* There are only two frequency states for each processor. Values | 88 | /* There are only two frequency states for each processor. Values |
92 | * are in kHz for the time being. | 89 | * are in kHz for the time being. |
93 | */ | 90 | */ |
94 | #define CPUFREQ_HIGH PMAC_CPU_HIGH_SPEED | 91 | #define CPUFREQ_HIGH 0 |
95 | #define CPUFREQ_LOW PMAC_CPU_LOW_SPEED | 92 | #define CPUFREQ_LOW 1 |
96 | 93 | ||
97 | static struct cpufreq_frequency_table pmac_cpu_freqs[] = { | 94 | static struct cpufreq_frequency_table pmac_cpu_freqs[] = { |
98 | {CPUFREQ_HIGH, 0}, | 95 | {CPUFREQ_HIGH, 0}, |
@@ -100,6 +97,11 @@ static struct cpufreq_frequency_table pmac_cpu_freqs[] = { | |||
100 | {0, CPUFREQ_TABLE_END}, | 97 | {0, CPUFREQ_TABLE_END}, |
101 | }; | 98 | }; |
102 | 99 | ||
100 | static struct freq_attr* pmac_cpu_freqs_attr[] = { | ||
101 | &cpufreq_freq_attr_scaling_available_freqs, | ||
102 | NULL, | ||
103 | }; | ||
104 | |||
103 | static inline void local_delay(unsigned long ms) | 105 | static inline void local_delay(unsigned long ms) |
104 | { | 106 | { |
105 | if (no_schedule) | 107 | if (no_schedule) |
@@ -355,7 +357,7 @@ static int __pmac do_set_cpu_speed(int speed_mode, int notify) | |||
355 | static unsigned long prev_l3cr; | 357 | static unsigned long prev_l3cr; |
356 | 358 | ||
357 | freqs.old = cur_freq; | 359 | freqs.old = cur_freq; |
358 | freqs.new = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq; | 360 | freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; |
359 | freqs.cpu = smp_processor_id(); | 361 | freqs.cpu = smp_processor_id(); |
360 | 362 | ||
361 | if (freqs.old == freqs.new) | 363 | if (freqs.old == freqs.new) |
@@ -363,7 +365,7 @@ static int __pmac do_set_cpu_speed(int speed_mode, int notify) | |||
363 | 365 | ||
364 | if (notify) | 366 | if (notify) |
365 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 367 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
366 | if (speed_mode == PMAC_CPU_LOW_SPEED && | 368 | if (speed_mode == CPUFREQ_LOW && |
367 | cpu_has_feature(CPU_FTR_L3CR)) { | 369 | cpu_has_feature(CPU_FTR_L3CR)) { |
368 | l3cr = _get_L3CR(); | 370 | l3cr = _get_L3CR(); |
369 | if (l3cr & L3CR_L3E) { | 371 | if (l3cr & L3CR_L3E) { |
@@ -371,8 +373,8 @@ static int __pmac do_set_cpu_speed(int speed_mode, int notify) | |||
371 | _set_L3CR(0); | 373 | _set_L3CR(0); |
372 | } | 374 | } |
373 | } | 375 | } |
374 | set_speed_proc(speed_mode == PMAC_CPU_LOW_SPEED); | 376 | set_speed_proc(speed_mode == CPUFREQ_LOW); |
375 | if (speed_mode == PMAC_CPU_HIGH_SPEED && | 377 | if (speed_mode == CPUFREQ_HIGH && |
376 | cpu_has_feature(CPU_FTR_L3CR)) { | 378 | cpu_has_feature(CPU_FTR_L3CR)) { |
377 | l3cr = _get_L3CR(); | 379 | l3cr = _get_L3CR(); |
378 | if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr) | 380 | if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr) |
@@ -380,7 +382,7 @@ static int __pmac do_set_cpu_speed(int speed_mode, int notify) | |||
380 | } | 382 | } |
381 | if (notify) | 383 | if (notify) |
382 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 384 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
383 | cur_freq = (speed_mode == PMAC_CPU_HIGH_SPEED) ? hi_freq : low_freq; | 385 | cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; |
384 | 386 | ||
385 | return 0; | 387 | return 0; |
386 | } | 388 | } |
@@ -423,7 +425,8 @@ static int __pmac pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
423 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; | 425 | policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; |
424 | policy->cur = cur_freq; | 426 | policy->cur = cur_freq; |
425 | 427 | ||
426 | return cpufreq_frequency_table_cpuinfo(policy, &pmac_cpu_freqs[0]); | 428 | cpufreq_frequency_table_get_attr(pmac_cpu_freqs, policy->cpu); |
429 | return cpufreq_frequency_table_cpuinfo(policy, pmac_cpu_freqs); | ||
427 | } | 430 | } |
428 | 431 | ||
429 | static u32 __pmac read_gpio(struct device_node *np) | 432 | static u32 __pmac read_gpio(struct device_node *np) |
@@ -457,7 +460,7 @@ static int __pmac pmac_cpufreq_suspend(struct cpufreq_policy *policy, u32 state) | |||
457 | no_schedule = 1; | 460 | no_schedule = 1; |
458 | sleep_freq = cur_freq; | 461 | sleep_freq = cur_freq; |
459 | if (cur_freq == low_freq) | 462 | if (cur_freq == low_freq) |
460 | do_set_cpu_speed(PMAC_CPU_HIGH_SPEED, 0); | 463 | do_set_cpu_speed(CPUFREQ_HIGH, 0); |
461 | return 0; | 464 | return 0; |
462 | } | 465 | } |
463 | 466 | ||
@@ -473,8 +476,8 @@ static int __pmac pmac_cpufreq_resume(struct cpufreq_policy *policy) | |||
473 | * is that we force a switch to whatever it was, which is | 476 | * is that we force a switch to whatever it was, which is |
474 | * probably high speed due to our suspend() routine | 477 | * probably high speed due to our suspend() routine |
475 | */ | 478 | */ |
476 | do_set_cpu_speed(sleep_freq == low_freq ? PMAC_CPU_LOW_SPEED | 479 | do_set_cpu_speed(sleep_freq == low_freq ? |
477 | : PMAC_CPU_HIGH_SPEED, 0); | 480 | CPUFREQ_LOW : CPUFREQ_HIGH, 0); |
478 | 481 | ||
479 | no_schedule = 0; | 482 | no_schedule = 0; |
480 | return 0; | 483 | return 0; |
@@ -488,6 +491,7 @@ static struct cpufreq_driver pmac_cpufreq_driver = { | |||
488 | .suspend = pmac_cpufreq_suspend, | 491 | .suspend = pmac_cpufreq_suspend, |
489 | .resume = pmac_cpufreq_resume, | 492 | .resume = pmac_cpufreq_resume, |
490 | .flags = CPUFREQ_PM_NO_WARN, | 493 | .flags = CPUFREQ_PM_NO_WARN, |
494 | .attr = pmac_cpu_freqs_attr, | ||
491 | .name = "powermac", | 495 | .name = "powermac", |
492 | .owner = THIS_MODULE, | 496 | .owner = THIS_MODULE, |
493 | }; | 497 | }; |