xref: /linux/include/trace/events/asoc.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM asoc
4 
5 #if !defined(_TRACE_ASOC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_ASOC_H
7 
8 #include <linux/ktime.h>
9 #include <linux/tracepoint.h>
10 #include <sound/jack.h>
11 #include <sound/pcm.h>
12 
13 #define DAPM_DIRECT "(direct)"
14 #define DAPM_ARROW(dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-")
15 
16 TRACE_DEFINE_ENUM(SND_SOC_DAPM_DIR_OUT);
17 
18 struct snd_soc_jack;
19 struct snd_soc_card;
20 struct snd_soc_dapm_widget;
21 struct snd_soc_dapm_path;
22 
23 DECLARE_EVENT_CLASS(snd_soc_dapm,
24 
25 	TP_PROTO(struct snd_soc_dapm_context *dapm, int val),
26 
27 	TP_ARGS(dapm, val),
28 
29 	TP_STRUCT__entry(
30 		__string(	card_name,	dapm->card->name)
31 		__string(	comp_name,	dapm->component ? dapm->component->name : "(none)")
32 		__field(	int,		val)
33 	),
34 
35 	TP_fast_assign(
36 		__assign_str(card_name);
37 		__assign_str(comp_name);
38 		__entry->val = val;
39 	),
40 
41 	TP_printk("card=%s component=%s val=%d",
42 		  __get_str(card_name), __get_str(comp_name), (int)__entry->val)
43 );
44 
45 DEFINE_EVENT(snd_soc_dapm, snd_soc_bias_level_start,
46 
47 	TP_PROTO(struct snd_soc_dapm_context *dapm, int val),
48 
49 	TP_ARGS(dapm, val)
50 
51 );
52 
53 DEFINE_EVENT(snd_soc_dapm, snd_soc_bias_level_done,
54 
55 	TP_PROTO(struct snd_soc_dapm_context *dapm, int val),
56 
57 	TP_ARGS(dapm, val)
58 
59 );
60 
61 DECLARE_EVENT_CLASS(snd_soc_dapm_basic,
62 
63 	TP_PROTO(struct snd_soc_card *card, int event),
64 
65 	TP_ARGS(card, event),
66 
67 	TP_STRUCT__entry(
68 		__string(	name,	card->name	)
69 		__field(	int,	event		)
70 	),
71 
72 	TP_fast_assign(
73 		__assign_str(name);
74 		__entry->event = event;
75 	),
76 
77 	TP_printk("card=%s event=%d", __get_str(name), (int)__entry->event)
78 );
79 
80 DEFINE_EVENT(snd_soc_dapm_basic, snd_soc_dapm_start,
81 
82 	TP_PROTO(struct snd_soc_card *card, int event),
83 
84 	TP_ARGS(card, event)
85 
86 );
87 
88 DEFINE_EVENT(snd_soc_dapm_basic, snd_soc_dapm_done,
89 
90 	TP_PROTO(struct snd_soc_card *card, int event),
91 
92 	TP_ARGS(card, event)
93 
94 );
95 
96 DECLARE_EVENT_CLASS(snd_soc_dapm_widget,
97 
98 	TP_PROTO(struct snd_soc_dapm_widget *w, int val),
99 
100 	TP_ARGS(w, val),
101 
102 	TP_STRUCT__entry(
103 		__string(	name,	w->name		)
104 		__field(	int,	val		)
105 	),
106 
107 	TP_fast_assign(
108 		__assign_str(name);
109 		__entry->val = val;
110 	),
111 
112 	TP_printk("widget=%s val=%d", __get_str(name),
113 		  (int)__entry->val)
114 );
115 
116 DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_power,
117 
118 	TP_PROTO(struct snd_soc_dapm_widget *w, int val),
119 
120 	TP_ARGS(w, val)
121 
122 );
123 
124 DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_event_start,
125 
126 	TP_PROTO(struct snd_soc_dapm_widget *w, int val),
127 
128 	TP_ARGS(w, val)
129 
130 );
131 
132 DEFINE_EVENT(snd_soc_dapm_widget, snd_soc_dapm_widget_event_done,
133 
134 	TP_PROTO(struct snd_soc_dapm_widget *w, int val),
135 
136 	TP_ARGS(w, val)
137 
138 );
139 
140 TRACE_EVENT(snd_soc_dapm_walk_done,
141 
142 	TP_PROTO(struct snd_soc_card *card),
143 
144 	TP_ARGS(card),
145 
146 	TP_STRUCT__entry(
147 		__string(	name,	card->name		)
148 		__field(	int,	power_checks		)
149 		__field(	int,	path_checks		)
150 		__field(	int,	neighbour_checks	)
151 	),
152 
153 	TP_fast_assign(
154 		__assign_str(name);
155 		__entry->power_checks = card->dapm_stats.power_checks;
156 		__entry->path_checks = card->dapm_stats.path_checks;
157 		__entry->neighbour_checks = card->dapm_stats.neighbour_checks;
158 	),
159 
160 	TP_printk("%s: checks %d power, %d path, %d neighbour",
161 		  __get_str(name), (int)__entry->power_checks,
162 		  (int)__entry->path_checks, (int)__entry->neighbour_checks)
163 );
164 
165 TRACE_EVENT(snd_soc_dapm_path,
166 
167 	TP_PROTO(struct snd_soc_dapm_widget *widget,
168 		enum snd_soc_dapm_direction dir,
169 		struct snd_soc_dapm_path *path),
170 
171 	TP_ARGS(widget, dir, path),
172 
173 	TP_STRUCT__entry(
174 		__string(	wname,	widget->name		)
175 		__string(	pname,	path->name ? path->name : DAPM_DIRECT)
176 		__string(	pnname,	path->node[dir]->name	)
177 		__field(	int,	path_node		)
178 		__field(	int,	path_connect		)
179 		__field(	int,	path_dir		)
180 	),
181 
182 	TP_fast_assign(
183 		__assign_str(wname);
184 		__assign_str(pname);
185 		__assign_str(pnname);
186 		__entry->path_connect = path->connect;
187 		__entry->path_node = (long)path->node[dir];
188 		__entry->path_dir = dir;
189 	),
190 
191 	TP_printk("%c%s %s %s %s %s",
192 		(int) __entry->path_node &&
193 		(int) __entry->path_connect ? '*' : ' ',
194 		__get_str(wname), DAPM_ARROW(__entry->path_dir),
195 		__get_str(pname), DAPM_ARROW(__entry->path_dir),
196 		__get_str(pnname))
197 );
198 
199 TRACE_EVENT(snd_soc_dapm_connected,
200 
201 	TP_PROTO(int paths, int stream),
202 
203 	TP_ARGS(paths, stream),
204 
205 	TP_STRUCT__entry(
206 		__field(	int,	paths		)
207 		__field(	int,	stream		)
208 	),
209 
210 	TP_fast_assign(
211 		__entry->paths = paths;
212 		__entry->stream = stream;
213 	),
214 
215 	TP_printk("%s: found %d paths",
216 		  snd_pcm_direction_name(__entry->stream), __entry->paths)
217 );
218 
219 TRACE_EVENT(snd_soc_jack_irq,
220 
221 	TP_PROTO(const char *name),
222 
223 	TP_ARGS(name),
224 
225 	TP_STRUCT__entry(
226 		__string(	name,	name		)
227 	),
228 
229 	TP_fast_assign(
230 		__assign_str(name);
231 	),
232 
233 	TP_printk("%s", __get_str(name))
234 );
235 
236 TRACE_EVENT(snd_soc_jack_report,
237 
238 	TP_PROTO(struct snd_soc_jack *jack, int mask, int val),
239 
240 	TP_ARGS(jack, mask, val),
241 
242 	TP_STRUCT__entry(
243 		__string(	name,		jack->jack->id		)
244 		__field(	int,		mask			)
245 		__field(	int,		val			)
246 	),
247 
248 	TP_fast_assign(
249 		__assign_str(name);
250 		__entry->mask = mask;
251 		__entry->val = val;
252 	),
253 
254 	TP_printk("jack=%s %x/%x", __get_str(name), (int)__entry->val,
255 		  (int)__entry->mask)
256 );
257 
258 TRACE_EVENT(snd_soc_jack_notify,
259 
260 	TP_PROTO(struct snd_soc_jack *jack, int val),
261 
262 	TP_ARGS(jack, val),
263 
264 	TP_STRUCT__entry(
265 		__string(	name,		jack->jack->id		)
266 		__field(	int,		val			)
267 	),
268 
269 	TP_fast_assign(
270 		__assign_str(name);
271 		__entry->val = val;
272 	),
273 
274 	TP_printk("jack=%s %x", __get_str(name), (int)__entry->val)
275 );
276 
277 #endif /* _TRACE_ASOC_H */
278 
279 /* This part must be outside protection */
280 #include <trace/define_trace.h>
281