1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM hswadsp 4 5 #if !defined(_TRACE_HSWADSP_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_HSWADSP_H 7 8 #include <linux/types.h> 9 #include <linux/ktime.h> 10 #include <linux/tracepoint.h> 11 12 struct sst_hsw; 13 struct sst_hsw_stream; 14 struct sst_hsw_ipc_stream_free_req; 15 struct sst_hsw_ipc_volume_req; 16 struct sst_hsw_ipc_stream_alloc_req; 17 struct sst_hsw_audio_data_format_ipc; 18 struct sst_hsw_ipc_stream_info_reply; 19 struct sst_hsw_ipc_device_config_req; 20 21 DECLARE_EVENT_CLASS(sst_irq, 22 23 TP_PROTO(uint32_t status, uint32_t mask), 24 25 TP_ARGS(status, mask), 26 27 TP_STRUCT__entry( 28 __field( unsigned int, status ) 29 __field( unsigned int, mask ) 30 ), 31 32 TP_fast_assign( 33 __entry->status = status; 34 __entry->mask = mask; 35 ), 36 37 TP_printk("status 0x%8.8x mask 0x%8.8x", 38 (unsigned int)__entry->status, (unsigned int)__entry->mask) 39 ); 40 41 DEFINE_EVENT(sst_irq, sst_irq_busy, 42 43 TP_PROTO(unsigned int status, unsigned int mask), 44 45 TP_ARGS(status, mask) 46 47 ); 48 49 DEFINE_EVENT(sst_irq, sst_irq_done, 50 51 TP_PROTO(unsigned int status, unsigned int mask), 52 53 TP_ARGS(status, mask) 54 55 ); 56 57 DECLARE_EVENT_CLASS(ipc, 58 59 TP_PROTO(const char *name, int val), 60 61 TP_ARGS(name, val), 62 63 TP_STRUCT__entry( 64 __string( name, name ) 65 __field( unsigned int, val ) 66 ), 67 68 TP_fast_assign( 69 __assign_str(name, name); 70 __entry->val = val; 71 ), 72 73 TP_printk("%s 0x%8.8x", __get_str(name), (unsigned int)__entry->val) 74 75 ); 76 77 DEFINE_EVENT(ipc, ipc_request, 78 79 TP_PROTO(const char *name, int val), 80 81 TP_ARGS(name, val) 82 83 ); 84 85 DEFINE_EVENT(ipc, ipc_reply, 86 87 TP_PROTO(const char *name, int val), 88 89 TP_ARGS(name, val) 90 91 ); 92 93 DEFINE_EVENT(ipc, ipc_pending_reply, 94 95 TP_PROTO(const char *name, int val), 96 97 TP_ARGS(name, val) 98 99 ); 100 101 DEFINE_EVENT(ipc, ipc_notification, 102 103 TP_PROTO(const char *name, int val), 104 105 TP_ARGS(name, val) 106 107 ); 108 109 DEFINE_EVENT(ipc, ipc_error, 110 111 TP_PROTO(const char *name, int val), 112 113 TP_ARGS(name, val) 114 115 ); 116 117 DECLARE_EVENT_CLASS(stream_position, 118 119 TP_PROTO(unsigned int id, unsigned int pos), 120 121 TP_ARGS(id, pos), 122 123 TP_STRUCT__entry( 124 __field( unsigned int, id ) 125 __field( unsigned int, pos ) 126 ), 127 128 TP_fast_assign( 129 __entry->id = id; 130 __entry->pos = pos; 131 ), 132 133 TP_printk("id %d position 0x%x", 134 (unsigned int)__entry->id, (unsigned int)__entry->pos) 135 ); 136 137 DEFINE_EVENT(stream_position, stream_read_position, 138 139 TP_PROTO(unsigned int id, unsigned int pos), 140 141 TP_ARGS(id, pos) 142 143 ); 144 145 DEFINE_EVENT(stream_position, stream_write_position, 146 147 TP_PROTO(unsigned int id, unsigned int pos), 148 149 TP_ARGS(id, pos) 150 151 ); 152 153 TRACE_EVENT(hsw_stream_buffer, 154 155 TP_PROTO(struct sst_hsw_stream *stream), 156 157 TP_ARGS(stream), 158 159 TP_STRUCT__entry( 160 __field( int, id ) 161 __field( int, pt_addr ) 162 __field( int, num_pages ) 163 __field( int, ring_size ) 164 __field( int, ring_offset ) 165 __field( int, first_pfn ) 166 ), 167 168 TP_fast_assign( 169 __entry->id = stream->host_id; 170 __entry->pt_addr = stream->request.ringinfo.ring_pt_address; 171 __entry->num_pages = stream->request.ringinfo.num_pages; 172 __entry->ring_size = stream->request.ringinfo.ring_size; 173 __entry->ring_offset = stream->request.ringinfo.ring_offset; 174 __entry->first_pfn = stream->request.ringinfo.ring_first_pfn; 175 ), 176 177 TP_printk("stream %d ring addr 0x%x pages %d size 0x%x offset 0x%x PFN 0x%x", 178 (int) __entry->id, (int)__entry->pt_addr, 179 (int)__entry->num_pages, (int)__entry->ring_size, 180 (int)__entry->ring_offset, (int)__entry->first_pfn) 181 ); 182 183 TRACE_EVENT(hsw_stream_alloc_reply, 184 185 TP_PROTO(struct sst_hsw_stream *stream), 186 187 TP_ARGS(stream), 188 189 TP_STRUCT__entry( 190 __field( int, id ) 191 __field( int, stream_id ) 192 __field( int, mixer_id ) 193 __field( int, peak0 ) 194 __field( int, peak1 ) 195 __field( int, vol0 ) 196 __field( int, vol1 ) 197 ), 198 199 TP_fast_assign( 200 __entry->id = stream->host_id; 201 __entry->stream_id = stream->reply.stream_hw_id; 202 __entry->mixer_id = stream->reply.mixer_hw_id; 203 __entry->peak0 = stream->reply.peak_meter_register_address[0]; 204 __entry->peak1 = stream->reply.peak_meter_register_address[1]; 205 __entry->vol0 = stream->reply.volume_register_address[0]; 206 __entry->vol1 = stream->reply.volume_register_address[1]; 207 ), 208 209 TP_printk("stream %d hw id %d mixer %d peak 0x%x:0x%x vol 0x%x,0x%x", 210 (int) __entry->id, (int) __entry->stream_id, (int)__entry->mixer_id, 211 (int)__entry->peak0, (int)__entry->peak1, 212 (int)__entry->vol0, (int)__entry->vol1) 213 ); 214 215 TRACE_EVENT(hsw_mixer_info_reply, 216 217 TP_PROTO(struct sst_hsw_ipc_stream_info_reply *reply), 218 219 TP_ARGS(reply), 220 221 TP_STRUCT__entry( 222 __field( int, mixer_id ) 223 __field( int, peak0 ) 224 __field( int, peak1 ) 225 __field( int, vol0 ) 226 __field( int, vol1 ) 227 ), 228 229 TP_fast_assign( 230 __entry->mixer_id = reply->mixer_hw_id; 231 __entry->peak0 = reply->peak_meter_register_address[0]; 232 __entry->peak1 = reply->peak_meter_register_address[1]; 233 __entry->vol0 = reply->volume_register_address[0]; 234 __entry->vol1 = reply->volume_register_address[1]; 235 ), 236 237 TP_printk("mixer id %d peak 0x%x:0x%x vol 0x%x,0x%x", 238 (int)__entry->mixer_id, 239 (int)__entry->peak0, (int)__entry->peak1, 240 (int)__entry->vol0, (int)__entry->vol1) 241 ); 242 243 TRACE_EVENT(hsw_stream_data_format, 244 245 TP_PROTO(struct sst_hsw_stream *stream, 246 struct sst_hsw_audio_data_format_ipc *req), 247 248 TP_ARGS(stream, req), 249 250 TP_STRUCT__entry( 251 __field( uint32_t, id ) 252 __field( uint32_t, frequency ) 253 __field( uint32_t, bitdepth ) 254 __field( uint32_t, map ) 255 __field( uint32_t, config ) 256 __field( uint32_t, style ) 257 __field( uint8_t, ch_num ) 258 __field( uint8_t, valid_bit ) 259 ), 260 261 TP_fast_assign( 262 __entry->id = stream->host_id; 263 __entry->frequency = req->frequency; 264 __entry->bitdepth = req->bitdepth; 265 __entry->map = req->map; 266 __entry->config = req->config; 267 __entry->style = req->style; 268 __entry->ch_num = req->ch_num; 269 __entry->valid_bit = req->valid_bit; 270 ), 271 272 TP_printk("stream %d freq %d depth %d map 0x%x config 0x%x style 0x%x ch %d bits %d", 273 (int) __entry->id, (uint32_t)__entry->frequency, 274 (uint32_t)__entry->bitdepth, (uint32_t)__entry->map, 275 (uint32_t)__entry->config, (uint32_t)__entry->style, 276 (uint8_t)__entry->ch_num, (uint8_t)__entry->valid_bit) 277 ); 278 279 TRACE_EVENT(hsw_stream_alloc_request, 280 281 TP_PROTO(struct sst_hsw_stream *stream, 282 struct sst_hsw_ipc_stream_alloc_req *req), 283 284 TP_ARGS(stream, req), 285 286 TP_STRUCT__entry( 287 __field( uint32_t, id ) 288 __field( uint8_t, path_id ) 289 __field( uint8_t, stream_type ) 290 __field( uint8_t, format_id ) 291 ), 292 293 TP_fast_assign( 294 __entry->id = stream->host_id; 295 __entry->path_id = req->path_id; 296 __entry->stream_type = req->stream_type; 297 __entry->format_id = req->format_id; 298 ), 299 300 TP_printk("stream %d path %d type %d format %d", 301 (int) __entry->id, (uint8_t)__entry->path_id, 302 (uint8_t)__entry->stream_type, (uint8_t)__entry->format_id) 303 ); 304 305 TRACE_EVENT(hsw_stream_free_req, 306 307 TP_PROTO(struct sst_hsw_stream *stream, 308 struct sst_hsw_ipc_stream_free_req *req), 309 310 TP_ARGS(stream, req), 311 312 TP_STRUCT__entry( 313 __field( int, id ) 314 __field( int, stream_id ) 315 ), 316 317 TP_fast_assign( 318 __entry->id = stream->host_id; 319 __entry->stream_id = req->stream_id; 320 ), 321 322 TP_printk("stream %d hw id %d", 323 (int) __entry->id, (int) __entry->stream_id) 324 ); 325 326 TRACE_EVENT(hsw_volume_req, 327 328 TP_PROTO(struct sst_hsw_stream *stream, 329 struct sst_hsw_ipc_volume_req *req), 330 331 TP_ARGS(stream, req), 332 333 TP_STRUCT__entry( 334 __field( int, id ) 335 __field( uint32_t, channel ) 336 __field( uint32_t, target_volume ) 337 __field( uint64_t, curve_duration ) 338 __field( uint32_t, curve_type ) 339 ), 340 341 TP_fast_assign( 342 __entry->id = stream->host_id; 343 __entry->channel = req->channel; 344 __entry->target_volume = req->target_volume; 345 __entry->curve_duration = req->curve_duration; 346 __entry->curve_type = req->curve_type; 347 ), 348 349 TP_printk("stream %d chan 0x%x vol %d duration %llu type %d", 350 (int) __entry->id, (uint32_t) __entry->channel, 351 (uint32_t)__entry->target_volume, 352 (uint64_t)__entry->curve_duration, 353 (uint32_t)__entry->curve_type) 354 ); 355 356 TRACE_EVENT(hsw_device_config_req, 357 358 TP_PROTO(struct sst_hsw_ipc_device_config_req *req), 359 360 TP_ARGS(req), 361 362 TP_STRUCT__entry( 363 __field( uint32_t, ssp ) 364 __field( uint32_t, clock_freq ) 365 __field( uint32_t, mode ) 366 __field( uint16_t, clock_divider ) 367 ), 368 369 TP_fast_assign( 370 __entry->ssp = req->ssp_interface; 371 __entry->clock_freq = req->clock_frequency; 372 __entry->mode = req->mode; 373 __entry->clock_divider = req->clock_divider; 374 ), 375 376 TP_printk("SSP %d Freq %d mode %d div %d", 377 (uint32_t)__entry->ssp, 378 (uint32_t)__entry->clock_freq, (uint32_t)__entry->mode, 379 (uint32_t)__entry->clock_divider) 380 ); 381 382 #endif /* _TRACE_HSWADSP_H */ 383 384 /* This part must be outside protection */ 385 #include <trace/define_trace.h> 386