Lines Matching full:device
18 * @brief Device Power Management API
20 * @defgroup device_power_management_api Device Power Management API
25 struct device;
27 /** @brief Device power states. */
29 /** Device is in active or regular state. */
32 * Device is in low power state.
35 * Device context is preserved.
39 * Device is suspended.
42 * Device context may be lost.
46 * Device is turned off (power removed).
49 * Device context is lost.
54 /** @brief Device PM flags. */
56 /** Indicate if the device is busy or not. */
59 * Indicates whether or not the device is capable of waking the system
63 /** Indicates if the device is being used as wakeup source. */
65 /** Indicates that the device is changing its state */
71 /** @brief Device PM actions. */
86 * @brief Device PM info
90 /** Pointer to the device */
91 const struct device *dev;
95 /** Device pm enable flag */
97 /** Device usage count */
104 /* Device PM status flags. */
106 /** Device power state */
126 * @param node_id Devicetree node for the initialized device (can be invalid).
139 * @brief Device power management control function callback.
141 * @param dev Device instance.
148 typedef int (*pm_device_control_callback_t)(const struct device *dev,
152 * @brief Get name of device PM state
159 * @brief Set the power state of a device.
161 * This function calls the device PM control callback so that the device does
162 * the necessary operations to put the device into the given state.
164 * @note Some devices may not support all device power states.
166 * @param dev Device instance.
167 * @param state Device power state to be set.
171 * @retval -EALREADY If device is already at the requested state.
172 * @retval -EBUSY If device is changing its state.
176 int pm_device_state_set(const struct device *dev,
180 * @brief Obtain the power state of a device.
182 * @param dev Device instance.
183 * @param state Pointer where device power state will be stored.
186 * @retval -ENOSYS If device does not implement power management.
188 int pm_device_state_get(const struct device *dev,
193 * @brief Indicate that the device is in the middle of a transaction
195 * Called by a device driver to indicate that it is in the middle of a
198 * @param dev Pointer to device structure of the driver instance.
200 void pm_device_busy_set(const struct device *dev);
203 * @brief Indicate that the device has completed its transaction
205 * Called by a device driver to indicate the end of a transaction.
207 * @param dev Pointer to device structure of the driver instance.
209 void pm_device_busy_clear(const struct device *dev);
212 * @brief Check if any device is in the middle of a transaction
214 * Called by an application to see if any device is in the middle
217 * @retval false if no device is busy
218 * @retval true if any device is busy
223 * @brief Check if a specific device is in the middle of a transaction
225 * Called by an application to see if a particular device is in the
228 * @param dev Pointer to device structure of the specific device driver
230 * @retval false if the device is not busy
231 * @retval true if the device is busy
233 bool pm_device_is_busy(const struct device *dev);
235 static inline void pm_device_busy_set(const struct device *dev) {} in pm_device_busy_set()
236 static inline void pm_device_busy_clear(const struct device *dev) {} in pm_device_busy_clear()
238 static inline bool pm_device_is_busy(const struct device *dev) { return false; } in pm_device_is_busy()
241 __deprecated static inline void device_busy_set(const struct device *dev) in device_busy_set()
246 __deprecated static inline void device_busy_clear(const struct device *dev) in device_busy_clear()
256 __deprecated static inline int device_busy_check(const struct device *dev) in device_busy_check()
267 * Enable a wakeup source. This will keep the current device active when the
270 * @param dev device object to enable.
276 bool pm_device_wakeup_enable(struct device *dev, bool enable);
283 * @param dev device object to check.
288 bool pm_device_wakeup_is_enabled(const struct device *dev);
291 * @brief Check if a device is wake up capable
293 * @param dev device object to check.
295 * @retval true if the device is wake up capable.
296 * @retval false if the device is not wake up capable.
298 bool pm_device_wakeup_is_capable(const struct device *dev);