1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM asoc
5 #if !defined(_TRACE_ASOC_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/ktime.h>
9 #include <linux/tracepoint.h>
10 #include <sound/jack.h>
12 #define DAPM_DIRECT "(direct)"
13 #define DAPM_ARROW(dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-")
17 struct snd_soc_dapm_widget
;
18 struct snd_soc_dapm_path
;
20 DECLARE_EVENT_CLASS(snd_soc_card
,
22 TP_PROTO(struct snd_soc_card
*card
, int val
),
27 __string( name
, card
->name
)
32 __assign_str(name
, card
->name
);
36 TP_printk("card=%s val=%d", __get_str(name
), (int)__entry
->val
)
39 DEFINE_EVENT(snd_soc_card
, snd_soc_bias_level_start
,
41 TP_PROTO(struct snd_soc_card
*card
, int val
),
47 DEFINE_EVENT(snd_soc_card
, snd_soc_bias_level_done
,
49 TP_PROTO(struct snd_soc_card
*card
, int val
),
55 DECLARE_EVENT_CLASS(snd_soc_dapm_basic
,
57 TP_PROTO(struct snd_soc_card
*card
),
62 __string( name
, card
->name
)
66 __assign_str(name
, card
->name
);
69 TP_printk("card=%s", __get_str(name
))
72 DEFINE_EVENT(snd_soc_dapm_basic
, snd_soc_dapm_start
,
74 TP_PROTO(struct snd_soc_card
*card
),
80 DEFINE_EVENT(snd_soc_dapm_basic
, snd_soc_dapm_done
,
82 TP_PROTO(struct snd_soc_card
*card
),
88 DECLARE_EVENT_CLASS(snd_soc_dapm_widget
,
90 TP_PROTO(struct snd_soc_dapm_widget
*w
, int val
),
95 __string( name
, w
->name
)
100 __assign_str(name
, w
->name
);
104 TP_printk("widget=%s val=%d", __get_str(name
),
108 DEFINE_EVENT(snd_soc_dapm_widget
, snd_soc_dapm_widget_power
,
110 TP_PROTO(struct snd_soc_dapm_widget
*w
, int val
),
116 DEFINE_EVENT(snd_soc_dapm_widget
, snd_soc_dapm_widget_event_start
,
118 TP_PROTO(struct snd_soc_dapm_widget
*w
, int val
),
124 DEFINE_EVENT(snd_soc_dapm_widget
, snd_soc_dapm_widget_event_done
,
126 TP_PROTO(struct snd_soc_dapm_widget
*w
, int val
),
132 TRACE_EVENT(snd_soc_dapm_walk_done
,
134 TP_PROTO(struct snd_soc_card
*card
),
139 __string( name
, card
->name
)
140 __field( int, power_checks
)
141 __field( int, path_checks
)
142 __field( int, neighbour_checks
)
146 __assign_str(name
, card
->name
);
147 __entry
->power_checks
= card
->dapm_stats
.power_checks
;
148 __entry
->path_checks
= card
->dapm_stats
.path_checks
;
149 __entry
->neighbour_checks
= card
->dapm_stats
.neighbour_checks
;
152 TP_printk("%s: checks %d power, %d path, %d neighbour",
153 __get_str(name
), (int)__entry
->power_checks
,
154 (int)__entry
->path_checks
, (int)__entry
->neighbour_checks
)
157 TRACE_EVENT(snd_soc_dapm_path
,
159 TP_PROTO(struct snd_soc_dapm_widget
*widget
,
160 enum snd_soc_dapm_direction dir
,
161 struct snd_soc_dapm_path
*path
),
163 TP_ARGS(widget
, dir
, path
),
166 __string( wname
, widget
->name
)
167 __string( pname
, path
->name
? path
->name
: DAPM_DIRECT
)
168 __string( pnname
, path
->node
[dir
]->name
)
169 __field( int, path_node
)
170 __field( int, path_connect
)
171 __field( int, path_dir
)
175 __assign_str(wname
, widget
->name
);
176 __assign_str(pname
, path
->name
? path
->name
: DAPM_DIRECT
);
177 __assign_str(pnname
, path
->node
[dir
]->name
);
178 __entry
->path_connect
= path
->connect
;
179 __entry
->path_node
= (long)path
->node
[dir
];
180 __entry
->path_dir
= dir
;
183 TP_printk("%c%s %s %s %s %s",
184 (int) __entry
->path_node
&&
185 (int) __entry
->path_connect
? '*' : ' ',
186 __get_str(wname
), DAPM_ARROW(__entry
->path_dir
),
187 __get_str(pname
), DAPM_ARROW(__entry
->path_dir
),
191 TRACE_EVENT(snd_soc_dapm_connected
,
193 TP_PROTO(int paths
, int stream
),
195 TP_ARGS(paths
, stream
),
198 __field( int, paths
)
199 __field( int, stream
)
203 __entry
->paths
= paths
;
204 __entry
->stream
= stream
;
207 TP_printk("%s: found %d paths",
208 __entry
->stream
? "capture" : "playback", __entry
->paths
)
211 TRACE_EVENT(snd_soc_jack_irq
,
213 TP_PROTO(const char *name
),
218 __string( name
, name
)
222 __assign_str(name
, name
);
225 TP_printk("%s", __get_str(name
))
228 TRACE_EVENT(snd_soc_jack_report
,
230 TP_PROTO(struct snd_soc_jack
*jack
, int mask
, int val
),
232 TP_ARGS(jack
, mask
, val
),
235 __string( name
, jack
->jack
->id
)
241 __assign_str(name
, jack
->jack
->id
);
242 __entry
->mask
= mask
;
246 TP_printk("jack=%s %x/%x", __get_str(name
), (int)__entry
->val
,
250 TRACE_EVENT(snd_soc_jack_notify
,
252 TP_PROTO(struct snd_soc_jack
*jack
, int val
),
257 __string( name
, jack
->jack
->id
)
262 __assign_str(name
, jack
->jack
->id
);
266 TP_printk("jack=%s %x", __get_str(name
), (int)__entry
->val
)
269 #endif /* _TRACE_ASOC_H */
271 /* This part must be outside protection */
272 #include <trace/define_trace.h>