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