Lines Matching full:device
11 #include <zephyr/device.h>
18 * @brief Device Runtime Power Management API
19 * @defgroup subsys_pm_device_runtime Device Runtime
26 * @brief Automatically enable device runtime based on devicetree properties
29 * zephyr,pm-device-runtime-auto property in pm.yaml and z_sys_init_run_level.
31 * @param dev Device instance.
33 * @retval 0 If the device runtime PM is enabled successfully or it has not
34 * been requested for this device in devicetree.
35 * @retval -errno Other negative errno, result of enabled device runtime PM.
37 int pm_device_runtime_auto_enable(const struct device *dev);
40 * @brief Enable device runtime PM
42 * This function will enable runtime PM on the given device. If the device is
43 * in #PM_DEVICE_STATE_ACTIVE state, the device will be suspended.
47 * @param dev Device instance.
49 * @retval 0 If the device runtime PM is enabled successfully.
50 * @retval -EPERM If device has power state locked.
51 * @retval -ENOTSUP If the device does not support PM.
52 * @retval -errno Other negative errno, result of suspending the device.
56 int pm_device_runtime_enable(const struct device *dev);
59 * @brief Disable device runtime PM
61 * If the device is currently suspended it will be resumed.
65 * @param dev Device instance.
67 * @retval 0 If the device runtime PM is disabled successfully.
68 * @retval -ENOTSUP If the device does not support PM.
69 * @retval -errno Other negative errno, result of resuming the device.
71 int pm_device_runtime_disable(const struct device *dev);
74 * @brief Resume a device based on usage count.
76 * This function will resume the device if the device is suspended (usage count
77 * equal to 0). In case of a resume failure, usage count and device state will
80 * If the device is still being suspended as a result of calling
82 * finish to then resume the device.
85 * allowed, e.g. ISR, provided the device PM implementation does not block.
89 * @param dev Device instance.
91 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
96 int pm_device_runtime_get(const struct device *dev);
99 * @brief Suspend a device based on usage count.
101 * This function will suspend the device if the device is no longer required
102 * (usage count equal to 0). In case of suspend failure, usage count and device
108 * @param dev Device instance.
110 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
112 * @retval -EALREADY If device is already suspended (can only happen if get/put
118 int pm_device_runtime_put(const struct device *dev);
121 * @brief Suspend a device based on usage count (asynchronously).
123 * This function will schedule the device suspension if the device is no longer
133 * @param dev Device instance.
135 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
137 * @retval -EBUSY If the device is busy.
138 * @retval -EALREADY If device is already suspended (can only happen if get/put
143 int pm_device_runtime_put_async(const struct device *dev);
146 * @brief Check if device runtime is enabled for a given device.
150 * @param dev Device instance.
152 * @retval true If device has device runtime PM enabled.
153 * @retval false If the device has device runtime PM disabled.
157 bool pm_device_runtime_is_enabled(const struct device *dev);
161 static inline int pm_device_runtime_auto_enable(const struct device *dev)
167 static inline int pm_device_runtime_enable(const struct device *dev)
173 static inline int pm_device_runtime_disable(const struct device *dev)
179 static inline int pm_device_runtime_get(const struct device *dev)
185 static inline int pm_device_runtime_put(const struct device *dev)
191 static inline int pm_device_runtime_put_async(const struct device *dev)
197 static inline bool pm_device_runtime_is_enabled(const struct device *dev)