Merge remote-tracking branch 'asoc/fix/intel' into asoc-linus
[deliverable/linux.git] / drivers / base / power / power.h
CommitLineData
1a9a9152
RW
1#include <linux/pm_qos.h>
2
e91c11b1
RW
3static inline void device_pm_init_common(struct device *dev)
4{
bed2b42d
RW
5 if (!dev->power.early_init) {
6 spin_lock_init(&dev->power.lock);
37530f2b 7 dev->power.qos = NULL;
bed2b42d
RW
8 dev->power.early_init = true;
9 }
e91c11b1
RW
10}
11
d30d819d 12#ifdef CONFIG_PM
5e928f77 13
bed2b42d
RW
14static inline void pm_runtime_early_init(struct device *dev)
15{
16 dev->power.disable_depth = 1;
17 device_pm_init_common(dev);
18}
19
5e928f77 20extern void pm_runtime_init(struct device *dev);
5de85b9d 21extern void pm_runtime_reinit(struct device *dev);
5e928f77
RW
22extern void pm_runtime_remove(struct device *dev);
23
4990d4fe
TL
24struct wake_irq {
25 struct device *dev;
26 int irq;
27 bool dedicated_irq:1;
28};
29
30extern void dev_pm_arm_wake_irq(struct wake_irq *wirq);
31extern void dev_pm_disarm_wake_irq(struct wake_irq *wirq);
32
33#ifdef CONFIG_PM_SLEEP
34
35extern int device_wakeup_attach_irq(struct device *dev,
36 struct wake_irq *wakeirq);
37extern void device_wakeup_detach_irq(struct device *dev);
38extern void device_wakeup_arm_wake_irqs(void);
39extern void device_wakeup_disarm_wake_irqs(void);
40
41#else
42
43static inline int
44device_wakeup_attach_irq(struct device *dev,
45 struct wake_irq *wakeirq)
46{
47 return 0;
48}
49
50static inline void device_wakeup_detach_irq(struct device *dev)
51{
52}
53
54static inline void device_wakeup_arm_wake_irqs(void)
55{
56}
57
58static inline void device_wakeup_disarm_wake_irqs(void)
59{
60}
61
62#endif /* CONFIG_PM_SLEEP */
63
d30d819d
RW
64/*
65 * sysfs.c
66 */
67
68extern int dpm_sysfs_add(struct device *dev);
69extern void dpm_sysfs_remove(struct device *dev);
70extern void rpm_sysfs_remove(struct device *dev);
71extern int wakeup_sysfs_add(struct device *dev);
72extern void wakeup_sysfs_remove(struct device *dev);
73extern int pm_qos_sysfs_add_resume_latency(struct device *dev);
74extern void pm_qos_sysfs_remove_resume_latency(struct device *dev);
75extern int pm_qos_sysfs_add_flags(struct device *dev);
76extern void pm_qos_sysfs_remove_flags(struct device *dev);
13b2c4a0
MW
77extern int pm_qos_sysfs_add_latency_tolerance(struct device *dev);
78extern void pm_qos_sysfs_remove_latency_tolerance(struct device *dev);
d30d819d
RW
79
80#else /* CONFIG_PM */
5e928f77 81
bed2b42d
RW
82static inline void pm_runtime_early_init(struct device *dev)
83{
84 device_pm_init_common(dev);
85}
86
5e928f77 87static inline void pm_runtime_init(struct device *dev) {}
5de85b9d 88static inline void pm_runtime_reinit(struct device *dev) {}
5e928f77
RW
89static inline void pm_runtime_remove(struct device *dev) {}
90
d30d819d
RW
91static inline int dpm_sysfs_add(struct device *dev) { return 0; }
92static inline void dpm_sysfs_remove(struct device *dev) {}
93static inline void rpm_sysfs_remove(struct device *dev) {}
94static inline int wakeup_sysfs_add(struct device *dev) { return 0; }
95static inline void wakeup_sysfs_remove(struct device *dev) {}
96static inline int pm_qos_sysfs_add(struct device *dev) { return 0; }
97static inline void pm_qos_sysfs_remove(struct device *dev) {}
98
4990d4fe
TL
99static inline void dev_pm_arm_wake_irq(struct wake_irq *wirq)
100{
101}
102
103static inline void dev_pm_disarm_wake_irq(struct wake_irq *wirq)
104{
105}
106
d30d819d 107#endif
3b98aeaf 108
296699de 109#ifdef CONFIG_PM_SLEEP
1da177e4 110
0e06b4a8
RW
111/* kernel/power/main.c */
112extern int pm_async_enabled;
1da177e4 113
0e06b4a8 114/* drivers/base/power/main.c */
1eede070 115extern struct list_head dpm_list; /* The active device list */
1da177e4 116
dec13c15 117static inline struct device *to_device(struct list_head *entry)
1da177e4 118{
cd59abfc 119 return container_of(entry, struct device, power.entry);
1da177e4
LT
120}
121
e91c11b1 122extern void device_pm_sleep_init(struct device *dev);
3b98aeaf 123extern void device_pm_add(struct device *);
1da177e4 124extern void device_pm_remove(struct device *);
ffa6a705
CH
125extern void device_pm_move_before(struct device *, struct device *);
126extern void device_pm_move_after(struct device *, struct device *);
127extern void device_pm_move_last(struct device *);
aa8e54b5 128extern void device_pm_check_callbacks(struct device *dev);
1da177e4 129
5e928f77
RW
130#else /* !CONFIG_PM_SLEEP */
131
e91c11b1 132static inline void device_pm_sleep_init(struct device *dev) {}
5e928f77 133
37530f2b 134static inline void device_pm_add(struct device *dev) {}
1a9a9152 135
5e928f77
RW
136static inline void device_pm_remove(struct device *dev)
137{
138 pm_runtime_remove(dev);
139}
dec13c15 140
ffa6a705
CH
141static inline void device_pm_move_before(struct device *deva,
142 struct device *devb) {}
143static inline void device_pm_move_after(struct device *deva,
144 struct device *devb) {}
145static inline void device_pm_move_last(struct device *dev) {}
775b64d2 146
aa8e54b5
TV
147static inline void device_pm_check_callbacks(struct device *dev) {}
148
5e928f77 149#endif /* !CONFIG_PM_SLEEP */
dec13c15 150
e91c11b1
RW
151static inline void device_pm_init(struct device *dev)
152{
153 device_pm_init_common(dev);
154 device_pm_sleep_init(dev);
155 pm_runtime_init(dev);
156}
This page took 0.841864 seconds and 5 git commands to generate.