aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-03-03 22:00:29 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-06 09:04:12 -0500
commit59625ba393881f224b4af9ab1c8ed494c643fb87 (patch)
tree09accc9a779ace1e6a32ec086fdefceab63d47a4
parentd248bb89f94c193d5f88dbaeb32858d8d3c5762a (diff)
cpufreq: s5pv210: Use cpufreq_generic_suspend()
The cpufreq core now supports suspending and resuming of cpufreq drivers and governors during systems suspend and resume, so use the common infrastructure instead of defining special PM notifiers for the same thing. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> [rjw: Changelog] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/s5pv210-cpufreq.c49
1 files changed, 3 insertions, 46 deletions
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index 55a8e9fa9435..72421534fff5 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -18,7 +18,6 @@
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/reboot.h> 19#include <linux/reboot.h>
20#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
21#include <linux/suspend.h>
22 21
23#include <mach/map.h> 22#include <mach/map.h>
24#include <mach/regs-clock.h> 23#include <mach/regs-clock.h>
@@ -435,18 +434,6 @@ exit:
435 return ret; 434 return ret;
436} 435}
437 436
438#ifdef CONFIG_PM
439static int s5pv210_cpufreq_suspend(struct cpufreq_policy *policy)
440{
441 return 0;
442}
443
444static int s5pv210_cpufreq_resume(struct cpufreq_policy *policy)
445{
446 return 0;
447}
448#endif
449
450static int check_mem_type(void __iomem *dmc_reg) 437static int check_mem_type(void __iomem *dmc_reg)
451{ 438{
452 unsigned long val; 439 unsigned long val;
@@ -502,6 +489,7 @@ static int __init s5pv210_cpu_init(struct cpufreq_policy *policy)
502 s5pv210_dram_conf[1].refresh = (__raw_readl(S5P_VA_DMC1 + 0x30) * 1000); 489 s5pv210_dram_conf[1].refresh = (__raw_readl(S5P_VA_DMC1 + 0x30) * 1000);
503 s5pv210_dram_conf[1].freq = clk_get_rate(dmc1_clk); 490 s5pv210_dram_conf[1].freq = clk_get_rate(dmc1_clk);
504 491
492 policy->suspend_freq = SLEEP_FREQ;
505 return cpufreq_generic_init(policy, s5pv210_freq_table, 40000); 493 return cpufreq_generic_init(policy, s5pv210_freq_table, 40000);
506 494
507out_dmc1: 495out_dmc1:
@@ -511,32 +499,6 @@ out_dmc0:
511 return ret; 499 return ret;
512} 500}
513 501
514static int s5pv210_cpufreq_notifier_event(struct notifier_block *this,
515 unsigned long event, void *ptr)
516{
517 int ret;
518
519 switch (event) {
520 case PM_SUSPEND_PREPARE:
521 ret = cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ, 0);
522 if (ret < 0)
523 return NOTIFY_BAD;
524
525 /* Disable updation of cpu frequency */
526 no_cpufreq_access = true;
527 return NOTIFY_OK;
528 case PM_POST_RESTORE:
529 case PM_POST_SUSPEND:
530 /* Enable updation of cpu frequency */
531 no_cpufreq_access = false;
532 cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ, 0);
533
534 return NOTIFY_OK;
535 }
536
537 return NOTIFY_DONE;
538}
539
540static int s5pv210_cpufreq_reboot_notifier_event(struct notifier_block *this, 502static int s5pv210_cpufreq_reboot_notifier_event(struct notifier_block *this,
541 unsigned long event, void *ptr) 503 unsigned long event, void *ptr)
542{ 504{
@@ -558,15 +520,11 @@ static struct cpufreq_driver s5pv210_driver = {
558 .init = s5pv210_cpu_init, 520 .init = s5pv210_cpu_init,
559 .name = "s5pv210", 521 .name = "s5pv210",
560#ifdef CONFIG_PM 522#ifdef CONFIG_PM
561 .suspend = s5pv210_cpufreq_suspend, 523 .suspend = cpufreq_generic_suspend,
562 .resume = s5pv210_cpufreq_resume, 524 .resume = cpufreq_generic_suspend, /* We need to set SLEEP FREQ again */
563#endif 525#endif
564}; 526};
565 527
566static struct notifier_block s5pv210_cpufreq_notifier = {
567 .notifier_call = s5pv210_cpufreq_notifier_event,
568};
569
570static struct notifier_block s5pv210_cpufreq_reboot_notifier = { 528static struct notifier_block s5pv210_cpufreq_reboot_notifier = {
571 .notifier_call = s5pv210_cpufreq_reboot_notifier_event, 529 .notifier_call = s5pv210_cpufreq_reboot_notifier_event,
572}; 530};
@@ -586,7 +544,6 @@ static int __init s5pv210_cpufreq_init(void)
586 return PTR_ERR(int_regulator); 544 return PTR_ERR(int_regulator);
587 } 545 }
588 546
589 register_pm_notifier(&s5pv210_cpufreq_notifier);
590 register_reboot_notifier(&s5pv210_cpufreq_reboot_notifier); 547 register_reboot_notifier(&s5pv210_cpufreq_reboot_notifier);
591 548
592 return cpufreq_register_driver(&s5pv210_driver); 549 return cpufreq_register_driver(&s5pv210_driver);