aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2011-11-30 18:02:05 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-12-01 15:47:40 -0500
commitb02c999ac325e977585abeb4caf6e0a2ee21e30b (patch)
tree1ddec5f020a80b9df443b03ffb578ef7f882abb6 /include
parentd23b9b00cdde5c93b914a172cecd57d5625fcd04 (diff)
PM / Domains: Add device stop governor function (v4)
Add a function deciding whether or not devices should be stopped in pm_genpd_runtime_suspend() depending on their PM QoS constraints and stop/start timing values. Make it possible to add information used by this function to device objects. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Magnus Damm <damm@opensource.se>
Diffstat (limited to 'include')
-rw-r--r--include/linux/pm_domain.h63
1 files changed, 55 insertions, 8 deletions
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 10a197dce07e..f6745c213a57 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -21,6 +21,7 @@ enum gpd_status {
21 21
22struct dev_power_governor { 22struct dev_power_governor {
23 bool (*power_down_ok)(struct dev_pm_domain *domain); 23 bool (*power_down_ok)(struct dev_pm_domain *domain);
24 bool (*stop_ok)(struct device *dev);
24}; 25};
25 26
26struct gpd_dev_ops { 27struct gpd_dev_ops {
@@ -76,9 +77,16 @@ struct gpd_link {
76 struct list_head slave_node; 77 struct list_head slave_node;
77}; 78};
78 79
80struct gpd_timing_data {
81 s64 stop_latency_ns;
82 s64 start_latency_ns;
83 s64 break_even_ns;
84};
85
79struct generic_pm_domain_data { 86struct generic_pm_domain_data {
80 struct pm_domain_data base; 87 struct pm_domain_data base;
81 struct gpd_dev_ops ops; 88 struct gpd_dev_ops ops;
89 struct gpd_timing_data td;
82 bool need_restore; 90 bool need_restore;
83}; 91};
84 92
@@ -93,20 +101,48 @@ static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
93 return to_gpd_data(dev->power.subsys_data->domain_data); 101 return to_gpd_data(dev->power.subsys_data->domain_data);
94} 102}
95 103
96extern int pm_genpd_add_device(struct generic_pm_domain *genpd, 104extern struct dev_power_governor simple_qos_governor;
97 struct device *dev); 105
106extern struct generic_pm_domain *dev_to_genpd(struct device *dev);
107extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
108 struct device *dev,
109 struct gpd_timing_data *td);
110
111static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
112 struct device *dev)
113{
114 return __pm_genpd_add_device(genpd, dev, NULL);
115}
116
98extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 117extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
99 struct device *dev); 118 struct device *dev);
100extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 119extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
101 struct generic_pm_domain *new_subdomain); 120 struct generic_pm_domain *new_subdomain);
102extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 121extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
103 struct generic_pm_domain *target); 122 struct generic_pm_domain *target);
104extern int pm_genpd_add_callbacks(struct device *dev, struct gpd_dev_ops *ops); 123extern int pm_genpd_add_callbacks(struct device *dev,
105extern int pm_genpd_remove_callbacks(struct device *dev); 124 struct gpd_dev_ops *ops,
125 struct gpd_timing_data *td);
126extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td);
106extern void pm_genpd_init(struct generic_pm_domain *genpd, 127extern void pm_genpd_init(struct generic_pm_domain *genpd,
107 struct dev_power_governor *gov, bool is_off); 128 struct dev_power_governor *gov, bool is_off);
129
108extern int pm_genpd_poweron(struct generic_pm_domain *genpd); 130extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
131
132extern bool default_stop_ok(struct device *dev);
133
109#else 134#else
135
136static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
137{
138 return ERR_PTR(-ENOSYS);
139}
140static inline int __pm_genpd_add_device(struct generic_pm_domain *genpd,
141 struct device *dev,
142 struct gpd_timing_data *td)
143{
144 return -ENOSYS;
145}
110static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 146static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
111 struct device *dev) 147 struct device *dev)
112{ 148{
@@ -128,22 +164,33 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
128 return -ENOSYS; 164 return -ENOSYS;
129} 165}
130static inline int pm_genpd_add_callbacks(struct device *dev, 166static inline int pm_genpd_add_callbacks(struct device *dev,
131 struct gpd_dev_ops *ops) 167 struct gpd_dev_ops *ops,
168 struct gpd_timing_data *td)
132{ 169{
133 return -ENOSYS; 170 return -ENOSYS;
134} 171}
135static inline int pm_genpd_remove_callbacks(struct device *dev) 172static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
136{ 173{
137 return -ENOSYS; 174 return -ENOSYS;
138} 175}
139static inline void pm_genpd_init(struct generic_pm_domain *genpd, 176static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off)
140 struct dev_power_governor *gov, bool is_off) {} 177{
178}
141static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) 179static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
142{ 180{
143 return -ENOSYS; 181 return -ENOSYS;
144} 182}
183static inline bool default_stop_ok(struct device *dev)
184{
185 return false;
186}
145#endif 187#endif
146 188
189static inline int pm_genpd_remove_callbacks(struct device *dev)
190{
191 return __pm_genpd_remove_callbacks(dev, true);
192}
193
147#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME 194#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
148extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd); 195extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
149extern void pm_genpd_poweroff_unused(void); 196extern void pm_genpd_poweroff_unused(void);