summaryrefslogtreecommitdiff
path: root/arch/arm/mach-shmobile/pm-sh7372.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-12-23 00:24:34 (GMT)
committerRafael J. Wysocki <rjw@sisk.pl>2011-12-25 22:40:01 (GMT)
commita8cf27bee7adc40d91956cf1b9e44d7001f93aba (patch)
treeffd8ad9de0de9d32a60b6063764e81674828ea4e /arch/arm/mach-shmobile/pm-sh7372.c
parent9ee27ffbe303ce18e7336115f1d443e9911eba53 (diff)
downloadlinux-a8cf27bee7adc40d91956cf1b9e44d7001f93aba.tar.xz
PM / shmobile: Allow the A4R domain to be turned off at run time
After adding PM QoS constraints for the I2C controller in the A4R domain, that domain can be allowed to be turned off and on by runtime PM, so remove the "always on" governor from it. However, the A4R domain has to be "on" when suspend_device_irqs() and resume_device_irqs() are executed during system suspend and resume, respectively, so that those functions don't crash while accessing the INTCS. For this reason, add a PM notifier to the SH7372 PM code and make it restore power to A4R before system suspend and remove power from all unused PM domains after system resume. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Magnus Damm <damm@opensource.se>
Diffstat (limited to 'arch/arm/mach-shmobile/pm-sh7372.c')
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 7fda230..77b8fc1 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -239,7 +239,6 @@ struct sh7372_pm_domain sh7372_d4 = {
struct sh7372_pm_domain sh7372_a4r = {
.genpd.name = "A4R",
.bit_shift = 5,
- .gov = &pm_domain_always_on_gov,
.suspend = sh7372_a4r_suspend,
.resume = sh7372_intcs_resume,
};
@@ -535,9 +534,37 @@ static int sh7372_enter_suspend(suspend_state_t suspend_state)
return 0;
}
+/**
+ * sh7372_pm_notifier_fn - SH7372 PM notifier routine.
+ * @notifier: Unused.
+ * @pm_event: Event being handled.
+ * @unused: Unused.
+ */
+static int sh7372_pm_notifier_fn(struct notifier_block *notifier,
+ unsigned long pm_event, void *unused)
+{
+ switch (pm_event) {
+ case PM_SUSPEND_PREPARE:
+ /*
+ * This is necessary, because the A4R domain has to be "on"
+ * when suspend_device_irqs() and resume_device_irqs() are
+ * executed during system suspend and resume, respectively, so
+ * that those functions don't crash while accessing the INTCS.
+ */
+ pm_genpd_poweron(&sh7372_a4r.genpd);
+ break;
+ case PM_POST_SUSPEND:
+ pm_genpd_poweroff_unused();
+ break;
+ }
+
+ return NOTIFY_DONE;
+}
+
static void sh7372_suspend_init(void)
{
shmobile_suspend_ops.enter = sh7372_enter_suspend;
+ pm_notifier(sh7372_pm_notifier_fn, 0);
}
#else
static void sh7372_suspend_init(void) {}