Skip to content

Commit 994ef5c

Browse files
pizi-nordicnashif
authored andcommitted
power: Move part of Power Management API to correct group
Part of Power Management API was incorrecty documented under "Power Management Hook Interface" section. This commit fixes that problem by introducing "System Power Management APIs". Signed-off-by: Piotr Zięcik <[email protected]>
1 parent ff50704 commit 994ef5c

File tree

2 files changed

+89
-75
lines changed

2 files changed

+89
-75
lines changed

doc/reference/power_management/index.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,14 @@ Power Management Hook Interface
459459
.. doxygengroup:: power_management_hook_interface
460460
:project: Zephyr
461461

462+
System Power Management APIs
463+
============================
464+
465+
.. doxygengroup:: system_power_management_api
466+
:project: Zephyr
467+
462468
Device Power Management APIs
463469
============================
464470

465471
.. doxygengroup:: device_power_management_api
466472
:project: Zephyr
467-

include/power.h

Lines changed: 83 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@ extern "C" {
1717

1818
extern unsigned char sys_pm_idle_exit_notify;
1919

20-
2120
/**
2221
* @defgroup power_management_api Power Management
2322
* @{
2423
* @}
2524
*/
2625

2726
/**
28-
* @brief Power Management states.
27+
* @brief System power states.
2928
*/
3029
enum power_states {
3130
SYS_POWER_STATE_AUTO = (-2),
@@ -56,6 +55,14 @@ enum power_states {
5655
SYS_POWER_STATE_MAX
5756
};
5857

58+
/**
59+
* @brief System Power Management API
60+
*
61+
* @defgroup system_power_management_api System Power Management API
62+
* @ingroup power_management_api
63+
* @{
64+
*/
65+
5966
/**
6067
* @brief Check if particular power state is a low power state.
6168
*
@@ -114,18 +121,10 @@ static inline bool sys_pm_is_deep_sleep_state(enum power_states state)
114121
}
115122
}
116123

117-
/**
118-
* @brief Power Management Hooks
119-
*
120-
* @defgroup power_management_hook_interface Power Management Hooks
121-
* @ingroup power_management_api
122-
* @{
123-
*/
124-
125124
/**
126125
* @brief Function to disable power management idle exit notification
127126
*
128-
* sys_resume() would be called from the ISR of the event that caused
127+
* The sys_resume() would be called from the ISR of the event that caused
129128
* exit from kernel idling after PM operations. For some power operations,
130129
* this notification may not be necessary. This function can be called in
131130
* sys_suspend to disable the corresponding sys_resume notification.
@@ -136,6 +135,79 @@ static inline void sys_pm_idle_exit_notification_disable(void)
136135
sys_pm_idle_exit_notify = 0;
137136
}
138137

138+
/**
139+
* @brief Force usage of given power state.
140+
*
141+
* This function overrides decision made by PM policy
142+
* forcing usage of given power state in all subseqent
143+
* suspend operations. Forcing the SYS_POWER_STATE_AUTO
144+
* state restores normal operation.
145+
*
146+
* @param state Power state which should be used in all
147+
* subsequent suspend operations or
148+
* SYS_POWER_STATE_AUTO.
149+
*/
150+
extern void sys_pm_force_power_state(enum power_states state);
151+
152+
#ifdef CONFIG_PM_CONTROL_OS_DEBUG
153+
/**
154+
* @brief Dump Low Power states related debug info
155+
*
156+
* Dump Low Power states debug info like LPS entry count and residencies.
157+
*/
158+
extern void sys_pm_dump_debug_info(void);
159+
160+
#endif /* CONFIG_PM_CONTROL_OS_DEBUG */
161+
162+
#ifdef CONFIG_PM_CONTROL_STATE_LOCK
163+
/**
164+
* @brief Disable particular power state
165+
*
166+
* @details Disabled state cannot be selected by the Zephyr power
167+
* management policies. Application defined policy should
168+
* use the @ref sys_pm_ctrl_is_state_enabled function to
169+
* check if given state could is enabled and could be used.
170+
*
171+
* @param [in] state Power state to be disabled.
172+
*/
173+
extern void sys_pm_ctrl_disable_state(enum power_states state);
174+
175+
/**
176+
* @brief Enable particular power state
177+
*
178+
* @details Enabled state can be selected by the Zephyr power
179+
* management policies. Application defined policy should
180+
* use the @ref sys_pm_ctrl_is_state_enabled function to
181+
* check if given state could is enabled and could be used.
182+
* By default all power states are enabled.
183+
*
184+
* @param [in] state Power state to be enabled.
185+
*/
186+
extern void sys_pm_ctrl_enable_state(enum power_states state);
187+
188+
/**
189+
* @brief Check if particular power state is enabled
190+
*
191+
* This function returns true if given power state is enabled.
192+
*
193+
* @param [in] state Power state.
194+
*/
195+
extern bool sys_pm_ctrl_is_state_enabled(enum power_states state);
196+
197+
#endif /* CONFIG_PM_CONTROL_STATE_LOCK */
198+
199+
/**
200+
* @}
201+
*/
202+
203+
/**
204+
* @brief Power Management Hooks
205+
*
206+
* @defgroup power_management_hook_interface Power Management Hooks
207+
* @ingroup power_management_api
208+
* @{
209+
*/
210+
139211
/**
140212
* @brief Hook function to notify exit from deep sleep
141213
*
@@ -201,69 +273,6 @@ void sys_resume(void);
201273
*/
202274
extern enum power_states sys_suspend(s32_t ticks);
203275

204-
/**
205-
* @brief Force usage of given power state.
206-
*
207-
* This function overrides decision made by PM policy
208-
* forcing usage of given power state in all subseqent
209-
* suspend operations.
210-
*
211-
* Forcing the SYS_POWER_STATE_AUTO power state restores
212-
* normal operation.
213-
*
214-
* @param state Power state which should be used in all
215-
* subsequent suspend operations or
216-
* SYS_POWER_STATE_AUTO.
217-
*/
218-
extern void sys_pm_force_power_state(enum power_states state);
219-
220-
#ifdef CONFIG_PM_CONTROL_OS_DEBUG
221-
/**
222-
* @brief Dump Low Power states related debug info
223-
*
224-
* Dump Low Power states debug info like LPS entry count and residencies.
225-
*/
226-
extern void sys_pm_dump_debug_info(void);
227-
228-
#endif /* CONFIG_PM_CONTROL_OS_DEBUG */
229-
230-
#ifdef CONFIG_PM_CONTROL_STATE_LOCK
231-
/**
232-
* @brief Disable particular power state
233-
*
234-
* @details Disabled state cannot be selected by the Zephyr power
235-
* management policies. Application defined policy should
236-
* use the @ref sys_pm_ctrl_is_state_enabled function to
237-
* check if given state could is enabled and could be used.
238-
*
239-
* @param [in] state Power state to be disabled.
240-
*/
241-
extern void sys_pm_ctrl_disable_state(enum power_states state);
242-
243-
/**
244-
* @brief Enable particular power state
245-
*
246-
* @details Enabled state can be selected by the Zephyr power
247-
* management policies. Application defined policy should
248-
* use the @ref sys_pm_ctrl_is_state_enabled function to
249-
* check if given state could is enabled and could be used.
250-
* By default all power states are enabled.
251-
*
252-
* @param [in] state Power state to be enabled.
253-
*/
254-
extern void sys_pm_ctrl_enable_state(enum power_states state);
255-
256-
/**
257-
* @brief Check if particular power state is enabled
258-
*
259-
* This function returns true if given power state is enabled.
260-
*
261-
* @param [in] state Power state.
262-
*/
263-
extern bool sys_pm_ctrl_is_state_enabled(enum power_states state);
264-
265-
#endif /* CONFIG_PM_CONTROL_STATE_LOCK */
266-
267276
/**
268277
* @}
269278
*/

0 commit comments

Comments
 (0)