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