Zephyr API Documentation 4.4.99
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
24
25#if defined(CONFIG_PM_DEVICE_RUNTIME) || defined(__DOXYGEN__)
38
55int pm_device_runtime_enable(const struct device *dev);
56
69int pm_device_runtime_disable(const struct device *dev);
70
93int pm_device_runtime_get(const struct device *dev);
94
114int pm_device_runtime_put(const struct device *dev);
115
140int pm_device_runtime_put_async(const struct device *dev, k_timeout_t delay);
141
154bool pm_device_runtime_is_enabled(const struct device *dev);
155
166int pm_device_runtime_usage(const struct device *dev);
167
168#else
169
170static inline int pm_device_runtime_auto_enable(const struct device *dev)
171{
172 ARG_UNUSED(dev);
173 return 0;
174}
175
176static inline int pm_device_runtime_enable(const struct device *dev)
177{
178 ARG_UNUSED(dev);
179 return 0;
180}
181
182static inline int pm_device_runtime_disable(const struct device *dev)
183{
184 ARG_UNUSED(dev);
185 return 0;
186}
187
188static inline int pm_device_runtime_get(const struct device *dev)
189{
190 ARG_UNUSED(dev);
191 return 0;
192}
193
194static inline int pm_device_runtime_put(const struct device *dev)
195{
196 ARG_UNUSED(dev);
197 return 0;
198}
199
200static inline int pm_device_runtime_put_async(const struct device *dev,
201 k_timeout_t delay)
202{
203 ARG_UNUSED(dev);
204 ARG_UNUSED(delay);
205 return 0;
206}
207
208static inline bool pm_device_runtime_is_enabled(const struct device *dev)
209{
210 ARG_UNUSED(dev);
211 return false;
212}
213
214static inline int pm_device_runtime_usage(const struct device *dev)
215{
216 ARG_UNUSED(dev);
217 return -ENOSYS;
218}
219
220#endif
221
223
224#ifdef __cplusplus
225}
226#endif
227
228#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:513
Kernel timeout type.
Definition clock.h:65