1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright(c) 2022 Intel Corporation. All rights reserved.
5 * Author: Noah Klayman <noah.klayman@intel.com>
9 #define TRACE_SYSTEM sof
11 #if !defined(_TRACE_SOF_H) || defined(TRACE_HEADER_MULTI_READ)
13 #include <linux/tracepoint.h>
14 #include <linux/types.h>
15 #include <sound/sof/stream.h>
16 #include "../../../sound/soc/sof/sof-audio.h"
18 DECLARE_EVENT_CLASS(sof_widget_template,
19 TP_PROTO(struct snd_sof_widget *swidget),
22 __string(name, swidget->widget->name)
23 __field(int, use_count)
26 __assign_str(name, swidget->widget->name);
27 __entry->use_count = swidget->use_count;
29 TP_printk("name=%s use_count=%d", __get_str(name), __entry->use_count)
32 DEFINE_EVENT(sof_widget_template, sof_widget_setup,
33 TP_PROTO(struct snd_sof_widget *swidget),
37 DEFINE_EVENT(sof_widget_template, sof_widget_free,
38 TP_PROTO(struct snd_sof_widget *swidget),
42 TRACE_EVENT(sof_ipc3_period_elapsed_position,
43 TP_PROTO(struct snd_sof_dev *sdev, struct sof_ipc_stream_posn *posn),
46 __string(device_name, dev_name(sdev->dev))
47 __field(u64, host_posn)
48 __field(u64, dai_posn)
49 __field(u64, wallclock)
52 __assign_str(device_name, dev_name(sdev->dev));
53 __entry->host_posn = posn->host_posn;
54 __entry->dai_posn = posn->dai_posn;
55 __entry->wallclock = posn->wallclock;
57 TP_printk("device_name=%s host_posn=%#llx dai_posn=%#llx wallclock=%#llx",
58 __get_str(device_name), __entry->host_posn, __entry->dai_posn,
62 TRACE_EVENT(sof_pcm_pointer_position,
63 TP_PROTO(struct snd_sof_dev *sdev,
64 struct snd_sof_pcm *spcm,
65 struct snd_pcm_substream *substream,
66 snd_pcm_uframes_t dma_posn,
67 snd_pcm_uframes_t dai_posn
69 TP_ARGS(sdev, spcm, substream, dma_posn, dai_posn),
71 __string(device_name, dev_name(sdev->dev))
74 __field(unsigned long, dma_posn)
75 __field(unsigned long, dai_posn)
78 __assign_str(device_name, dev_name(sdev->dev));
79 __entry->pcm_id = le32_to_cpu(spcm->pcm.pcm_id);
80 __entry->stream = substream->stream;
81 __entry->dma_posn = dma_posn;
82 __entry->dai_posn = dai_posn;
84 TP_printk("device_name=%s pcm_id=%d stream=%d dma_posn=%lu dai_posn=%lu",
85 __get_str(device_name), __entry->pcm_id, __entry->stream,
86 __entry->dma_posn, __entry->dai_posn)
89 TRACE_EVENT(sof_stream_position_ipc_rx,
90 TP_PROTO(struct device *dev),
93 __string(device_name, dev_name(dev))
96 __assign_str(device_name, dev_name(dev));
98 TP_printk("device_name=%s", __get_str(device_name))
101 TRACE_EVENT(sof_ipc4_fw_config,
102 TP_PROTO(struct snd_sof_dev *sdev, char *key, u32 value),
103 TP_ARGS(sdev, key, value),
105 __string(device_name, dev_name(sdev->dev))
110 __assign_str(device_name, dev_name(sdev->dev));
111 __assign_str(key, key);
112 __entry->value = value;
114 TP_printk("device_name=%s key=%s value=%d",
115 __get_str(device_name), __get_str(key), __entry->value)
118 #endif /* _TRACE_SOF_H */
120 /* This part must be outside protection */
121 #include <trace/define_trace.h>