diff options
-rw-r--r-- | arch/avr32/mach-at32ap/cpufreq.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/avr32/mach-at32ap/cpufreq.c b/arch/avr32/mach-at32ap/cpufreq.c index d84efe4984ab..024c586e936c 100644 --- a/arch/avr32/mach-at32ap/cpufreq.c +++ b/arch/avr32/mach-at32ap/cpufreq.c | |||
@@ -40,6 +40,9 @@ static unsigned int at32_get_speed(unsigned int cpu) | |||
40 | return (unsigned int)((clk_get_rate(cpuclk) + 500) / 1000); | 40 | return (unsigned int)((clk_get_rate(cpuclk) + 500) / 1000); |
41 | } | 41 | } |
42 | 42 | ||
43 | static unsigned int ref_freq; | ||
44 | static unsigned long loops_per_jiffy_ref; | ||
45 | |||
43 | static int at32_set_target(struct cpufreq_policy *policy, | 46 | static int at32_set_target(struct cpufreq_policy *policy, |
44 | unsigned int target_freq, | 47 | unsigned int target_freq, |
45 | unsigned int relation) | 48 | unsigned int relation) |
@@ -61,8 +64,19 @@ static int at32_set_target(struct cpufreq_policy *policy, | |||
61 | freqs.cpu = 0; | 64 | freqs.cpu = 0; |
62 | freqs.flags = 0; | 65 | freqs.flags = 0; |
63 | 66 | ||
67 | if (!ref_freq) { | ||
68 | ref_freq = freqs.old; | ||
69 | loops_per_jiffy_ref = boot_cpu_data.loops_per_jiffy; | ||
70 | } | ||
71 | |||
64 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 72 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
73 | if (freqs.old < freqs.new) | ||
74 | boot_cpu_data.loops_per_jiffy = cpufreq_scale( | ||
75 | loops_per_jiffy_ref, ref_freq, freqs.new); | ||
65 | clk_set_rate(cpuclk, freq); | 76 | clk_set_rate(cpuclk, freq); |
77 | if (freqs.new < freqs.old) | ||
78 | boot_cpu_data.loops_per_jiffy = cpufreq_scale( | ||
79 | loops_per_jiffy_ref, ref_freq, freqs.new); | ||
66 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | 80 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); |
67 | 81 | ||
68 | pr_debug("cpufreq: set frequency %lu Hz\n", freq); | 82 | pr_debug("cpufreq: set frequency %lu Hz\n", freq); |