Skip to content

Commit 77829b4

Browse files
pm: device: extend pm_device_driver_init() description
Rewrite the docstring for pm_device_driver_init() to align with documentation, especially covering the case where CONFIG_PM_DEVICE=n Signed-off-by: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
1 parent 3e70425 commit 77829b4

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

include/zephyr/pm/device.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,13 +622,22 @@ int pm_device_power_domain_remove(const struct device *dev,
622622
bool pm_device_is_powered(const struct device *dev);
623623

624624
/**
625-
* @brief Setup a device driver into the lowest valid power mode
625+
* @brief Move a device driver into its initial device power state.
626626
*
627-
* This helper function is intended to be called at the end of a driver
628-
* init function to automatically setup the device into the lowest power
629-
* mode. It assumes that the device has been configured as if it is in
630-
* @ref PM_DEVICE_STATE_OFF, or @ref PM_DEVICE_STATE_SUSPENDED if device can
631-
* never be powered off.
627+
* @details This function uses the device driver's internal PM hook to
628+
* move the device from the OFF state to the initial power state expected
629+
* by the system.
630+
*
631+
* The initial power state expected by the system is:
632+
*
633+
* - ACTIVE if CONFIG_PM_DEVICE=n or (CONFIG_PM_DEVICE=y and
634+
* CONFIG_PM_DEVICE_RUNTIME=n) or (CONFIG_PM_DEVICE_RUNTIME=y and
635+
* !pm_device_runtime_is_enabled(dev)).
636+
* - SUSPENDED if CONFIG_PM_DEVICE_RUNTIME=y and device's parent power domain is ACTIVE.
637+
* - OFF if CONFIG_PM_DEVICE_RUNTIME=y and device's parent power domain is SUSPENDED.
638+
*
639+
* @note This function must be called at the end of a driver's init
640+
* function.
632641
*
633642
* @param dev Device instance.
634643
* @param action_cb Device PM control callback function.

0 commit comments

Comments
 (0)