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>
11 #include <sound/pcm.h>
13 #define DAPM_DIRECT "(direct)"
14 #define DAPM_ARROW(dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-")
16 TRACE_DEFINE_ENUM(SND_SOC_DAPM_DIR_OUT
);
20 struct snd_soc_dapm_widget
;
21 struct snd_soc_dapm_path
;
23 DECLARE_EVENT_CLASS(snd_soc_dapm
,
25 TP_PROTO(struct snd_soc_dapm_context
*dapm
, int val
),
30 __string( card_name
, dapm
->card
->name
)
31 __string( comp_name
, dapm
->component
? dapm
->component
->name
: "(none)")
36 __assign_str(card_name
);
37 __assign_str(comp_name
);
41 TP_printk("card=%s component=%s val=%d",
42 __get_str(card_name
), __get_str(comp_name
), (int)__entry
->val
)
45 DEFINE_EVENT(snd_soc_dapm
, snd_soc_bias_level_start
,
47 TP_PROTO(struct snd_soc_dapm_context
*dapm
, int val
),
53 DEFINE_EVENT(snd_soc_dapm
, snd_soc_bias_level_done
,
55 TP_PROTO(struct snd_soc_dapm_context
*dapm
, int val
),
61 DECLARE_EVENT_CLASS(snd_soc_dapm_basic
,
63 TP_PROTO(struct snd_soc_card
*card
, int event
),
68 __string( name
, card
->name
)
74 __entry
->event
= event
;
77 TP_printk("card=%s event=%d", __get_str(name
), (int)__entry
->event
)
80 DEFINE_EVENT(snd_soc_dapm_basic
, snd_soc_dapm_start
,
82 TP_PROTO(struct snd_soc_card
*card
, int event
),
88 DEFINE_EVENT(snd_soc_dapm_basic
, snd_soc_dapm_done
,
90 TP_PROTO(struct snd_soc_card
*card
, int event
),
96 DECLARE_EVENT_CLASS(snd_soc_dapm_widget
,
98 TP_PROTO(struct snd_soc_dapm_widget
*w
, int val
),
103 __string( name
, w
->name
)
112 TP_printk("widget=%s val=%d", __get_str(name
),
116 DEFINE_EVENT(snd_soc_dapm_widget
, snd_soc_dapm_widget_power
,
118 TP_PROTO(struct snd_soc_dapm_widget
*w
, int val
),
124 DEFINE_EVENT(snd_soc_dapm_widget
, snd_soc_dapm_widget_event_start
,
126 TP_PROTO(struct snd_soc_dapm_widget
*w
, int val
),
132 DEFINE_EVENT(snd_soc_dapm_widget
, snd_soc_dapm_widget_event_done
,
134 TP_PROTO(struct snd_soc_dapm_widget
*w
, int val
),
140 TRACE_EVENT(snd_soc_dapm_walk_done
,
142 TP_PROTO(struct snd_soc_card
*card
),
147 __string( name
, card
->name
)
148 __field( int, power_checks
)
149 __field( int, path_checks
)
150 __field( int, neighbour_checks
)
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
;
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
)
165 TRACE_EVENT(snd_soc_dapm_path
,
167 TP_PROTO(struct snd_soc_dapm_widget
*widget
,
168 enum snd_soc_dapm_direction dir
,
169 struct snd_soc_dapm_path
*path
),
171 TP_ARGS(widget
, dir
, path
),
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
)
185 __assign_str(pnname
);
186 __entry
->path_connect
= path
->connect
;
187 __entry
->path_node
= (long)path
->node
[dir
];
188 __entry
->path_dir
= dir
;
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
),
199 TRACE_EVENT(snd_soc_dapm_connected
,
201 TP_PROTO(int paths
, int stream
),
203 TP_ARGS(paths
, stream
),
206 __field( int, paths
)
207 __field( int, stream
)
211 __entry
->paths
= paths
;
212 __entry
->stream
= stream
;
215 TP_printk("%s: found %d paths",
216 snd_pcm_direction_name(__entry
->stream
), __entry
->paths
)
219 TRACE_EVENT(snd_soc_jack_irq
,
221 TP_PROTO(const char *name
),
226 __string( name
, name
)
233 TP_printk("%s", __get_str(name
))
236 TRACE_EVENT(snd_soc_jack_report
,
238 TP_PROTO(struct snd_soc_jack
*jack
, int mask
, int val
),
240 TP_ARGS(jack
, mask
, val
),
243 __string( name
, jack
->jack
->id
)
250 __entry
->mask
= mask
;
254 TP_printk("jack=%s %x/%x", __get_str(name
), (int)__entry
->val
,
258 TRACE_EVENT(snd_soc_jack_notify
,
260 TP_PROTO(struct snd_soc_jack
*jack
, int val
),
265 __string( name
, jack
->jack
->id
)
274 TP_printk("jack=%s %x", __get_str(name
), (int)__entry
->val
)
277 #endif /* _TRACE_ASOC_H */
279 /* This part must be outside protection */
280 #include <trace/define_trace.h>