summaryrefslogtreecommitdiff
path: root/arch/arm/vfp
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2011-02-10 02:08:32 -0800
committerColin Cross <ccross@android.com>2011-05-23 18:10:21 -0700
commit5e0d41cd13362586879a18a2e1565c69fd3dfe00 (patch)
tree1b6473a53dcf2a2fc7045692ee51e2f175aec7aa /arch/arm/vfp
parent26e6d4b214453a241c4b13d437d948fe9c934f1d (diff)
ARM: vfp: Use cpu pm notifiers to save vfp state
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/vfp')
-rw-r--r--arch/arm/vfp/vfpmodule.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index f74695075e64..d4e2aa061a8b 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -21,6 +21,7 @@
#include <asm/cputype.h>
#include <asm/thread_notify.h>
#include <asm/vfp.h>
+#include <asm/cpu_pm.h>
#include "vfpinstr.h"
#include "vfp.h"
@@ -169,6 +170,35 @@ static struct notifier_block vfp_notifier_block = {
.notifier_call = vfp_notifier,
};
+static int vfp_cpu_pm_notifier(struct notifier_block *self, unsigned long cmd,
+ void *v)
+{
+ u32 fpexc = fmrx(FPEXC);
+ unsigned int cpu = smp_processor_id();
+
+ switch (cmd) {
+ case CPU_PM_ENTER:
+ if (last_VFP_context[cpu]) {
+ fmxr(FPEXC, fpexc | FPEXC_EN);
+ vfp_save_state(last_VFP_context[cpu], fpexc);
+ /* force a reload when coming back from idle */
+ last_VFP_context[cpu] = NULL;
+ fmxr(FPEXC, fpexc & ~FPEXC_EN);
+ }
+ break;
+ case CPU_PM_ENTER_FAILED:
+ case CPU_PM_EXIT:
+ /* make sure VFP is disabled when leaving idle */
+ fmxr(FPEXC, fpexc & ~FPEXC_EN);
+ break;
+ }
+ return NOTIFY_OK;
+}
+
+static struct notifier_block vfp_cpu_pm_notifier_block = {
+ .notifier_call = vfp_cpu_pm_notifier,
+};
+
/*
* Raise a SIGFPE for the current process.
* sicode describes the signal being raised.
@@ -572,6 +602,7 @@ static int __init vfp_init(void)
vfp_vector = vfp_support_entry;
thread_register_notifier(&vfp_notifier_block);
+ cpu_pm_register_notifier(&vfp_cpu_pm_notifier_block);
vfp_pm_init();
/*