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.
86 * @param dev Device instance.
88 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
92 int pm_device_runtime_get(const struct device *dev);
95 * @brief Suspend a device based on usage count.
97 * This function will suspend the device if the device is no longer required
98 * (usage count equal to 0). In case of suspend failure, usage count and device
104 * @param dev Device instance.
106 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
108 * @retval -EALREADY If device is already suspended (can only happen if get/put
114 int pm_device_runtime_put(const struct device *dev);
117 * @brief Suspend a device based on usage count (asynchronously).
119 * This function will schedule the device suspension if the device is no longer
129 * @param dev Device instance.
131 * @retval 0 If it succeeds. In case device runtime PM is not enabled or not
133 * @retval -EBUSY If the device is busy.
134 * @retval -EALREADY If device is already suspended (can only happen if get/put
139 int pm_device_runtime_put_async(const struct device *dev);
142 * @brief Check if device runtime is enabled for a given device.
146 * @param dev Device instance.
148 * @retval true If device has device runtime PM enabled.
149 * @retval false If the device has device runtime PM disabled.
153 bool pm_device_runtime_is_enabled(const struct device *dev);
157 static inline int pm_device_runtime_auto_enable(const struct device *dev)
163 static inline int pm_device_runtime_enable(const struct device *dev)
169 static inline int pm_device_runtime_disable(const struct device *dev)
175 static inline int pm_device_runtime_get(const struct device *dev)
181 static inline int pm_device_runtime_put(const struct device *dev)
187 static inline int pm_device_runtime_put_async(const struct device *dev)
193 static inline bool pm_device_runtime_is_enabled(const struct device *dev)