Lines Matching full:device

11 #include <zephyr/device.h>
19 * @brief Device Runtime Power Management API
20 * @defgroup subsys_pm_device_runtime Device Runtime
27 * @brief Automatically enable device runtime based on devicetree properties
30 * zephyr,pm-device-runtime-auto property in pm.yaml and z_sys_init_run_level.
32 * @param dev Device instance.
34 * @retval 0 If the device runtime PM is enabled successfully or it has not
35 * been requested for this device in devicetree.
36 * @retval -errno Other negative errno, result of enabled device runtime PM.
38 int pm_device_runtime_auto_enable(const struct device *dev);
41 * @brief Enable device runtime PM
43 * This function will enable runtime PM on the given device. If the device is
44 * in #PM_DEVICE_STATE_ACTIVE state, the device will be suspended.
48 * @param dev Device instance.
50 * @retval 0 If the device runtime PM is enabled successfully.
51 * @retval -EBUSY If device is busy.
52 * @retval -ENOTSUP If the device does not support PM.
53 * @retval -errno Other negative errno, result of suspending the device.
57 int pm_device_runtime_enable(const struct device *dev);
60 * @brief Disable device runtime PM
62 * If the device is currently suspended it will be resumed.
66 * @param dev Device instance.
68 * @retval 0 If the device runtime PM is disabled successfully.
69 * @retval -ENOTSUP If the device does not support PM.
70 * @retval -errno Other negative errno, result of resuming the device.
72 int pm_device_runtime_disable(const struct device *dev);
75 * @brief Resume a device based on usage count.
77 * This function will resume the device if the device is suspended (usage count
78 * equal to 0). In case of a resume failure, usage count and device state will
81 * If the device is still being suspended as a result of calling
83 * finish to then resume the device.
86 * allowed, e.g. ISR, provided the device PM implementation does not block.
90 * @param dev Device instance.
92 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
97 int pm_device_runtime_get(const struct device *dev);
100 * @brief Suspend a device based on usage count.
102 * This function will suspend the device if the device is no longer required
103 * (usage count equal to 0). In case of suspend failure, usage count and device
109 * @param dev Device instance.
111 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
113 * @retval -EALREADY If device is already suspended (can only happen if get/put
119 int pm_device_runtime_put(const struct device *dev);
122 * @brief Suspend a device based on usage count (asynchronously).
124 * This function will schedule the device suspension if the device is no longer
134 * @param dev Device instance.
137 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
139 * @retval -EBUSY If the device is busy.
140 * @retval -EALREADY If device is already suspended (can only happen if get/put
145 int pm_device_runtime_put_async(const struct device *dev, k_timeout_t delay);
148 * @brief Check if device runtime is enabled for a given device.
152 * @param dev Device instance.
154 * @retval true If device has device runtime PM enabled.
155 * @retval false If the device has device runtime PM disabled.
159 bool pm_device_runtime_is_enabled(const struct device *dev);
162 * @brief Return the current device usage counter.
164 * @param dev Device instance.
167 * @retval -ENOTSUP If the device is not using runtime PM.
170 int pm_device_runtime_usage(const struct device *dev);
174 static inline int pm_device_runtime_auto_enable(const struct device *dev)
180 static inline int pm_device_runtime_enable(const struct device *dev)
186 static inline int pm_device_runtime_disable(const struct device *dev)
192 static inline int pm_device_runtime_get(const struct device *dev)
198 static inline int pm_device_runtime_put(const struct device *dev)
204 static inline int pm_device_runtime_put_async(const struct device *dev,
212 static inline bool pm_device_runtime_is_enabled(const struct device *dev)
218 static inline int pm_device_runtime_usage(const struct device *dev)