aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/pmac32-cpufreq.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-08-14 10:08:24 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-30 19:11:08 -0400
commitd4019f0a92ab802f385cc9c8ad3ab7b5449712cb (patch)
treeebd06695585e457ae1bf219653452b111e7508db /drivers/cpufreq/pmac32-cpufreq.c
parent7dbf694db6ac7c759599316d50d7050efcbd512a (diff)
cpufreq: move freq change notifications to cpufreq core
Most of the drivers do following in their ->target_index() routines: struct cpufreq_freqs freqs; freqs.old = old freq... freqs.new = new freq... cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* Change rate here */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); This is replicated over all cpufreq drivers today and there doesn't exists a good enough reason why this shouldn't be moved to cpufreq core instead. There are few special cases though, like exynos5440, which doesn't do everything on the call to ->target_index() routine and call some kind of bottom halves for doing this work, work/tasklet/etc.. They may continue doing notification from their own code as flag: CPUFREQ_ASYNC_NOTIFICATION is already set for them. All drivers are also modified in this patch to avoid breaking 'git bisect', as double notification would happen otherwise. Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Russell King <linux@arm.linux.org.uk> Acked-by: Stephen Warren <swarren@nvidia.com> Tested-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Nicolas Pitre <nicolas.pitre@linaro.org> Reviewed-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/pmac32-cpufreq.c')
-rw-r--r--drivers/cpufreq/pmac32-cpufreq.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c
index 05f705e1b7a2..cf55d202f332 100644
--- a/drivers/cpufreq/pmac32-cpufreq.c
+++ b/drivers/cpufreq/pmac32-cpufreq.c
@@ -331,21 +331,11 @@ static int pmu_set_cpu_speed(int low_speed)
331 return 0; 331 return 0;
332} 332}
333 333
334static int do_set_cpu_speed(struct cpufreq_policy *policy, int speed_mode, 334static int do_set_cpu_speed(struct cpufreq_policy *policy, int speed_mode)
335 int notify)
336{ 335{
337 struct cpufreq_freqs freqs;
338 unsigned long l3cr; 336 unsigned long l3cr;
339 static unsigned long prev_l3cr; 337 static unsigned long prev_l3cr;
340 338
341 freqs.old = cur_freq;
342 freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq;
343
344 if (freqs.old == freqs.new)
345 return 0;
346
347 if (notify)
348 cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE);
349 if (speed_mode == CPUFREQ_LOW && 339 if (speed_mode == CPUFREQ_LOW &&
350 cpu_has_feature(CPU_FTR_L3CR)) { 340 cpu_has_feature(CPU_FTR_L3CR)) {
351 l3cr = _get_L3CR(); 341 l3cr = _get_L3CR();
@@ -361,8 +351,6 @@ static int do_set_cpu_speed(struct cpufreq_policy *policy, int speed_mode,
361 if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr) 351 if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr)
362 _set_L3CR(prev_l3cr); 352 _set_L3CR(prev_l3cr);
363 } 353 }
364 if (notify)
365 cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE);
366 cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq; 354 cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq;
367 355
368 return 0; 356 return 0;
@@ -378,7 +366,7 @@ static int pmac_cpufreq_target( struct cpufreq_policy *policy,
378{ 366{
379 int rc; 367 int rc;
380 368
381 rc = do_set_cpu_speed(policy, index, 1); 369 rc = do_set_cpu_speed(policy, index);
382 370
383 ppc_proc_freq = cur_freq * 1000ul; 371 ppc_proc_freq = cur_freq * 1000ul;
384 return rc; 372 return rc;
@@ -420,7 +408,7 @@ static int pmac_cpufreq_suspend(struct cpufreq_policy *policy)
420 no_schedule = 1; 408 no_schedule = 1;
421 sleep_freq = cur_freq; 409 sleep_freq = cur_freq;
422 if (cur_freq == low_freq && !is_pmu_based) 410 if (cur_freq == low_freq && !is_pmu_based)
423 do_set_cpu_speed(policy, CPUFREQ_HIGH, 0); 411 do_set_cpu_speed(policy, CPUFREQ_HIGH);
424 return 0; 412 return 0;
425} 413}
426 414
@@ -437,7 +425,7 @@ static int pmac_cpufreq_resume(struct cpufreq_policy *policy)
437 * probably high speed due to our suspend() routine 425 * probably high speed due to our suspend() routine
438 */ 426 */
439 do_set_cpu_speed(policy, sleep_freq == low_freq ? 427 do_set_cpu_speed(policy, sleep_freq == low_freq ?
440 CPUFREQ_LOW : CPUFREQ_HIGH, 0); 428 CPUFREQ_LOW : CPUFREQ_HIGH);
441 429
442 ppc_proc_freq = cur_freq * 1000ul; 430 ppc_proc_freq = cur_freq * 1000ul;
443 431