diff options
author | Colin Cross <ccross@android.com> | 2011-02-10 05:08:32 -0500 |
---|---|---|
committer | Santosh Shilimkar <santosh.shilimkar@ti.com> | 2011-09-23 02:35:30 -0400 |
commit | 746a9d1963f1c7a3cd22662065d7dcd3d93ee62e (patch) | |
tree | 184b6ed198685e58f903da3c4c4d5c7b7fe25190 /arch | |
parent | 254056f3b12563c11e6dbcfad2fbfce20a4f3302 (diff) |
ARM: vfp: Use cpu pm notifiers to save vfp state
When the cpu is powered down in a low power mode, the vfp
registers may be reset.
This patch uses CPU_PM_ENTER and CPU_PM_EXIT notifiers to save
and restore the cpu's vfp registers.
Signed-off-by: Colin Cross <ccross@android.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-and-Acked-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Vishwanath BS <vishwanath.bs@ti.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/vfp/vfpmodule.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c index 79bcb4316930..fe4b60b1e6c7 100644 --- a/arch/arm/vfp/vfpmodule.c +++ b/arch/arm/vfp/vfpmodule.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/cpu.h> | 13 | #include <linux/cpu.h> |
14 | #include <linux/cpu_pm.h> | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
15 | #include <linux/notifier.h> | 16 | #include <linux/notifier.h> |
16 | #include <linux/signal.h> | 17 | #include <linux/signal.h> |
@@ -436,9 +437,7 @@ static void vfp_enable(void *unused) | |||
436 | set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11)); | 437 | set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11)); |
437 | } | 438 | } |
438 | 439 | ||
439 | #ifdef CONFIG_PM | 440 | #ifdef CONFIG_CPU_PM |
440 | #include <linux/syscore_ops.h> | ||
441 | |||
442 | static int vfp_pm_suspend(void) | 441 | static int vfp_pm_suspend(void) |
443 | { | 442 | { |
444 | struct thread_info *ti = current_thread_info(); | 443 | struct thread_info *ti = current_thread_info(); |
@@ -468,19 +467,33 @@ static void vfp_pm_resume(void) | |||
468 | fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN); | 467 | fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN); |
469 | } | 468 | } |
470 | 469 | ||
471 | static struct syscore_ops vfp_pm_syscore_ops = { | 470 | static int vfp_cpu_pm_notifier(struct notifier_block *self, unsigned long cmd, |
472 | .suspend = vfp_pm_suspend, | 471 | void *v) |
473 | .resume = vfp_pm_resume, | 472 | { |
473 | switch (cmd) { | ||
474 | case CPU_PM_ENTER: | ||
475 | vfp_pm_suspend(); | ||
476 | break; | ||
477 | case CPU_PM_ENTER_FAILED: | ||
478 | case CPU_PM_EXIT: | ||
479 | vfp_pm_resume(); | ||
480 | break; | ||
481 | } | ||
482 | return NOTIFY_OK; | ||
483 | } | ||
484 | |||
485 | static struct notifier_block vfp_cpu_pm_notifier_block = { | ||
486 | .notifier_call = vfp_cpu_pm_notifier, | ||
474 | }; | 487 | }; |
475 | 488 | ||
476 | static void vfp_pm_init(void) | 489 | static void vfp_pm_init(void) |
477 | { | 490 | { |
478 | register_syscore_ops(&vfp_pm_syscore_ops); | 491 | cpu_pm_register_notifier(&vfp_cpu_pm_notifier_block); |
479 | } | 492 | } |
480 | 493 | ||
481 | #else | 494 | #else |
482 | static inline void vfp_pm_init(void) { } | 495 | static inline void vfp_pm_init(void) { } |
483 | #endif /* CONFIG_PM */ | 496 | #endif /* CONFIG_CPU_PM */ |
484 | 497 | ||
485 | /* | 498 | /* |
486 | * Ensure that the VFP state stored in 'thread->vfpstate' is up to date | 499 | * Ensure that the VFP state stored in 'thread->vfpstate' is up to date |