PM: Add user-space wake lock api.
[firefly-linux-kernel-4.4.55.git] / kernel / power / Kconfig
1 config PM
2         bool "Power Management support"
3         depends on !IA64_HP_SIM
4         ---help---
5           "Power Management" means that parts of your computer are shut
6           off or put into a power conserving "sleep" mode if they are not
7           being used.  There are two competing standards for doing this: APM
8           and ACPI.  If you want to use either one, say Y here and then also
9           to the requisite support below.
10
11           Power Management is most important for battery powered laptop
12           computers; if you have a laptop, check out the Linux Laptop home
13           page on the WWW at <http://www.linux-on-laptops.com/> or
14           Tuxmobil - Linux on Mobile Computers at <http://www.tuxmobil.org/>
15           and the Battery Powered Linux mini-HOWTO, available from
16           <http://www.tldp.org/docs.html#howto>.
17
18           Note that, even if you say N here, Linux on the x86 architecture
19           will issue the hlt instruction if nothing is to be done, thereby
20           sending the processor to sleep and saving power.
21
22 config PM_DEBUG
23         bool "Power Management Debug Support"
24         depends on PM
25         ---help---
26         This option enables various debugging support in the Power Management
27         code. This is helpful when debugging and reporting PM bugs, like
28         suspend support.
29
30 config PM_VERBOSE
31         bool "Verbose Power Management debugging"
32         depends on PM_DEBUG
33         default n
34         ---help---
35         This option enables verbose messages from the Power Management code.
36
37 config CAN_PM_TRACE
38         def_bool y
39         depends on PM_DEBUG && PM_SLEEP && EXPERIMENTAL
40
41 config PM_TRACE
42         bool
43         help
44           This enables code to save the last PM event point across
45           reboot. The architecture needs to support this, x86 for
46           example does by saving things in the RTC, see below.
47
48           The architecture specific code must provide the extern
49           functions from <linux/resume-trace.h> as well as the
50           <asm/resume-trace.h> header with a TRACE_RESUME() macro.
51
52           The way the information is presented is architecture-
53           dependent, x86 will print the information during a
54           late_initcall.
55
56 config PM_TRACE_RTC
57         bool "Suspend/resume event tracing"
58         depends on CAN_PM_TRACE
59         depends on X86
60         select PM_TRACE
61         default n
62         ---help---
63         This enables some cheesy code to save the last PM event point in the
64         RTC across reboots, so that you can debug a machine that just hangs
65         during suspend (or more commonly, during resume).
66
67         To use this debugging feature you should attempt to suspend the
68         machine, reboot it and then run
69
70                 dmesg -s 1000000 | grep 'hash matches'
71
72         CAUTION: this option will cause your machine's real-time clock to be
73         set to an invalid time after a resume.
74
75 config PM_SLEEP_SMP
76         bool
77         depends on SMP
78         depends on ARCH_SUSPEND_POSSIBLE || ARCH_HIBERNATION_POSSIBLE
79         depends on PM_SLEEP
80         select HOTPLUG_CPU
81         default y
82
83 config PM_SLEEP
84         bool
85         depends on SUSPEND || HIBERNATION || XEN_SAVE_RESTORE
86         default y
87
88 config SUSPEND
89         bool "Suspend to RAM and standby"
90         depends on PM && ARCH_SUSPEND_POSSIBLE
91         default y
92         ---help---
93           Allow the system to enter sleep states in which main memory is
94           powered and thus its contents are preserved, such as the
95           suspend-to-RAM state (e.g. the ACPI S3 state).
96
97 config PM_TEST_SUSPEND
98         bool "Test suspend/resume and wakealarm during bootup"
99         depends on SUSPEND && PM_DEBUG && RTC_CLASS=y
100         ---help---
101         This option will let you suspend your machine during bootup, and
102         make it wake up a few seconds later using an RTC wakeup alarm.
103         Enable this with a kernel parameter like "test_suspend=mem".
104
105         You probably want to have your system's RTC driver statically
106         linked, ensuring that it's available when this test runs.
107
108 config SUSPEND_FREEZER
109         bool "Enable freezer for suspend to RAM/standby" \
110                 if ARCH_WANTS_FREEZER_CONTROL || BROKEN
111         depends on SUSPEND
112         default y
113         help
114           This allows you to turn off the freezer for suspend. If this is
115           done, no tasks are frozen for suspend to RAM/standby.
116
117           Turning OFF this setting is NOT recommended! If in doubt, say Y.
118
119 config HIBERNATION_NVS
120         bool
121
122 config HAS_WAKELOCK
123         bool
124
125 config HAS_EARLYSUSPEND
126         bool
127
128 config WAKELOCK
129         bool "Wake lock"
130         depends on PM && RTC_CLASS
131         default n
132         select HAS_WAKELOCK
133         ---help---
134           Enable wakelocks. When user space request a sleep state the
135           sleep request will be delayed until no wake locks are held.
136
137 config WAKELOCK_STAT
138         bool "Wake lock stats"
139         depends on WAKELOCK
140         default y
141         ---help---
142           Report wake lock stats in /proc/wakelocks
143
144 config USER_WAKELOCK
145         bool "Userspace wake locks"
146         depends on WAKELOCK
147         default y
148         ---help---
149           User-space wake lock api. Write "lockname" or "lockname timeout"
150           to /sys/power/wake_lock lock and if needed create a wake lock.
151           Write "lockname" to /sys/power/wake_unlock to unlock a user wake
152           lock.
153
154 config EARLYSUSPEND
155         bool "Early suspend"
156         depends on WAKELOCK
157         default y
158         select HAS_EARLYSUSPEND
159         ---help---
160           Call early suspend handlers when the user requested sleep state
161           changes.
162
163 config HIBERNATION
164         bool "Hibernation (aka 'suspend to disk')"
165         depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
166         select HIBERNATION_NVS if HAS_IOMEM
167         ---help---
168           Enable the suspend to disk (STD) functionality, which is usually
169           called "hibernation" in user interfaces.  STD checkpoints the
170           system and powers it off; and restores that checkpoint on reboot.
171
172           You can suspend your machine with 'echo disk > /sys/power/state'
173           after placing resume=/dev/swappartition on the kernel command line
174           in your bootloader's configuration file.
175
176           Alternatively, you can use the additional userland tools available
177           from <http://suspend.sf.net>.
178
179           In principle it does not require ACPI or APM, although for example
180           ACPI will be used for the final steps when it is available.  One
181           of the reasons to use software suspend is that the firmware hooks
182           for suspend states like suspend-to-RAM (STR) often don't work very
183           well with Linux.
184
185           It creates an image which is saved in your active swap. Upon the next
186           boot, pass the 'resume=/dev/swappartition' argument to the kernel to
187           have it detect the saved image, restore memory state from it, and
188           continue to run as before. If you do not want the previous state to
189           be reloaded, then use the 'noresume' kernel command line argument.
190           Note, however, that fsck will be run on your filesystems and you will
191           need to run mkswap against the swap partition used for the suspend.
192
193           It also works with swap files to a limited extent (for details see
194           <file:Documentation/power/swsusp-and-swap-files.txt>).
195
196           Right now you may boot without resuming and resume later but in the
197           meantime you cannot use the swap partition(s)/file(s) involved in
198           suspending.  Also in this case you must not use the filesystems
199           that were mounted before the suspend.  In particular, you MUST NOT
200           MOUNT any journaled filesystems mounted before the suspend or they
201           will get corrupted in a nasty way.
202
203           For more information take a look at <file:Documentation/power/swsusp.txt>.
204
205 config PM_STD_PARTITION
206         string "Default resume partition"
207         depends on HIBERNATION
208         default ""
209         ---help---
210           The default resume partition is the partition that the suspend-
211           to-disk implementation will look for a suspended disk image. 
212
213           The partition specified here will be different for almost every user. 
214           It should be a valid swap partition (at least for now) that is turned
215           on before suspending. 
216
217           The partition specified can be overridden by specifying:
218
219                 resume=/dev/<other device> 
220
221           which will set the resume partition to the device specified. 
222
223           Note there is currently not a way to specify which device to save the
224           suspended image to. It will simply pick the first available swap 
225           device.
226
227 config APM_EMULATION
228         tristate "Advanced Power Management Emulation"
229         depends on PM && SYS_SUPPORTS_APM_EMULATION
230         help
231           APM is a BIOS specification for saving power using several different
232           techniques. This is mostly useful for battery powered laptops with
233           APM compliant BIOSes. If you say Y here, the system time will be
234           reset after a RESUME operation, the /proc/apm device will provide
235           battery status information, and user-space programs will receive
236           notification of APM "events" (e.g. battery status change).
237
238           In order to use APM, you will need supporting software. For location
239           and more information, read <file:Documentation/power/pm.txt> and the
240           Battery Powered Linux mini-HOWTO, available from
241           <http://www.tldp.org/docs.html#howto>.
242
243           This driver does not spin down disk drives (see the hdparm(8)
244           manpage ("man 8 hdparm") for that), and it doesn't turn off
245           VESA-compliant "green" monitors.
246
247           Generally, if you don't have a battery in your machine, there isn't
248           much point in using this driver and you should say N. If you get
249           random kernel OOPSes or reboots that don't seem to be related to
250           anything, try disabling/enabling this option (or disabling/enabling
251           APM in your BIOS).
252
253 config PM_RUNTIME
254         bool "Run-time PM core functionality"
255         depends on PM
256         ---help---
257           Enable functionality allowing I/O devices to be put into energy-saving
258           (low power) states at run time (or autosuspended) after a specified
259           period of inactivity and woken up in response to a hardware-generated
260           wake-up event or a driver's request.
261
262           Hardware support is generally required for this functionality to work
263           and the bus type drivers of the buses the devices are on are
264           responsible for the actual handling of the autosuspend requests and
265           wake-up events.