aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/s5pv210-cpufreq.c
diff options
context:
space:
mode:
authorHuisung Kang <hs1218.kang@samsung.com>2011-06-24 03:04:15 -0400
committerDave Jones <davej@redhat.com>2011-07-13 18:29:57 -0400
commit405e6d6df739a27a267b381213aa9e86c4929543 (patch)
tree9efe5f032219af2a08c971117b9f062f4d0eff1b /drivers/cpufreq/s5pv210-cpufreq.c
parente8b4c1986efbb5b1e1bab9f359c340816e4d9869 (diff)
[CPUFREQ] S5PV210: Add pm_notifier to prevent system unstable
Minimum 800MHz is needed to enter/exit suspend mode due to voltage mismatch. Signed-off-by: Huisung Kang <hs1218.kang@samsung.com> Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq/s5pv210-cpufreq.c')
-rw-r--r--drivers/cpufreq/s5pv210-cpufreq.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index 9a5b2847434..79b1b4ec8e3 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -17,6 +17,7 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/cpufreq.h> 18#include <linux/cpufreq.h>
19#include <linux/regulator/consumer.h> 19#include <linux/regulator/consumer.h>
20#include <linux/suspend.h>
20 21
21#include <mach/map.h> 22#include <mach/map.h>
22#include <mach/regs-clock.h> 23#include <mach/regs-clock.h>
@@ -30,6 +31,9 @@ static struct cpufreq_freqs freqs;
30#define APLL_VAL_1000 ((1 << 31) | (125 << 16) | (3 << 8) | 1) 31#define APLL_VAL_1000 ((1 << 31) | (125 << 16) | (3 << 8) | 1)
31#define APLL_VAL_800 ((1 << 31) | (100 << 16) | (3 << 8) | 1) 32#define APLL_VAL_800 ((1 << 31) | (100 << 16) | (3 << 8) | 1)
32 33
34/* Use 800MHz when entering sleep mode */
35#define SLEEP_FREQ (800 * 1000)
36
33/* 37/*
34 * relation has an additional symantics other than the standard of cpufreq 38 * relation has an additional symantics other than the standard of cpufreq
35 * DISALBE_FURTHER_CPUFREQ: disable further access to target 39 * DISALBE_FURTHER_CPUFREQ: disable further access to target
@@ -552,6 +556,30 @@ out_dmc0:
552 return ret; 556 return ret;
553} 557}
554 558
559static int s5pv210_cpufreq_notifier_event(struct notifier_block *this,
560 unsigned long event, void *ptr)
561{
562 int ret;
563
564 switch (event) {
565 case PM_SUSPEND_PREPARE:
566 ret = cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ,
567 DISABLE_FURTHER_CPUFREQ);
568 if (ret < 0)
569 return NOTIFY_BAD;
570
571 return NOTIFY_OK;
572 case PM_POST_RESTORE:
573 case PM_POST_SUSPEND:
574 cpufreq_driver_target(cpufreq_cpu_get(0), SLEEP_FREQ,
575 ENABLE_FURTHER_CPUFREQ);
576
577 return NOTIFY_OK;
578 }
579
580 return NOTIFY_DONE;
581}
582
555static struct cpufreq_driver s5pv210_driver = { 583static struct cpufreq_driver s5pv210_driver = {
556 .flags = CPUFREQ_STICKY, 584 .flags = CPUFREQ_STICKY,
557 .verify = s5pv210_verify_speed, 585 .verify = s5pv210_verify_speed,
@@ -565,6 +593,10 @@ static struct cpufreq_driver s5pv210_driver = {
565#endif 593#endif
566}; 594};
567 595
596static struct notifier_block s5pv210_cpufreq_notifier = {
597 .notifier_call = s5pv210_cpufreq_notifier_event,
598};
599
568static int __init s5pv210_cpufreq_init(void) 600static int __init s5pv210_cpufreq_init(void)
569{ 601{
570 arm_regulator = regulator_get(NULL, "vddarm"); 602 arm_regulator = regulator_get(NULL, "vddarm");
@@ -580,6 +612,8 @@ static int __init s5pv210_cpufreq_init(void)
580 return PTR_ERR(int_regulator); 612 return PTR_ERR(int_regulator);
581 } 613 }
582 614
615 register_pm_notifier(&s5pv210_cpufreq_notifier);
616
583 return cpufreq_register_driver(&s5pv210_driver); 617 return cpufreq_register_driver(&s5pv210_driver);
584} 618}
585 619