aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-03 17:10:23 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-03 17:10:23 -0400
commitee7f9d7c7c1d0fde6441be495f6f14eae43af2e0 (patch)
treee47d5f4ae1e8f939b0cde3548987d599181ce529
parent97b80e685ffae9a6dc946ab08ed32f1eafda97d7 (diff)
parent057b0a7518e4b8fca26201715996d6d928a62300 (diff)
Merge branch 'pm-sleep'
* pm-sleep: PM / hibernate: fixed typo in comment PM / sleep: unregister wakeup source when disabling device wakeup PM / sleep: Introduce command line argument for sleep state enumeration PM / sleep: Use valid_state() for platform-dependent sleep states only PM / sleep: Add state field to pm_states[] entries PM / sleep: Update device PM documentation to cover direct_complete PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily PM / hibernate: Fix memory corruption in resumedelay_setup() PM / hibernate: convert simple_strtoul to kstrtoul PM / hibernate: Documentation: Fix script for unswapping PM / hibernate: no kernel_power_off when pm_power_off NULL PM / hibernate: use unsigned local variables in swsusp_show_speed()
-rw-r--r--Documentation/ABI/testing/sysfs-power29
-rw-r--r--Documentation/kernel-parameters.txt7
-rw-r--r--Documentation/power/devices.txt34
-rw-r--r--Documentation/power/runtime_pm.txt17
-rw-r--r--Documentation/power/states.txt87
-rw-r--r--Documentation/power/swsusp.txt5
-rw-r--r--drivers/base/power/main.c66
-rw-r--r--drivers/base/power/wakeup.c6
-rw-r--r--include/linux/pm.h36
-rw-r--r--include/linux/pm_runtime.h6
-rw-r--r--kernel/power/hibernate.c27
-rw-r--r--kernel/power/main.c33
-rw-r--r--kernel/power/power.h9
-rw-r--r--kernel/power/suspend.c94
-rw-r--r--kernel/power/suspend_test.c24
-rw-r--r--kernel/power/swap.c2
16 files changed, 339 insertions, 143 deletions
diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
index 64c9276e9421..f4551816329e 100644
--- a/Documentation/ABI/testing/sysfs-power
+++ b/Documentation/ABI/testing/sysfs-power
@@ -7,19 +7,30 @@ Description:
7 subsystem. 7 subsystem.
8 8
9What: /sys/power/state 9What: /sys/power/state
10Date: August 2006 10Date: May 2014
11Contact: Rafael J. Wysocki <rjw@rjwysocki.net> 11Contact: Rafael J. Wysocki <rjw@rjwysocki.net>
12Description: 12Description:
13 The /sys/power/state file controls the system power state. 13 The /sys/power/state file controls system sleep states.
14 Reading from this file returns what states are supported, 14 Reading from this file returns the available sleep state
15 which is hard-coded to 'freeze' (Low-Power Idle), 'standby' 15 labels, which may be "mem", "standby", "freeze" and "disk"
16 (Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk' 16 (hibernation). The meanings of the first three labels depend on
17 (Suspend-to-Disk). 17 the relative_sleep_states command line argument as follows:
18 1) relative_sleep_states = 1
19 "mem", "standby", "freeze" represent non-hibernation sleep
20 states from the deepest ("mem", always present) to the
21 shallowest ("freeze"). "standby" and "freeze" may or may
22 not be present depending on the capabilities of the
23 platform. "freeze" can only be present if "standby" is
24 present.
25 2) relative_sleep_states = 0 (default)
26 "mem" - "suspend-to-RAM", present if supported.
27 "standby" - "power-on suspend", present if supported.
28 "freeze" - "suspend-to-idle", always present.
18 29
19 Writing to this file one of these strings causes the system to 30 Writing to this file one of these strings causes the system to
20 transition into that state. Please see the file 31 transition into the corresponding state, if available. See
21 Documentation/power/states.txt for a description of each of 32 Documentation/power/states.txt for a description of what
22 these states. 33 "suspend-to-RAM", "power-on suspend" and "suspend-to-idle" mean.
23 34
24What: /sys/power/disk 35What: /sys/power/disk
25Date: September 2006 36Date: September 2006
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 30a8ad0dae53..2b64fb221790 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2889,6 +2889,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
2889 [KNL, SMP] Set scheduler's default relax_domain_level. 2889 [KNL, SMP] Set scheduler's default relax_domain_level.
2890 See Documentation/cgroups/cpusets.txt. 2890 See Documentation/cgroups/cpusets.txt.
2891 2891
2892 relative_sleep_states=
2893 [SUSPEND] Use sleep state labeling where the deepest
2894 state available other than hibernation is always "mem".
2895 Format: { "0" | "1" }
2896 0 -- Traditional sleep state labels.
2897 1 -- Relative sleep state labels.
2898
2892 reserve= [KNL,BUGS] Force the kernel to ignore some iomem area 2899 reserve= [KNL,BUGS] Force the kernel to ignore some iomem area
2893 2900
2894 reservetop= [X86-32] 2901 reservetop= [X86-32]
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt
index 47d46dff70f7..d172bce0fd49 100644
--- a/Documentation/power/devices.txt
+++ b/Documentation/power/devices.txt
@@ -2,6 +2,7 @@ Device Power Management
2 2
3Copyright (c) 2010-2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. 3Copyright (c) 2010-2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
4Copyright (c) 2010 Alan Stern <stern@rowland.harvard.edu> 4Copyright (c) 2010 Alan Stern <stern@rowland.harvard.edu>
5Copyright (c) 2014 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
5 6
6 7
7Most of the code in Linux is device drivers, so most of the Linux power 8Most of the code in Linux is device drivers, so most of the Linux power
@@ -326,6 +327,20 @@ the phases are:
326 driver in some way for the upcoming system power transition, but it 327 driver in some way for the upcoming system power transition, but it
327 should not put the device into a low-power state. 328 should not put the device into a low-power state.
328 329
330 For devices supporting runtime power management, the return value of the
331 prepare callback can be used to indicate to the PM core that it may
332 safely leave the device in runtime suspend (if runtime-suspended
333 already), provided that all of the device's descendants are also left in
334 runtime suspend. Namely, if the prepare callback returns a positive
335 number and that happens for all of the descendants of the device too,
336 and all of them (including the device itself) are runtime-suspended, the
337 PM core will skip the suspend, suspend_late and suspend_noirq suspend
338 phases as well as the resume_noirq, resume_early and resume phases of
339 the following system resume for all of these devices. In that case,
340 the complete callback will be called directly after the prepare callback
341 and is entirely responsible for bringing the device back to the
342 functional state as appropriate.
343
329 2. The suspend methods should quiesce the device to stop it from performing 344 2. The suspend methods should quiesce the device to stop it from performing
330 I/O. They also may save the device registers and put it into the 345 I/O. They also may save the device registers and put it into the
331 appropriate low-power state, depending on the bus type the device is on, 346 appropriate low-power state, depending on the bus type the device is on,
@@ -400,12 +415,23 @@ When resuming from freeze, standby or memory sleep, the phases are:
400 the resume callbacks occur; it's not necessary to wait until the 415 the resume callbacks occur; it's not necessary to wait until the
401 complete phase. 416 complete phase.
402 417
418 Moreover, if the preceding prepare callback returned a positive number,
419 the device may have been left in runtime suspend throughout the whole
420 system suspend and resume (the suspend, suspend_late, suspend_noirq
421 phases of system suspend and the resume_noirq, resume_early, resume
422 phases of system resume may have been skipped for it). In that case,
423 the complete callback is entirely responsible for bringing the device
424 back to the functional state after system suspend if necessary. [For
425 example, it may need to queue up a runtime resume request for the device
426 for this purpose.] To check if that is the case, the complete callback
427 can consult the device's power.direct_complete flag. Namely, if that
428 flag is set when the complete callback is being run, it has been called
429 directly after the preceding prepare and special action may be required
430 to make the device work correctly afterward.
431
403At the end of these phases, drivers should be as functional as they were before 432At the end of these phases, drivers should be as functional as they were before
404suspending: I/O can be performed using DMA and IRQs, and the relevant clocks are 433suspending: I/O can be performed using DMA and IRQs, and the relevant clocks are
405gated on. Even if the device was in a low-power state before the system sleep 434gated on.
406because of runtime power management, afterwards it should be back in its
407full-power state. There are multiple reasons why it's best to do this; they are
408discussed in more detail in Documentation/power/runtime_pm.txt.
409 435
410However, the details here may again be platform-specific. For example, 436However, the details here may again be platform-specific. For example,
411some systems support multiple "run" states, and the mode in effect at 437some systems support multiple "run" states, and the mode in effect at
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt
index 5f96daf8566a..e1bee8a4aaac 100644
--- a/Documentation/power/runtime_pm.txt
+++ b/Documentation/power/runtime_pm.txt
@@ -2,6 +2,7 @@ Runtime Power Management Framework for I/O Devices
2 2
3(C) 2009-2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc. 3(C) 2009-2011 Rafael J. Wysocki <rjw@sisk.pl>, Novell Inc.
4(C) 2010 Alan Stern <stern@rowland.harvard.edu> 4(C) 2010 Alan Stern <stern@rowland.harvard.edu>
5(C) 2014 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
5 6
61. Introduction 71. Introduction
7 8
@@ -444,6 +445,10 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:
444 bool pm_runtime_status_suspended(struct device *dev); 445 bool pm_runtime_status_suspended(struct device *dev);
445 - return true if the device's runtime PM status is 'suspended' 446 - return true if the device's runtime PM status is 'suspended'
446 447
448 bool pm_runtime_suspended_if_enabled(struct device *dev);
449 - return true if the device's runtime PM status is 'suspended' and its
450 'power.disable_depth' field