diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-11-30 18:02:05 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-12-01 15:47:40 -0500 |
commit | b02c999ac325e977585abeb4caf6e0a2ee21e30b (patch) | |
tree | 1ddec5f020a80b9df443b03ffb578ef7f882abb6 /include | |
parent | d23b9b00cdde5c93b914a172cecd57d5625fcd04 (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.h | 63 |
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 | ||
22 | struct dev_power_governor { | 22 | struct 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 | ||
26 | struct gpd_dev_ops { | 27 | struct 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 | ||
80 | struct gpd_timing_data { | ||
81 | s64 stop_latency_ns; | ||
82 | s64 start_latency_ns; | ||
83 | s64 break_even_ns; | ||
84 | }; | ||
85 | |||
79 | struct generic_pm_domain_data { | 86 | struct 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 | ||
96 | extern int pm_genpd_add_device(struct generic_pm_domain *genpd, | 104 | extern struct dev_power_governor simple_qos_governor; |
97 | struct device *dev); | 105 | |
106 | extern struct generic_pm_domain *dev_to_genpd(struct device *dev); | ||
107 | extern int __pm_genpd_add_device(struct generic_pm_domain *genpd, | ||
108 | struct device *dev, | ||
109 | struct gpd_timing_data *td); | ||
110 | |||
111 | static 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 | |||
98 | extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, | 117 | extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, |
99 | struct device *dev); | 118 | struct device *dev); |
100 | extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, | 119 | extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, |
101 | struct generic_pm_domain *new_subdomain); | 120 | struct generic_pm_domain *new_subdomain); |
102 | extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, | 121 | extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, |
103 | struct generic_pm_domain *target); | 122 | struct generic_pm_domain *target); |
104 | extern int pm_genpd_add_callbacks(struct device *dev, struct gpd_dev_ops *ops); | 123 | extern int pm_genpd_add_callbacks(struct device *dev, |
105 | extern int pm_genpd_remove_callbacks(struct device *dev); | 124 | struct gpd_dev_ops *ops, |
125 | struct gpd_timing_data *td); | ||
126 | extern int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td); | ||
106 | extern void pm_genpd_init(struct generic_pm_domain *genpd, | 127 | extern 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 | |||
108 | extern int pm_genpd_poweron(struct generic_pm_domain *genpd); | 130 | extern int pm_genpd_poweron(struct generic_pm_domain *genpd); |
131 | |||
132 | extern bool default_stop_ok(struct device *dev); | ||
133 | |||
109 | #else | 134 | #else |
135 | |||
136 | static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) | ||
137 | { | ||
138 | return ERR_PTR(-ENOSYS); | ||
139 | } | ||
140 | static 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 | } | ||
110 | static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, | 146 | static 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 | } |
130 | static inline int pm_genpd_add_callbacks(struct device *dev, | 166 | static 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 | } |
135 | static inline int pm_genpd_remove_callbacks(struct device *dev) | 172 | static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td) |
136 | { | 173 | { |
137 | return -ENOSYS; | 174 | return -ENOSYS; |
138 | } | 175 | } |
139 | static inline void pm_genpd_init(struct generic_pm_domain *genpd, | 176 | static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off) |
140 | struct dev_power_governor *gov, bool is_off) {} | 177 | { |
178 | } | ||
141 | static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) | 179 | static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) |
142 | { | 180 | { |
143 | return -ENOSYS; | 181 | return -ENOSYS; |
144 | } | 182 | } |
183 | static inline bool default_stop_ok(struct device *dev) | ||
184 | { | ||
185 | return false; | ||
186 | } | ||
145 | #endif | 187 | #endif |
146 | 188 | ||
189 | static 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 |
148 | extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd); | 195 | extern void genpd_queue_power_off_work(struct generic_pm_domain *genpd); |
149 | extern void pm_genpd_poweroff_unused(void); | 196 | extern void pm_genpd_poweroff_unused(void); |