xref: /openbmc/linux/include/trace/events/rtc.h (revision 9fb29c73)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM rtc
3 
4 #if !defined(_TRACE_RTC_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_RTC_H
6 
7 #include <linux/rtc.h>
8 #include <linux/tracepoint.h>
9 
10 DECLARE_EVENT_CLASS(rtc_time_alarm_class,
11 
12 	TP_PROTO(time64_t secs, int err),
13 
14 	TP_ARGS(secs, err),
15 
16 	TP_STRUCT__entry(
17 		__field(time64_t, secs)
18 		__field(int, err)
19 	),
20 
21 	TP_fast_assign(
22 		__entry->secs = secs;
23 		__entry->err = err;
24 	),
25 
26 	TP_printk("UTC (%lld) (%d)",
27 		  __entry->secs, __entry->err
28 	)
29 );
30 
31 DEFINE_EVENT(rtc_time_alarm_class, rtc_set_time,
32 
33 	TP_PROTO(time64_t secs, int err),
34 
35 	TP_ARGS(secs, err)
36 );
37 
38 DEFINE_EVENT(rtc_time_alarm_class, rtc_read_time,
39 
40 	TP_PROTO(time64_t secs, int err),
41 
42 	TP_ARGS(secs, err)
43 );
44 
45 DEFINE_EVENT(rtc_time_alarm_class, rtc_set_alarm,
46 
47 	TP_PROTO(time64_t secs, int err),
48 
49 	TP_ARGS(secs, err)
50 );
51 
52 DEFINE_EVENT(rtc_time_alarm_class, rtc_read_alarm,
53 
54 	TP_PROTO(time64_t secs, int err),
55 
56 	TP_ARGS(secs, err)
57 );
58 
59 TRACE_EVENT(rtc_irq_set_freq,
60 
61 	TP_PROTO(int freq, int err),
62 
63 	TP_ARGS(freq, err),
64 
65 	TP_STRUCT__entry(
66 		__field(int, freq)
67 		__field(int, err)
68 	),
69 
70 	TP_fast_assign(
71 		__entry->freq = freq;
72 		__entry->err = err;
73 	),
74 
75 	TP_printk("set RTC periodic IRQ frequency:%u (%d)",
76 		  __entry->freq, __entry->err
77 	)
78 );
79 
80 TRACE_EVENT(rtc_irq_set_state,
81 
82 	TP_PROTO(int enabled, int err),
83 
84 	TP_ARGS(enabled, err),
85 
86 	TP_STRUCT__entry(
87 		__field(int, enabled)
88 		__field(int, err)
89 	),
90 
91 	TP_fast_assign(
92 		__entry->enabled = enabled;
93 		__entry->err = err;
94 	),
95 
96 	TP_printk("%s RTC 2^N Hz periodic IRQs (%d)",
97 		  __entry->enabled ? "enable" : "disable",
98 		  __entry->err
99 	)
100 );
101 
102 TRACE_EVENT(rtc_alarm_irq_enable,
103 
104 	TP_PROTO(unsigned int enabled, int err),
105 
106 	TP_ARGS(enabled, err),
107 
108 	TP_STRUCT__entry(
109 		__field(unsigned int, enabled)
110 		__field(int, err)
111 	),
112 
113 	TP_fast_assign(
114 		__entry->enabled = enabled;
115 		__entry->err = err;
116 	),
117 
118 	TP_printk("%s RTC alarm IRQ (%d)",
119 		  __entry->enabled ? "enable" : "disable",
120 		  __entry->err
121 	)
122 );
123 
124 DECLARE_EVENT_CLASS(rtc_offset_class,
125 
126 	TP_PROTO(long offset, int err),
127 
128 	TP_ARGS(offset, err),
129 
130 	TP_STRUCT__entry(
131 		__field(long, offset)
132 		__field(int, err)
133 	),
134 
135 	TP_fast_assign(
136 		__entry->offset = offset;
137 		__entry->err = err;
138 	),
139 
140 	TP_printk("RTC offset: %ld (%d)",
141 		  __entry->offset, __entry->err
142 	)
143 );
144 
145 DEFINE_EVENT(rtc_offset_class, rtc_set_offset,
146 
147 	TP_PROTO(long offset, int err),
148 
149 	TP_ARGS(offset, err)
150 );
151 
152 DEFINE_EVENT(rtc_offset_class, rtc_read_offset,
153 
154 	TP_PROTO(long offset, int err),
155 
156 	TP_ARGS(offset, err)
157 );
158 
159 DECLARE_EVENT_CLASS(rtc_timer_class,
160 
161 	TP_PROTO(struct rtc_timer *timer),
162 
163 	TP_ARGS(timer),
164 
165 	TP_STRUCT__entry(
166 		__field(struct rtc_timer *, timer)
167 		__field(ktime_t, expires)
168 		__field(ktime_t, period)
169 	),
170 
171 	TP_fast_assign(
172 		__entry->timer = timer;
173 		__entry->expires = timer->node.expires;
174 		__entry->period = timer->period;
175 	),
176 
177 	TP_printk("RTC timer:(%p) expires:%lld period:%lld",
178 		  __entry->timer, __entry->expires, __entry->period
179 	)
180 );
181 
182 DEFINE_EVENT(rtc_timer_class, rtc_timer_enqueue,
183 
184 	TP_PROTO(struct rtc_timer *timer),
185 
186 	TP_ARGS(timer)
187 );
188 
189 DEFINE_EVENT(rtc_timer_class, rtc_timer_dequeue,
190 
191 	TP_PROTO(struct rtc_timer *timer),
192 
193 	TP_ARGS(timer)
194 );
195 
196 DEFINE_EVENT(rtc_timer_class, rtc_timer_fired,
197 
198 	TP_PROTO(struct rtc_timer *timer),
199 
200 	TP_ARGS(timer)
201 );
202 
203 #endif /* _TRACE_RTC_H */
204 
205 /* This part must be outside protection */
206 #include <trace/define_trace.h>
207