diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2011-12-21 15:59:45 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2011-12-21 15:59:45 -0500 |
commit | b00f4dc5ff022cb9cbaffd376d9454d7fa1e496f (patch) | |
tree | 40f1b232e2f1e8ac365317a14fdcbcb331722b46 /Documentation/power | |
parent | 1eac8111e0763853266a171ce11214da3a347a0a (diff) | |
parent | b9e26dfdad5a4f9cbdaacafac6998614cc9c41bc (diff) |
Merge branch 'master' into pm-sleep
* master: (848 commits)
SELinux: Fix RCU deref check warning in sel_netport_insert()
binary_sysctl(): fix memory leak
mm/vmalloc.c: remove static declaration of va from __get_vm_area_node
ipmi_watchdog: restore settings when BMC reset
oom: fix integer overflow of points in oom_badness
memcg: keep root group unchanged if creation fails
nilfs2: potential integer overflow in nilfs_ioctl_clean_segments()
nilfs2: unbreak compat ioctl
cpusets: stall when updating mems_allowed for mempolicy or disjoint nodemask
evm: prevent racing during tfm allocation
evm: key must be set once during initialization
mmc: vub300: fix type of firmware_rom_wait_states module parameter
Revert "mmc: enable runtime PM by default"
mmc: sdhci: remove "state" argument from sdhci_suspend_host
x86, dumpstack: Fix code bytes breakage due to missing KERN_CONT
IB/qib: Correct sense on freectxts increment and decrement
RDMA/cma: Verify private data length
cgroups: fix a css_set not found bug in cgroup_attach_proc
oprofile: Fix uninitialized memory access when writing to writing to oprofilefs
Revert "xen/pv-on-hvm kexec: add xs_reset_watches to shutdown watches from old kernel"
...
Conflicts:
kernel/cgroup_freezer.c
Diffstat (limited to 'Documentation/power')
-rw-r--r-- | Documentation/power/devices.txt | 111 | ||||
-rw-r--r-- | Documentation/power/runtime_pm.txt | 40 |
2 files changed, 93 insertions, 58 deletions
diff --git a/Documentation/power/devices.txt b/Documentation/power/devices.txt index 646a89e0c07d..3139fb505dce 100644 --- a/Documentation/power/devices.txt +++ b/Documentation/power/devices.txt | |||
@@ -123,9 +123,10 @@ please refer directly to the source code for more information about it. | |||
123 | Subsystem-Level Methods | 123 | Subsystem-Level Methods |
124 | ----------------------- | 124 | ----------------------- |
125 | The core methods to suspend and resume devices reside in struct dev_pm_ops | 125 | The core methods to suspend and resume devices reside in struct dev_pm_ops |
126 | pointed to by the pm member of struct bus_type, struct device_type and | 126 | pointed to by the ops member of struct dev_pm_domain, or by the pm member of |
127 | struct class. They are mostly of interest to the people writing infrastructure | 127 | struct bus_type, struct device_type and struct class. They are mostly of |
128 | for buses, like PCI or USB, or device type and device class drivers. | 128 | interest to the people writing infrastructure for platforms and buses, like PCI |
129 | or USB, or device type and device class drivers. | ||
129 | 130 | ||
130 | Bus drivers implement these methods as appropriate for the hardware and the | 131 | Bus drivers implement these methods as appropriate for the hardware and the |
131 | drivers using it; PCI works differently from USB, and so on. Not many people | 132 | drivers using it; PCI works differently from USB, and so on. Not many people |
@@ -139,41 +140,57 @@ sequencing in the driver model tree. | |||
139 | 140 | ||
140 | /sys/devices/.../power/wakeup files | 141 | /sys/devices/.../power/wakeup files |
141 | ----------------------------------- | 142 | ----------------------------------- |
142 | All devices in the driver model have two flags to control handling of wakeup | 143 | All device objects in the driver model contain fields that control the handling |
143 | events (hardware signals that can force the device and/or system out of a low | 144 | of system wakeup events (hardware signals that can force the system out of a |
144 | power state). These flags are initialized by bus or device driver code using | 145 | sleep state). These fields are initialized by bus or device driver code using |
145 | device_set_wakeup_capable() and device_set_wakeup_enable(), defined in | 146 | device_set_wakeup_capable() and device_set_wakeup_enable(), defined in |
146 | include/linux/pm_wakeup.h. | 147 | include/linux/pm_wakeup.h. |
147 | 148 | ||
148 | The "can_wakeup" flag just records whether the device (and its driver) can | 149 | The "power.can_wakeup" flag just records whether the device (and its driver) can |
149 | physically support wakeup events. The device_set_wakeup_capable() routine | 150 | physically support wakeup events. The device_set_wakeup_capable() routine |
150 | affects this flag. The "should_wakeup" flag controls whether the device should | 151 | affects this flag. The "power.wakeup" field is a pointer to an object of type |
151 | try to use its wakeup mechanism. device_set_wakeup_enable() affects this flag; | 152 | struct wakeup_source used for controlling whether or not the device should use |
152 | for the most part drivers should not change its value. The initial value of | 153 | its system wakeup mechanism and for notifying the PM core of system wakeup |
153 | should_wakeup is supposed to be false for the majority of devices; the major | 154 | events signaled by the device. This object is only present for wakeup-capable |
154 | exceptions are power buttons, keyboards, and Ethernet adapters whose WoL | 155 | devices (i.e. devices whose "can_wakeup" flags are set) and is created (or |
155 | (wake-on-LAN) feature has been set up with ethtool. It should also default | 156 | removed) by device_set_wakeup_capable(). |
156 | to true for devices that don't generate wakeup requests on their own but merely | ||
157 | forward wakeup requests from one bus to another (like PCI bridges). | ||
158 | 157 | ||
159 | Whether or not a device is capable of issuing wakeup events is a hardware | 158 | Whether or not a device is capable of issuing wakeup events is a hardware |
160 | matter, and the kernel is responsible for keeping track of it. By contrast, | 159 | matter, and the kernel is responsible for keeping track of it. By contrast, |
161 | whether or not a wakeup-capable device should issue wakeup events is a policy | 160 | whether or not a wakeup-capable device should issue wakeup events is a policy |
162 | decision, and it is managed by user space through a sysfs attribute: the | 161 | decision, and it is managed by user space through a sysfs attribute: the |
163 | power/wakeup file. User space can write the strings "enabled" or "disabled" to | 162 | "power/wakeup" file. User space can write the strings "enabled" or "disabled" |
164 | set or clear the "should_wakeup" flag, respectively. This file is only present | 163 | to it to indicate whether or not, respectively, the device is supposed to signal |
165 | for wakeup-capable devices (i.e. devices whose "can_wakeup" flags are set) | 164 | system wakeup. This file is only present if the "power.wakeup" object exists |
166 | and is created (or removed) by device_set_wakeup_capable(). Reads from the | 165 | for the given device and is created (or removed) along with that object, by |
167 | file will return the corresponding string. | 166 | device_set_wakeup_capable(). Reads from the file will return the corresponding |
168 | 167 | string. | |
169 | The device_may_wakeup() routine returns true only if both flags are set. | 168 | |
169 | The "power/wakeup" file is supposed to contain the "disabled" string initially | ||
170 | for the majority of devices; the major exceptions are power buttons, keyboards, | ||
171 | and Ethernet adapters whose WoL (wake-on-LAN) feature has been set up with | ||
172 | ethtool. It should also default to "enabled" for devices that don't generate | ||
173 | wakeup requests on their own but merely forward wakeup requests from one bus to | ||
174 | another (like PCI Express ports). | ||
175 | |||
176 | The device_may_wakeup() routine returns true only if the "power.wakeup" object | ||
177 | exists and the corresponding "power/wakeup" file contains the string "enabled". | ||
170 | This information is used by subsystems, like the PCI bus type code, to see | 178 | This information is used by subsystems, like the PCI bus type code, to see |
171 | whether or not to enable the devices' wakeup mechanisms. If device wakeup | 179 | whether or not to enable the devices' wakeup mechanisms. If device wakeup |
172 | mechanisms are enabled or disabled directly by drivers, they also should use | 180 | mechanisms are enabled or disabled directly by drivers, they also should use |
173 | device_may_wakeup() to decide what to do during a system sleep transition. | 181 | device_may_wakeup() to decide what to do during a system sleep transition. |
174 | However for runtime power management, wakeup events should be enabled whenever | 182 | Device drivers, however, are not supposed to call device_set_wakeup_enable() |
175 | the device and driver both support them, regardless of the should_wakeup flag. | 183 | directly in any case. |
176 | 184 | ||
185 | It ought to be noted that system wakeup is conceptually different from "remote | ||
186 | wakeup" used by runtime power management, although it may be supported by the | ||
187 | same physical mechanism. Remote wakeup is a feature allowing devices in | ||
188 | low-power states to trigger specific interrupts to signal conditions in which | ||
189 | they should be put into the full-power state. Those interrupts may or may not | ||
190 | be used to signal system wakeup events, depending on the hardware design. On | ||
191 | some systems it is impossible to trigger them from system sleep states. In any | ||
192 | case, remote wakeup should always be enabled for runtime power management for | ||
193 | all devices and drivers that support it. | ||
177 | 194 | ||
178 | /sys/devices/.../power/control files | 195 | /sys/devices/.../power/control files |
179 | ------------------------------------ | 196 | ------------------------------------ |
@@ -249,20 +266,31 @@ for every device before the next phase begins. Not all busses or classes | |||
249 | support all these callbacks and not all drivers use all the callbacks. The | 266 | support all these callbacks and not all drivers use all the callbacks. The |
250 | various phases always run after tasks have been frozen and before they are | 267 | various phases always run after tasks have been frozen and before they are |
251 | unfrozen. Furthermore, the *_noirq phases run at a time when IRQ handlers have | 268 | unfrozen. Furthermore, the *_noirq phases run at a time when IRQ handlers have |
252 | been disabled (except for those marked with the IRQ_WAKEUP flag). | 269 | been disabled (except for those marked with the IRQF_NO_SUSPEND flag). |
253 | 270 | ||
254 | All phases use bus, type, or class callbacks (that is, methods defined in | 271 | All phases use PM domain, bus, type, or class callbacks (that is, methods |
255 | dev->bus->pm, dev->type->pm, or dev->class->pm). These callbacks are mutually | 272 | defined in dev->pm_domain->ops, dev->bus->pm, dev->type->pm, or dev->class->pm). |
256 | exclusive, so if the device type provides a struct dev_pm_ops object pointed to | 273 | These callbacks are regarded by the PM core as mutually exclusive. Moreover, |
257 | by its pm field (i.e. both dev->type and dev->type->pm are defined), the | 274 | PM domain callbacks always take precedence over bus, type and class callbacks, |
258 | callbacks included in that object (i.e. dev->type->pm) will be used. Otherwise, | 275 | while type callbacks take precedence over bus and class callbacks, and class |
259 | if the class provides a struct dev_pm_ops object pointed to by its pm field | 276 | callbacks take precedence over bus callbacks. To be precise, the following |
260 | (i.e. both dev->class and dev->class->pm are defined), the PM core will use the | 277 | rules are used to determine which callback to execute in the given phase: |
261 | callbacks from that object (i.e. dev->class->pm). Finally, if the pm fields of | 278 | |
262 | both the device type and class objects are NULL (or those objects do not exist), | 279 | 1. If dev->pm_domain is present, the PM core will attempt to execute the |
263 | the callbacks provided by the bus (that is, the callbacks from dev->bus->pm) | 280 | callback included in dev->pm_domain->ops. If that callback is not |
264 | will be used (this allows device types to override callbacks provided by bus | 281 | present, no action will be carried out for the given device. |
265 | types or classes if necessary). | 282 | |
283 | 2. Otherwise, if both dev->type and dev->type->pm are present, the callback | ||
284 | included in dev->type->pm will be executed. | ||
285 | |||
286 | 3. Otherwise, if both dev->class and dev->class->pm are present, the | ||
287 | callback included in dev->class->pm will be executed. | ||
288 | |||
289 | 4. Otherwise, if both dev->bus and dev->bus->pm are present, the callback | ||
290 | included in dev->bus->pm will be executed. | ||
291 | |||
292 | This allows PM domains and device types to override callbacks provided by bus | ||
293 | types or device classes if necessary. | ||
266 | 294 | ||
267 | These callbacks may in turn invoke device- or driver-specific methods stored in | 295 | These callbacks may in turn invoke device- or driver-specific methods stored in |
268 | dev->driver->pm, but they don't have to. | 296 | dev->driver->pm, but they don't have to. |
@@ -283,9 +311,8 @@ When the system goes into the standby or memory sleep state, the phases are: | |||
283 | 311 | ||
284 | After the prepare callback method returns, no new children may be | 312 | After the prepare callback method returns, no new children may be |
285 | registered below the device. The method may also prepare the device or | 313 | registered below the device. The method may also prepare the device or |
286 | driver in some way for the upcoming system power transition (for | 314 | driver in some way for the upcoming system power transition, but it |
287 | example, by allocating additional memory required for this purpose), but | 315 | should not put the device into a low-power state. |
288 | it should not put the device into a low-power state. | ||
289 | 316 | ||
290 | 2. The suspend methods should quiesce the device to stop it from performing | 317 | 2. The suspend methods should quiesce the device to stop it from performing |
291 | I/O. They also may save the device registers and put it into the | 318 | I/O. They also may save the device registers and put it into the |
diff --git a/Documentation/power/runtime_pm.txt b/Documentation/power/runtime_pm.txt index 5336149f831b..c2ae8bf77d46 100644 --- a/Documentation/power/runtime_pm.txt +++ b/Documentation/power/runtime_pm.txt | |||
@@ -44,25 +44,33 @@ struct dev_pm_ops { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | The ->runtime_suspend(), ->runtime_resume() and ->runtime_idle() callbacks | 46 | The ->runtime_suspend(), ->runtime_resume() and ->runtime_idle() callbacks |
47 | are executed by the PM core for either the power domain, or the device type | 47 | are executed by the PM core for the device's subsystem that may be either of |
48 | (if the device power domain's struct dev_pm_ops does not exist), or the class | 48 | the following: |
49 | (if the device power domain's and type's struct dev_pm_ops object does not | 49 | |
50 | exist), or the bus type (if the device power domain's, type's and class' | 50 | 1. PM domain of the device, if the device's PM domain object, dev->pm_domain, |
51 | struct dev_pm_ops objects do not exist) of the given device, so the priority | 51 | is present. |
52 | order of callbacks from high to low is that power domain callbacks, device | 52 | |
53 | type callbacks, class callbacks and bus type callbacks, and the high priority | 53 | 2. Device type of the device, if both dev->type and dev->type->pm are present. |
54 | one will take precedence over low priority one. The bus type, device type and | 54 | |
55 | class callbacks are referred to as subsystem-level callbacks in what follows, | 55 | 3. Device class of the device, if both dev->class and dev->class->pm are |
56 | and generally speaking, the power domain callbacks are used for representing | 56 | present. |
57 | power domains within a SoC. | 57 | |
58 | 4. Bus type of the device, if both dev->bus and dev->bus->pm are present. | ||
59 | |||
60 | The PM core always checks which callback to use in the order given above, so the | ||
61 | priority order of callbacks from high to low is: PM domain, device type, class | ||
62 | and bus type. Moreover, the high-priority one will always take precedence over | ||
63 | a low-priority one. The PM domain, bus type, device type and class callbacks | ||
64 | are referred to as subsystem-level callbacks in what follows. | ||
58 | 65 | ||
59 | By default, the callbacks are always invoked in process context with interrupts | 66 | By default, the callbacks are always invoked in process context with interrupts |
60 | enabled. However, subsystems can use the pm_runtime_irq_safe() helper function | 67 | enabled. However, subsystems can use the pm_runtime_irq_safe() helper function |
61 | to tell the PM core that a device's ->runtime_suspend() and ->runtime_resume() | 68 | to tell the PM core that their ->runtime_suspend(), ->runtime_resume() and |
62 | callbacks should be invoked in atomic context with interrupts disabled. | 69 | ->runtime_idle() callbacks may be invoked in atomic context with interrupts |
63 | This implies that these callback routines must not block or sleep, but it also | 70 | disabled for a given device. This implies that the callback routines in |
64 | means that the synchronous helper functions listed at the end of Section 4 can | 71 | question must not block or sleep, but it also means that the synchronous helper |
65 | be used within an interrupt handler or in an atomic context. | 72 | functions listed at the end of Section 4 may be used for that device within an |
73 | interrupt handler or generally in an atomic context. | ||
66 | 74 | ||
67 | The subsystem-level suspend callback is _entirely_ _responsible_ for handling | 75 | The subsystem-level suspend callback is _entirely_ _responsible_ for handling |
68 | the suspend of the device as appropriate, which may, but need not include | 76 | the suspend of the device as appropriate, which may, but need not include |