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