aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-03-24 02:26:43 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-04-02 09:24:00 -0400
commitb43a7ffbf33be7e4d3b10b7714ee663ea2c52fe2 (patch)
tree7d3ac2733d76a785be12bfba75bfe244a5a31460 /arch/sparc/kernel
parentfd143b4d6fb763183ef6e46d1ab84a42c59079af (diff)
cpufreq: Notify all policy->cpus in cpufreq_notify_transition()
policy->cpus contains all online cpus that have single shared clock line. And their frequencies are always updated together. Many SMP system's cpufreq drivers take care of this in individual drivers but the best place for this code is in cpufreq core. This patch modifies cpufreq_notify_transition() to notify frequency change for all cpus in policy->cpus and hence updates all users of this API. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r--arch/sparc/kernel/us2e_cpufreq.c13
-rw-r--r--arch/sparc/kernel/us3_cpufreq.c13
2 files changed, 14 insertions, 12 deletions
diff --git a/arch/sparc/kernel/us2e_cpufreq.c b/arch/sparc/kernel/us2e_cpufreq.c
index 489fc15f3194..abe963d7b87c 100644
--- a/arch/sparc/kernel/us2e_cpufreq.c
+++ b/arch/sparc/kernel/us2e_cpufreq.c
@@ -248,8 +248,10 @@ static unsigned int us2e_freq_get(unsigned int cpu)
248 return clock_tick / estar_to_divisor(estar); 248 return clock_tick / estar_to_divisor(estar);
249} 249}
250 250
251static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index) 251static void us2e_set_cpu_divider_index(struct cpufreq_policy *policy,
252 unsigned int index)
252{ 253{
254 unsigned int cpu = policy->cpu;
253 unsigned long new_bits, new_freq; 255 unsigned long new_bits, new_freq;
254 unsigned long clock_tick, divisor, old_divisor, estar; 256 unsigned long clock_tick, divisor, old_divisor, estar;
255 cpumask_t cpus_allowed; 257 cpumask_t cpus_allowed;
@@ -272,14 +274,13 @@ static void us2e_set_cpu_divider_index(unsigned int cpu, unsigned int index)
272 274
273 freqs.old = clock_tick / old_divisor; 275 freqs.old = clock_tick / old_divisor;
274 freqs.new = new_freq; 276 freqs.new = new_freq;
275 freqs.cpu = cpu; 277 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
276 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
277 278
278 if (old_divisor != divisor) 279 if (old_divisor != divisor)
279 us2e_transition(estar, new_bits, clock_tick * 1000, 280 us2e_transition(estar, new_bits, clock_tick * 1000,
280 old_divisor, divisor); 281 old_divisor, divisor);
281 282
282 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 283 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
283 284
284 set_cpus_allowed_ptr(current, &cpus_allowed); 285 set_cpus_allowed_ptr(current, &cpus_allowed);
285} 286}
@@ -295,7 +296,7 @@ static int us2e_freq_target(struct cpufreq_policy *policy,
295 target_freq, relation, &new_index)) 296 target_freq, relation, &new_index))
296 return -EINVAL; 297 return -EINVAL;
297 298
298 us2e_set_cpu_divider_index(policy->cpu, new_index); 299 us2e_set_cpu_divider_index(policy, new_index);
299 300
300 return 0; 301 return 0;
301} 302}
@@ -335,7 +336,7 @@ static int __init us2e_freq_cpu_init(struct cpufreq_policy *policy)
335static int us2e_freq_cpu_exit(struct cpufreq_policy *policy) 336static int us2e_freq_cpu_exit(struct cpufreq_policy *policy)
336{ 337{
337 if (cpufreq_us2e_driver) 338 if (cpufreq_us2e_driver)
338 us2e_set_cpu_divider_index(policy->cpu, 0); 339 us2e_set_cpu_divider_index(policy, 0);
339 340
340 return 0; 341 return 0;
341} 342}
diff --git a/arch/sparc/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c
index eb1624b931d9..7ceb9c8458f0 100644
--- a/arch/sparc/kernel/us3_cpufreq.c
+++ b/arch/sparc/kernel/us3_cpufreq.c
@@ -96,8 +96,10 @@ static unsigned int us3_freq_get(unsigned int cpu)
96 return ret; 96 return ret;
97} 97}
98 98
99static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index) 99static void us3_set_cpu_divider_index(struct cpufreq_policy *policy,
100 unsigned int index)
100{ 101{
102 unsigned int cpu = policy->cpu;
101 unsigned long new_bits, new_freq, reg; 103 unsigned long new_bits, new_freq, reg;
102 cpumask_t cpus_allowed; 104 cpumask_t cpus_allowed;
103 struct cpufreq_freqs freqs; 105 struct cpufreq_freqs freqs;
@@ -131,14 +133,13 @@ static void us3_set_cpu_divider_index(unsigned int cpu, unsigned int index)
131 133
132 freqs.old = get_current_freq(cpu, reg); 134 freqs.old = get_current_freq(cpu, reg);
133 freqs.new = new_freq; 135 freqs.new = new_freq;
134 freqs.cpu = cpu; 136 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
135 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
136 137
137 reg &= ~SAFARI_CFG_DIV_MASK; 138 reg &= ~SAFARI_CFG_DIV_MASK;
138 reg |= new_bits; 139 reg |= new_bits;
139 write_safari_cfg(reg); 140 write_safari_cfg(reg);
140 141
141 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 142 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
142 143
143 set_cpus_allowed_ptr(current, &cpus_allowed); 144 set_cpus_allowed_ptr(current, &cpus_allowed);
144} 145}
@@ -156,7 +157,7 @@ static int us3_freq_target(struct cpufreq_policy *policy,
156 &new_index)) 157 &new_index))
157 return -EINVAL; 158 return -EINVAL;
158 159
159 us3_set_cpu_divider_index(policy->cpu, new_index); 160 us3_set_cpu_divider_index(policy, new_index);
160 161
161 return 0; 162 return 0;
162} 163}
@@ -192,7 +193,7 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
192static int us3_freq_cpu_exit(struct cpufreq_policy *policy) 193static int us3_freq_cpu_exit(struct cpufreq_policy *policy)
193{ 194{
194 if (cpufreq_us3_driver) 195 if (cpufreq_us3_driver)
195 us3_set_cpu_divider_index(policy->cpu, 0); 196 us3_set_cpu_divider_index(policy, 0);
196 197
197 return 0; 198 return 0;
198} 199}