xref: /freebsd/sys/compat/linuxkpi/common/include/linux/pm_runtime.h (revision 5180fce1cf7ec7430ccf2adb88358602e5ccee1e)
1 /*
2  * Copyright (c) 2026 The FreeBSD Foundation
3  *
4  * Portions of this software were developed by Björn Zeeb
5  * under sponsorship from the FreeBSD Foundation.
6  *
7  * SPDX-License-Identifier: BSD-2-Clause
8  */
9 
10 #ifndef _LINUXKPI_LINUX_PM_RUNTIME_H_
11 #define _LINUXKPI_LINUX_PM_RUNTIME_H_
12 
13 #include <linux/kernel.h>	/* pr_debug */
14 #include <linux/device.h>
15 #include <linux/pm.h>
16 
17 /*
18  * Return values, where needed, are based on the !CONFIG_PM/!CONFIG_PM_SLEEP
19  * assumption given we currently do not support anything in here.
20  * We could #error in case CONFIG_PM or CONFIG_PM_SLEEP are set but that
21  * would likely be too intrusive for now.
22  *
23  * We could likely use dev_dbg() in here instead of pr_debug() if the former
24  * would be mapped to the latter with additional dev information.
25  */
26 
27 static inline void
28 pm_runtime_enable(struct device *dev __unused)
29 {
30 	pr_debug("%s TODO\n", __func__);
31 }
32 
33 static inline void
34 pm_runtime_disable(struct device *dev __unused)
35 {
36 	pr_debug("%s TODO\n", __func__);
37 }
38 
39 static inline void
40 pm_runtime_allow(struct device *dev __unused)
41 {
42 	pr_debug("%s TODO\n", __func__);
43 }
44 
45 static inline void
46 pm_runtime_forbid(struct device *dev __unused)
47 {
48 	pr_debug("%s TODO\n", __func__);
49 }
50 
51 
52 static inline void
53 pm_runtime_mark_last_busy(struct device *dev __unused)
54 {
55 	pr_debug("%s TODO\n", __func__);
56 }
57 
58 static inline void
59 pm_runtime_get_noresume(struct device *dev __unused)
60 {
61 	pr_debug("%s TODO\n", __func__);
62 }
63 
64 static inline void
65 pm_runtime_put_noidle(struct device *dev __unused)
66 {
67 	pr_debug("%s TODO\n", __func__);
68 }
69 
70 static inline bool
71 pm_runtime_suspended(struct device *dev __unused)
72 {
73 	pr_debug("%s TODO\n", __func__);
74 	return (false);
75 }
76 
77 static inline int
78 pm_runtime_autosuspend(struct device *dev)
79 {
80 	pm_runtime_mark_last_busy(dev);
81 	pr_debug("%s TODO\n", __func__);
82 	return (-ENOSYS);
83 }
84 
85 static inline void
86 pm_runtime_use_autosuspend(struct device *dev __unused)
87 {
88 	pr_debug("%s TODO\n", __func__);
89 }
90 
91 static inline void
92 pm_runtime_dont_use_autosuspend(struct device *dev __unused)
93 {
94 	pr_debug("%s TODO\n", __func__);
95 }
96 
97 static inline void
98 pm_runtime_set_autosuspend_delay(struct device *dev __unused, int delay __unused)
99 {
100 	pr_debug("%s TODO\n", __func__);
101 }
102 
103 static inline int
104 pm_runtime_put_autosuspend(struct device *dev)
105 {
106 	pm_runtime_mark_last_busy(dev);
107 	pr_debug("%s TODO\n", __func__);
108 	return (-ENOSYS);
109 }
110 
111 static inline int
112 pm_runtime_set_active(struct device *dev __unused)
113 {
114 	pr_debug("%s TODO\n", __func__);
115 	return (0);
116 }
117 
118 static inline void
119 pm_runtime_put(struct device *dev __unused)
120 {
121 	pr_debug("%s TODO\n", __func__);
122 }
123 
124 static inline int
125 pm_runtime_resume(struct device *dev __unused)
126 {
127 	pr_debug("%s TODO\n", __func__);
128 	return (1);
129 }
130 
131 static inline int
132 pm_runtime_get_sync(struct device *dev __unused)
133 {
134 	pr_debug("%s TODO\n", __func__);
135 	return (1);
136 }
137 
138 static inline int
139 pm_runtime_get_if_in_use(struct device *dev __unused)
140 {
141 	pr_debug("%s TODO\n", __func__);
142 	return (-EINVAL);
143 }
144 
145 #if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION < 60900
146 static inline int
147 pm_runtime_get_if_active(struct device *dev __unused, bool x __unused)
148 #else
149 static inline int
150 pm_runtime_get_if_active(struct device *dev __unused)
151 #endif
152 {
153 	pr_debug("%s TODO\n", __func__);
154 	return (-EINVAL);
155 }
156 
157 static inline int
158 pm_runtime_resume_and_get(struct device *dev __unused)
159 {
160 	pr_debug("%s TODO\n", __func__);
161 	return (1);
162 }
163 
164 #endif	/* _LINUXKPI_LINUX_PM_RUNTIME_H_ */
165