xref: /openbmc/linux/include/trace/events/clk.h (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
19c92ab61SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2dfc202eaSStephen Boyd /*
3dfc202eaSStephen Boyd  * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
4dfc202eaSStephen Boyd  */
5dfc202eaSStephen Boyd #undef TRACE_SYSTEM
6dfc202eaSStephen Boyd #define TRACE_SYSTEM clk
7dfc202eaSStephen Boyd 
8dfc202eaSStephen Boyd #if !defined(_TRACE_CLK_H) || defined(TRACE_HEADER_MULTI_READ)
9dfc202eaSStephen Boyd #define _TRACE_CLK_H
10dfc202eaSStephen Boyd 
11dfc202eaSStephen Boyd #include <linux/tracepoint.h>
12dfc202eaSStephen Boyd 
13dfc202eaSStephen Boyd struct clk_core;
14dfc202eaSStephen Boyd 
15dfc202eaSStephen Boyd DECLARE_EVENT_CLASS(clk,
16dfc202eaSStephen Boyd 
17dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
18dfc202eaSStephen Boyd 
19dfc202eaSStephen Boyd 	TP_ARGS(core),
20dfc202eaSStephen Boyd 
21dfc202eaSStephen Boyd 	TP_STRUCT__entry(
22dfc202eaSStephen Boyd 		__string(        name,           core->name       )
23dfc202eaSStephen Boyd 	),
24dfc202eaSStephen Boyd 
25dfc202eaSStephen Boyd 	TP_fast_assign(
26dfc202eaSStephen Boyd 		__assign_str(name, core->name);
27dfc202eaSStephen Boyd 	),
28dfc202eaSStephen Boyd 
29dfc202eaSStephen Boyd 	TP_printk("%s", __get_str(name))
30dfc202eaSStephen Boyd );
31dfc202eaSStephen Boyd 
32dfc202eaSStephen Boyd DEFINE_EVENT(clk, clk_enable,
33dfc202eaSStephen Boyd 
34dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
35dfc202eaSStephen Boyd 
36dfc202eaSStephen Boyd 	TP_ARGS(core)
37dfc202eaSStephen Boyd );
38dfc202eaSStephen Boyd 
39dfc202eaSStephen Boyd DEFINE_EVENT(clk, clk_enable_complete,
40dfc202eaSStephen Boyd 
41dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
42dfc202eaSStephen Boyd 
43dfc202eaSStephen Boyd 	TP_ARGS(core)
44dfc202eaSStephen Boyd );
45dfc202eaSStephen Boyd 
46dfc202eaSStephen Boyd DEFINE_EVENT(clk, clk_disable,
47dfc202eaSStephen Boyd 
48dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
49dfc202eaSStephen Boyd 
50dfc202eaSStephen Boyd 	TP_ARGS(core)
51dfc202eaSStephen Boyd );
52dfc202eaSStephen Boyd 
53dfc202eaSStephen Boyd DEFINE_EVENT(clk, clk_disable_complete,
54dfc202eaSStephen Boyd 
55dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
56dfc202eaSStephen Boyd 
57dfc202eaSStephen Boyd 	TP_ARGS(core)
58dfc202eaSStephen Boyd );
59dfc202eaSStephen Boyd 
60dfc202eaSStephen Boyd DEFINE_EVENT(clk, clk_prepare,
61dfc202eaSStephen Boyd 
62dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
63dfc202eaSStephen Boyd 
64dfc202eaSStephen Boyd 	TP_ARGS(core)
65dfc202eaSStephen Boyd );
66dfc202eaSStephen Boyd 
67dfc202eaSStephen Boyd DEFINE_EVENT(clk, clk_prepare_complete,
68dfc202eaSStephen Boyd 
69dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
70dfc202eaSStephen Boyd 
71dfc202eaSStephen Boyd 	TP_ARGS(core)
72dfc202eaSStephen Boyd );
73dfc202eaSStephen Boyd 
74dfc202eaSStephen Boyd DEFINE_EVENT(clk, clk_unprepare,
75dfc202eaSStephen Boyd 
76dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
77dfc202eaSStephen Boyd 
78dfc202eaSStephen Boyd 	TP_ARGS(core)
79dfc202eaSStephen Boyd );
80dfc202eaSStephen Boyd 
81dfc202eaSStephen Boyd DEFINE_EVENT(clk, clk_unprepare_complete,
82dfc202eaSStephen Boyd 
83dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core),
84dfc202eaSStephen Boyd 
85dfc202eaSStephen Boyd 	TP_ARGS(core)
86dfc202eaSStephen Boyd );
87dfc202eaSStephen Boyd 
88dfc202eaSStephen Boyd DECLARE_EVENT_CLASS(clk_rate,
89dfc202eaSStephen Boyd 
90dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, unsigned long rate),
91dfc202eaSStephen Boyd 
92dfc202eaSStephen Boyd 	TP_ARGS(core, rate),
93dfc202eaSStephen Boyd 
94dfc202eaSStephen Boyd 	TP_STRUCT__entry(
95dfc202eaSStephen Boyd 		__string(        name,           core->name                )
96dfc202eaSStephen Boyd 		__field(unsigned long,           rate                      )
97dfc202eaSStephen Boyd 	),
98dfc202eaSStephen Boyd 
99dfc202eaSStephen Boyd 	TP_fast_assign(
100dfc202eaSStephen Boyd 		__assign_str(name, core->name);
101dfc202eaSStephen Boyd 		__entry->rate = rate;
102dfc202eaSStephen Boyd 	),
103dfc202eaSStephen Boyd 
104dfc202eaSStephen Boyd 	TP_printk("%s %lu", __get_str(name), (unsigned long)__entry->rate)
105dfc202eaSStephen Boyd );
106dfc202eaSStephen Boyd 
107dfc202eaSStephen Boyd DEFINE_EVENT(clk_rate, clk_set_rate,
108dfc202eaSStephen Boyd 
109dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, unsigned long rate),
110dfc202eaSStephen Boyd 
111dfc202eaSStephen Boyd 	TP_ARGS(core, rate)
112dfc202eaSStephen Boyd );
113dfc202eaSStephen Boyd 
114dfc202eaSStephen Boyd DEFINE_EVENT(clk_rate, clk_set_rate_complete,
115dfc202eaSStephen Boyd 
116dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, unsigned long rate),
117dfc202eaSStephen Boyd 
118dfc202eaSStephen Boyd 	TP_ARGS(core, rate)
119dfc202eaSStephen Boyd );
120dfc202eaSStephen Boyd 
12103813d9bSMaxime Ripard DEFINE_EVENT(clk_rate, clk_set_min_rate,
12203813d9bSMaxime Ripard 
12303813d9bSMaxime Ripard 	TP_PROTO(struct clk_core *core, unsigned long rate),
12403813d9bSMaxime Ripard 
12503813d9bSMaxime Ripard 	TP_ARGS(core, rate)
12603813d9bSMaxime Ripard );
12703813d9bSMaxime Ripard 
12803813d9bSMaxime Ripard DEFINE_EVENT(clk_rate, clk_set_max_rate,
12903813d9bSMaxime Ripard 
13003813d9bSMaxime Ripard 	TP_PROTO(struct clk_core *core, unsigned long rate),
13103813d9bSMaxime Ripard 
13203813d9bSMaxime Ripard 	TP_ARGS(core, rate)
13303813d9bSMaxime Ripard );
13403813d9bSMaxime Ripard 
13503813d9bSMaxime Ripard DECLARE_EVENT_CLASS(clk_rate_range,
13603813d9bSMaxime Ripard 
13703813d9bSMaxime Ripard 	TP_PROTO(struct clk_core *core, unsigned long min, unsigned long max),
13803813d9bSMaxime Ripard 
13903813d9bSMaxime Ripard 	TP_ARGS(core, min, max),
14003813d9bSMaxime Ripard 
14103813d9bSMaxime Ripard 	TP_STRUCT__entry(
14203813d9bSMaxime Ripard 		__string(        name,           core->name                )
14303813d9bSMaxime Ripard 		__field(unsigned long,           min                       )
14403813d9bSMaxime Ripard 		__field(unsigned long,           max                       )
14503813d9bSMaxime Ripard 	),
14603813d9bSMaxime Ripard 
14703813d9bSMaxime Ripard 	TP_fast_assign(
14803813d9bSMaxime Ripard 		__assign_str(name, core->name);
14903813d9bSMaxime Ripard 		__entry->min = min;
15003813d9bSMaxime Ripard 		__entry->max = max;
15103813d9bSMaxime Ripard 	),
15203813d9bSMaxime Ripard 
15303813d9bSMaxime Ripard 	TP_printk("%s min %lu max %lu", __get_str(name),
15403813d9bSMaxime Ripard 		  (unsigned long)__entry->min,
15503813d9bSMaxime Ripard 		  (unsigned long)__entry->max)
15603813d9bSMaxime Ripard );
15703813d9bSMaxime Ripard 
15803813d9bSMaxime Ripard DEFINE_EVENT(clk_rate_range, clk_set_rate_range,
15903813d9bSMaxime Ripard 
16003813d9bSMaxime Ripard 	TP_PROTO(struct clk_core *core, unsigned long min, unsigned long max),
16103813d9bSMaxime Ripard 
16203813d9bSMaxime Ripard 	TP_ARGS(core, min, max)
16303813d9bSMaxime Ripard );
16403813d9bSMaxime Ripard 
165dfc202eaSStephen Boyd DECLARE_EVENT_CLASS(clk_parent,
166dfc202eaSStephen Boyd 
167dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, struct clk_core *parent),
168dfc202eaSStephen Boyd 
169dfc202eaSStephen Boyd 	TP_ARGS(core, parent),
170dfc202eaSStephen Boyd 
171dfc202eaSStephen Boyd 	TP_STRUCT__entry(
172dfc202eaSStephen Boyd 		__string(        name,           core->name                )
173975b820bSCai Li 		__string(        pname, parent ? parent->name : "none"     )
174dfc202eaSStephen Boyd 	),
175dfc202eaSStephen Boyd 
176dfc202eaSStephen Boyd 	TP_fast_assign(
177dfc202eaSStephen Boyd 		__assign_str(name, core->name);
178975b820bSCai Li 		__assign_str(pname, parent ? parent->name : "none");
179dfc202eaSStephen Boyd 	),
180dfc202eaSStephen Boyd 
181dfc202eaSStephen Boyd 	TP_printk("%s %s", __get_str(name), __get_str(pname))
182dfc202eaSStephen Boyd );
183dfc202eaSStephen Boyd 
184dfc202eaSStephen Boyd DEFINE_EVENT(clk_parent, clk_set_parent,
185dfc202eaSStephen Boyd 
186dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, struct clk_core *parent),
187dfc202eaSStephen Boyd 
188dfc202eaSStephen Boyd 	TP_ARGS(core, parent)
189dfc202eaSStephen Boyd );
190dfc202eaSStephen Boyd 
191dfc202eaSStephen Boyd DEFINE_EVENT(clk_parent, clk_set_parent_complete,
192dfc202eaSStephen Boyd 
193dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, struct clk_core *parent),
194dfc202eaSStephen Boyd 
195dfc202eaSStephen Boyd 	TP_ARGS(core, parent)
196dfc202eaSStephen Boyd );
197dfc202eaSStephen Boyd 
198dfc202eaSStephen Boyd DECLARE_EVENT_CLASS(clk_phase,
199dfc202eaSStephen Boyd 
200dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, int phase),
201dfc202eaSStephen Boyd 
202dfc202eaSStephen Boyd 	TP_ARGS(core, phase),
203dfc202eaSStephen Boyd 
204dfc202eaSStephen Boyd 	TP_STRUCT__entry(
205dfc202eaSStephen Boyd 		__string(        name,           core->name                )
206dfc202eaSStephen Boyd 		__field(	  int,           phase                     )
207dfc202eaSStephen Boyd 	),
208dfc202eaSStephen Boyd 
209dfc202eaSStephen Boyd 	TP_fast_assign(
210dfc202eaSStephen Boyd 		__assign_str(name, core->name);
211dfc202eaSStephen Boyd 		__entry->phase = phase;
212dfc202eaSStephen Boyd 	),
213dfc202eaSStephen Boyd 
214dfc202eaSStephen Boyd 	TP_printk("%s %d", __get_str(name), (int)__entry->phase)
215dfc202eaSStephen Boyd );
216dfc202eaSStephen Boyd 
217dfc202eaSStephen Boyd DEFINE_EVENT(clk_phase, clk_set_phase,
218dfc202eaSStephen Boyd 
219dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, int phase),
220dfc202eaSStephen Boyd 
221dfc202eaSStephen Boyd 	TP_ARGS(core, phase)
222dfc202eaSStephen Boyd );
223dfc202eaSStephen Boyd 
224dfc202eaSStephen Boyd DEFINE_EVENT(clk_phase, clk_set_phase_complete,
225dfc202eaSStephen Boyd 
226dfc202eaSStephen Boyd 	TP_PROTO(struct clk_core *core, int phase),
227dfc202eaSStephen Boyd 
228dfc202eaSStephen Boyd 	TP_ARGS(core, phase)
229dfc202eaSStephen Boyd );
230dfc202eaSStephen Boyd 
2319fba738aSJerome Brunet DECLARE_EVENT_CLASS(clk_duty_cycle,
2329fba738aSJerome Brunet 
2339fba738aSJerome Brunet 	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
2349fba738aSJerome Brunet 
2359fba738aSJerome Brunet 	TP_ARGS(core, duty),
2369fba738aSJerome Brunet 
2379fba738aSJerome Brunet 	TP_STRUCT__entry(
2389fba738aSJerome Brunet 		__string(        name,           core->name              )
2399fba738aSJerome Brunet 		__field( unsigned int,           num                     )
2409fba738aSJerome Brunet 		__field( unsigned int,           den                     )
2419fba738aSJerome Brunet 	),
2429fba738aSJerome Brunet 
2439fba738aSJerome Brunet 	TP_fast_assign(
2449fba738aSJerome Brunet 		__assign_str(name, core->name);
2459fba738aSJerome Brunet 		__entry->num = duty->num;
2469fba738aSJerome Brunet 		__entry->den = duty->den;
2479fba738aSJerome Brunet 	),
2489fba738aSJerome Brunet 
2499fba738aSJerome Brunet 	TP_printk("%s %u/%u", __get_str(name), (unsigned int)__entry->num,
2509fba738aSJerome Brunet 		  (unsigned int)__entry->den)
2519fba738aSJerome Brunet );
2529fba738aSJerome Brunet 
2539fba738aSJerome Brunet DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle,
2549fba738aSJerome Brunet 
2559fba738aSJerome Brunet 	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
2569fba738aSJerome Brunet 
2579fba738aSJerome Brunet 	TP_ARGS(core, duty)
2589fba738aSJerome Brunet );
2599fba738aSJerome Brunet 
2609fba738aSJerome Brunet DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle_complete,
2619fba738aSJerome Brunet 
2629fba738aSJerome Brunet 	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
2639fba738aSJerome Brunet 
2649fba738aSJerome Brunet 	TP_ARGS(core, duty)
2659fba738aSJerome Brunet );
2669fba738aSJerome Brunet 
267*49e62e0dSMaxime Ripard DECLARE_EVENT_CLASS(clk_rate_request,
268*49e62e0dSMaxime Ripard 
269*49e62e0dSMaxime Ripard 	TP_PROTO(struct clk_rate_request *req),
270*49e62e0dSMaxime Ripard 
271*49e62e0dSMaxime Ripard 	TP_ARGS(req),
272*49e62e0dSMaxime Ripard 
273*49e62e0dSMaxime Ripard 	TP_STRUCT__entry(
274*49e62e0dSMaxime Ripard 		__string(        name, req->core ? req->core->name : "none")
275*49e62e0dSMaxime Ripard 		__string(       pname, req->best_parent_hw ? clk_hw_get_name(req->best_parent_hw) : "none" )
276*49e62e0dSMaxime Ripard 		__field(unsigned long,           min                       )
277*49e62e0dSMaxime Ripard 		__field(unsigned long,           max                       )
278*49e62e0dSMaxime Ripard 		__field(unsigned long,           prate                     )
279*49e62e0dSMaxime Ripard 	),
280*49e62e0dSMaxime Ripard 
281*49e62e0dSMaxime Ripard 	TP_fast_assign(
282*49e62e0dSMaxime Ripard 		__assign_str(name, req->core ? req->core->name : "none");
283*49e62e0dSMaxime Ripard 		__assign_str(pname, req->best_parent_hw ? clk_hw_get_name(req->best_parent_hw) : "none");
284*49e62e0dSMaxime Ripard 		__entry->min = req->min_rate;
285*49e62e0dSMaxime Ripard 		__entry->max = req->max_rate;
286*49e62e0dSMaxime Ripard 		__entry->prate = req->best_parent_rate;
287*49e62e0dSMaxime Ripard 	),
288*49e62e0dSMaxime Ripard 
289*49e62e0dSMaxime Ripard 	TP_printk("%s min %lu max %lu, parent %s (%lu)", __get_str(name),
290*49e62e0dSMaxime Ripard 		  (unsigned long)__entry->min,
291*49e62e0dSMaxime Ripard 		  (unsigned long)__entry->max,
292*49e62e0dSMaxime Ripard 		  __get_str(pname),
293*49e62e0dSMaxime Ripard 		  (unsigned long)__entry->prate)
294*49e62e0dSMaxime Ripard );
295*49e62e0dSMaxime Ripard 
296*49e62e0dSMaxime Ripard DEFINE_EVENT(clk_rate_request, clk_rate_request_start,
297*49e62e0dSMaxime Ripard 
298*49e62e0dSMaxime Ripard 	TP_PROTO(struct clk_rate_request *req),
299*49e62e0dSMaxime Ripard 
300*49e62e0dSMaxime Ripard 	TP_ARGS(req)
301*49e62e0dSMaxime Ripard );
302*49e62e0dSMaxime Ripard 
303*49e62e0dSMaxime Ripard DEFINE_EVENT(clk_rate_request, clk_rate_request_done,
304*49e62e0dSMaxime Ripard 
305*49e62e0dSMaxime Ripard 	TP_PROTO(struct clk_rate_request *req),
306*49e62e0dSMaxime Ripard 
307*49e62e0dSMaxime Ripard 	TP_ARGS(req)
308*49e62e0dSMaxime Ripard );
309*49e62e0dSMaxime Ripard 
310dfc202eaSStephen Boyd #endif /* _TRACE_CLK_H */
311dfc202eaSStephen Boyd 
312dfc202eaSStephen Boyd /* This part must be outside protection */
313dfc202eaSStephen Boyd #include <trace/define_trace.h>
314