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.h25
1 files changed, 23 insertions, 2 deletions
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index fa2e20b621b0..91f8286106ea 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -13,6 +13,7 @@
13#include <linux/mutex.h> 13#include <linux/mutex.h>
14#include <linux/pm.h> 14#include <linux/pm.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/of.h>
16 17
17enum gpd_status { 18enum gpd_status {
18 GPD_STATE_ACTIVE = 0, /* PM domain is active */ 19 GPD_STATE_ACTIVE = 0, /* PM domain is active */
@@ -72,6 +73,7 @@ struct generic_pm_domain {
72 s64 break_even_ns; /* Power break even for the entire domain. */ 73 s64 break_even_ns; /* Power break even for the entire domain. */
73 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */ 74 s64 max_off_time_ns; /* Maximum allowed "suspended" time. */
74 ktime_t power_off_time; 75 ktime_t power_off_time;
76 struct device_node *of_node; /* Node in device tree */
75}; 77};
76 78
77static 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)
@@ -99,14 +101,15 @@ struct generic_pm_domain_data {
99 struct gpd_dev_ops ops; 101 struct gpd_dev_ops ops;
100 struct gpd_timing_data td; 102 struct gpd_timing_data td;
101 bool need_restore; 103 bool need_restore;
104 bool always_on;
102}; 105};
103 106
107#ifdef CONFIG_PM_GENERIC_DOMAINS
104static 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)
105{ 109{
106 return container_of(pdd, struct generic_pm_domain_data, base); 110 return container_of(pdd, struct generic_pm_domain_data, base);
107} 111}
108 112
109#ifdef CONFIG_PM_GENERIC_DOMAINS
110static 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)
111{ 114{
112 return to_gpd_data(dev->power.subsys_data->domain_data); 115 return to_gpd_data(dev->power.subsys_data->domain_data);
@@ -119,14 +122,25 @@ extern int __pm_genpd_add_device(struct generic_pm_domain *genpd,
119 struct device *dev, 122 struct device *dev,
120 struct gpd_timing_data *td); 123 struct gpd_timing_data *td);
121 124
125extern int __pm_genpd_of_add_device(struct device_node *genpd_node,
126 struct device *dev,
127 struct gpd_timing_data *td);
128
122static inline int pm_genpd_add_device(struct generic_pm_domain *genpd, 129static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
123 struct device *dev) 130 struct device *dev)
124{ 131{
125 return __pm_genpd_add_device(genpd, dev, NULL); 132 return __pm_genpd_add_device(genpd, dev, NULL);
126} 133}
127 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
128extern int pm_genpd_remove_device(struct generic_pm_domain *genpd, 141extern int pm_genpd_remove_device(struct generic_pm_domain *genpd,
129 struct device *dev); 142 struct device *dev);
143extern void pm_genpd_dev_always_on(struct device *dev, bool val);
130extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 144extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
131 struct generic_pm_domain *new_subdomain); 145 struct generic_pm_domain *new_subdomain);
132extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, 146extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
@@ -145,6 +159,10 @@ extern bool default_stop_ok(struct device *dev);
145extern struct dev_power_governor pm_domain_always_on_gov; 159extern struct dev_power_governor pm_domain_always_on_gov;
146#else 160#else
147 161
162static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
163{
164 return ERR_PTR(-ENOSYS);
165}
148static inline struct generic_pm_domain *dev_to_genpd(struct device *dev) 166static inline struct generic_pm_domain *dev_to_genpd(struct device *dev)
149{ 167{
150 return ERR_PTR(-ENOSYS); 168 return ERR_PTR(-ENOSYS);
@@ -165,6 +183,7 @@ static inline int pm_genpd_remove_device(struct generic_pm_domain *genpd,
165{ 183{
166 return -ENOSYS; 184 return -ENOSYS;
167} 185}
186static inline void pm_genpd_dev_always_on(struct device *dev, bool val) {}
168static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, 187static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
169 struct generic_pm_domain *new_sd) 188 struct generic_pm_domain *new_sd)
170{ 189{
@@ -185,7 +204,8 @@ static inline int __pm_genpd_remove_callbacks(struct device *dev, bool clear_td)
185{ 204{
186 return -ENOSYS; 205 return -ENOSYS;
187} 206}
188static 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)
189{ 209{
190} 210}
191static inline int pm_genpd_poweron(struct generic_pm_domain *genpd) 211static inline int pm_genpd_poweron(struct generic_pm_domain *genpd)
@@ -196,6 +216,7 @@ static inline bool default_stop_ok(struct device *dev)
196{ 216{
197 return false; 217 return false;
198} 218}
219#define simple_qos_governor NULL
199#define pm_domain_always_on_gov NULL 220#define pm_domain_always_on_gov NULL
200#endif 221#endif
201 222