Zephyr Project API
3.3.0
A Scalable Open Source RTOS
|
Device Runtime Power Management API. More...
Functions | |
int | pm_device_runtime_enable (const struct device *dev) |
Enable device runtime PM. More... | |
int | pm_device_runtime_disable (const struct device *dev) |
Disable device runtime PM. More... | |
int | pm_device_runtime_get (const struct device *dev) |
Resume a device based on usage count. More... | |
int | pm_device_runtime_put (const struct device *dev) |
Suspend a device based on usage count. More... | |
int | pm_device_runtime_put_async (const struct device *dev) |
Suspend a device based on usage count (asynchronously). More... | |
bool | pm_device_runtime_is_enabled (const struct device *dev) |
Check if device runtime is enabled for a given device. More... | |
Device Runtime Power Management API.
int pm_device_runtime_disable | ( | const struct device * | dev | ) |
#include <include/zephyr/pm/device_runtime.h>
Disable device runtime PM.
If the device is currently suspended it will be resumed.
dev | Device instance. |
0 | If the device runtime PM is disabled successfully. |
-ENOTSUP | If the device does not support PM. |
-ENOSYS | If the functionality is not available. |
-errno | Other negative errno, result of resuming the device. |
int pm_device_runtime_enable | ( | const struct device * | dev | ) |
#include <include/zephyr/pm/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. |
0 | If the device runtime PM is enabled successfully. |
-EPERM | If device has power state locked. |
-ENOTSUP | If the device does not support PM. |
-ENOSYS | If the functionality is not available. |
-errno | Other negative errno, result of suspending the device. |
int pm_device_runtime_get | ( | const struct device * | dev | ) |
#include <include/zephyr/pm/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. |
0 | If it succeeds. In case device runtime PM is not enabled or not available this function will be a no-op and will also return 0. |
-ENOTSUP | If the device does not support PM. |
-errno | Other negative errno, result of the PM action callback. |
#include <include/zephyr/pm/device_runtime.h>
Check if device runtime is enabled for a given device.
dev | Device instance. |
true | If device has device runtime PM enabled. |
false | If the device has device runtime PM disabled. |
int pm_device_runtime_put | ( | const struct device * | dev | ) |
#include <include/zephyr/pm/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. |
0 | If it succeeds. In case device runtime PM is not enabled or not available this function will be a no-op and will also return 0. |
-ENOTSUP | If the device does not support PM. |
-EALREADY | If device is already suspended (can only happen if get/put calls are unbalanced). |
-errno | Other negative errno, result of the action callback. |
int pm_device_runtime_put_async | ( | const struct device * | dev | ) |
#include <include/zephyr/pm/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. |
0 | If it succeeds. In case device runtime PM is not enabled or not available this function will be a no-op and will also return 0. |
-ENOTSUP | If the device does not support PM. |
-EBUSY | If the device is busy. |
-EALREADY | If device is already suspended (can only happen if get/put calls are unbalanced). |