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