Zephyr Project API  3.2.0
A Scalable Open Source RTOS
device_runtime.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 Intel Corporation.
3 * Copyright (c) 2021 Nordic Semiconductor ASA
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_INCLUDE_PM_DEVICE_RUNTIME_H_
9#define ZEPHYR_INCLUDE_PM_DEVICE_RUNTIME_H_
10
11#include <zephyr/device.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
24#if defined(CONFIG_PM_DEVICE_RUNTIME) || defined(__DOXYGEN__)
43int pm_device_runtime_enable(const struct device *dev);
44
59int pm_device_runtime_disable(const struct device *dev);
60
81int pm_device_runtime_get(const struct device *dev);
82
104int pm_device_runtime_put(const struct device *dev);
105
129int pm_device_runtime_put_async(const struct device *dev);
130
143bool pm_device_runtime_is_enabled(const struct device *dev);
144
145#else
146static inline int pm_device_runtime_enable(const struct device *dev) { return -ENOSYS; }
147static inline int pm_device_runtime_disable(const struct device *dev) { return -ENOSYS; }
148static inline int pm_device_runtime_get(const struct device *dev) { return 0; }
149static inline int pm_device_runtime_put(const struct device *dev) { return 0; }
150static inline int pm_device_runtime_put_async(const struct device *dev) { return 0; }
151static inline bool pm_device_runtime_is_enabled(const struct device *dev) { return false; }
152#endif
153
156#ifdef __cplusplus
157}
158#endif
159
160#endif /* ZEPHYR_INCLUDE_PM_DEVICE_RUNTIME_H_ */
int pm_device_runtime_get(const struct device *dev)
Resume a device based on usage count.
bool pm_device_runtime_is_enabled(const struct device *dev)
Check if device runtime is enabled for a given device.
int pm_device_runtime_put(const struct device *dev)
Suspend a device based on usage count.
int pm_device_runtime_disable(const struct device *dev)
Disable device runtime PM.
int pm_device_runtime_enable(const struct device *dev)
Enable device runtime PM.
int pm_device_runtime_put_async(const struct device *dev)
Suspend a device based on usage count (asynchronously).
#define ENOSYS
Definition: errno.h:83
Runtime device structure (in ROM) per driver instance.
Definition: device.h:435