|
Zephyr Project API 4.4.99
A Scalable Open Source RTOS
|
Device Runtime Power Management API. More...
Files | |
| file | device_runtime.h |
| Header file for the Device Runtime Power Management API. | |
Macros | |
| #define | LOG_DBG_PM_DEVICE_RUNTIME_GET(dev, ...) |
| Writes a "failed to resume" debug message to the log. | |
| #define | LOG_WRN_PM_DEVICE_RUNTIME_GET(dev, ...) |
| Writes a "failed to resume" warning message to the log. | |
| #define | LOG_ERR_PM_DEVICE_RUNTIME_GET(dev, ...) |
| Writes a "failed to resume" error message to the log. | |
| #define | LOG_DBG_PM_DEVICE_RUNTIME_PUT(dev, ...) |
| Writes a "failed to suspend" debug message to the log. | |
| #define | LOG_WRN_PM_DEVICE_RUNTIME_PUT(dev, ...) |
| Writes a "failed to suspend" warning message to the log. | |
| #define | LOG_ERR_PM_DEVICE_RUNTIME_PUT(dev, ...) |
| Writes a "failed to suspend" error message to the log. | |
| #define | LOG_INST_DBG_PM_DEVICE_RUNTIME_GET(_log_inst, dev, ...) |
| Writes a "failed to resume" debug message to the log for the logging instance. | |
| #define | LOG_INST_WRN_PM_DEVICE_RUNTIME_GET(_log_inst, dev, ...) |
| Writes a "failed to resume" warning message to the log for the logging instance. | |
| #define | LOG_INST_ERR_PM_DEVICE_RUNTIME_GET(_log_inst, dev, ...) |
| Writes a "failed to resume" error message to the log for the logging instance. | |
| #define | LOG_INST_DBG_PM_DEVICE_RUNTIME_PUT(_log_inst, dev, ...) |
| Writes a "failed to suspend" debug message to the log for the logging instance. | |
| #define | LOG_INST_WRN_PM_DEVICE_RUNTIME_PUT(_log_inst, dev, ...) |
| Writes a "failed to suspend" warning message to the log for the logging instance. | |
| #define | LOG_INST_ERR_PM_DEVICE_RUNTIME_PUT(_log_inst, dev, ...) |
| Writes a "failed to suspend" error message to the log for the logging instance. | |
Functions | |
| int | pm_device_runtime_auto_enable (const struct device *dev) |
| Automatically enable device runtime based on devicetree properties. | |
| int | pm_device_runtime_enable (const struct device *dev) |
| Enable device runtime PM. | |
| int | pm_device_runtime_disable (const struct device *dev) |
| Disable device runtime PM. | |
| int | pm_device_runtime_get (const struct device *dev) |
| Resume a device based on usage count. | |
| int | pm_device_runtime_put (const struct device *dev) |
| Suspend a device based on usage count. | |
| int | pm_device_runtime_put_async (const struct device *dev, k_timeout_t delay) |
| Suspend a device based on usage count (asynchronously). | |
| bool | pm_device_runtime_is_enabled (const struct device *dev) |
| Check if device runtime is enabled for a given device. | |
| int | pm_device_runtime_usage (const struct device *dev) |
| Return the current device usage counter. | |
Device Runtime Power Management API.
| #define LOG_DBG_PM_DEVICE_RUNTIME_GET | ( | dev, | |
| ... ) |
#include <device_runtime.h>
Writes a "failed to resume" debug message to the log.
Writes a "failed to resume" debug message to the log using the device name as reference, meant to be used in pm_device_runtime_get() checks.
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_get(). Only the first argument is used; all others will be discarded. |
| #define LOG_DBG_PM_DEVICE_RUNTIME_PUT | ( | dev, | |
| ... ) |
#include <device_runtime.h>
Writes a "failed to suspend" debug message to the log.
Writes a "failed to suspend" debug message to the log using the device name as reference, meant to be used in pm_device_runtime_put() checks.
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_put(). Only the first argument is used; all others will be discarded. |
| #define LOG_ERR_PM_DEVICE_RUNTIME_GET | ( | dev, | |
| ... ) |
#include <device_runtime.h>
Writes a "failed to resume" error message to the log.
Writes a "failed to resume" error message to the log using the device name as reference, meant to be used in pm_device_runtime_get() checks.
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_get(). Only the first argument is used; all others will be discarded. |
| #define LOG_ERR_PM_DEVICE_RUNTIME_PUT | ( | dev, | |
| ... ) |
#include <device_runtime.h>
Writes a "failed to suspend" error message to the log.
Writes a "failed to suspend" error message to the log using the device name as reference, meant to be used in pm_device_runtime_put() checks.
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_put(). Only the first argument is used; all others will be discarded. |
| #define LOG_INST_DBG_PM_DEVICE_RUNTIME_GET | ( | _log_inst, | |
| dev, | |||
| ... ) |
#include <device_runtime.h>
Writes a "failed to resume" debug message to the log for the logging instance.
Writes a "failed to resume" debug message to the log using the device name as reference, meant to be used in pm_device_runtime_get() checks.
| _log_inst | pointer to the log structure associated with the instance. |
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_get(). Only the first argument is used; all others will be discarded. |
| #define LOG_INST_DBG_PM_DEVICE_RUNTIME_PUT | ( | _log_inst, | |
| dev, | |||
| ... ) |
#include <device_runtime.h>
Writes a "failed to suspend" debug message to the log for the logging instance.
Writes a "failed to suspend" debug message to the log using the device name as reference, meant to be used in pm_device_runtime_put() checks.
| _log_inst | pointer to the log structure associated with the instance. |
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_put(). Only the first argument is used; all others will be discarded. |
| #define LOG_INST_ERR_PM_DEVICE_RUNTIME_GET | ( | _log_inst, | |
| dev, | |||
| ... ) |
#include <device_runtime.h>
Writes a "failed to resume" error message to the log for the logging instance.
Writes a "failed to resume" error message to the log using the device name as reference, meant to be used in pm_device_runtime_get() checks.
| _log_inst | pointer to the log structure associated with the instance. |
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_get(). Only the first argument is used; all others will be discarded. |
| #define LOG_INST_ERR_PM_DEVICE_RUNTIME_PUT | ( | _log_inst, | |
| dev, | |||
| ... ) |
#include <device_runtime.h>
Writes a "failed to suspend" error message to the log for the logging instance.
Writes a "failed to suspend" error message to the log using the device name as reference, meant to be used in pm_device_runtime_put() checks.
| _log_inst | pointer to the log structure associated with the instance. |
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_put(). Only the first argument is used; all others will be discarded. |
| #define LOG_INST_WRN_PM_DEVICE_RUNTIME_GET | ( | _log_inst, | |
| dev, | |||
| ... ) |
#include <device_runtime.h>
Writes a "failed to resume" warning message to the log for the logging instance.
Writes a "failed to resume" warning message to the log using the device name as reference, meant to be used in pm_device_runtime_get() checks.
| _log_inst | pointer to the log structure associated with the instance. |
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_get(). Only the first argument is used; all others will be discarded. |
| #define LOG_INST_WRN_PM_DEVICE_RUNTIME_PUT | ( | _log_inst, | |
| dev, | |||
| ... ) |
#include <device_runtime.h>
Writes a "failed to suspend" warning message to the log for the logging instance.
Writes a "failed to suspend" warning message to the log using the device name as reference, meant to be used in pm_device_runtime_put() checks.
| _log_inst | pointer to the log structure associated with the instance. |
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_put(). Only the first argument is used; all others will be discarded. |
| #define LOG_WRN_PM_DEVICE_RUNTIME_GET | ( | dev, | |
| ... ) |
#include <device_runtime.h>
Writes a "failed to resume" warning message to the log.
Writes a "failed to resume" warning message to the log using the device name as reference, meant to be used in pm_device_runtime_get() checks.
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_get(). Only the first argument is used; all others will be discarded. |
| #define LOG_WRN_PM_DEVICE_RUNTIME_PUT | ( | dev, | |
| ... ) |
#include <device_runtime.h>
Writes a "failed to suspend" warning message to the log.
Writes a "failed to suspend" warning message to the log using the device name as reference, meant to be used in pm_device_runtime_put() checks.
| dev | pointer to a struct device. |
| ... | optional return code for pm_device_runtime_put(). Only the first argument is used; all others will be discarded. |
| int pm_device_runtime_auto_enable | ( | const struct device * | dev | ) |
#include <device_runtime.h>
Automatically enable device runtime based on devicetree properties.
| dev | Device instance. |
|
pre-kernel-ok |
#include <device_runtime.h>
Disable device runtime PM.
If the device is currently suspended it will be resumed.
| dev | Device instance. |
| -ENOTSUP | Device does not support PM. |
|
pre-kernel-ok |
#include <device_runtime.h>
Enable device runtime PM.
This function will enable runtime PM on the given device. If the device is in PM_DEVICE_STATE_ACTIVE state, the device will be suspended.
| dev | Device instance. |
| -EBUSY | Device is busy. |
| -ENOTSUP | Device does not support PM. |
|
pre-kernel-ok |
#include <device_runtime.h>
Resume a device based on usage count.
This function will resume the device if the device is suspended (usage count equal to 0). In case of a resume failure, usage count and device state will be left unchanged. In all other cases, usage count will be incremented.
If the device is still being suspended as a result of calling pm_device_runtime_put_async(), this function will wait for the operation to finish to then resume the device.
| dev | Device instance. |
| -EWOULDBLOCK | Call would block but it is not allowed (e.g. in ISR). |
#include <device_runtime.h>
Check if device runtime is enabled for a given device.
| dev | Device instance. |
|
pre-kernel-ok |
#include <device_runtime.h>
Suspend a device based on usage count.
This function will suspend the device if the device is no longer required (usage count equal to 0). In case of suspend failure, usage count and device state will be left unchanged. In all other cases, usage count will be decremented (down to 0).
| dev | Device instance. |
| -EALREADY | Device is already suspended (can only happen if get/put calls are unbalanced). |
|
pre-kernel-okasyncisr-ok |
#include <device_runtime.h>
Suspend a device based on usage count (asynchronously).
This function will schedule the device suspension if the device is no longer required (usage count equal to 0). In all other cases, usage count will be decremented (down to 0).
| dev | Device instance. |
| delay | Minimum amount of time before triggering the action. |
| -EBUSY | Device is busy. |
| -EALREADY | Device is already suspended (can only happen if get/put calls are unbalanced). |
| int pm_device_runtime_usage | ( | const struct device * | dev | ) |
#include <device_runtime.h>
Return the current device usage counter.
| dev | Device instance. |
| -ENOTSUP | Device is not using runtime PM. |
| -ENOSYS | Runtime PM is not enabled in this build (CONFIG_PM_DEVICE_RUNTIME is disabled). |