hswadsp.h 8.4 KB

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