pm: device: runtime: Add API to check if it is enabled
Add a new API to check if a device has device runtime feature enabled. Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
parent
a8c9cf0b0a
commit
b2aa5feb9d
2 changed files with 31 additions and 0 deletions
|
@ -116,12 +116,27 @@ int pm_device_runtime_put(const struct device *dev);
|
|||
*/
|
||||
int pm_device_runtime_put_async(const struct device *dev);
|
||||
|
||||
/**
|
||||
* @brief Check if device runtime is enabled for a given device.
|
||||
*
|
||||
* @funcprops \pre_kernel_ok
|
||||
*
|
||||
* @param dev Device instance.
|
||||
*
|
||||
* @retval true If device has device runtime PM enabled.
|
||||
* @retval false If the device has device runtime PM disabled.
|
||||
*
|
||||
* @see pm_device_runtime_enable()
|
||||
*/
|
||||
bool pm_device_runtime_is_enabled(const struct device *dev);
|
||||
|
||||
#else
|
||||
static inline void pm_device_runtime_enable(const struct device *dev) { }
|
||||
static inline int pm_device_runtime_disable(const struct device *dev) { return -ENOSYS; }
|
||||
static inline int pm_device_runtime_get(const struct device *dev) { return -ENOSYS; }
|
||||
static inline int pm_device_runtime_put(const struct device *dev) { return -ENOSYS; }
|
||||
static inline int pm_device_runtime_put_async(const struct device *dev) { return -ENOSYS; }
|
||||
static inline bool pm_device_runtime_is_enabled(const struct device *dev) { return false; }
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue