aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_domain.h
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2012-05-14 15:45:52 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-05-18 14:45:26 -0400
commitca1d72f033d4a89e60db25f680896c76c721062b (patch)
tree77a5d45a878b85ed3dad23f304b4e10fbfa66129 /include/linux/pm_domain.h
parentb723b0eb91e08a0ee9a401c0b22c0d52966d9daa (diff)
PM / Domains: Make it possible to add devices to inactive domains
The generic PM domains core code currently requires domains to be in the "power on" state for adding devices to them, but this limitation turns out to be inconvenient in some situations, so remove it. For this purpose, make __pm_genpd_add_device() set the device's need_restore flag if the domain is in the "power off" state, so that the device's "restore state" (usually .runtime_resume()) callback is executed when it is resumed after the domain has been turned on. If the domain is in the "power on" state, the device's need_restore flag will be cleared by __pm_genpd_add_device(), so that its "save state" (usually .runtime_suspend()) callback is executed when the domain is about to be turned off. However, since that default behavior need not be always desirable, add a helper function pm_genpd_dev_need_restore() allowing a device's need_restore flag to be set/unset at any time. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/pm_domain.h')
-rw-r--r--include/linux/pm_domain.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 1e994eeacdf3..30f794eb3826 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -146,6 +146,7 @@ static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
146extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 146extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
147 struct device *dev); 147 struct device *dev);
148extern void pm_genpd_dev_always_on(struct device *dev, bool val); 148extern void pm_genpd_dev_always_on(struct device *dev, bool val);
149extern void pm_genpd_dev_need_restore(struct device *dev, bool val);
149extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 150extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
150 struct generic_pm_domain *new_subdomain); 151 struct generic_pm_domain *new_subdomain);
151extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 152extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
@@ -189,6 +190,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
189 return -ENOSYS; 190 return -ENOSYS;
190} 191}
191static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {} 192static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
193static inline void pm_genpd_dev_need_restore(struct device *dev, bool val) {}
192static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 194static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
193 struct generic_pm_domain *new_sd) 195 struct generic_pm_domain *new_sd)
194{ 196{