1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM snd_pcm
5 #if !defined(_PCM_PARAMS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _PCM_PARAMS_TRACE_H
8 #include <linux/tracepoint.h>
10 #define HW_PARAM_ENTRY(param) {SNDRV_PCM_HW_PARAM_##param, #param}
11 #define hw_param_labels \
12 HW_PARAM_ENTRY(ACCESS), \
13 HW_PARAM_ENTRY(FORMAT), \
14 HW_PARAM_ENTRY(SUBFORMAT), \
15 HW_PARAM_ENTRY(SAMPLE_BITS), \
16 HW_PARAM_ENTRY(FRAME_BITS), \
17 HW_PARAM_ENTRY(CHANNELS), \
18 HW_PARAM_ENTRY(RATE), \
19 HW_PARAM_ENTRY(PERIOD_TIME), \
20 HW_PARAM_ENTRY(PERIOD_SIZE), \
21 HW_PARAM_ENTRY(PERIOD_BYTES), \
22 HW_PARAM_ENTRY(PERIODS), \
23 HW_PARAM_ENTRY(BUFFER_TIME), \
24 HW_PARAM_ENTRY(BUFFER_SIZE), \
25 HW_PARAM_ENTRY(BUFFER_BYTES), \
26 HW_PARAM_ENTRY(TICK_TIME)
28 TRACE_EVENT(hw_mask_param
,
29 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
),
30 TP_ARGS(substream
, type
, index
, prev
, curr
),
34 __field(int, subdevice
)
35 __field(int, direction
)
36 __field(snd_pcm_hw_param_t
, type
)
39 __array(__u32
, prev_bits
, 8)
40 __array(__u32
, curr_bits
, 8)
43 __entry
->card
= substream
->pcm
->card
->number
;
44 __entry
->device
= substream
->pcm
->device
;
45 __entry
->subdevice
= substream
->number
;
46 __entry
->direction
= substream
->stream
;
48 __entry
->index
= index
;
49 __entry
->total
= substream
->runtime
->hw_constraints
.rules_num
;
50 memcpy(__entry
->prev_bits
, prev
->bits
, sizeof(__u32
) * 8);
51 memcpy(__entry
->curr_bits
, curr
->bits
, sizeof(__u32
) * 8);
53 TP_printk("pcmC%dD%d%s:%d %03d/%03d %s %08x%08x%08x%08x %08x%08x%08x%08x",
56 __entry
->direction
? "c" : "p",
60 __print_symbolic(__entry
->type
, hw_param_labels
),
61 __entry
->prev_bits
[3], __entry
->prev_bits
[2],
62 __entry
->prev_bits
[1], __entry
->prev_bits
[0],
63 __entry
->curr_bits
[3], __entry
->curr_bits
[2],
64 __entry
->curr_bits
[1], __entry
->curr_bits
[0]
68 TRACE_EVENT(hw_interval_param
,
69 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
),
70 TP_ARGS(substream
, type
, index
, prev
, curr
),
74 __field(int, subdevice
)
75 __field(int, direction
)
76 __field(snd_pcm_hw_param_t
, type
)
79 __field(unsigned int, prev_min
)
80 __field(unsigned int, prev_max
)
81 __field(unsigned int, prev_openmin
)
82 __field(unsigned int, prev_openmax
)
83 __field(unsigned int, prev_integer
)
84 __field(unsigned int, prev_empty
)
85 __field(unsigned int, curr_min
)
86 __field(unsigned int, curr_max
)
87 __field(unsigned int, curr_openmin
)
88 __field(unsigned int, curr_openmax
)
89 __field(unsigned int, curr_integer
)
90 __field(unsigned int, curr_empty
)
93 __entry
->card
= substream
->pcm
->card
->number
;
94 __entry
->device
= substream
->pcm
->device
;
95 __entry
->subdevice
= substream
->number
;
96 __entry
->direction
= substream
->stream
;
98 __entry
->index
= index
;
99 __entry
->total
= substream
->runtime
->hw_constraints
.rules_num
;
100 __entry
->prev_min
= prev
->min
;
101 __entry
->prev_max
= prev
->max
;
102 __entry
->prev_openmin
= prev
->openmin
;
103 __entry
->prev_openmax
= prev
->openmax
;
104 __entry
->prev_integer
= prev
->integer
;
105 __entry
->prev_empty
= prev
->empty
;
106 __entry
->curr_min
= curr
->min
;
107 __entry
->curr_max
= curr
->max
;
108 __entry
->curr_openmin
= curr
->openmin
;
109 __entry
->curr_openmax
= curr
->openmax
;
110 __entry
->curr_integer
= curr
->integer
;
111 __entry
->curr_empty
= curr
->empty
;
113 TP_printk("pcmC%dD%d%s:%d %03d/%03d %s %d %d %s%u %u%s %d %d %s%u %u%s",
116 __entry
->direction
? "c" : "p",
120 __print_symbolic(__entry
->type
, hw_param_labels
),
122 __entry
->prev_integer
,
123 __entry
->prev_openmin
? "(" : "[",
126 __entry
->prev_openmax
? ")" : "]",
128 __entry
->curr_integer
,
129 __entry
->curr_openmin
? "(" : "[",
132 __entry
->curr_openmax
? ")" : "]"
136 #endif /* _PCM_PARAMS_TRACE_H */
138 /* This part must be outside protection */
139 #undef TRACE_INCLUDE_PATH
140 #define TRACE_INCLUDE_PATH .
141 #undef TRACE_INCLUDE_FILE
142 #define TRACE_INCLUDE_FILE pcm_param_trace
143 #include <trace/define_trace.h>