PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
[linux/fpc-iii.git] / drivers / base / power / power.h
blobf1a5d95e7b207816ef522ef0c9b20de192fdc28e
1 #include <linux/pm_qos.h>
3 static inline void device_pm_init_common(struct device *dev)
5 if (!dev->power.early_init) {
6 spin_lock_init(&dev->power.lock);
7 dev->power.qos = NULL;
8 dev->power.early_init = true;
12 #ifdef CONFIG_PM
14 static inline void pm_runtime_early_init(struct device *dev)
16 dev->power.disable_depth = 1;
17 device_pm_init_common(dev);
20 extern void pm_runtime_init(struct device *dev);
21 extern void pm_runtime_remove(struct device *dev);
23 struct wake_irq {
24 struct device *dev;
25 int irq;
26 bool dedicated_irq:1;
29 extern void dev_pm_arm_wake_irq(struct wake_irq *wirq);
30 extern void dev_pm_disarm_wake_irq(struct wake_irq *wirq);
32 #ifdef CONFIG_PM_SLEEP
34 extern int device_wakeup_attach_irq(struct device *dev,
35 struct wake_irq *wakeirq);
36 extern void device_wakeup_detach_irq(struct device *dev);
37 extern void device_wakeup_arm_wake_irqs(void);
38 extern void device_wakeup_disarm_wake_irqs(void);
40 #else
42 static inline int
43 device_wakeup_attach_irq(struct device *dev,
44 struct wake_irq *wakeirq)
46 return 0;
49 static inline void device_wakeup_detach_irq(struct device *dev)
53 static inline void device_wakeup_arm_wake_irqs(void)
57 static inline void device_wakeup_disarm_wake_irqs(void)
61 #endif /* CONFIG_PM_SLEEP */
64 * sysfs.c
67 extern int dpm_sysfs_add(struct device *dev);
68 extern void dpm_sysfs_remove(struct device *dev);
69 extern void rpm_sysfs_remove(struct device *dev);
70 extern int wakeup_sysfs_add(struct device *dev);
71 extern void wakeup_sysfs_remove(struct device *dev);
72 extern int pm_qos_sysfs_add_resume_latency(struct device *dev);
73 extern void pm_qos_sysfs_remove_resume_latency(struct device *dev);
74 extern int pm_qos_sysfs_add_flags(struct device *dev);
75 extern void pm_qos_sysfs_remove_flags(struct device *dev);
77 #else /* CONFIG_PM */
79 static inline void pm_runtime_early_init(struct device *dev)
81 device_pm_init_common(dev);
84 static inline void pm_runtime_init(struct device *dev) {}
85 static inline void pm_runtime_remove(struct device *dev) {}
87 static inline int dpm_sysfs_add(struct device *dev) { return 0; }
88 static inline void dpm_sysfs_remove(struct device *dev) {}
89 static inline void rpm_sysfs_remove(struct device *dev) {}
90 static inline int wakeup_sysfs_add(struct device *dev) { return 0; }
91 static inline void wakeup_sysfs_remove(struct device *dev) {}
92 static inline int pm_qos_sysfs_add(struct device *dev) { return 0; }
93 static inline void pm_qos_sysfs_remove(struct device *dev) {}
95 static inline void dev_pm_arm_wake_irq(struct wake_irq *wirq)
99 static inline void dev_pm_disarm_wake_irq(struct wake_irq *wirq)
103 #endif
105 #ifdef CONFIG_PM_SLEEP
107 /* kernel/power/main.c */
108 extern int pm_async_enabled;
110 /* drivers/base/power/main.c */
111 extern struct list_head dpm_list; /* The active device list */
113 static inline struct device *to_device(struct list_head *entry)
115 return container_of(entry, struct device, power.entry);
118 extern void device_pm_sleep_init(struct device *dev);
119 extern void device_pm_add(struct device *);
120 extern void device_pm_remove(struct device *);
121 extern void device_pm_move_before(struct device *, struct device *);
122 extern void device_pm_move_after(struct device *, struct device *);
123 extern void device_pm_move_last(struct device *);
125 #else /* !CONFIG_PM_SLEEP */
127 static inline void device_pm_sleep_init(struct device *dev) {}
129 static inline void device_pm_add(struct device *dev) {}
131 static inline void device_pm_remove(struct device *dev)
133 pm_runtime_remove(dev);
136 static inline void device_pm_move_before(struct device *deva,
137 struct device *devb) {}
138 static inline void device_pm_move_after(struct device *deva,
139 struct device *devb) {}
140 static inline void device_pm_move_last(struct device *dev) {}
142 #endif /* !CONFIG_PM_SLEEP */
144 static inline void device_pm_init(struct device *dev)
146 device_pm_init_common(dev);
147 device_pm_sleep_init(dev);
148 pm_runtime_init(dev);