Skip to content

Commit 6c68d62

Browse files
Flavio Ceolinnashif
authored andcommitted
doc: pm: Update device power management documentation
Update information about device power management. Signed-off-by: Flavio Ceolin <[email protected]>
1 parent 0a44403 commit 6c68d62

File tree

2 files changed

+66
-22
lines changed

2 files changed

+66
-22
lines changed

doc/services/pm/api/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Device PM APIs
2828

2929
.. doxygengroup:: subsys_pm_device
3030

31+
.. _device_runtime_apis:
32+
3133
Device Runtime PM APIs
3234
**********************
3335

doc/services/pm/device.rst

Lines changed: 64 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ setting :kconfig:option:`CONFIG_PM_DEVICE` to ``y``. When this option is
1010
selected, device drivers implementing power management will be able to take
1111
advantage of the device power management subsystem.
1212

13-
Zephyr supports two types of device power management:
13+
Zephyr supports two methods of device power management:
1414

1515
- :ref:`Device Runtime Power Management <pm-device-runtime-pm>`
1616
- :ref:`System-Managed Device Power Management <pm-device-system-pm>`
@@ -20,18 +20,50 @@ Zephyr supports two types of device power management:
2020
Device Runtime Power Management
2121
*******************************
2222

23-
In this method, the application or any component that deals with devices directly
24-
and has the best knowledge of their use, performs the device power management. This
25-
saves power if some devices that are not in use can be turned off or put
26-
in power saving mode. This method allows saving power even when the CPU is
27-
active. The components that use the devices need to be power aware and should
28-
be able to make decisions related to managing device power.
29-
30-
When using this type of device power management, the kernel can change CPU
31-
power states quickly when :c:func:`pm_system_suspend()` gets called. This is
32-
because it does not need to spend time doing device power management if the
33-
devices are already put in the appropriate power state by the application or
34-
component managing the devices.
23+
Device runtime power management involves coordinated interaction between
24+
device drivers, subsystems, and applications. While device drivers
25+
play a crucial role in directly controlling the power state of
26+
devices, the decision to suspend or resume a device can also be
27+
influenced by higher layers of the software stack.
28+
29+
Each layer—device drivers, subsystems, and applications—can operate
30+
independently without needing to know about the specifics of the other
31+
layers because the subsystem uses reference count to check when it needs
32+
to suspend or resume a device.
33+
34+
- **Device drivers** are responsible for managing the
35+
power state of devices. They interact directly with the hardware to
36+
put devices into low-power states (suspend) when they are not in
37+
use, and bring them back (resume) when needed. Drivers should use the
38+
:ref:`device runtime power management APIs <device_runtime_apis>` provided
39+
by Zephyr to control the power state of devices.
40+
41+
- **Subsystems**, such as sensors, file systems,
42+
and network, can also influence device power management.
43+
Subsystems may have better knowledge about the overall system
44+
state and workload, allowing them to make informed decisions about
45+
when to suspend or resume devices. For example, a networking
46+
subsystem may decide to keep a network interface powered on if it
47+
expects network activity in the near future.
48+
49+
- **Applications** running on Zephyr can impact device
50+
power management as well. An application may have specific
51+
requirements regarding device usage and power consumption. For
52+
example, an application that streams data over a network may need
53+
to keep the network interface powered on continuously.
54+
55+
Coordination between device drivers, subsystems, and applications is
56+
key to efficient device power management. For example, a device driver
57+
may not know that a subsystem will perform a series of sequential
58+
operations that require a device to remain powered on. In such cases,
59+
the subsystem can use device runtime power management to ensure that
60+
the device remains in an active state until the operations are
61+
complete.
62+
63+
When using this Device Runtime Power Management, the System Power
64+
Management subsystem is able to change power states quickly because it
65+
does not need to spend time suspending and resuming devices that are
66+
runtime enabled.
3567

3668
For more information, see :ref:`pm-device-runtime`.
3769

@@ -40,7 +72,7 @@ For more information, see :ref:`pm-device-runtime`.
4072
System-Managed Device Power Management
4173
**************************************
4274

43-
When using this type, device power management is mostly done inside
75+
When using this method, device power management is mostly done inside
4476
:c:func:`pm_system_suspend()` along with entering a CPU or SOC power state.
4577

4678
If a decision to enter a CPU lower power state is made, the power management
@@ -56,20 +88,30 @@ suspended.
5688
As functions in this context cannot block, transitions that intend to use blocking
5789
APIs **must** check whether they can do so with :c:func:`k_can_yield`.
5890

59-
This type of device power management can be useful when the application is not
60-
power aware and does not implement runtime device power management. Though,
61-
:ref:`Device Runtime Power Management <pm-device-runtime-pm>` is the **preferred**
62-
option for device power management.
91+
This method of device power management can be useful in the following scenarios:
92+
93+
- Systems with no device requiring any blocking operations when suspending and
94+
resuming. This implementation is reasonably simpler than device runtime
95+
power management.
96+
- For devices that can not make any power management decision and have to be
97+
always active. For example a firmware using Zephyr that is controlled by an
98+
external entity (e.g Host CPU). In this scenario, some devices have to be
99+
always active and should be suspended together with the SoC when requested by
100+
this external entity.
101+
102+
It is important to emphasize that this method has drawbacks (see above) and
103+
:ref:`Device Runtime Power Management <pm-device-runtime-pm>` is the
104+
**preferred** method for implementing device power management.
63105

64106
.. note::
65107

66-
When using this type of device power management, the CPU will only enter
67-
a low power state only if no device is in the middle of a hardware
108+
When using this method of device power management, the CPU will enter
109+
a low power state only if no devices are in the middle of a hardware
68110
transaction that cannot be interrupted.
69111

70112
.. note::
71113

72-
This type of device power management is disabled when
114+
This method of device power management is disabled when
73115
:kconfig:option:`CONFIG_PM_DEVICE_RUNTIME_EXCLUSIVE` is set to ``y`` (that is
74116
the default value when :kconfig:option:`CONFIG_PM_DEVICE_RUNTIME` is enabled)
75117

@@ -82,7 +124,7 @@ Device Power Management States
82124
******************************
83125

84126
The power management subsystem defines device states in
85-
:c:enum:`pm_device_state`. This type is used to track power states of
127+
:c:enum:`pm_device_state`. This method is used to track power states of
86128
a particular device. It is important to emphasize that, although the
87129
state is tracked by the subsystem, it is the responsibility of each device driver
88130
to handle device actions(:c:enum:`pm_device_action`) which change device state.

0 commit comments

Comments
 (0)