xref: /linux/include/linux/pm_domain.h (revision fc8f5028eb0cc5aee0501a99f59a04f748fbff1c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * pm_domain.h - Definitions and headers related to device power domains.
4  *
5  * Copyright (C) 2011 Rafael J. Wysocki <rjw@sisk.pl>, Renesas Electronics Corp.
6  */
7 
8 #ifndef _LINUX_PM_DOMAIN_H
9 #define _LINUX_PM_DOMAIN_H
10 
11 #include <linux/device.h>
12 #include <linux/ktime.h>
13 #include <linux/mutex.h>
14 #include <linux/pm.h>
15 #include <linux/err.h>
16 #include <linux/of.h>
17 #include <linux/notifier.h>
18 #include <linux/spinlock.h>
19 #include <linux/cpumask_types.h>
20 #include <linux/time64.h>
21 
22 /*
23  * Flags to control the behaviour when attaching a device to its PM domains.
24  *
25  * PD_FLAG_NO_DEV_LINK:		As the default behaviour creates a device-link
26  *				for every PM domain that gets attached, this
27  *				flag can be used to skip that.
28  *
29  * PD_FLAG_DEV_LINK_ON:		Add the DL_FLAG_RPM_ACTIVE to power-on the
30  *				supplier and its PM domain when creating the
31  *				device-links.
32  *
33  * PD_FLAG_REQUIRED_OPP:	Assign required_devs for the required OPPs. The
34  *				index of the required OPP must correspond to the
35  *				index in the array of the pd_names. If pd_names
36  *				isn't specified, the index just follows the
37  *				index for the attached PM domain.
38  *
39  * PD_FLAG_ATTACH_POWER_ON:	Power on the domain during attach.
40  *
41  * PD_FLAG_DETACH_POWER_OFF:	Power off the domain during detach.
42  *
43  */
44 #define PD_FLAG_NO_DEV_LINK		BIT(0)
45 #define PD_FLAG_DEV_LINK_ON		BIT(1)
46 #define PD_FLAG_REQUIRED_OPP		BIT(2)
47 #define PD_FLAG_ATTACH_POWER_ON		BIT(3)
48 #define PD_FLAG_DETACH_POWER_OFF	BIT(4)
49 
50 struct dev_pm_domain_attach_data {
51 	const char * const *pd_names;
52 	const u32 num_pd_names;
53 	const u32 pd_flags;
54 };
55 
56 struct dev_pm_domain_list {
57 	struct device **pd_devs;
58 	struct device_link **pd_links;
59 	u32 *opp_tokens;
60 	u32 num_pds;
61 };
62 
63 /*
64  * Flags to control the behaviour of a genpd.
65  *
66  * These flags may be set in the struct generic_pm_domain's flags field by a
67  * genpd backend driver. The flags must be set before it calls pm_genpd_init(),
68  * which initializes a genpd.
69  *
70  * GENPD_FLAG_PM_CLK:		Instructs genpd to use the PM clk framework,
71  *				while powering on/off attached devices.
72  *
73  * GENPD_FLAG_IRQ_SAFE:		This informs genpd that its backend callbacks,
74  *				->power_on|off(), doesn't sleep. Hence, these
75  *				can be invoked from within atomic context, which
76  *				enables genpd to power on/off the PM domain,
77  *				even when pm_runtime_is_irq_safe() returns true,
78  *				for any of its attached devices. Note that, a
79  *				genpd having this flag set, requires its
80  *				masterdomains to also have it set.
81  *
82  * GENPD_FLAG_ALWAYS_ON:	Instructs genpd to always keep the PM domain
83  *				powered on.
84  *
85  * GENPD_FLAG_ACTIVE_WAKEUP:	Instructs genpd to keep the PM domain powered
86  *				on, in case any of its attached devices is used
87  *				in the wakeup path to serve system wakeups.
88  *
89  * GENPD_FLAG_CPU_DOMAIN:	Instructs genpd that it should expect to get
90  *				devices attached, which may belong to CPUs or
91  *				possibly have subdomains with CPUs attached.
92  *				This flag enables the genpd backend driver to
93  *				deploy idle power management support for CPUs
94  *				and groups of CPUs. Note that, the backend
95  *				driver must then comply with the so called,
96  *				last-man-standing algorithm, for the CPUs in the
97  *				PM domain.
98  *
99  * GENPD_FLAG_RPM_ALWAYS_ON:	Instructs genpd to always keep the PM domain
100  *				powered on except for system suspend.
101  *
102  * GENPD_FLAG_MIN_RESIDENCY:	Enable the genpd governor to consider its
103  *				components' next wakeup when determining the
104  *				optimal idle state.
105  *
106  * GENPD_FLAG_OPP_TABLE_FW:	The genpd provider supports performance states,
107  *				but its corresponding OPP tables are not
108  *				described in DT, but are given directly by FW.
109  *
110  * GENPD_FLAG_DEV_NAME_FW:	Instructs genpd to generate an unique device name
111  *				using ida. It is used by genpd providers which
112  *				get their genpd-names directly from FW.
113  *
114  * GENPD_FLAG_NO_SYNC_STATE:	The ->sync_state() support is implemented in a
115  *				genpd provider specific way, likely through a
116  *				parent device node. This flag makes genpd to
117  *				skip its internal support for this.
118  */
119 #define GENPD_FLAG_PM_CLK	 (1U << 0)
120 #define GENPD_FLAG_IRQ_SAFE	 (1U << 1)
121 #define GENPD_FLAG_ALWAYS_ON	 (1U << 2)
122 #define GENPD_FLAG_ACTIVE_WAKEUP (1U << 3)
123 #define GENPD_FLAG_CPU_DOMAIN	 (1U << 4)
124 #define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5)
125 #define GENPD_FLAG_MIN_RESIDENCY (1U << 6)
126 #define GENPD_FLAG_OPP_TABLE_FW	 (1U << 7)
127 #define GENPD_FLAG_DEV_NAME_FW	 (1U << 8)
128 #define GENPD_FLAG_NO_SYNC_STATE (1U << 9)
129 
130 enum gpd_status {
131 	GENPD_STATE_ON = 0,	/* PM domain is on */
132 	GENPD_STATE_OFF,	/* PM domain is off */
133 };
134 
135 enum genpd_notication {
136 	GENPD_NOTIFY_PRE_OFF = 0,
137 	GENPD_NOTIFY_OFF,
138 	GENPD_NOTIFY_PRE_ON,
139 	GENPD_NOTIFY_ON,
140 };
141 
142 enum genpd_sync_state {
143 	GENPD_SYNC_STATE_OFF = 0,
144 	GENPD_SYNC_STATE_SIMPLE,
145 	GENPD_SYNC_STATE_ONECELL,
146 };
147 
148 struct dev_power_governor {
149 	bool (*power_down_ok)(struct dev_pm_domain *domain);
150 	bool (*suspend_ok)(struct device *dev);
151 };
152 
153 struct gpd_dev_ops {
154 	int (*start)(struct device *dev);
155 	int (*stop)(struct device *dev);
156 };
157 
158 struct genpd_governor_data {
159 	s64 max_off_time_ns;
160 	bool max_off_time_changed;
161 	ktime_t next_wakeup;
162 	ktime_t next_hrtimer;
163 	ktime_t last_enter;
164 	bool reflect_residency;
165 	bool cached_power_down_ok;
166 	bool cached_power_down_state_idx;
167 };
168 
169 struct genpd_power_state {
170 	const char *name;
171 	s64 power_off_latency_ns;
172 	s64 power_on_latency_ns;
173 	s64 residency_ns;
174 	u64 usage;
175 	u64 rejected;
176 	u64 above;
177 	u64 below;
178 	struct fwnode_handle *fwnode;
179 	u64 idle_time;
180 	void *data;
181 };
182 
183 struct genpd_lock_ops;
184 struct opp_table;
185 
186 struct generic_pm_domain {
187 	struct device dev;
188 	struct dev_pm_domain domain;	/* PM domain operations */
189 	struct list_head gpd_list_node;	/* Node in the global PM domains list */
190 	struct list_head parent_links;	/* Links with PM domain as a parent */
191 	struct list_head child_links;	/* Links with PM domain as a child */
192 	struct list_head dev_list;	/* List of devices */
193 	struct dev_power_governor *gov;
194 	struct genpd_governor_data *gd;	/* Data used by a genpd governor. */
195 	struct work_struct power_off_work;
196 	struct fwnode_handle *provider;	/* Identity of the domain provider */
197 	bool has_provider;
198 	const char *name;
199 	atomic_t sd_count;	/* Number of subdomains with power "on" */
200 	enum gpd_status status;	/* Current state of the domain */
201 	unsigned int device_count;	/* Number of devices */
202 	unsigned int device_id;		/* unique device id */
203 	unsigned int suspended_count;	/* System suspend device counter */
204 	unsigned int prepared_count;	/* Suspend counter of prepared devices */
205 	unsigned int performance_state;	/* Aggregated max performance state */
206 	cpumask_var_t cpus;		/* A cpumask of the attached CPUs */
207 	bool synced_poweroff;		/* A consumer needs a synced poweroff */
208 	bool stay_on;			/* Stay powered-on during boot. */
209 	enum genpd_sync_state sync_state; /* How sync_state is managed. */
210 	int (*power_off)(struct generic_pm_domain *domain);
211 	int (*power_on)(struct generic_pm_domain *domain);
212 	struct raw_notifier_head power_notifiers; /* Power on/off notifiers */
213 	struct opp_table *opp_table;	/* OPP table of the genpd */
214 	int (*set_performance_state)(struct generic_pm_domain *genpd,
215 				     unsigned int state);
216 	struct gpd_dev_ops dev_ops;
217 	int (*set_hwmode_dev)(struct generic_pm_domain *domain,
218 			      struct device *dev, bool enable);
219 	bool (*get_hwmode_dev)(struct generic_pm_domain *domain,
220 			      struct device *dev);
221 	int (*attach_dev)(struct generic_pm_domain *domain,
222 			  struct device *dev);
223 	void (*detach_dev)(struct generic_pm_domain *domain,
224 			   struct device *dev);
225 	unsigned int flags;		/* Bit field of configs for genpd */
226 	struct genpd_power_state *states;
227 	void (*free_states)(struct genpd_power_state *states,
228 			    unsigned int state_count);
229 	unsigned int state_count; /* number of states */
230 	unsigned int state_idx; /* state that genpd will go to when off */
231 	u64 on_time;
232 	u64 accounting_time;
233 	const struct genpd_lock_ops *lock_ops;
234 	union {
235 		struct mutex mlock;
236 		struct {
237 			spinlock_t slock;
238 			unsigned long lock_flags;
239 		};
240 		struct {
241 			raw_spinlock_t raw_slock;
242 			unsigned long raw_lock_flags;
243 		};
244 	};
245 };
246 
pd_to_genpd(struct dev_pm_domain * pd)247 static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd)
248 {
249 	return container_of(pd, struct generic_pm_domain, domain);
250 }
251 
252 struct gpd_link {
253 	struct generic_pm_domain *parent;
254 	struct list_head parent_node;
255 	struct generic_pm_domain *child;
256 	struct list_head child_node;
257 
258 	/* Sub-domain's per-master domain performance state */
259 	unsigned int performance_state;
260 	unsigned int prev_performance_state;
261 };
262 
263 struct gpd_timing_data {
264 	s64 suspend_latency_ns;
265 	s64 resume_latency_ns;
266 	s64 effective_constraint_ns;
267 	ktime_t	next_wakeup;
268 	bool constraint_changed;
269 	bool cached_suspend_ok;
270 };
271 
272 struct pm_domain_data {
273 	struct list_head list_node;
274 	struct device *dev;
275 };
276 
277 struct generic_pm_domain_data {
278 	struct pm_domain_data base;
279 	struct gpd_timing_data *td;
280 	struct notifier_block nb;
281 	struct notifier_block *power_nb;
282 	int cpu;
283 	unsigned int performance_state;
284 	unsigned int default_pstate;
285 	unsigned int rpm_pstate;
286 	unsigned int opp_token;
287 	bool hw_mode;
288 	bool rpm_always_on;
289 	void *data;
290 };
291 
292 #ifdef CONFIG_PM_GENERIC_DOMAINS
to_gpd_data(struct pm_domain_data * pdd)293 static inline struct generic_pm_domain_data *to_gpd_data(struct pm_domain_data *pdd)
294 {
295 	return container_of(pdd, struct generic_pm_domain_data, base);
296 }
297 
dev_gpd_data(struct device * dev)298 static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
299 {
300 	return to_gpd_data(dev->power.subsys_data->domain_data);
301 }
302 
303 int pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev);
304 int pm_genpd_remove_device(struct device *dev);
305 int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
306 			   struct generic_pm_domain *subdomain);
307 int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
308 			      struct generic_pm_domain *subdomain);
309 int pm_genpd_init(struct generic_pm_domain *genpd,
310 		  struct dev_power_governor *gov, bool is_off);
311 int pm_genpd_remove(struct generic_pm_domain *genpd);
312 void pm_genpd_inc_rejected(struct generic_pm_domain *genpd,
313 			   unsigned int state_idx);
314 struct device *dev_to_genpd_dev(struct device *dev);
315 int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state);
316 int dev_pm_genpd_add_notifier(struct device *dev, struct notifier_block *nb);
317 int dev_pm_genpd_remove_notifier(struct device *dev);
318 void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next);
319 ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev);
320 void dev_pm_genpd_synced_poweroff(struct device *dev);
321 int dev_pm_genpd_set_hwmode(struct device *dev, bool enable);
322 bool dev_pm_genpd_get_hwmode(struct device *dev);
323 int dev_pm_genpd_rpm_always_on(struct device *dev, bool on);
324 bool dev_pm_genpd_is_on(struct device *dev);
325 
326 extern struct dev_power_governor simple_qos_governor;
327 extern struct dev_power_governor pm_domain_always_on_gov;
328 #ifdef CONFIG_CPU_IDLE
329 extern struct dev_power_governor pm_domain_cpu_gov;
330 #endif
331 #else
332 
dev_gpd_data(struct device * dev)333 static inline struct generic_pm_domain_data *dev_gpd_data(struct device *dev)
334 {
335 	return ERR_PTR(-ENOSYS);
336 }
pm_genpd_add_device(struct generic_pm_domain * genpd,struct device * dev)337 static inline int pm_genpd_add_device(struct generic_pm_domain *genpd,
338 				      struct device *dev)
339 {
340 	return -ENOSYS;
341 }
pm_genpd_remove_device(struct device * dev)342 static inline int pm_genpd_remove_device(struct device *dev)
343 {
344 	return -ENOSYS;
345 }
pm_genpd_add_subdomain(struct generic_pm_domain * genpd,struct generic_pm_domain * subdomain)346 static inline int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
347 					 struct generic_pm_domain *subdomain)
348 {
349 	return -ENOSYS;
350 }
pm_genpd_remove_subdomain(struct generic_pm_domain * genpd,struct generic_pm_domain * subdomain)351 static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
352 					    struct generic_pm_domain *subdomain)
353 {
354 	return -ENOSYS;
355 }
pm_genpd_init(struct generic_pm_domain * genpd,struct dev_power_governor * gov,bool is_off)356 static inline int pm_genpd_init(struct generic_pm_domain *genpd,
357 				struct dev_power_governor *gov, bool is_off)
358 {
359 	return -ENOSYS;
360 }
pm_genpd_remove(struct generic_pm_domain * genpd)361 static inline int pm_genpd_remove(struct generic_pm_domain *genpd)
362 {
363 	return -EOPNOTSUPP;
364 }
365 
pm_genpd_inc_rejected(struct generic_pm_domain * genpd,unsigned int state_idx)366 static inline void pm_genpd_inc_rejected(struct generic_pm_domain *genpd,
367 					 unsigned int state_idx)
368 { }
369 
dev_to_genpd_dev(struct device * dev)370 static inline struct device *dev_to_genpd_dev(struct device *dev)
371 {
372 	return ERR_PTR(-EOPNOTSUPP);
373 }
374 
dev_pm_genpd_set_performance_state(struct device * dev,unsigned int state)375 static inline int dev_pm_genpd_set_performance_state(struct device *dev,
376 						     unsigned int state)
377 {
378 	return -EOPNOTSUPP;
379 }
380 
dev_pm_genpd_add_notifier(struct device * dev,struct notifier_block * nb)381 static inline int dev_pm_genpd_add_notifier(struct device *dev,
382 					    struct notifier_block *nb)
383 {
384 	return -EOPNOTSUPP;
385 }
386 
dev_pm_genpd_remove_notifier(struct device * dev)387 static inline int dev_pm_genpd_remove_notifier(struct device *dev)
388 {
389 	return -EOPNOTSUPP;
390 }
391 
dev_pm_genpd_set_next_wakeup(struct device * dev,ktime_t next)392 static inline void dev_pm_genpd_set_next_wakeup(struct device *dev, ktime_t next)
393 { }
394 
dev_pm_genpd_get_next_hrtimer(struct device * dev)395 static inline ktime_t dev_pm_genpd_get_next_hrtimer(struct device *dev)
396 {
397 	return KTIME_MAX;
398 }
dev_pm_genpd_synced_poweroff(struct device * dev)399 static inline void dev_pm_genpd_synced_poweroff(struct device *dev)
400 { }
401 
dev_pm_genpd_set_hwmode(struct device * dev,bool enable)402 static inline int dev_pm_genpd_set_hwmode(struct device *dev, bool enable)
403 {
404 	return -EOPNOTSUPP;
405 }
406 
dev_pm_genpd_get_hwmode(struct device * dev)407 static inline bool dev_pm_genpd_get_hwmode(struct device *dev)
408 {
409 	return false;
410 }
411 
dev_pm_genpd_rpm_always_on(struct device * dev,bool on)412 static inline int dev_pm_genpd_rpm_always_on(struct device *dev, bool on)
413 {
414 	return -EOPNOTSUPP;
415 }
416 
dev_pm_genpd_is_on(struct device * dev)417 static inline bool dev_pm_genpd_is_on(struct device *dev)
418 {
419 	return false;
420 }
421 
422 #define simple_qos_governor		(*(struct dev_power_governor *)(NULL))
423 #define pm_domain_always_on_gov		(*(struct dev_power_governor *)(NULL))
424 #endif
425 
426 #ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP
427 void dev_pm_genpd_suspend(struct device *dev);
428 void dev_pm_genpd_resume(struct device *dev);
429 #else
dev_pm_genpd_suspend(struct device * dev)430 static inline void dev_pm_genpd_suspend(struct device *dev) {}
dev_pm_genpd_resume(struct device * dev)431 static inline void dev_pm_genpd_resume(struct device *dev) {}
432 #endif
433 
434 /* OF PM domain providers */
435 struct of_device_id;
436 
437 typedef struct generic_pm_domain *(*genpd_xlate_t)(const struct of_phandle_args *args,
438 						   void *data);
439 
440 struct genpd_onecell_data {
441 	struct generic_pm_domain **domains;
442 	unsigned int num_domains;
443 	genpd_xlate_t xlate;
444 };
445 
446 #ifdef CONFIG_PM_GENERIC_DOMAINS_OF
447 int of_genpd_add_provider_simple(struct device_node *np,
448 				 struct generic_pm_domain *genpd);
449 int of_genpd_add_provider_onecell(struct device_node *np,
450 				  struct genpd_onecell_data *data);
451 void of_genpd_del_provider(struct device_node *np);
452 int of_genpd_add_device(const struct of_phandle_args *args, struct device *dev);
453 int of_genpd_add_subdomain(const struct of_phandle_args *parent_spec,
454 			   const struct of_phandle_args *subdomain_spec);
455 int of_genpd_remove_subdomain(const struct of_phandle_args *parent_spec,
456 			      const struct of_phandle_args *subdomain_spec);
457 struct generic_pm_domain *of_genpd_remove_last(struct device_node *np);
458 int of_genpd_parse_idle_states(struct device_node *dn,
459 			       struct genpd_power_state **states, int *n);
460 void of_genpd_sync_state(struct device_node *np);
461 
462 int genpd_dev_pm_attach(struct device *dev);
463 struct device *genpd_dev_pm_attach_by_id(struct device *dev,
464 					 unsigned int index);
465 struct device *genpd_dev_pm_attach_by_name(struct device *dev,
466 					   const char *name);
467 #else /* !CONFIG_PM_GENERIC_DOMAINS_OF */
of_genpd_add_provider_simple(struct device_node * np,struct generic_pm_domain * genpd)468 static inline int of_genpd_add_provider_simple(struct device_node *np,
469 					struct generic_pm_domain *genpd)
470 {
471 	return -EOPNOTSUPP;
472 }
473 
of_genpd_add_provider_onecell(struct device_node * np,struct genpd_onecell_data * data)474 static inline int of_genpd_add_provider_onecell(struct device_node *np,
475 					struct genpd_onecell_data *data)
476 {
477 	return -EOPNOTSUPP;
478 }
479 
of_genpd_del_provider(struct device_node * np)480 static inline void of_genpd_del_provider(struct device_node *np) {}
481 
of_genpd_add_device(const struct of_phandle_args * args,struct device * dev)482 static inline int of_genpd_add_device(const struct of_phandle_args *args,
483 				      struct device *dev)
484 {
485 	return -ENODEV;
486 }
487 
of_genpd_add_subdomain(const struct of_phandle_args * parent_spec,const struct of_phandle_args * subdomain_spec)488 static inline int of_genpd_add_subdomain(const struct of_phandle_args *parent_spec,
489 					 const struct of_phandle_args *subdomain_spec)
490 {
491 	return -ENODEV;
492 }
493 
of_genpd_remove_subdomain(const struct of_phandle_args * parent_spec,const struct of_phandle_args * subdomain_spec)494 static inline int of_genpd_remove_subdomain(const struct of_phandle_args *parent_spec,
495 					    const struct of_phandle_args *subdomain_spec)
496 {
497 	return -ENODEV;
498 }
499 
of_genpd_parse_idle_states(struct device_node * dn,struct genpd_power_state ** states,int * n)500 static inline int of_genpd_parse_idle_states(struct device_node *dn,
501 			struct genpd_power_state **states, int *n)
502 {
503 	return -ENODEV;
504 }
505 
of_genpd_sync_state(struct device_node * np)506 static inline void of_genpd_sync_state(struct device_node *np) {}
507 
genpd_dev_pm_attach(struct device * dev)508 static inline int genpd_dev_pm_attach(struct device *dev)
509 {
510 	return 0;
511 }
512 
genpd_dev_pm_attach_by_id(struct device * dev,unsigned int index)513 static inline struct device *genpd_dev_pm_attach_by_id(struct device *dev,
514 						       unsigned int index)
515 {
516 	return NULL;
517 }
518 
genpd_dev_pm_attach_by_name(struct device * dev,const char * name)519 static inline struct device *genpd_dev_pm_attach_by_name(struct device *dev,
520 							 const char *name)
521 {
522 	return NULL;
523 }
524 
525 static inline
of_genpd_remove_last(struct device_node * np)526 struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)
527 {
528 	return ERR_PTR(-EOPNOTSUPP);
529 }
530 #endif /* CONFIG_PM_GENERIC_DOMAINS_OF */
531 
532 #ifdef CONFIG_PM
533 int dev_pm_domain_attach(struct device *dev, u32 flags);
534 struct device *dev_pm_domain_attach_by_id(struct device *dev,
535 					  unsigned int index);
536 struct device *dev_pm_domain_attach_by_name(struct device *dev,
537 					    const char *name);
538 int dev_pm_domain_attach_list(struct device *dev,
539 			      const struct dev_pm_domain_attach_data *data,
540 			      struct dev_pm_domain_list **list);
541 int devm_pm_domain_attach_list(struct device *dev,
542 			       const struct dev_pm_domain_attach_data *data,
543 			       struct dev_pm_domain_list **list);
544 void dev_pm_domain_detach(struct device *dev, bool power_off);
545 void dev_pm_domain_detach_list(struct dev_pm_domain_list *list);
546 int dev_pm_domain_start(struct device *dev);
547 void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd);
548 int dev_pm_domain_set_performance_state(struct device *dev, unsigned int state);
549 #else
dev_pm_domain_attach(struct device * dev,u32 flags)550 static inline int dev_pm_domain_attach(struct device *dev, u32 flags)
551 {
552 	return 0;
553 }
dev_pm_domain_attach_by_id(struct device * dev,unsigned int index)554 static inline struct device *dev_pm_domain_attach_by_id(struct device *dev,
555 							unsigned int index)
556 {
557 	return NULL;
558 }
dev_pm_domain_attach_by_name(struct device * dev,const char * name)559 static inline struct device *dev_pm_domain_attach_by_name(struct device *dev,
560 							  const char *name)
561 {
562 	return NULL;
563 }
dev_pm_domain_attach_list(struct device * dev,const struct dev_pm_domain_attach_data * data,struct dev_pm_domain_list ** list)564 static inline int dev_pm_domain_attach_list(struct device *dev,
565 				const struct dev_pm_domain_attach_data *data,
566 				struct dev_pm_domain_list **list)
567 {
568 	return 0;
569 }
570 
devm_pm_domain_attach_list(struct device * dev,const struct dev_pm_domain_attach_data * data,struct dev_pm_domain_list ** list)571 static inline int devm_pm_domain_attach_list(struct device *dev,
572 					     const struct dev_pm_domain_attach_data *data,
573 					     struct dev_pm_domain_list **list)
574 {
575 	return 0;
576 }
577 
dev_pm_domain_detach(struct device * dev,bool power_off)578 static inline void dev_pm_domain_detach(struct device *dev, bool power_off) {}
dev_pm_domain_detach_list(struct dev_pm_domain_list * list)579 static inline void dev_pm_domain_detach_list(struct dev_pm_domain_list *list) {}
dev_pm_domain_start(struct device * dev)580 static inline int dev_pm_domain_start(struct device *dev)
581 {
582 	return 0;
583 }
dev_pm_domain_set(struct device * dev,struct dev_pm_domain * pd)584 static inline void dev_pm_domain_set(struct device *dev,
585 				     struct dev_pm_domain *pd) {}
dev_pm_domain_set_performance_state(struct device * dev,unsigned int state)586 static inline int dev_pm_domain_set_performance_state(struct device *dev,
587 						      unsigned int state)
588 {
589 	return 0;
590 }
591 #endif
592 
593 #endif /* _LINUX_PM_DOMAIN_H */
594