Zephyr Project API 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
13
14#ifndef ZEPHYR_INCLUDE_PM_DEVICE_RUNTIME_H_
15#define ZEPHYR_INCLUDE_PM_DEVICE_RUNTIME_H_
16
17#include <zephyr/device.h>
18#include <zephyr/kernel.h>
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
30
31#if defined(CONFIG_PM_DEVICE_RUNTIME) || defined(__DOXYGEN__)
44
61int pm_device_runtime_enable(const struct device *dev);
62
75int pm_device_runtime_disable(const struct device *dev);
76
99int pm_device_runtime_get(const struct device *dev);
100
120int pm_device_runtime_put(const struct device *dev);
121
146int pm_device_runtime_put_async(const struct device *dev, k_timeout_t delay);
147
160bool pm_device_runtime_is_enabled(const struct device *dev);
161
172int pm_device_runtime_usage(const struct device *dev);
173
174#else
175
176static inline int pm_device_runtime_auto_enable(const struct device *dev)
177{
178 ARG_UNUSED(dev);
179 return 0;
180}
181
182static inline int pm_device_runtime_enable(const struct device *dev)
183{
184 ARG_UNUSED(dev);
185 return 0;
186}
187
188static inline int pm_device_runtime_disable(const struct device *dev)
189{
190 ARG_UNUSED(dev);
191 return 0;
192}
193
194static inline int pm_device_runtime_get(const struct device *dev)
195{
196 ARG_UNUSED(dev);
197 return 0;
198}
199
200static inline int pm_device_runtime_put(const struct device *dev)
201{
202 ARG_UNUSED(dev);
203 return 0;
204}
205
206static inline int pm_device_runtime_put_async(const struct device *dev,
207 k_timeout_t delay)
208{
209 ARG_UNUSED(dev);
210 ARG_UNUSED(delay);
211 return 0;
212}
213
214static inline bool pm_device_runtime_is_enabled(const struct device *dev)
215{
216 ARG_UNUSED(dev);
217 return false;
218}
219
220static inline int pm_device_runtime_usage(const struct device *dev)
221{
222 ARG_UNUSED(dev);
223 return -ENOSYS;
224}
225
226#endif
227
229
230#ifdef __cplusplus
231}
232#endif
233
234#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