aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-12-22 19:24:34 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-12-25 17:40:01 -0500
commita8cf27bee7adc40d91956cf1b9e44d7001f93aba (patch)
treeffd8ad9de0de9d32a60b6063764e81674828ea4e /arch
parent9ee27ffbe303ce18e7336115f1d443e9911eba53 (diff)
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')
-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 7fda2301c9b2..77b8fc12fc2f 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 = {
239struct sh7372_pm_domain sh7372_a4r = { 239struct sh7372_pm_domain sh7372_a4r = {
240 .genpd.name = "A4R", 240 .genpd.name = "A4R",
241 .bit_shift = 5, 241 .bit_shift = 5,
242 .gov = &pm_domain_always_on_gov,
243 .suspend = sh7372_a4r_suspend, 242 .suspend = sh7372_a4r_suspend,
244 .resume = sh7372_intcs_resume, 243 .resume = sh7372_intcs_resume,
245}; 244};
@@ -535,9 +534,37 @@ static int sh7372_enter_suspend(suspend_state_t suspend_state)
535 return 0; 534 return 0;
536} 535}
537 536
537/**
538 * sh7372_pm_notifier_fn - SH7372 PM notifier routine.
539 * @notifier: Unused.
540 * @pm_event: Event being handled.
541 * @unused: Unused.
542 */
543static int sh7372_pm_notifier_fn(struct notifier_block *notifier,
544 unsigned long pm_event, void *unused)
545{
546 switch (pm_event) {
547 case PM_SUSPEND_PREPARE:
548 /*
549 * This is necessary, because the A4R domain has to be "on"
550 * when suspend_device_irqs() and resume_device_irqs() are
551 * executed during system suspend and resume, respectively, so
552 * that those functions don't crash while accessing the INTCS.
553 */
554 pm_genpd_poweron(&sh7372_a4r.genpd);
555 break;
556 case PM_POST_SUSPEND:
557 pm_genpd_poweroff_unused();
558 break;
559 }
560
561 return NOTIFY_DONE;
562}
563
538static void sh7372_suspend_init(void) 564static void sh7372_suspend_init(void)
539{ 565{
540 shmobile_suspend_ops.enter = sh7372_enter_suspend; 566 shmobile_suspend_ops.enter = sh7372_enter_suspend;
567 pm_notifier(sh7372_pm_notifier_fn, 0);
541} 568}
542#else 569#else
543static void sh7372_suspend_init(void) {} 570static void sh7372_suspend_init(void) {}