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