aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-11-17 15:39:33 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-11-17 15:39:33 -0500
commit8b258cc8ac229aa7d5dcb7cc34cb35d9124498ac (patch)
tree9615636b05b04035af0c8eb11ee9711aa2b868a6
parentaf8db1508f2c9f3b6e633e2d2d906c6557c617f9 (diff)
PM Sleep: Do not extend wakeup paths to devices with ignore_children set
Commit 4ca46ff3e0d8c234cb40ebb6457653b59584426c (PM / Sleep: Mark devices involved in wakeup signaling during suspend) introduced the power.wakeup_path field in struct dev_pm_info to mark devices whose children are enabled to wake up the system from sleep states, so that power domains containing the parents that provide their children with wakeup power and/or relay their wakeup signals are not turned off. Unfortunately, that introduced a PM regression on SH7372 whose power consumption in the system "memory sleep" state increased as a result of it, because it prevented the power domain containing the I2C controller from being turned off when some children of that controller were enabled to wake up the system, although the controller was not necessary for them to signal wakeup. To fix this issue use the observation that devices whose power.ignore_children flag is set for runtime PM should be treated analogously during system suspend. Namely, they shouldn't be included in wakeup paths going through their children. Since the SH7372 I2C controller's power.ignore_children flag is set, doing so will restore the previous behavior of that SOC. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/power/main.c3
-rw-r--r--include/linux/device.h5
-rw-r--r--include/linux/pm.h2
-rw-r--r--include/linux/pm_runtime.h6
4 files changed, 8 insertions, 8 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 7fa098464dae..c3d2dfcf438d 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -920,7 +920,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
920 End: 920 End:
921 if (!error) { 921 if (!error) {
922 dev->power.is_suspended = true; 922 dev->power.is_suspended = true;
923 if (dev->power.wakeup_path && dev->parent) 923 if (dev->power.wakeup_path
924 && dev->parent && !dev->parent->power.ignore_children)
924 dev->parent->power.wakeup_path = true; 925 dev->parent->power.wakeup_path = true;
925 } 926 }
926 927
diff --git a/include/linux/device.h b/include/linux/device.h
index ffbcf95cd97d..52b3a4111df9 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -682,6 +682,11 @@ static inline bool device_async_suspend_enabled(struct device *dev)
682 return !!dev->power.async_suspend; 682 return !!dev->power.async_suspend;
683} 683}
684 684
685static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
686{
687 dev->power.ignore_children = enable;
688}
689
685static inline void device_lock(struct device *dev) 690static inline void device_lock(struct device *dev)
686{ 691{
687 mutex_lock(&dev->mutex); 692 mutex_lock(&dev->mutex);
diff --git a/include/linux/pm.h b/include/linux/pm.h
index f15acb646813..5c4c8b18c8b7 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -447,6 +447,7 @@ struct dev_pm_info {
447 unsigned int async_suspend:1; 447 unsigned int async_suspend:1;
448 bool is_prepared:1; /* Owned by the PM core */ 448 bool is_prepared:1; /* Owned by the PM core */
449 bool is_suspended:1; /* Ditto */ 449 bool is_suspended:1; /* Ditto */
450 bool ignore_children:1;
450 spinlock_t lock; 451 spinlock_t lock;
451#ifdef CONFIG_PM_SLEEP 452#ifdef CONFIG_PM_SLEEP
452 struct list_head entry; 453 struct list_head entry;
@@ -464,7 +465,6 @@ struct dev_pm_info {
464 atomic_t usage_count; 465 atomic_t usage_count;
465 atomic_t child_count; 466 atomic_t child_count;
466 unsigned int disable_depth:3; 467 unsigned int disable_depth:3;
467 unsigned int ignore_children:1;
468 unsigned int idle_notification:1; 468 unsigned int idle_notification:1;
469 unsigned int request_pending:1; 469 unsigned int request_pending:1;
470 unsigned int deferred_resume:1; 470 unsigned int deferred_resume:1;
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index d8d903619642..d3085e72a0ee 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -52,11 +52,6 @@ static inline bool pm_children_suspended(struct device *dev)
52 || !atomic_read(&dev->power.child_count); 52 || !atomic_read(&dev->power.child_count);
53} 53}
54 54
55static inline void pm_suspend_ignore_children(struct device *dev, bool enable)
56{
57 dev->power.ignore_children = enable;
58}
59
60static inline void pm_runtime_get_noresume(struct device *dev) 55static inline void pm_runtime_get_noresume(struct device *dev)
61{ 56{
62 atomic_inc(&dev->power.usage_count); 57 atomic_inc(&dev->power.usage_count);
@@ -130,7 +125,6 @@ static inline void pm_runtime_allow(struct device *dev) {}
130static inline void pm_runtime_forbid(struct device *dev) {} 125static inline void pm_runtime_forbid(struct device *dev) {}
131 126
132static inline bool pm_children_suspended(struct device *dev) { return false; } 127static inline bool pm_children_suspended(struct device *dev) { return false; }
133static inline void pm_suspend_ignore_children(struct device *dev, bool en) {}
134static inline void pm_runtime_get_noresume(struct device *dev) {} 128static inline void pm_runtime_get_noresume(struct device *dev) {}
135static inline void pm_runtime_put_noidle(struct device *dev) {} 129static inline void pm_runtime_put_noidle(struct device *dev) {}
136static inline bool device_run_wake(struct device *dev) { return false; } 130static inline bool device_run_wake(struct device *dev) { return false; }