Zephyr API Documentation 4.0.0-rc2
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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#include <zephyr/kernel.h>
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
25#if defined(CONFIG_PM_DEVICE_RUNTIME) || defined(__DOXYGEN__)
39
57int pm_device_runtime_enable(const struct device *dev);
58
72int pm_device_runtime_disable(const struct device *dev);
73
97int pm_device_runtime_get(const struct device *dev);
98
119int pm_device_runtime_put(const struct device *dev);
120
145int pm_device_runtime_put_async(const struct device *dev, k_timeout_t delay);
146
159bool pm_device_runtime_is_enabled(const struct device *dev);
160
170int pm_device_runtime_usage(const struct device *dev);
171
172#else
173
174static inline int pm_device_runtime_auto_enable(const struct device *dev)
175{
176 ARG_UNUSED(dev);
177 return 0;
178}
179
180static inline int pm_device_runtime_enable(const struct device *dev)
181{
182 ARG_UNUSED(dev);
183 return 0;
184}
185
186static inline int pm_device_runtime_disable(const struct device *dev)
187{
188 ARG_UNUSED(dev);
189 return 0;
190}
191
192static inline int pm_device_runtime_get(const struct device *dev)
193{
194 ARG_UNUSED(dev);
195 return 0;
196}
197
198static inline int pm_device_runtime_put(const struct device *dev)
199{
200 ARG_UNUSED(dev);
201 return 0;
202}
203
204static inline int pm_device_runtime_put_async(const struct device *dev,
205 k_timeout_t delay)
206{
207 ARG_UNUSED(dev);
208 ARG_UNUSED(delay);
209 return 0;
210}
211
212static inline bool pm_device_runtime_is_enabled(const struct device *dev)
213{
214 ARG_UNUSED(dev);
215 return false;
216}
217
218static inline int pm_device_runtime_usage(const struct device *dev)
219{
220 ARG_UNUSED(dev);
221 return -ENOSYS;
222}
223
224#endif
225
228#ifdef __cplusplus
229}
230#endif
231
232#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_put_async(const struct device *dev, k_timeout_t delay)
Suspend a device based on usage count (asynchronously).
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_usage(const struct device *dev)
Return the current device usage counter.
int pm_device_runtime_auto_enable(const struct device *dev)
Automatically enable device runtime based on devicetree properties.
#define ENOSYS
Function not implemented.
Definition errno.h:82
Public kernel APIs.
Runtime device structure (in ROM) per driver instance.
Definition device.h:412
Kernel timeout type.
Definition sys_clock.h:65