aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_domain.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pm_domain.h')
-rw-r--r--include/linux/pm_domain.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index a03a0ad998b8..91f8286106ea 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -10,7 +10,10 @@
10#define _LINUX_PM_DOMAIN_H 10#define _LINUX_PM_DOMAIN_H
11 11
12#include <linux/device.h> 12#include <linux/device.h>
13#include <linux/mutex.h>
14#include <linux/pm.h>
13#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/of.h>
14 17
15enum gpd_status { 18enum gpd_status {
16 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 19 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -70,6 +73,7 @@ struct generic_pm_domain {
70 s64 break_even_ns; /* Power break even for the entire domain. */ 73 s64 break_even_ns; /* Power break even for the entire domain. */
71 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
72 ktime_t power_off_time; 75 ktime_t power_off_time;
76 struct device_node *of_node; /* Node in device tree */
73}; 77};
74 78
75static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) 79static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
@@ -97,14 +101,15 @@ struct generic_pm_domain_data {
97 struct gpd_dev_ops ops; 101 struct gpd_dev_ops ops;
98 struct gpd_timing_data td; 102 struct gpd_timing_data td;
99 bool need_restore; 103 bool need_restore;
104 bool always_on;
100}; 105};
101 106
107#ifdef CONFIG_PM_GENERIC_DOMAINS
102static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd) 108static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd)
103{ 109{
104 return container_of(pdd, struct generic_pm_domain_data, base); 110 return container_of(pdd, struct generic_pm_domain_data, base);
105} 111}
106 112
107#ifdef CONFIG_PM_GENERIC_DOMAINS
108static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev) 113static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
109{ 114{
110 return to_gpd_data(dev->power.subsys_data->domain_data); 115 return to_gpd_data(dev->power.subsys_data->domain_data);
@@ -117,14 +122,25 @@ extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
117 struct device *dev, 122 struct device *dev,
118 struct gpd_timing_data *td); 123 struct gpd_timing_data *td);
119 124
125extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
126 struct device *dev,
127 struct gpd_timing_data *td);
128
120static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 129static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
121 struct device *dev) 130 struct device *dev)
122{ 131{
123 return __pm_genpd_add_device(genpd, dev, NULL); 132 return __pm_genpd_add_device(genpd, dev, NULL);
124} 133}
125 134
135static inline int pm_genpd_of_add_device(struct device_node *genpd_node,
136 struct device *dev)
137{
138 return __pm_genpd_of_add_device(genpd_node, dev, NULL);
139}
140
126extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 141extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
127 struct device *dev); 142 struct device *dev);
143extern void pm_genpd_dev_always_on(struct device *dev, bool val);
128extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 144extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
129 struct generic_pm_domain *new_subdomain); 145 struct generic_pm_domain *new_subdomain);
130extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 146extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
@@ -143,6 +159,10 @@ extern bool default_stop_ok(struct device *dev);
143extern struct dev_power_governor pm_domain_always_on_gov; 159extern struct dev_power_governor pm_domain_always_on_gov;
144#else 160#else
145 161
162static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
163{
164 return ERR_PTR(-ENOSYS);
165}
146static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) 166static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
147{ 167{
148 return ERR_PTR(-ENOSYS); 168 return ERR_PTR(-ENOSYS);
@@ -163,6 +183,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
163{ 183{
164 return -ENOSYS; 184 return -ENOSYS;
165} 185}
186static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
166static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 187static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
167 struct generic_pm_domain *new_sd) 188 struct generic_pm_domain *new_sd)
168{ 189{
@@ -183,7 +204,8 @@ static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
183{ 204{
184 return -ENOSYS; 205 return -ENOSYS;
185} 206}
186static inline void pm_genpd_init(struct generic_pm_domain *genpd, bool is_off) 207static inline void pm_genpd_init(struct generic_pm_domain *genpd,
208 struct dev_power_governor *gov, bool is_off)
187{ 209{
188} 210}
189static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) 211static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
@@ -194,6 +216,7 @@ static inline bool default_stop_ok(struct device *dev)
194{ 216{
195 return false; 217 return false;
196} 218}
219#define simple_qos_governor NULL
197#define pm_domain_always_on_gov NULL 220#define pm_domain_always_on_gov NULL
198#endif 221#endif
199 222