ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / base / power / power.h
1
2
3 enum {
4         DEVICE_PM_ON,
5         DEVICE_PM1,
6         DEVICE_PM2,
7         DEVICE_PM3,
8         DEVICE_PM_OFF,
9 };
10
11 /*
12  * shutdown.c
13  */
14
15 extern int device_detach_shutdown(struct device *);
16 extern void device_shutdown(void);
17
18
19 #ifdef CONFIG_PM
20
21 /*
22  * main.c
23  */
24
25 /*
26  * Used to synchronize global power management operations.
27  */
28 extern struct semaphore dpm_sem;
29
30 /* 
31  * The PM lists.
32  */
33 extern struct list_head dpm_active;
34 extern struct list_head dpm_off;
35 extern struct list_head dpm_off_irq;
36
37
38 static inline struct dev_pm_info * to_pm_info(struct list_head * entry)
39 {
40         return container_of(entry,struct dev_pm_info,entry);
41 }
42
43 static inline struct device * to_device(struct list_head * entry)
44 {
45         return container_of(to_pm_info(entry),struct device,power);
46 }
47
48 extern int device_pm_add(struct device *);
49 extern void device_pm_remove(struct device *);
50
51 /*
52  * sysfs.c
53  */
54
55 extern int dpm_sysfs_add(struct device *);
56 extern void dpm_sysfs_remove(struct device *);
57
58 /*
59  * resume.c 
60  */
61
62 extern void dpm_resume(void);
63 extern void dpm_power_up(void);
64 extern int resume_device(struct device *);
65
66 /*
67  * suspend.c
68  */
69 extern int suspend_device(struct device *, u32);
70
71
72 /*
73  * runtime.c
74  */
75
76 extern int dpm_runtime_suspend(struct device *, u32);
77 extern void dpm_runtime_resume(struct device *);
78
79 #else /* CONFIG_PM */
80
81
82 static inline int device_pm_add(struct device * dev)
83 {
84         return 0;
85 }
86 static inline void device_pm_remove(struct device * dev)
87 {
88
89 }
90
91 static inline int dpm_runtime_suspend(struct device * dev, u32 state)
92 {
93         return 0;
94 }
95
96 static inline void dpm_runtime_resume(struct device * dev)
97 {
98
99 }
100
101 #endif