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