xref: /openbmc/linux/include/trace/events/clk.h (revision 018f336f)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
4  */
5 #undef TRACE_SYSTEM
6 #define TRACE_SYSTEM clk
7 
8 #if !defined(_TRACE_CLK_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _TRACE_CLK_H
10 
11 #include <linux/tracepoint.h>
12 
13 struct clk_core;
14 
15 DECLARE_EVENT_CLASS(clk,
16 
17 	TP_PROTO(struct clk_core *core),
18 
19 	TP_ARGS(core),
20 
21 	TP_STRUCT__entry(
22 		__string(        name,           core->name       )
23 	),
24 
25 	TP_fast_assign(
26 		__assign_str(name, core->name);
27 	),
28 
29 	TP_printk("%s", __get_str(name))
30 );
31 
32 DEFINE_EVENT(clk, clk_enable,
33 
34 	TP_PROTO(struct clk_core *core),
35 
36 	TP_ARGS(core)
37 );
38 
39 DEFINE_EVENT(clk, clk_enable_complete,
40 
41 	TP_PROTO(struct clk_core *core),
42 
43 	TP_ARGS(core)
44 );
45 
46 DEFINE_EVENT(clk, clk_disable,
47 
48 	TP_PROTO(struct clk_core *core),
49 
50 	TP_ARGS(core)
51 );
52 
53 DEFINE_EVENT(clk, clk_disable_complete,
54 
55 	TP_PROTO(struct clk_core *core),
56 
57 	TP_ARGS(core)
58 );
59 
60 DEFINE_EVENT(clk, clk_prepare,
61 
62 	TP_PROTO(struct clk_core *core),
63 
64 	TP_ARGS(core)
65 );
66 
67 DEFINE_EVENT(clk, clk_prepare_complete,
68 
69 	TP_PROTO(struct clk_core *core),
70 
71 	TP_ARGS(core)
72 );
73 
74 DEFINE_EVENT(clk, clk_unprepare,
75 
76 	TP_PROTO(struct clk_core *core),
77 
78 	TP_ARGS(core)
79 );
80 
81 DEFINE_EVENT(clk, clk_unprepare_complete,
82 
83 	TP_PROTO(struct clk_core *core),
84 
85 	TP_ARGS(core)
86 );
87 
88 DECLARE_EVENT_CLASS(clk_rate,
89 
90 	TP_PROTO(struct clk_core *core, unsigned long rate),
91 
92 	TP_ARGS(core, rate),
93 
94 	TP_STRUCT__entry(
95 		__string(        name,           core->name                )
96 		__field(unsigned long,           rate                      )
97 	),
98 
99 	TP_fast_assign(
100 		__assign_str(name, core->name);
101 		__entry->rate = rate;
102 	),
103 
104 	TP_printk("%s %lu", __get_str(name), (unsigned long)__entry->rate)
105 );
106 
107 DEFINE_EVENT(clk_rate, clk_set_rate,
108 
109 	TP_PROTO(struct clk_core *core, unsigned long rate),
110 
111 	TP_ARGS(core, rate)
112 );
113 
114 DEFINE_EVENT(clk_rate, clk_set_rate_complete,
115 
116 	TP_PROTO(struct clk_core *core, unsigned long rate),
117 
118 	TP_ARGS(core, rate)
119 );
120 
121 DEFINE_EVENT(clk_rate, clk_set_min_rate,
122 
123 	TP_PROTO(struct clk_core *core, unsigned long rate),
124 
125 	TP_ARGS(core, rate)
126 );
127 
128 DEFINE_EVENT(clk_rate, clk_set_max_rate,
129 
130 	TP_PROTO(struct clk_core *core, unsigned long rate),
131 
132 	TP_ARGS(core, rate)
133 );
134 
135 DECLARE_EVENT_CLASS(clk_rate_range,
136 
137 	TP_PROTO(struct clk_core *core, unsigned long min, unsigned long max),
138 
139 	TP_ARGS(core, min, max),
140 
141 	TP_STRUCT__entry(
142 		__string(        name,           core->name                )
143 		__field(unsigned long,           min                       )
144 		__field(unsigned long,           max                       )
145 	),
146 
147 	TP_fast_assign(
148 		__assign_str(name, core->name);
149 		__entry->min = min;
150 		__entry->max = max;
151 	),
152 
153 	TP_printk("%s min %lu max %lu", __get_str(name),
154 		  (unsigned long)__entry->min,
155 		  (unsigned long)__entry->max)
156 );
157 
158 DEFINE_EVENT(clk_rate_range, clk_set_rate_range,
159 
160 	TP_PROTO(struct clk_core *core, unsigned long min, unsigned long max),
161 
162 	TP_ARGS(core, min, max)
163 );
164 
165 DECLARE_EVENT_CLASS(clk_parent,
166 
167 	TP_PROTO(struct clk_core *core, struct clk_core *parent),
168 
169 	TP_ARGS(core, parent),
170 
171 	TP_STRUCT__entry(
172 		__string(        name,           core->name                )
173 		__string(        pname, parent ? parent->name : "none"     )
174 	),
175 
176 	TP_fast_assign(
177 		__assign_str(name, core->name);
178 		__assign_str(pname, parent ? parent->name : "none");
179 	),
180 
181 	TP_printk("%s %s", __get_str(name), __get_str(pname))
182 );
183 
184 DEFINE_EVENT(clk_parent, clk_set_parent,
185 
186 	TP_PROTO(struct clk_core *core, struct clk_core *parent),
187 
188 	TP_ARGS(core, parent)
189 );
190 
191 DEFINE_EVENT(clk_parent, clk_set_parent_complete,
192 
193 	TP_PROTO(struct clk_core *core, struct clk_core *parent),
194 
195 	TP_ARGS(core, parent)
196 );
197 
198 DECLARE_EVENT_CLASS(clk_phase,
199 
200 	TP_PROTO(struct clk_core *core, int phase),
201 
202 	TP_ARGS(core, phase),
203 
204 	TP_STRUCT__entry(
205 		__string(        name,           core->name                )
206 		__field(	  int,           phase                     )
207 	),
208 
209 	TP_fast_assign(
210 		__assign_str(name, core->name);
211 		__entry->phase = phase;
212 	),
213 
214 	TP_printk("%s %d", __get_str(name), (int)__entry->phase)
215 );
216 
217 DEFINE_EVENT(clk_phase, clk_set_phase,
218 
219 	TP_PROTO(struct clk_core *core, int phase),
220 
221 	TP_ARGS(core, phase)
222 );
223 
224 DEFINE_EVENT(clk_phase, clk_set_phase_complete,
225 
226 	TP_PROTO(struct clk_core *core, int phase),
227 
228 	TP_ARGS(core, phase)
229 );
230 
231 DECLARE_EVENT_CLASS(clk_duty_cycle,
232 
233 	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
234 
235 	TP_ARGS(core, duty),
236 
237 	TP_STRUCT__entry(
238 		__string(        name,           core->name              )
239 		__field( unsigned int,           num                     )
240 		__field( unsigned int,           den                     )
241 	),
242 
243 	TP_fast_assign(
244 		__assign_str(name, core->name);
245 		__entry->num = duty->num;
246 		__entry->den = duty->den;
247 	),
248 
249 	TP_printk("%s %u/%u", __get_str(name), (unsigned int)__entry->num,
250 		  (unsigned int)__entry->den)
251 );
252 
253 DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle,
254 
255 	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
256 
257 	TP_ARGS(core, duty)
258 );
259 
260 DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle_complete,
261 
262 	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
263 
264 	TP_ARGS(core, duty)
265 );
266 
267 DECLARE_EVENT_CLASS(clk_rate_request,
268 
269 	TP_PROTO(struct clk_rate_request *req),
270 
271 	TP_ARGS(req),
272 
273 	TP_STRUCT__entry(
274 		__string(        name, req->core ? req->core->name : "none")
275 		__string(       pname, req->best_parent_hw ? clk_hw_get_name(req->best_parent_hw) : "none" )
276 		__field(unsigned long,           min                       )
277 		__field(unsigned long,           max                       )
278 		__field(unsigned long,           prate                     )
279 	),
280 
281 	TP_fast_assign(
282 		__assign_str(name, req->core ? req->core->name : "none");
283 		__assign_str(pname, req->best_parent_hw ? clk_hw_get_name(req->best_parent_hw) : "none");
284 		__entry->min = req->min_rate;
285 		__entry->max = req->max_rate;
286 		__entry->prate = req->best_parent_rate;
287 	),
288 
289 	TP_printk("%s min %lu max %lu, parent %s (%lu)", __get_str(name),
290 		  (unsigned long)__entry->min,
291 		  (unsigned long)__entry->max,
292 		  __get_str(pname),
293 		  (unsigned long)__entry->prate)
294 );
295 
296 DEFINE_EVENT(clk_rate_request, clk_rate_request_start,
297 
298 	TP_PROTO(struct clk_rate_request *req),
299 
300 	TP_ARGS(req)
301 );
302 
303 DEFINE_EVENT(clk_rate_request, clk_rate_request_done,
304 
305 	TP_PROTO(struct clk_rate_request *req),
306 
307 	TP_ARGS(req)
308 );
309 
310 #endif /* _TRACE_CLK_H */
311 
312 /* This part must be outside protection */
313 #include <trace/define_trace.h>
314