xref: /openbmc/linux/include/trace/events/sof_intel.h (revision 6e63153d)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright(c) 2022 Intel Corporation. All rights reserved.
4  *
5  * Author: Noah Klayman <noah.klayman@intel.com>
6  */
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM sof_intel
10 
11 #if !defined(_TRACE_SOF_INTEL_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_SOF_INTEL_H
13 #include <linux/tracepoint.h>
14 #include <sound/hdaudio.h>
15 #include "../../../sound/soc/sof/sof-audio.h"
16 
17 TRACE_EVENT(sof_intel_hda_irq,
18 	TP_PROTO(struct snd_sof_dev *sdev, char *source),
19 	TP_ARGS(sdev, source),
20 	TP_STRUCT__entry(
21 		__string(device_name, dev_name(sdev->dev))
22 		__string(source, source)
23 	),
24 	TP_fast_assign(
25 		__assign_str(device_name, dev_name(sdev->dev));
26 		__assign_str(source, source);
27 	),
28 	TP_printk("device_name=%s source=%s",
29 		  __get_str(device_name), __get_str(source))
30 );
31 
32 DECLARE_EVENT_CLASS(sof_intel_ipc_firmware_template,
33 	TP_ARGS(struct snd_sof_dev *sdev, u32 msg, u32 msg_ext),
34 	TP_PROTO(sdev, msg, msg_ext),
35 	TP_STRUCT__entry(
36 		__string(device_name, dev_name(sdev->dev))
37 		__field(u32, msg)
38 		__field(u32, msg_ext)
39 	),
40 	TP_fast_assign(
41 		__assign_str(device_name, dev_name(sdev->dev));
42 		__entry->msg = msg;
43 		__entry->msg_ext = msg_ext;
44 	),
45 	TP_printk("device_name=%s msg=%#x msg_ext=%#x",
46 		  __get_str(device_name), __entry->msg, __entry->msg_ext)
47 );
48 
49 DEFINE_EVENT(sof_intel_ipc_firmware_template, sof_intel_ipc_firmware_response,
50 	TP_PROTO(struct snd_sof_dev *sdev, u32 msg, u32 msg_ext),
51 	TP_ARGS(sdev, msg, msg_ext)
52 );
53 
54 DEFINE_EVENT(sof_intel_ipc_firmware_template, sof_intel_ipc_firmware_initiated,
55 	TP_PROTO(struct snd_sof_dev *sdev, u32 msg, u32 msg_ext),
56 	TP_ARGS(sdev, msg, msg_ext)
57 );
58 
59 TRACE_EVENT(sof_intel_D0I3C_updated,
60 	TP_PROTO(struct snd_sof_dev *sdev, u8 reg),
61 	TP_ARGS(sdev, reg),
62 	TP_STRUCT__entry(
63 		__string(device_name, dev_name(sdev->dev))
64 		__field(u8, reg)
65 	),
66 	TP_fast_assign(
67 		__assign_str(device_name, dev_name(sdev->dev));
68 		__entry->reg = reg;
69 	),
70 	TP_printk("device_name=%s register=%#x",
71 		  __get_str(device_name), __entry->reg)
72 );
73 
74 TRACE_EVENT(sof_intel_hda_irq_ipc_check,
75 	TP_PROTO(struct snd_sof_dev *sdev, u32 irq_status),
76 	TP_ARGS(sdev, irq_status),
77 	TP_STRUCT__entry(
78 		__string(device_name, dev_name(sdev->dev))
79 		__field(u32, irq_status)
80 	),
81 	TP_fast_assign(
82 		__assign_str(device_name, dev_name(sdev->dev));
83 		__entry->irq_status = irq_status;
84 	),
85 	TP_printk("device_name=%s irq_status=%#x",
86 		  __get_str(device_name), __entry->irq_status)
87 );
88 
89 TRACE_EVENT(sof_intel_hda_dsp_pcm,
90 	TP_PROTO(struct snd_sof_dev *sdev,
91 		struct hdac_stream *hstream,
92 		struct snd_pcm_substream *substream,
93 		snd_pcm_uframes_t pos
94 	),
95 	TP_ARGS(sdev, hstream, substream, pos),
96 	TP_STRUCT__entry(
97 		__string(device_name, dev_name(sdev->dev))
98 		__field(u32, hstream_index)
99 		__field(u32, substream)
100 		__field(unsigned long, pos)
101 	),
102 	TP_fast_assign(
103 		__assign_str(device_name, dev_name(sdev->dev));
104 		__entry->hstream_index = hstream->index;
105 		__entry->substream = substream->stream;
106 		__entry->pos = pos;
107 	),
108 	TP_printk("device_name=%s hstream_index=%d substream=%d pos=%lu",
109 		  __get_str(device_name), __entry->hstream_index,
110 		  __entry->substream, __entry->pos)
111 );
112 
113 TRACE_EVENT(sof_intel_hda_dsp_stream_status,
114 	TP_PROTO(struct device *dev, struct hdac_stream *s, u32 status),
115 	TP_ARGS(dev, s, status),
116 	TP_STRUCT__entry(
117 		__string(device_name, dev_name(dev))
118 		__field(u32, stream)
119 		__field(u32, status)
120 	),
121 	TP_fast_assign(
122 		__assign_str(device_name, dev_name(dev));
123 		__entry->stream = s->index;
124 		__entry->status = status;
125 	),
126 	TP_printk("device_name=%s stream=%d status=%#x",
127 		  __get_str(device_name), __entry->stream, __entry->status)
128 );
129 
130 TRACE_EVENT(sof_intel_hda_dsp_check_stream_irq,
131 	TP_PROTO(struct snd_sof_dev *sdev, u32 status),
132 	TP_ARGS(sdev, status),
133 	TP_STRUCT__entry(
134 		__string(device_name, dev_name(sdev->dev))
135 		__field(u32, status)
136 	),
137 	TP_fast_assign(
138 		__assign_str(device_name, dev_name(sdev->dev));
139 		__entry->status = status;
140 	),
141 	TP_printk("device_name=%s status=%#x",
142 		  __get_str(device_name), __entry->status)
143 );
144 
145 #endif /* _TRACE_SOF_INTEL_H */
146 
147 /* This part must be outside protection */
148 #include <trace/define_trace.h>
149