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
13struct clk_core;
14
15DECLARE_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
32DEFINE_EVENT(clk, clk_enable,
33
34	TP_PROTO(struct clk_core *core),
35
36	TP_ARGS(core)
37);
38
39DEFINE_EVENT(clk, clk_enable_complete,
40
41	TP_PROTO(struct clk_core *core),
42
43	TP_ARGS(core)
44);
45
46DEFINE_EVENT(clk, clk_disable,
47
48	TP_PROTO(struct clk_core *core),
49
50	TP_ARGS(core)
51);
52
53DEFINE_EVENT(clk, clk_disable_complete,
54
55	TP_PROTO(struct clk_core *core),
56
57	TP_ARGS(core)
58);
59
60DEFINE_EVENT(clk, clk_prepare,
61
62	TP_PROTO(struct clk_core *core),
63
64	TP_ARGS(core)
65);
66
67DEFINE_EVENT(clk, clk_prepare_complete,
68
69	TP_PROTO(struct clk_core *core),
70
71	TP_ARGS(core)
72);
73
74DEFINE_EVENT(clk, clk_unprepare,
75
76	TP_PROTO(struct clk_core *core),
77
78	TP_ARGS(core)
79);
80
81DEFINE_EVENT(clk, clk_unprepare_complete,
82
83	TP_PROTO(struct clk_core *core),
84
85	TP_ARGS(core)
86);
87
88DECLARE_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
107DEFINE_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
114DEFINE_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
121DECLARE_EVENT_CLASS(clk_parent,
122
123	TP_PROTO(struct clk_core *core, struct clk_core *parent),
124
125	TP_ARGS(core, parent),
126
127	TP_STRUCT__entry(
128		__string(        name,           core->name                )
129		__string(        pname, parent ? parent->name : "none"     )
130	),
131
132	TP_fast_assign(
133		__assign_str(name, core->name);
134		__assign_str(pname, parent ? parent->name : "none");
135	),
136
137	TP_printk("%s %s", __get_str(name), __get_str(pname))
138);
139
140DEFINE_EVENT(clk_parent, clk_set_parent,
141
142	TP_PROTO(struct clk_core *core, struct clk_core *parent),
143
144	TP_ARGS(core, parent)
145);
146
147DEFINE_EVENT(clk_parent, clk_set_parent_complete,
148
149	TP_PROTO(struct clk_core *core, struct clk_core *parent),
150
151	TP_ARGS(core, parent)
152);
153
154DECLARE_EVENT_CLASS(clk_phase,
155
156	TP_PROTO(struct clk_core *core, int phase),
157
158	TP_ARGS(core, phase),
159
160	TP_STRUCT__entry(
161		__string(        name,           core->name                )
162		__field(	  int,           phase                     )
163	),
164
165	TP_fast_assign(
166		__assign_str(name, core->name);
167		__entry->phase = phase;
168	),
169
170	TP_printk("%s %d", __get_str(name), (int)__entry->phase)
171);
172
173DEFINE_EVENT(clk_phase, clk_set_phase,
174
175	TP_PROTO(struct clk_core *core, int phase),
176
177	TP_ARGS(core, phase)
178);
179
180DEFINE_EVENT(clk_phase, clk_set_phase_complete,
181
182	TP_PROTO(struct clk_core *core, int phase),
183
184	TP_ARGS(core, phase)
185);
186
187DECLARE_EVENT_CLASS(clk_duty_cycle,
188
189	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
190
191	TP_ARGS(core, duty),
192
193	TP_STRUCT__entry(
194		__string(        name,           core->name              )
195		__field( unsigned int,           num                     )
196		__field( unsigned int,           den                     )
197	),
198
199	TP_fast_assign(
200		__assign_str(name, core->name);
201		__entry->num = duty->num;
202		__entry->den = duty->den;
203	),
204
205	TP_printk("%s %u/%u", __get_str(name), (unsigned int)__entry->num,
206		  (unsigned int)__entry->den)
207);
208
209DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle,
210
211	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
212
213	TP_ARGS(core, duty)
214);
215
216DEFINE_EVENT(clk_duty_cycle, clk_set_duty_cycle_complete,
217
218	TP_PROTO(struct clk_core *core, struct clk_duty *duty),
219
220	TP_ARGS(core, duty)
221);
222
223#endif /* _TRACE_CLK_H */
224
225/* This part must be outside protection */
226#include <trace/define_trace.h>
227