Skip to content

Commit 746a9d1

Browse files
colincrossSantosh Shilimkar
authored andcommitted
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>
1 parent 254056f commit 746a9d1

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

‎arch/arm/vfp/vfpmodule.c‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/module.h>
1212
#include <linux/types.h>
1313
#include <linux/cpu.h>
14+
#include <linux/cpu_pm.h>
1415
#include <linux/kernel.h>
1516
#include <linux/notifier.h>
1617
#include <linux/signal.h>
@@ -436,9 +437,7 @@ static void vfp_enable(void *unused)
436437
set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
437438
}
438439

439-
#ifdef CONFIG_PM
440-
#include <linux/syscore_ops.h>
441-
440+
#ifdef CONFIG_CPU_PM
442441
static int vfp_pm_suspend(void)
443442
{
444443
struct thread_info *ti = current_thread_info();
@@ -468,19 +467,33 @@ static void vfp_pm_resume(void)
468467
fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
469468
}
470469

471-
static struct syscore_ops vfp_pm_syscore_ops = {
472-
.suspend = vfp_pm_suspend,
473-
.resume = vfp_pm_resume,
470+
static int vfp_cpu_pm_notifier(struct notifier_block *self, unsigned long cmd,
471+
void *v)
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,
474487
};
475488

476489
static void vfp_pm_init(void)
477490
{
478-
register_syscore_ops(&vfp_pm_syscore_ops);
491+
cpu_pm_register_notifier(&vfp_cpu_pm_notifier_block);
479492
}
480493

481494
#else
482495
static inline void vfp_pm_init(void) { }
483-
#endif /* CONFIG_PM */
496+
#endif /* CONFIG_CPU_PM */
484497

485498
/*
486499
* Ensure that the VFP state stored in 'thread->vfpstate' is up to date

0 commit comments

Comments
 (0)