aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_domain.h
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-08 05:47:46 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-08 05:47:46 -0500
commit41966710ab574f1fcedf3e10e1ceef911c096d1d (patch)
treea370f9fb2392267d1e7b06d7c9f43c6d80eb12be /include/linux/pm_domain.h
parent4633fa48fb41dc6d6f0cd83d7f6b7e262820e7cb (diff)
parent1dd6c0770d7d4ca477a1a8452ab0161b1150e4ad (diff)
Merge branch 'for-3.2' into for-3.3
Diffstat (limited to 'include/linux/pm_domain.h')
-rw-r--r--include/linux/pm_domain.h36
1 files changed, 26 insertions, 10 deletions
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 21097cb086fe..65633e5a2bc0 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -13,6 +13,7 @@
13 13
14enum gpd_status { 14enum gpd_status {
15 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 15 GPD_STATE_ACTIVE = 0, /* PM domain is active */
16 GPD_STATE_WAIT_MASTER, /* PM domain's master is being waited for */
16 GPD_STATE_BUSY, /* Something is happening to the PM domain */ 17 GPD_STATE_BUSY, /* Something is happening to the PM domain */
17 GPD_STATE_REPEAT, /* Power off in progress, to be repeated */ 18 GPD_STATE_REPEAT, /* Power off in progress, to be repeated */
18 GPD_STATE_POWER_OFF, /* PM domain is off */ 19 GPD_STATE_POWER_OFF, /* PM domain is off */
@@ -25,15 +26,14 @@ struct dev_power_governor {
25struct generic_pm_domain { 26struct generic_pm_domain {
26 struct dev_pm_domain domain; /* PM domain operations */ 27 struct dev_pm_domain domain; /* PM domain operations */
27 struct list_head gpd_list_node; /* Node in the global PM domains list */ 28 struct list_head gpd_list_node; /* Node in the global PM domains list */
28 struct list_head sd_node; /* Node in the parent's subdomain list */ 29 struct list_head master_links; /* Links with PM domain as a master */
29 struct generic_pm_domain *parent; /* Parent PM domain */ 30 struct list_head slave_links; /* Links with PM domain as a slave */
30 struct list_head sd_list; /* List of dubdomains */
31 struct list_head dev_list; /* List of devices */ 31 struct list_head dev_list; /* List of devices */
32 struct mutex lock; 32 struct mutex lock;
33 struct dev_power_governor *gov; 33 struct dev_power_governor *gov;
34 struct work_struct power_off_work; 34 struct work_struct power_off_work;
35 unsigned int in_progress; /* Number of devices being suspended now */ 35 unsigned int in_progress; /* Number of devices being suspended now */
36 unsigned int sd_count; /* Number of subdomains with power "on" */ 36 atomic_t sd_count; /* Number of subdomains with power "on" */
37 enum gpd_status status; /* Current state of the domain */ 37 enum gpd_status status; /* Current state of the domain */
38 wait_queue_head_t status_wait_queue; 38 wait_queue_head_t status_wait_queue;
39 struct task_struct *poweroff_task; /* Powering off task */ 39 struct task_struct *poweroff_task; /* Powering off task */
@@ -42,6 +42,7 @@ struct generic_pm_domain {
42 unsigned int suspended_count; /* System suspend device counter */ 42 unsigned int suspended_count; /* System suspend device counter */
43 unsigned int prepared_count; /* Suspend counter of prepared devices */ 43 unsigned int prepared_count; /* Suspend counter of prepared devices */
44 bool suspend_power_off; /* Power status before system suspend */ 44 bool suspend_power_off; /* Power status before system suspend */
45 bool dev_irq_safe; /* Device callbacks are IRQ-safe */
45 int (*power_off)(struct generic_pm_domain *domain); 46 int (*power_off)(struct generic_pm_domain *domain);
46 int (*power_on)(struct generic_pm_domain *domain); 47 int (*power_on)(struct generic_pm_domain *domain);
47 int (*start_device)(struct device *dev); 48 int (*start_device)(struct device *dev);
@@ -54,12 +55,23 @@ static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
54 return container_of(pd, struct generic_pm_domain, domain); 55 return container_of(pd, struct generic_pm_domain, domain);
55} 56}
56 57
57struct dev_list_entry { 58struct gpd_link {
58 struct list_head node; 59 struct generic_pm_domain *master;
59 struct device *dev; 60 struct list_head master_node;
61 struct generic_pm_domain *slave;
62 struct list_head slave_node;
63};
64
65struct generic_pm_domain_data {
66 struct pm_domain_data base;
60 bool need_restore; 67 bool need_restore;
61}; 68};
62 69
70static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd)
71{
72 return container_of(pdd, struct generic_pm_domain_data, base);
73}
74
63#ifdef CONFIG_PM_GENERIC_DOMAINS 75#ifdef CONFIG_PM_GENERIC_DOMAINS
64extern int pm_genpd_add_device(struct generic_pm_domain *genpd, 76extern int pm_genpd_add_device(struct generic_pm_domain *genpd,
65 struct device *dev); 77 struct device *dev);
@@ -72,8 +84,6 @@ extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
72extern void pm_genpd_init(struct generic_pm_domain *genpd, 84extern void pm_genpd_init(struct generic_pm_domain *genpd,
73 struct dev_power_governor *gov, bool is_off); 85 struct dev_power_governor *gov, bool is_off);
74extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 86extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
75extern void pm_genpd_poweroff_unused(void);
76extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
77#else 87#else
78static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 88static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
79 struct device *dev) 89 struct device *dev)
@@ -101,8 +111,14 @@ static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
101{ 111{
102 return -ENOSYS; 112 return -ENOSYS;
103} 113}
104static inline void pm_genpd_poweroff_unused(void) {} 114#endif
115
116#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
117extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
118extern void pm_genpd_poweroff_unused(void);
119#else
105static inline void genpd_queue_power_off_work(struct generic_pm_domain *gpd) {} 120static inline void genpd_queue_power_off_work(struct generic_pm_domain *gpd) {}
121static inline void pm_genpd_poweroff_unused(void) {}
106#endif 122#endif
107 123
108#endif /* _LINUX_PM_DOMAIN_H */ 124#endif /* _LINUX_PM_DOMAIN_H */