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