Commit 75e1d828 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branch 'pm-fixes'

* pm-fixes:
  PM / hibernate: Correct documentation
  PM / Documentation: remove inaccurate suspend/hibernate transition lantency statement
  PM: Documentation update for freeze state
  PM: Avoid calling kfree() under spinlock in dev_pm_put_subsys_data()
parents c01782d8 6bc08ed0
...@@ -268,7 +268,7 @@ situations. ...@@ -268,7 +268,7 @@ situations.
System Power Management Phases System Power Management Phases
------------------------------ ------------------------------
Suspending or resuming the system is done in several phases. Different phases Suspending or resuming the system is done in several phases. Different phases
are used for standby or memory sleep states ("suspend-to-RAM") and the are used for freeze, standby, and memory sleep states ("suspend-to-RAM") and the
hibernation state ("suspend-to-disk"). Each phase involves executing callbacks hibernation state ("suspend-to-disk"). Each phase involves executing callbacks
for every device before the next phase begins. Not all busses or classes for every device before the next phase begins. Not all busses or classes
support all these callbacks and not all drivers use all the callbacks. The support all these callbacks and not all drivers use all the callbacks. The
...@@ -309,7 +309,8 @@ execute the corresponding method from dev->driver->pm instead if there is one. ...@@ -309,7 +309,8 @@ execute the corresponding method from dev->driver->pm instead if there is one.
Entering System Suspend Entering System Suspend
----------------------- -----------------------
When the system goes into the standby or memory sleep state, the phases are: When the system goes into the freeze, standby or memory sleep state,
the phases are:
prepare, suspend, suspend_late, suspend_noirq. prepare, suspend, suspend_late, suspend_noirq.
...@@ -368,7 +369,7 @@ the devices that were suspended. ...@@ -368,7 +369,7 @@ the devices that were suspended.
Leaving System Suspend Leaving System Suspend
---------------------- ----------------------
When resuming from standby or memory sleep, the phases are: When resuming from freeze, standby or memory sleep, the phases are:
resume_noirq, resume_early, resume, complete. resume_noirq, resume_early, resume, complete.
...@@ -433,8 +434,8 @@ the system log. ...@@ -433,8 +434,8 @@ the system log.
Entering Hibernation Entering Hibernation
-------------------- --------------------
Hibernating the system is more complicated than putting it into the standby or Hibernating the system is more complicated than putting it into the other
memory sleep state, because it involves creating and saving a system image. sleep states, because it involves creating and saving a system image.
Therefore there are more phases for hibernation, with a different set of Therefore there are more phases for hibernation, with a different set of
callbacks. These phases always run after tasks have been frozen and memory has callbacks. These phases always run after tasks have been frozen and memory has
been freed. been freed.
...@@ -485,8 +486,8 @@ image forms an atomic snapshot of the system state. ...@@ -485,8 +486,8 @@ image forms an atomic snapshot of the system state.
At this point the system image is saved, and the devices then need to be At this point the system image is saved, and the devices then need to be
prepared for the upcoming system shutdown. This is much like suspending them prepared for the upcoming system shutdown. This is much like suspending them
before putting the system into the standby or memory sleep state, and the phases before putting the system into the freeze, standby or memory sleep state,
are similar. and the phases are similar.
9. The prepare phase is discussed above. 9. The prepare phase is discussed above.
......
...@@ -7,8 +7,8 @@ running. The interface exists in /sys/power/ directory (assuming sysfs ...@@ -7,8 +7,8 @@ running. The interface exists in /sys/power/ directory (assuming sysfs
is mounted at /sys). is mounted at /sys).
/sys/power/state controls system power state. Reading from this file /sys/power/state controls system power state. Reading from this file
returns what states are supported, which is hard-coded to 'standby' returns what states are supported, which is hard-coded to 'freeze',
(Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk' 'standby' (Power-On Suspend), 'mem' (Suspend-to-RAM), and 'disk'
(Suspend-to-Disk). (Suspend-to-Disk).
Writing to this file one of those strings causes the system to Writing to this file one of those strings causes the system to
......
...@@ -15,8 +15,10 @@ A suspend/hibernation notifier may be used for this purpose. ...@@ -15,8 +15,10 @@ A suspend/hibernation notifier may be used for this purpose.
The subsystems or drivers having such needs can register suspend notifiers that The subsystems or drivers having such needs can register suspend notifiers that
will be called upon the following events by the PM core: will be called upon the following events by the PM core:
PM_HIBERNATION_PREPARE The system is going to hibernate or suspend, tasks will PM_HIBERNATION_PREPARE The system is going to hibernate, tasks will be frozen
be frozen immediately. immediately. This is different from PM_SUSPEND_PREPARE
below because here we do additional work between notifiers
and drivers freezing.
PM_POST_HIBERNATION The system memory state has been restored from a PM_POST_HIBERNATION The system memory state has been restored from a
hibernation image or an error occurred during hibernation image or an error occurred during
......
...@@ -2,12 +2,26 @@ ...@@ -2,12 +2,26 @@
System Power Management States System Power Management States
The kernel supports three power management states generically, though The kernel supports four power management states generically, though
each is dependent on platform support code to implement the low-level one is generic and the other three are dependent on platform support
details for each state. This file describes each state, what they are code to implement the low-level details for each state.
This file describes each state, what they are
commonly called, what ACPI state they map to, and what string to write commonly called, what ACPI state they map to, and what string to write
to /sys/power/state to enter that state to /sys/power/state to enter that state
state: Freeze / Low-Power Idle
ACPI state: S0
String: "freeze"
This state is a generic, pure software, light-weight, low-power state.
It allows more energy to be saved relative to idle by freezing user
space and putting all I/O devices into low-power states (possibly
lower-power than available at run time), such that the processors can
spend more time in their idle states.
This state can be used for platforms without Standby/Suspend-to-RAM
support, or it can be used in addition to Suspend-to-RAM (memory sleep)
to provide reduced resume latency.
State: Standby / Power-On Suspend State: Standby / Power-On Suspend
ACPI State: S1 ACPI State: S1
...@@ -22,9 +36,6 @@ We try to put devices in a low-power state equivalent to D1, which ...@@ -22,9 +36,6 @@ We try to put devices in a low-power state equivalent to D1, which
also offers low power savings, but low resume latency. Not all devices also offers low power savings, but low resume latency. Not all devices
support D1, and those that don't are left on. support D1, and those that don't are left on.
A transition from Standby to the On state should take about 1-2
seconds.
State: Suspend-to-RAM State: Suspend-to-RAM
ACPI State: S3 ACPI State: S3
...@@ -42,9 +53,6 @@ transition back to the On state. ...@@ -42,9 +53,6 @@ transition back to the On state.
For at least ACPI, STR requires some minimal boot-strapping code to For at least ACPI, STR requires some minimal boot-strapping code to
resume the system from STR. This may be true on other platforms. resume the system from STR. This may be true on other platforms.
A transition from Suspend-to-RAM to the On state should take about
3-5 seconds.
State: Suspend-to-disk State: Suspend-to-disk
ACPI State: S4 ACPI State: S4
...@@ -74,7 +82,3 @@ low-power state (like ACPI S4), or it may simply power down. Powering ...@@ -74,7 +82,3 @@ low-power state (like ACPI S4), or it may simply power down. Powering
down offers greater savings, and allows this mechanism to work on any down offers greater savings, and allows this mechanism to work on any
system. However, entering a real low-power state allows the user to system. However, entering a real low-power state allows the user to
trigger wake up events (e.g. pressing a key or opening a laptop lid). trigger wake up events (e.g. pressing a key or opening a laptop lid).
A transition from Suspend-to-Disk to the On state should take about 30
seconds, though it's typically a bit more with the current
implementation.
...@@ -61,24 +61,24 @@ EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data); ...@@ -61,24 +61,24 @@ EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data);
int dev_pm_put_subsys_data(struct device *dev) int dev_pm_put_subsys_data(struct device *dev)
{ {
struct pm_subsys_data *psd; struct pm_subsys_data *psd;
int ret = 0; int ret = 1;
spin_lock_irq(&dev->power.lock); spin_lock_irq(&dev->power.lock);
psd = dev_to_psd(dev); psd = dev_to_psd(dev);
if (!psd) { if (!psd)
ret = -EINVAL;
goto out; goto out;
}
if (--psd->refcount == 0) { if (--psd->refcount == 0) {
dev->power.subsys_data = NULL; dev->power.subsys_data = NULL;
kfree(psd); } else {
ret = 1; psd = NULL;
ret = 0;
} }
out: out:
spin_unlock_irq(&dev->power.lock); spin_unlock_irq(&dev->power.lock);
kfree(psd);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment