xref: /openbmc/linux/sound/core/pcm_param_trace.h (revision b78412b8)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM snd_pcm
3 
4 #if !defined(_PCM_PARAMS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _PCM_PARAMS_TRACE_H
6 
7 #include <linux/tracepoint.h>
8 
9 #define HW_PARAM_ENTRY(param) {SNDRV_PCM_HW_PARAM_##param, #param}
10 #define hw_param_labels			\
11 	HW_PARAM_ENTRY(ACCESS),		\
12 	HW_PARAM_ENTRY(FORMAT),		\
13 	HW_PARAM_ENTRY(SUBFORMAT),	\
14 	HW_PARAM_ENTRY(SAMPLE_BITS),	\
15 	HW_PARAM_ENTRY(FRAME_BITS),	\
16 	HW_PARAM_ENTRY(CHANNELS),	\
17 	HW_PARAM_ENTRY(RATE),		\
18 	HW_PARAM_ENTRY(PERIOD_TIME),	\
19 	HW_PARAM_ENTRY(PERIOD_SIZE),	\
20 	HW_PARAM_ENTRY(PERIOD_BYTES),	\
21 	HW_PARAM_ENTRY(PERIODS),	\
22 	HW_PARAM_ENTRY(BUFFER_TIME),	\
23 	HW_PARAM_ENTRY(BUFFER_SIZE),	\
24 	HW_PARAM_ENTRY(BUFFER_BYTES),	\
25 	HW_PARAM_ENTRY(TICK_TIME)
26 
27 TRACE_EVENT(hw_mask_param,
28 	TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_hw_param_t type, int index, const struct snd_mask *prev, const struct snd_mask *curr),
29 	TP_ARGS(substream, type, index, prev, curr),
30 	TP_STRUCT__entry(
31 		__field(int, card)
32 		__field(int, device)
33 		__field(int, subdevice)
34 		__field(int, direction)
35 		__field(snd_pcm_hw_param_t, type)
36 		__field(int, index)
37 		__field(int, total)
38 		__array(__u32, prev_bits, 8)
39 		__array(__u32, curr_bits, 8)
40 	),
41 	TP_fast_assign(
42 		__entry->card = substream->pcm->card->number;
43 		__entry->device = substream->pcm->device;
44 		__entry->subdevice = substream->number;
45 		__entry->direction = substream->stream;
46 		__entry->type = type;
47 		__entry->index = index;
48 		__entry->total = substream->runtime->hw_constraints.rules_num;
49 		memcpy(__entry->prev_bits, prev->bits, sizeof(__u32) * 8);
50 		memcpy(__entry->curr_bits, curr->bits, sizeof(__u32) * 8);
51 	),
52 	TP_printk("pcmC%dD%d%s:%d %03d/%03d %s %08x%08x%08x%08x %08x%08x%08x%08x",
53 		  __entry->card,
54 		  __entry->device,
55 		  __entry->direction ? "c" : "p",
56 		  __entry->subdevice,
57 		  __entry->index,
58 		  __entry->total,
59 		  __print_symbolic(__entry->type, hw_param_labels),
60 		  __entry->prev_bits[3], __entry->prev_bits[2],
61 		  __entry->prev_bits[1], __entry->prev_bits[0],
62 		  __entry->curr_bits[3], __entry->curr_bits[2],
63 		  __entry->curr_bits[1], __entry->curr_bits[0]
64 	)
65 );
66 
67 TRACE_EVENT(hw_interval_param,
68 	TP_PROTO(struct snd_pcm_substream *substream, snd_pcm_hw_param_t type, int index, const struct snd_interval *prev, const struct snd_interval *curr),
69 	TP_ARGS(substream, type, index, prev, curr),
70 	TP_STRUCT__entry(
71 		__field(int, card)
72 		__field(int, device)
73 		__field(int, subdevice)
74 		__field(int, direction)
75 		__field(snd_pcm_hw_param_t, type)
76 		__field(int, index)
77 		__field(int, total)
78 		__field(unsigned int, prev_min)
79 		__field(unsigned int, prev_max)
80 		__field(unsigned int, prev_openmin)
81 		__field(unsigned int, prev_openmax)
82 		__field(unsigned int, prev_integer)
83 		__field(unsigned int, prev_empty)
84 		__field(unsigned int, curr_min)
85 		__field(unsigned int, curr_max)
86 		__field(unsigned int, curr_openmin)
87 		__field(unsigned int, curr_openmax)
88 		__field(unsigned int, curr_integer)
89 		__field(unsigned int, curr_empty)
90 	),
91 	TP_fast_assign(
92 		__entry->card = substream->pcm->card->number;
93 		__entry->device = substream->pcm->device;
94 		__entry->subdevice = substream->number;
95 		__entry->direction = substream->stream;
96 		__entry->type = type;
97 		__entry->index = index;
98 		__entry->total = substream->runtime->hw_constraints.rules_num;
99 		__entry->prev_min = prev->min;
100 		__entry->prev_max = prev->max;
101 		__entry->prev_openmin = prev->openmin;
102 		__entry->prev_openmax = prev->openmax;
103 		__entry->prev_integer = prev->integer;
104 		__entry->prev_empty = prev->empty;
105 		__entry->curr_min = curr->min;
106 		__entry->curr_max = curr->max;
107 		__entry->curr_openmin = curr->openmin;
108 		__entry->curr_openmax = curr->openmax;
109 		__entry->curr_integer = curr->integer;
110 		__entry->curr_empty = curr->empty;
111 	),
112 	TP_printk("pcmC%dD%d%s:%d %03d/%03d %s %d %d %s%u %u%s %d %d %s%u %u%s",
113 		  __entry->card,
114 		  __entry->device,
115 		  __entry->direction ? "c" : "p",
116 		  __entry->subdevice,
117 		  __entry->index,
118 		  __entry->total,
119 		  __print_symbolic(__entry->type, hw_param_labels),
120 		  __entry->prev_empty,
121 		  __entry->prev_integer,
122 		  __entry->prev_openmin ? "(" : "[",
123 		  __entry->prev_min,
124 		  __entry->prev_max,
125 		  __entry->prev_openmax ? ")" : "]",
126 		  __entry->curr_empty,
127 		  __entry->curr_integer,
128 		  __entry->curr_openmin ? "(" : "[",
129 		  __entry->curr_min,
130 		  __entry->curr_max,
131 		  __entry->curr_openmax ? ")" : "]"
132 	)
133 );
134 
135 #endif /* _PCM_PARAMS_TRACE_H */
136 
137 /* This part must be outside protection */
138 #undef TRACE_INCLUDE_PATH
139 #define TRACE_INCLUDE_PATH .
140 #undef TRACE_INCLUDE_FILE
141 #define TRACE_INCLUDE_FILE pcm_param_trace
142 #include <trace/define_trace.h>
143