sof.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright(c) 2022 Intel Corporation. All rights reserved.
  4. *
  5. * Author: Noah Klayman <[email protected]>
  6. */
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM sof
  9. #if !defined(_TRACE_SOF_H) || defined(TRACE_HEADER_MULTI_READ)
  10. #define _TRACE_SOF_H
  11. #include <linux/tracepoint.h>
  12. #include <linux/types.h>
  13. #include <sound/sof/stream.h>
  14. #include "../../../sound/soc/sof/sof-audio.h"
  15. DECLARE_EVENT_CLASS(sof_widget_template,
  16. TP_PROTO(struct snd_sof_widget *swidget),
  17. TP_ARGS(swidget),
  18. TP_STRUCT__entry(
  19. __string(name, swidget->widget->name)
  20. __field(int, use_count)
  21. ),
  22. TP_fast_assign(
  23. __assign_str(name, swidget->widget->name);
  24. __entry->use_count = swidget->use_count;
  25. ),
  26. TP_printk("name=%s use_count=%d", __get_str(name), __entry->use_count)
  27. );
  28. DEFINE_EVENT(sof_widget_template, sof_widget_setup,
  29. TP_PROTO(struct snd_sof_widget *swidget),
  30. TP_ARGS(swidget)
  31. );
  32. DEFINE_EVENT(sof_widget_template, sof_widget_free,
  33. TP_PROTO(struct snd_sof_widget *swidget),
  34. TP_ARGS(swidget)
  35. );
  36. TRACE_EVENT(sof_ipc3_period_elapsed_position,
  37. TP_PROTO(struct snd_sof_dev *sdev, struct sof_ipc_stream_posn *posn),
  38. TP_ARGS(sdev, posn),
  39. TP_STRUCT__entry(
  40. __string(device_name, dev_name(sdev->dev))
  41. __field(u64, host_posn)
  42. __field(u64, dai_posn)
  43. __field(u64, wallclock)
  44. ),
  45. TP_fast_assign(
  46. __assign_str(device_name, dev_name(sdev->dev));
  47. __entry->host_posn = posn->host_posn;
  48. __entry->dai_posn = posn->dai_posn;
  49. __entry->wallclock = posn->wallclock;
  50. ),
  51. TP_printk("device_name=%s host_posn=%#llx dai_posn=%#llx wallclock=%#llx",
  52. __get_str(device_name), __entry->host_posn, __entry->dai_posn,
  53. __entry->wallclock)
  54. );
  55. TRACE_EVENT(sof_pcm_pointer_position,
  56. TP_PROTO(struct snd_sof_dev *sdev,
  57. struct snd_sof_pcm *spcm,
  58. struct snd_pcm_substream *substream,
  59. snd_pcm_uframes_t dma_posn,
  60. snd_pcm_uframes_t dai_posn
  61. ),
  62. TP_ARGS(sdev, spcm, substream, dma_posn, dai_posn),
  63. TP_STRUCT__entry(
  64. __string(device_name, dev_name(sdev->dev))
  65. __field(u32, pcm_id)
  66. __field(int, stream)
  67. __field(unsigned long, dma_posn)
  68. __field(unsigned long, dai_posn)
  69. ),
  70. TP_fast_assign(
  71. __assign_str(device_name, dev_name(sdev->dev));
  72. __entry->pcm_id = le32_to_cpu(spcm->pcm.pcm_id);
  73. __entry->stream = substream->stream;
  74. __entry->dma_posn = dma_posn;
  75. __entry->dai_posn = dai_posn;
  76. ),
  77. TP_printk("device_name=%s pcm_id=%d stream=%d dma_posn=%lu dai_posn=%lu",
  78. __get_str(device_name), __entry->pcm_id, __entry->stream,
  79. __entry->dma_posn, __entry->dai_posn)
  80. );
  81. TRACE_EVENT(sof_stream_position_ipc_rx,
  82. TP_PROTO(struct device *dev),
  83. TP_ARGS(dev),
  84. TP_STRUCT__entry(
  85. __string(device_name, dev_name(dev))
  86. ),
  87. TP_fast_assign(
  88. __assign_str(device_name, dev_name(dev));
  89. ),
  90. TP_printk("device_name=%s", __get_str(device_name))
  91. );
  92. TRACE_EVENT(sof_ipc4_fw_config,
  93. TP_PROTO(struct snd_sof_dev *sdev, char *key, u32 value),
  94. TP_ARGS(sdev, key, value),
  95. TP_STRUCT__entry(
  96. __string(device_name, dev_name(sdev->dev))
  97. __string(key, key)
  98. __field(u32, value)
  99. ),
  100. TP_fast_assign(
  101. __assign_str(device_name, dev_name(sdev->dev));
  102. __assign_str(key, key);
  103. __entry->value = value;
  104. ),
  105. TP_printk("device_name=%s key=%s value=%d",
  106. __get_str(device_name), __get_str(key), __entry->value)
  107. );
  108. #endif /* _TRACE_SOF_H */
  109. /* This part must be outside protection */
  110. #include <trace/define_trace.h>