Zephyr Project API  3.3.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
130int pm_device_runtime_put_async(const struct device *dev);
131
144bool pm_device_runtime_is_enabled(const struct device *dev);
145
146#else
147
148static inline int pm_device_runtime_enable(const struct device *dev)
149{
150 ARG_UNUSED(dev);
151 return 0;
152}
153
154static inline int pm_device_runtime_disable(const struct device *dev)
155{
156 ARG_UNUSED(dev);
157 return 0;
158}
159
160static inline int pm_device_runtime_get(const struct device *dev)
161{
162 ARG_UNUSED(dev);
163 return 0;
164}
165
166static inline int pm_device_runtime_put(const struct device *dev)
167{
168 ARG_UNUSED(dev);
169 return 0;
170}
171
172static inline int pm_device_runtime_put_async(const struct device *dev)
173{
174 ARG_UNUSED(dev);
175 return 0;
176}
177
178static inline bool pm_device_runtime_is_enabled(const struct device *dev)
179{
180 ARG_UNUSED(dev);
181 return false;
182}
183
184#endif
185
188#ifdef __cplusplus
189}
190#endif
191
192#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).
Runtime device structure (in ROM) per driver instance.
Definition: device.h:378