xref: /openbmc/linux/include/trace/events/asoc.h (revision b34e08d5)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM asoc
3 
4 #if !defined(_TRACE_ASOC_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_ASOC_H
6 
7 #include <linux/ktime.h>
8 #include <linux/tracepoint.h>
9 
10 #define DAPM_DIRECT "(direct)"
11 
12 struct snd_soc_jack;
13 struct snd_soc_codec;
14 struct snd_soc_platform;
15 struct snd_soc_card;
16 struct snd_soc_dapm_widget;
17 struct snd_soc_dapm_path;
18 
19 /*
20  * Log register events
21  */
22 DECLARE_EVENT_CLASS(snd_soc_reg,
23 
24 	TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
25 		 unsigned int val),
26 
27 	TP_ARGS(codec, reg, val),
28 
29 	TP_STRUCT__entry(
30 		__string(	name,		codec->name	)
31 		__field(	int,		id		)
32 		__field(	unsigned int,	reg		)
33 		__field(	unsigned int,	val		)
34 	),
35 
36 	TP_fast_assign(
37 		__assign_str(name, codec->name);
38 		__entry->id = codec->id;
39 		__entry->reg = reg;
40 		__entry->val = val;
41 	),
42 
43 	TP_printk("codec=%s.%d reg=%x val=%x", __get_str(name),
44 		  (int)__entry->id, (unsigned int)__entry->reg,
45 		  (unsigned int)__entry->val)
46 );
47 
48 DEFINE_EVENT(snd_soc_reg, snd_soc_reg_write,
49 
50 	TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
51 		 unsigned int val),
52 
53 	TP_ARGS(codec, reg, val)
54 
55 );
56 
57 DEFINE_EVENT(snd_soc_reg, snd_soc_reg_read,
58 
59 	TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
60 		 unsigned int val),
61 
62 	TP_ARGS(codec, reg, val)
63 
64 );
65 
66 DECLARE_EVENT_CLASS(snd_soc_preg,
67 
68 	TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
69 		 unsigned int val),
70 
71 	TP_ARGS(platform, reg, val),
72 
73 	TP_STRUCT__entry(
74 		__string(	name,		platform->name	)
75 		__field(	int,		id		)
76 		__field(	unsigned int,	reg		)
77 		__field(	unsigned int,	val		)
78 	),
79 
80 	TP_fast_assign(
81 		__assign_str(name, platform->name);
82 		__entry->id = platform->id;
83 		__entry->reg = reg;
84 		__entry->val = val;
85 	),
86 
87 	TP_printk("platform=%s.%d reg=%x val=%x", __get_str(name),
88 		  (int)__entry->id, (unsigned int)__entry->reg,
89 		  (unsigned int)__entry->val)
90 );
91 
92 DEFINE_EVENT(snd_soc_preg, snd_soc_preg_write,
93 
94 	TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
95 		 unsigned int val),
96 
97 	TP_ARGS(platform, reg, val)
98 
99 );
100 
101 DEFINE_EVENT(snd_soc_preg, snd_soc_preg_read,
102 
103 	TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
104 		 unsigned int val),
105 
106 	TP_ARGS(platform, reg, val)
107 
108 );
109 
110 DECLARE_EVENT_CLASS(snd_soc_card,
111 
112 	TP_PROTO(struct snd_soc_card *card, int val),
113 
114 	TP_ARGS(card, val),
115 
116 	TP_STRUCT__entry(
117 		__string(	name,		card->name	)
118 		__field(	int,		val		)
119 	),
120 
121 	TP_fast_assign(
122 		__assign_str(name, card->name);
123 		__entry->val = val;
124 	),
125 
126 	TP_printk("card=%s val=%d", __get_str(name), (int)__entry->val)
127 );
128 
129 DEFINE_EVENT(snd_soc_card, snd_soc_bias_level_start,
130 
131 	TP_PROTO(struct snd_soc_card *card, int val),
132 
133 	TP_ARGS(card, val)
134 
135 );
136 
137 DEFINE_EVENT(snd_soc_card, snd_soc_bias_level_done,
138 
139 	TP_PROTO(struct snd_soc_card *card, int val),
140 
141 	TP_ARGS(card, val)
142 
143 );
144 
145 DECLARE_EVENT_CLASS(snd_soc_dapm_basic,
146 
147 	TP_PROTO(struct snd_soc_card *card),
148 
149 	TP_ARGS(card),
150 
151 	TP_STRUCT__entry(
152 		__string(	name,	card->name	)
153 	),
154 
155 	TP_fast_assign(
156 		__assign_str(name, card->name);
157 	),
158 
159 	TP_printk("card=%s", __get_str(name))
160 );
161 
162 DEFINE_EVENT(snd_soc_dapm_basic, snd_soc_dapm_start,
163 
164 	TP_PROTO(struct snd_soc_card *card),
165 
166 	TP_ARGS(card)
167 
168 );
169 
170 DEFINE_EVENT(snd_soc_dapm_basic, snd_soc_dapm_done,
171 
172 	TP_PROTO(struct snd_soc_card *card),
173 
174 	TP_ARGS(card)
175 
176 );
177 
178 DECLARE_EVENT_CLASS(snd_soc_dapm_widget,
179 
180 	TP_PROTO(struct snd_soc_dapm_widget *w, int val),
181 
182 	TP_ARGS(w, val),
183 
184 	TP_STRUCT__entry(
185 		__string(	name,	w->name		)
186 		__field(	int,	val		)
187 	),
188 
189 	TP_fast_assign(
190 		__assign_str(name, w->name);
191 		__entry->val = val;
192 	),
193 
194 	TP_printk("widget=%s val=%d", __get_str(name),
195 		  (int)__entry->val)
196 );
197 
198 DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_power,
199 
200 	TP_PROTO(struct snd_soc_dapm_widget *w, int val),
201 
202 	TP_ARGS(w, val)
203 
204 );
205 
206 DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_event_start,
207 
208 	TP_PROTO(struct snd_soc_dapm_widget *w, int val),
209 
210 	TP_ARGS(w, val)
211 
212 );
213 
214 DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_event_done,
215 
216 	TP_PROTO(struct snd_soc_dapm_widget *w, int val),
217 
218 	TP_ARGS(w, val)
219 
220 );
221 
222 TRACE_EVENT(snd_soc_dapm_walk_done,
223 
224 	TP_PROTO(struct snd_soc_card *card),
225 
226 	TP_ARGS(card),
227 
228 	TP_STRUCT__entry(
229 		__string(	name,	card->name		)
230 		__field(	int,	power_checks		)
231 		__field(	int,	path_checks		)
232 		__field(	int,	neighbour_checks	)
233 	),
234 
235 	TP_fast_assign(
236 		__assign_str(name, card->name);
237 		__entry->power_checks = card->dapm_stats.power_checks;
238 		__entry->path_checks = card->dapm_stats.path_checks;
239 		__entry->neighbour_checks = card->dapm_stats.neighbour_checks;
240 	),
241 
242 	TP_printk("%s: checks %d power, %d path, %d neighbour",
243 		  __get_str(name), (int)__entry->power_checks,
244 		  (int)__entry->path_checks, (int)__entry->neighbour_checks)
245 );
246 
247 TRACE_EVENT(snd_soc_dapm_output_path,
248 
249 	TP_PROTO(struct snd_soc_dapm_widget *widget,
250 		struct snd_soc_dapm_path *path),
251 
252 	TP_ARGS(widget, path),
253 
254 	TP_STRUCT__entry(
255 		__string(	wname,	widget->name		)
256 		__string(	pname,	path->name ? path->name : DAPM_DIRECT)
257 		__string(	psname,	path->sink->name	)
258 		__field(	int,	path_sink		)
259 		__field(	int,	path_connect		)
260 	),
261 
262 	TP_fast_assign(
263 		__assign_str(wname, widget->name);
264 		__assign_str(pname, path->name ? path->name : DAPM_DIRECT);
265 		__assign_str(psname, path->sink->name);
266 		__entry->path_connect = path->connect;
267 		__entry->path_sink = (long)path->sink;
268 	),
269 
270 	TP_printk("%c%s -> %s -> %s\n",
271 		(int) __entry->path_sink &&
272 		(int) __entry->path_connect ? '*' : ' ',
273 		__get_str(wname), __get_str(pname), __get_str(psname))
274 );
275 
276 TRACE_EVENT(snd_soc_dapm_input_path,
277 
278 	TP_PROTO(struct snd_soc_dapm_widget *widget,
279 		struct snd_soc_dapm_path *path),
280 
281 	TP_ARGS(widget, path),
282 
283 	TP_STRUCT__entry(
284 		__string(	wname,	widget->name		)
285 		__string(	pname,	path->name ? path->name : DAPM_DIRECT)
286 		__string(	psname,	path->source->name	)
287 		__field(	int,	path_source		)
288 		__field(	int,	path_connect		)
289 	),
290 
291 	TP_fast_assign(
292 		__assign_str(wname, widget->name);
293 		__assign_str(pname, path->name ? path->name : DAPM_DIRECT);
294 		__assign_str(psname, path->source->name);
295 		__entry->path_connect = path->connect;
296 		__entry->path_source = (long)path->source;
297 	),
298 
299 	TP_printk("%c%s <- %s <- %s\n",
300 		(int) __entry->path_source &&
301 		(int) __entry->path_connect ? '*' : ' ',
302 		__get_str(wname), __get_str(pname), __get_str(psname))
303 );
304 
305 TRACE_EVENT(snd_soc_dapm_connected,
306 
307 	TP_PROTO(int paths, int stream),
308 
309 	TP_ARGS(paths, stream),
310 
311 	TP_STRUCT__entry(
312 		__field(	int,	paths		)
313 		__field(	int,	stream		)
314 	),
315 
316 	TP_fast_assign(
317 		__entry->paths = paths;
318 		__entry->stream = stream;
319 	),
320 
321 	TP_printk("%s: found %d paths\n",
322 		__entry->stream ? "capture" : "playback", __entry->paths)
323 );
324 
325 TRACE_EVENT(snd_soc_jack_irq,
326 
327 	TP_PROTO(const char *name),
328 
329 	TP_ARGS(name),
330 
331 	TP_STRUCT__entry(
332 		__string(	name,	name		)
333 	),
334 
335 	TP_fast_assign(
336 		__assign_str(name, name);
337 	),
338 
339 	TP_printk("%s", __get_str(name))
340 );
341 
342 TRACE_EVENT(snd_soc_jack_report,
343 
344 	TP_PROTO(struct snd_soc_jack *jack, int mask, int val),
345 
346 	TP_ARGS(jack, mask, val),
347 
348 	TP_STRUCT__entry(
349 		__string(	name,		jack->jack->name	)
350 		__field(	int,		mask			)
351 		__field(	int,		val			)
352 	),
353 
354 	TP_fast_assign(
355 		__assign_str(name, jack->jack->name);
356 		__entry->mask = mask;
357 		__entry->val = val;
358 	),
359 
360 	TP_printk("jack=%s %x/%x", __get_str(name), (int)__entry->val,
361 		  (int)__entry->mask)
362 );
363 
364 TRACE_EVENT(snd_soc_jack_notify,
365 
366 	TP_PROTO(struct snd_soc_jack *jack, int val),
367 
368 	TP_ARGS(jack, val),
369 
370 	TP_STRUCT__entry(
371 		__string(	name,		jack->jack->name	)
372 		__field(	int,		val			)
373 	),
374 
375 	TP_fast_assign(
376 		__assign_str(name, jack->jack->name);
377 		__entry->val = val;
378 	),
379 
380 	TP_printk("jack=%s %x", __get_str(name), (int)__entry->val)
381 );
382 
383 TRACE_EVENT(snd_soc_cache_sync,
384 
385 	TP_PROTO(struct snd_soc_codec *codec, const char *type,
386 		 const char *status),
387 
388 	TP_ARGS(codec, type, status),
389 
390 	TP_STRUCT__entry(
391 		__string(	name,		codec->name	)
392 		__string(	status,		status		)
393 		__string(	type,		type		)
394 		__field(	int,		id		)
395 	),
396 
397 	TP_fast_assign(
398 		__assign_str(name, codec->name);
399 		__assign_str(status, status);
400 		__assign_str(type, type);
401 		__entry->id = codec->id;
402 	),
403 
404 	TP_printk("codec=%s.%d type=%s status=%s", __get_str(name),
405 		  (int)__entry->id, __get_str(type), __get_str(status))
406 );
407 
408 #endif /* _TRACE_ASOC_H */
409 
410 /* This part must be outside protection */
411 #include <trace/define_trace.h>
412