diff options
author | Graf Yang <graf.yang@analog.com> | 2010-03-07 22:01:35 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-03-09 00:30:53 -0500 |
commit | 7998a8787a8b35fede689c2bb716f65b231e7492 (patch) | |
tree | 07a9d6c0e27923cfdbe237aa0a0cfca6cb9f095c /arch/blackfin/mach-common/cpufreq.c | |
parent | f2b0cd61cf635cbdc110472f6edc97328322cb8b (diff) |
Blackfin: scale calibration when cpu freq changes
Need to make sure we update the loops_per_jiffy values when we start
changing the core clock.
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/mach-common/cpufreq.c')
-rw-r--r-- | arch/blackfin/mach-common/cpufreq.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/arch/blackfin/mach-common/cpufreq.c b/arch/blackfin/mach-common/cpufreq.c index 5d7f8ab5509a..4391d03dc845 100644 --- a/arch/blackfin/mach-common/cpufreq.c +++ b/arch/blackfin/mach-common/cpufreq.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/cpufreq.h> | 12 | #include <linux/cpufreq.h> |
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/delay.h> | ||
14 | #include <asm/blackfin.h> | 15 | #include <asm/blackfin.h> |
15 | #include <asm/time.h> | 16 | #include <asm/time.h> |
16 | #include <asm/dpmc.h> | 17 | #include <asm/dpmc.h> |
@@ -99,13 +100,15 @@ static unsigned int bfin_getfreq_khz(unsigned int cpu) | |||
99 | return get_cclk() / 1000; | 100 | return get_cclk() / 1000; |
100 | } | 101 | } |
101 | 102 | ||
102 | |||
103 | static int bfin_target(struct cpufreq_policy *poli, | 103 | static int bfin_target(struct cpufreq_policy *poli, |
104 | unsigned int target_freq, unsigned int relation) | 104 | unsigned int target_freq, unsigned int relation) |
105 | { | 105 | { |
106 | unsigned int index, plldiv, cpu; | 106 | unsigned int index, plldiv, cpu; |
107 | unsigned long flags, cclk_hz; | 107 | unsigned long flags, cclk_hz; |
108 | struct cpufreq_freqs freqs; | 108 | struct cpufreq_freqs freqs; |
109 | static unsigned long lpj_ref; | ||
110 | static unsigned int lpj_ref_freq; | ||
111 | |||
109 | #if defined(CONFIG_CYCLES_CLOCKSOURCE) | 112 | #if defined(CONFIG_CYCLES_CLOCKSOURCE) |
110 | cycles_t cycles; | 113 | cycles_t cycles; |
111 | #endif | 114 | #endif |
@@ -144,6 +147,14 @@ static int bfin_target(struct cpufreq_policy *poli, | |||
144 | (cycles << __bfin_cycles_mod) - (cycles << index); | 147 | (cycles << __bfin_cycles_mod) - (cycles << index); |
145 | __bfin_cycles_mod = index; | 148 | __bfin_cycles_mod = index; |
146 | #endif | 149 | #endif |
150 | if (!lpj_ref_freq) { | ||
151 | lpj_ref = loops_per_jiffy; | ||
152 | lpj_ref_freq = freqs.old; | ||
153 | } | ||
154 | if (freqs.new != freqs.old) { | ||
155 | loops_per_jiffy = cpufreq_scale(lpj_ref, | ||
156 | lpj_ref_freq, freqs.new); | ||
157 | } | ||
147 | local_irq_restore_hw(flags); | 158 | local_irq_restore_hw(flags); |
148 | } | 159 | } |
149 | /* TODO: just test case for cycles clock source, remove later */ | 160 | /* TODO: just test case for cycles clock source, remove later */ |