xref: /openbmc/linux/sound/hda/trace.h (revision 75cc1867)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM hda
4 
5 #if !defined(__HDAC_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define __HDAC_TRACE_H
7 
8 #include <linux/tracepoint.h>
9 #include <linux/device.h>
10 #include <sound/hdaudio.h>
11 
12 #ifndef HDAC_MSG_MAX
13 #define HDAC_MSG_MAX	500
14 #endif
15 
16 struct hdac_bus;
17 struct hdac_codec;
18 
19 TRACE_EVENT(hda_send_cmd,
20 	TP_PROTO(struct hdac_bus *bus, unsigned int cmd),
21 	TP_ARGS(bus, cmd),
22 	TP_STRUCT__entry(
23 		__string(name, dev_name((bus)->dev))
24 		__field(u32, cmd)
25 	),
26 	TP_fast_assign(
27 		__assign_str(name, dev_name((bus)->dev));
28 		__entry->cmd = cmd;
29 	),
30 	TP_printk("[%s:%d] val=0x%08x", __get_str(name), __entry->cmd >> 28, __entry->cmd)
31 );
32 
33 TRACE_EVENT(hda_get_response,
34 	TP_PROTO(struct hdac_bus *bus, unsigned int addr, unsigned int res),
35 	TP_ARGS(bus, addr, res),
36 	TP_STRUCT__entry(
37 		__string(name, dev_name((bus)->dev))
38 		__field(u32, addr)
39 		__field(u32, res)
40 	),
41 	TP_fast_assign(
42 		__assign_str(name, dev_name((bus)->dev));
43 		__entry->addr = addr;
44 		__entry->res = res;
45 	),
46 	TP_printk("[%s:%d] val=0x%08x", __get_str(name), __entry->addr, __entry->res)
47 );
48 
49 TRACE_EVENT(hda_unsol_event,
50 	TP_PROTO(struct hdac_bus *bus, u32 res, u32 res_ex),
51 	TP_ARGS(bus, res, res_ex),
52 	TP_STRUCT__entry(
53 		__string(name, dev_name((bus)->dev))
54 		__field(u32, res)
55 		__field(u32, res_ex)
56 	),
57 	TP_fast_assign(
58 		__assign_str(name, dev_name((bus)->dev));
59 		__entry->res = res;
60 		__entry->res_ex = res_ex;
61 	),
62 	TP_printk("[%s:%d] res=0x%08x, res_ex=0x%08x", __get_str(name),
63 		  __entry->res_ex & 0x0f, __entry->res, __entry->res_ex)
64 );
65 
66 DECLARE_EVENT_CLASS(hdac_stream,
67 	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
68 
69 	TP_ARGS(bus, azx_dev),
70 
71 	TP_STRUCT__entry(
72 		__field(unsigned char, stream_tag)
73 	),
74 
75 	TP_fast_assign(
76 		__entry->stream_tag = (azx_dev)->stream_tag;
77 	),
78 
79 	TP_printk("stream_tag: %d", __entry->stream_tag)
80 );
81 
82 DEFINE_EVENT(hdac_stream, snd_hdac_stream_start,
83 	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
84 	TP_ARGS(bus, azx_dev)
85 );
86 
87 DEFINE_EVENT(hdac_stream, snd_hdac_stream_stop,
88 	TP_PROTO(struct hdac_bus *bus, struct hdac_stream *azx_dev),
89 	TP_ARGS(bus, azx_dev)
90 );
91 
92 #endif /* __HDAC_TRACE_H */
93 
94 /* This part must be outside protection */
95 #undef TRACE_INCLUDE_PATH
96 #define TRACE_INCLUDE_PATH .
97 
98 #undef TRACE_INCLUDE_FILE
99 #define TRACE_INCLUDE_FILE trace
100 
101 #include <trace/define_trace.h>
102