Zephyr Project API  3.4.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__)
38
56int pm_device_runtime_enable(const struct device *dev);
57
71int pm_device_runtime_disable(const struct device *dev);
72
92int pm_device_runtime_get(const struct device *dev);
93
114int pm_device_runtime_put(const struct device *dev);
115
139int pm_device_runtime_put_async(const struct device *dev);
140
153bool pm_device_runtime_is_enabled(const struct device *dev);
154
155#else
156
157static inline int pm_device_runtime_auto_enable(const struct device *dev)
158{
159 ARG_UNUSED(dev);
160 return 0;
161}
162
163static inline int pm_device_runtime_enable(const struct device *dev)
164{
165 ARG_UNUSED(dev);
166 return 0;
167}
168
169static inline int pm_device_runtime_disable(const struct device *dev)
170{
171 ARG_UNUSED(dev);
172 return 0;
173}
174
175static inline int pm_device_runtime_get(const struct device *dev)
176{
177 ARG_UNUSED(dev);
178 return 0;
179}
180
181static inline int pm_device_runtime_put(const struct device *dev)
182{
183 ARG_UNUSED(dev);
184 return 0;
185}
186
187static inline int pm_device_runtime_put_async(const struct device *dev)
188{
189 ARG_UNUSED(dev);
190 return 0;
191}
192
193static inline bool pm_device_runtime_is_enabled(const struct device *dev)
194{
195 ARG_UNUSED(dev);
196 return false;
197}
198
199#endif
200
203#ifdef __cplusplus
204}
205#endif
206
207#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:380