XenevaOS
Loading...
Searching...
No Matches
pm_runtime.h
Go to the documentation of this file.
1#ifndef __LINUX_PM_RUNTIME_H__
2#define __LINUX_PM_RUNTIME_H__
3
4/*
5 * DCL <linux/pm_runtime.h> -- the four runtime-PM calls 8250_port.c makes,
6 * plus pm_wakeup_event().
7 *
8 * Runtime PM asks "may this device's power/clock be cut, and when did it last
9 * do something". Xeneva manages no device power: there is no PM domain, no
10 * reference-counted clock, no autosuspend timer, and DCL's UART console must
11 * not have its clock cut under it. So the get/put pair is deliberately
12 * *neutral* -- get succeeds, put does nothing -- rather than pretending to
13 * count references. A get that failed would make 8250_port.c bail out of
14 * serial8250_start_tx() and serial8250_rx_dma() with -EACCES, i.e. a driver
15 * that refuses to transmit; a get that succeeds and a put that does nothing
16 * is what an always-on device does, which is what this is.
17 *
18 * The call sites tell the same story: pm_runtime_get_sync() at
19 * 8250_port.c:519/655 guards "device is awake" on the way into transmit,
20 * pm_runtime_mark_last_busy() + pm_runtime_put_autosuspend() at :527/:668
21 * record activity and request idle on the way out. With nothing to suspend,
22 * the only part that matters is that none of them returns an error.
23 *
24 * pm_wakeup_event() lives in linux/pm_wakeup.h upstream; DCL has no wakeup
25 * source registry either, so it sits here next to the other PM no-ops rather
26 * than earning a header of its own.
27 *
28 * upstream include/linux/pm_runtime.h (mainline v7.2)
29 */
30#include <linux/kernel.h>
31
32static inline int pm_runtime_get_sync(const void* dev)
33{
34 (void)dev;
35 return 0;
36}
37
38static inline int pm_runtime_put_autosuspend(const void* dev)
39{
40 (void)dev;
41 return 0;
42}
43
44static inline int pm_runtime_put_sync(const void* dev)
45{
46 (void)dev;
47 return 0;
48}
49
50static inline void pm_runtime_mark_last_busy(const void* dev)
51{
52 (void)dev;
53}
54
55static inline void pm_wakeup_event(const void* dev, unsigned int msec)
56{
57 (void)dev;
58 (void)msec;
59}
60
61
62/*
63 * Four more runtime-PM entries serial_core.c calls, on the transmit path
64 * (serial_core.c:149-160), plus the wakeup trio the system-sleep handlers
65 * use at :2305-2324 and :3128.
66 *
67 * The interesting one is the pair at :160:
68 *
69 * if (!pm_runtime_enabled(port->dev) || pm_runtime_active(&port_dev->dev))
70 * port->ops->start_tx(port);
71 *
72 * -- "runtime PM off, or the device is already up, then transmit". Answering
73 * enabled = 1 here would have made the second half load-bearing, and a
74 * `pm_runtime_active` that said "yes" would be claiming a power state DCL
75 * does not track; saying *disabled* is both the truth (nothing ever enabled
76 * it) and the answer that makes mainline's own disjunct do the right thing,
77 * because !0 short-circuits straight to start_tx. A device with no runtime
78 * PM is always usable, which is exactly what the first arm means.
79 *
80 * The wakeup family is DCL's answer for the same reason: no device is
81 * wake-capable, so device_may_wakeup() is 0 and the enable/disable arms
82 * around it -- which would arm the GIC to wake the SoC -- are never reached.
83 * device_may_wakeup() still tolerates a NULL dev, because serial_core.c:2383
84 * calls it on the result of device_find_child() with no NULL check.
85 */
86static inline int pm_runtime_get(const void* dev)
87{
88 (void)dev;
89 return 0;
90}
91
92static inline void pm_runtime_put_noidle(const void* dev)
93{
94 (void)dev;
95}
96
97static inline int pm_runtime_enabled(const void* dev)
98{
99 (void)dev;
100 return 0; /* never enabled: mainline's "treat as always usable" */
101}
102
103static inline int pm_runtime_active(const void* dev)
104{
105 (void)dev;
106 return 0;
107}
108
109/*
110 * mainline keeps these three in <linux/pm_wakeup.h>; serial_core.c does not
111 * include it, and DCL has no wakeup-source registry to hang a header off --
112 * so they sit beside the other PM no-ops, with the reason stated once.
113 */
114static inline int device_may_wakeup(const void* dev)
115{
116 (void)dev;
117 return 0;
118}
119
120static inline void device_set_wakeup_capable(const void* dev, int enable)
121{
122 (void)dev;
123 (void)enable;
124}
125
126static inline void device_set_awake_path(const void* dev)
127{
128 (void)dev;
129}
130#endif /* __LINUX_PM_RUNTIME_H__ */
const struct device * dev
Definition drm_print.h:519