Zephyr API Documentation  3.5.0
A Scalable Open Source RTOS
3.5.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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__)
38
56int pm_device_runtime_enable(const struct device *dev);
57
71int pm_device_runtime_disable(const struct device *dev);
72
96int pm_device_runtime_get(const struct device *dev);
97
118int pm_device_runtime_put(const struct device *dev);
119
143int pm_device_runtime_put_async(const struct device *dev);
144
157bool pm_device_runtime_is_enabled(const struct device *dev);
158
159#else
160
161static inline int pm_device_runtime_auto_enable(const struct device *dev)
162{
163 ARG_UNUSED(dev);
164 return 0;
165}
166
167static inline int pm_device_runtime_enable(const struct device *dev)
168{
169 ARG_UNUSED(dev);
170 return 0;
171}
172
173static inline int pm_device_runtime_disable(const struct device *dev)
174{
175 ARG_UNUSED(dev);
176 return 0;
177}
178
179static inline int pm_device_runtime_get(const struct device *dev)
180{
181 ARG_UNUSED(dev);
182 return 0;
183}
184
185static inline int pm_device_runtime_put(const struct device *dev)
186{
187 ARG_UNUSED(dev);
188 return 0;
189}
190
191static inline int pm_device_runtime_put_async(const struct device *dev)
192{
193 ARG_UNUSED(dev);
194 return 0;
195}
196
197static inline bool pm_device_runtime_is_enabled(const struct device *dev)
198{
199 ARG_UNUSED(dev);
200 return false;
201}
202
203#endif
204
207#ifdef __cplusplus
208}
209#endif
210
211#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).
int pm_device_runtime_auto_enable(const struct device *dev)
Automatically enable device runtime based on devicetree properties.
Runtime device structure (in ROM) per driver instance.
Definition: device.h:381