diff options
author | Thomas Renninger <trenn@suse.de> | 2007-06-04 14:14:40 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-06-06 21:44:40 -0400 |
commit | 1552cb923efcd0f5499104256010d2ace437581d (patch) | |
tree | b80bc75c9f19cc69d8ef542bce4bd32669c1f478 /arch/powerpc | |
parent | e7c40012b84f670ba57fe4a3f453ddecc8813e9b (diff) |
[POWERPC] cbe_cpufreq: Limit frequency via cpufreq notifier chain
... and get rid of cpufreq_set_policy call that caused a build
failure due interfering commits.
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Christian Krafft <krafft@de.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/cbe_cpufreq.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c index f9ac3fe3be97..ac445998d831 100644 --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c | |||
@@ -67,6 +67,7 @@ static u64 MIC_Slow_Next_Timer_table[] = { | |||
67 | 0x00003FC000000000ull, | 67 | 0x00003FC000000000ull, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static unsigned int pmi_frequency_limit = 0; | ||
70 | /* | 71 | /* |
71 | * hardware specific functions | 72 | * hardware specific functions |
72 | */ | 73 | */ |
@@ -164,7 +165,6 @@ static int set_pmode(int cpu, unsigned int slow_mode) { | |||
164 | 165 | ||
165 | static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg) | 166 | static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg) |
166 | { | 167 | { |
167 | struct cpufreq_policy policy; | ||
168 | u8 cpu; | 168 | u8 cpu; |
169 | u8 cbe_pmode_new; | 169 | u8 cbe_pmode_new; |
170 | 170 | ||
@@ -173,15 +173,27 @@ static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg) | |||
173 | cpu = cbe_node_to_cpu(pmi_msg.data1); | 173 | cpu = cbe_node_to_cpu(pmi_msg.data1); |
174 | cbe_pmode_new = pmi_msg.data2; | 174 | cbe_pmode_new = pmi_msg.data2; |
175 | 175 | ||
176 | cpufreq_get_policy(&policy, cpu); | 176 | pmi_frequency_limit = cbe_freqs[cbe_pmode_new].frequency; |
177 | 177 | ||
178 | policy.max = min(policy.max, cbe_freqs[cbe_pmode_new].frequency); | 178 | pr_debug("cbe_handle_pmi: max freq=%d\n", pmi_frequency_limit); |
179 | policy.min = min(policy.min, policy.max); | 179 | } |
180 | |||
181 | static int pmi_notifier(struct notifier_block *nb, | ||
182 | unsigned long event, void *data) | ||
183 | { | ||
184 | struct cpufreq_policy *policy = data; | ||
180 | 185 | ||
181 | pr_debug("cbe_handle_pmi: new policy.min=%d policy.max=%d\n", policy.min, policy.max); | 186 | if (event != CPUFREQ_INCOMPATIBLE) |
182 | cpufreq_set_policy(&policy); | 187 | return 0; |
188 | |||
189 | cpufreq_verify_within_limits(policy, 0, pmi_frequency_limit); | ||
190 | return 0; | ||
183 | } | 191 | } |
184 | 192 | ||
193 | static struct notifier_block pmi_notifier_block = { | ||
194 | .notifier_call = pmi_notifier, | ||
195 | }; | ||
196 | |||
185 | static struct pmi_handler cbe_pmi_handler = { | 197 | static struct pmi_handler cbe_pmi_handler = { |
186 | .type = PMI_TYPE_FREQ_CHANGE, | 198 | .type = PMI_TYPE_FREQ_CHANGE, |
187 | .handle_pmi_message = cbe_cpufreq_handle_pmi, | 199 | .handle_pmi_message = cbe_cpufreq_handle_pmi, |
@@ -238,12 +250,21 @@ static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
238 | 250 | ||
239 | cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); | 251 | cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); |
240 | 252 | ||
253 | if (pmi_dev) { | ||
254 | /* frequency might get limited later, initialize limit with max_freq */ | ||
255 | pmi_frequency_limit = max_freq; | ||
256 | cpufreq_register_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER); | ||
257 | } | ||
258 | |||
241 | /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ | 259 | /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ |
242 | return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs); | 260 | return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs); |
243 | } | 261 | } |
244 | 262 | ||
245 | static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) | 263 | static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) |
246 | { | 264 | { |
265 | if (pmi_dev) | ||
266 | cpufreq_unregister_notifier(&pmi_notifier_block, CPUFREQ_POLICY_NOTIFIER); | ||
267 | |||
247 | cpufreq_frequency_table_put_attr(policy->cpu); | 268 | cpufreq_frequency_table_put_attr(policy->cpu); |
248 | return 0; | 269 | return 0; |
249 | } | 270 | } |