All of lore.kernel.org
 help / color / mirror / Atom feed
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: <linux-arm-kernel@lists.infradead.org>
Cc: <linux-kernel@vger.kernel.org>, <linux@arm.linux.org.uk>,
	<ccross@android.com>, <rjw@sisk.pl>, <khilman@ti.com>,
	Santosh Shilimkar <santosh.shilimkar@ti.com>
Subject: [PATCH v2 4/5] ARM: vfp: Use cpu pm notifiers to save vfp state
Date: Sat, 3 Sep 2011 20:09:14 +0530	[thread overview]
Message-ID: <1315060755-4613-5-git-send-email-santosh.shilimkar@ti.com> (raw)
In-Reply-To: <1315060755-4613-1-git-send-email-santosh.shilimkar@ti.com>

From: Colin Cross <ccross@android.com>

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>
[santosh.shilimkar@ti.com: Rebased against 3.1-rc4, resolved the conflicts]
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 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 79bcb43..fe4b60b 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/cpu.h>
+#include <linux/cpu_pm.h>
 #include <linux/kernel.h>
 #include <linux/notifier.h>
 #include <linux/signal.h>
@@ -436,9 +437,7 @@ static void vfp_enable(void *unused)
 	set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
 }
 
-#ifdef CONFIG_PM
-#include <linux/syscore_ops.h>
-
+#ifdef CONFIG_CPU_PM
 static int vfp_pm_suspend(void)
 {
 	struct thread_info *ti = current_thread_info();
@@ -468,19 +467,33 @@ static void vfp_pm_resume(void)
 	fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
 }
 
-static struct syscore_ops vfp_pm_syscore_ops = {
-	.suspend	= vfp_pm_suspend,
-	.resume		= vfp_pm_resume,
+static int vfp_cpu_pm_notifier(struct notifier_block *self, unsigned long cmd,
+	void *v)
+{
+	switch (cmd) {
+	case CPU_PM_ENTER:
+		vfp_pm_suspend();
+		break;
+	case CPU_PM_ENTER_FAILED:
+	case CPU_PM_EXIT:
+		vfp_pm_resume();
+		break;
+	}
+	return NOTIFY_OK;
+}
+
+static struct notifier_block vfp_cpu_pm_notifier_block = {
+	.notifier_call = vfp_cpu_pm_notifier,
 };
 
 static void vfp_pm_init(void)
 {
-	register_syscore_ops(&vfp_pm_syscore_ops);
+	cpu_pm_register_notifier(&vfp_cpu_pm_notifier_block);
 }
 
 #else
 static inline void vfp_pm_init(void) { }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_CPU_PM */
 
 /*
  * Ensure that the VFP state stored in 'thread->vfpstate' is up to date
-- 
1.7.4.1


WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 4/5] ARM: vfp: Use cpu pm notifiers to save vfp state
Date: Sat, 3 Sep 2011 20:09:14 +0530	[thread overview]
Message-ID: <1315060755-4613-5-git-send-email-santosh.shilimkar@ti.com> (raw)
In-Reply-To: <1315060755-4613-1-git-send-email-santosh.shilimkar@ti.com>

From: Colin Cross <ccross@android.com>

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>
[santosh.shilimkar at ti.com: Rebased against 3.1-rc4, resolved the conflicts]
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
---
 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 79bcb43..fe4b60b 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/cpu.h>
+#include <linux/cpu_pm.h>
 #include <linux/kernel.h>
 #include <linux/notifier.h>
 #include <linux/signal.h>
@@ -436,9 +437,7 @@ static void vfp_enable(void *unused)
 	set_copro_access(access | CPACC_FULL(10) | CPACC_FULL(11));
 }
 
-#ifdef CONFIG_PM
-#include <linux/syscore_ops.h>
-
+#ifdef CONFIG_CPU_PM
 static int vfp_pm_suspend(void)
 {
 	struct thread_info *ti = current_thread_info();
@@ -468,19 +467,33 @@ static void vfp_pm_resume(void)
 	fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
 }
 
-static struct syscore_ops vfp_pm_syscore_ops = {
-	.suspend	= vfp_pm_suspend,
-	.resume		= vfp_pm_resume,
+static int vfp_cpu_pm_notifier(struct notifier_block *self, unsigned long cmd,
+	void *v)
+{
+	switch (cmd) {
+	case CPU_PM_ENTER:
+		vfp_pm_suspend();
+		break;
+	case CPU_PM_ENTER_FAILED:
+	case CPU_PM_EXIT:
+		vfp_pm_resume();
+		break;
+	}
+	return NOTIFY_OK;
+}
+
+static struct notifier_block vfp_cpu_pm_notifier_block = {
+	.notifier_call = vfp_cpu_pm_notifier,
 };
 
 static void vfp_pm_init(void)
 {
-	register_syscore_ops(&vfp_pm_syscore_ops);
+	cpu_pm_register_notifier(&vfp_cpu_pm_notifier_block);
 }
 
 #else
 static inline void vfp_pm_init(void) { }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_CPU_PM */
 
 /*
  * Ensure that the VFP state stored in 'thread->vfpstate' is up to date
-- 
1.7.4.1

  parent reply	other threads:[~2011-09-03 14:40 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-03 14:39 [PATCH v2 0/5] CPU PM notifiers Santosh Shilimkar
2011-09-03 14:39 ` Santosh Shilimkar
2011-09-03 14:39 ` [PATCH v2 1/5] cpu_pm: Add cpu power management notifiers Santosh Shilimkar
2011-09-03 14:39   ` Santosh Shilimkar
2011-09-09 22:56   ` Andrew Morton
2011-09-09 22:56     ` Andrew Morton
2011-09-10  4:02     ` Santosh
2011-09-10  4:02       ` Santosh
2011-09-10  9:31     ` Santosh
2011-09-10  9:31       ` Santosh
2011-09-12  5:02       ` Santosh
2011-09-12  5:02         ` Santosh
2011-09-13  5:42         ` Santosh
2011-09-13  5:42           ` Santosh
2011-09-03 14:39 ` [PATCH v2 2/5] cpu_pm: call notifiers during suspend Santosh Shilimkar
2011-09-03 14:39   ` Santosh Shilimkar
2011-09-07 20:02   ` Kevin Hilman
2011-09-07 20:02     ` Kevin Hilman
2011-09-08  5:16     ` Santosh
2011-09-08  5:16       ` Santosh
2011-09-08 14:01       ` Kevin Hilman
2011-09-08 14:01         ` Kevin Hilman
2011-09-08 16:12         ` Santosh
2011-09-08 16:12           ` Santosh
2011-09-08 17:56           ` Kevin Hilman
2011-09-08 18:04         ` Colin Cross
2011-09-08 18:04           ` Colin Cross
2011-09-08 20:51           ` Kevin Hilman
2011-09-09  6:27             ` Santosh
2011-09-09  6:27               ` Santosh
2011-09-03 14:39 ` [PATCH v2 3/5] ARM: gic: Use cpu pm notifiers to save gic state Santosh Shilimkar
2011-09-03 14:39   ` Santosh Shilimkar
2011-09-03 14:39 ` Santosh Shilimkar [this message]
2011-09-03 14:39   ` [PATCH v2 4/5] ARM: vfp: Use cpu pm notifiers to save vfp state Santosh Shilimkar
2011-09-03 14:39 ` [PATCH v2 5/5] ARM: gic: Allow gic arch extensions to provide irqchip flags Santosh Shilimkar
2011-09-03 14:39   ` Santosh Shilimkar
2011-09-06  2:34 ` [PATCH v2 0/5] CPU PM notifiers Shawn Guo
2011-09-06  2:34   ` Shawn Guo
2011-09-06  5:17   ` Santosh
2011-09-06  5:17     ` Santosh
2011-09-09 18:00 ` Kevin Hilman
2011-09-09 18:00   ` Kevin Hilman
2011-09-10  5:53   ` Santosh
2011-09-10  5:53     ` Santosh
2011-09-16  4:50 ` Santosh
2011-09-16  4:50   ` Santosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315060755-4613-5-git-send-email-santosh.shilimkar@ti.com \
    --to=santosh.shilimkar@ti.com \
    --cc=ccross@android.com \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.