summaryrefslogtreecommitdiffstats
path: root/sound/core/pcm_param_trace.h
blob: 08abba3133abddb3f387affa62974e9cc23e7a6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM snd_pcm

#if !defined(_PCM_PARAMS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _PCM_PARAMS_TRACE_H

#include <linux/tracepoint.h>

#define HW_PARAM_ENTRY(param) {SNDRV_PCM_HW_PARAM_##param, #param}
#define hw_param_labels			\
	HW_PARAM_ENTRY(ACCESS),		\
	HW_PARAM_ENTRY(FORMAT),		\
	HW_PARAM_ENTRY(SUBFORMAT),	\
	HW_PARAM_ENTRY(SAMPLE_BITS),	\
	HW_PARAM_ENTRY(FRAME_BITS),	\
	HW_PARAM_ENTRY(CHANNELS),	\
	HW_PARAM_ENTRY(RATE),		\
	HW_PARAM_ENTRY(PERIOD_TIME),	\
	HW_PARAM_ENTRY(PERIOD_SIZE),	\
	HW_PARAM_ENTRY(PERIOD_BYTES),	\
	HW_PARAM_ENTRY(PERIODS),	\
	HW_PARAM_ENTRY(BUFFER_TIME),	\
	HW_PARAM_ENTRY(BUFFER_SIZE),	\
	HW_PARAM_ENTRY(BUFFER_BYTES),	\
	HW_PARAM_ENTRY(TICK_TIME)

TRACE_EVENT(hw_mask_param,
	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),
	TP_ARGS(substream, type, index, prev, curr),
	TP_STRUCT__entry(
		__field(int, card)
		__field(int, device)
		__field(int, subdevice)
		__field(int, direction)
		__field(snd_pcm_hw_param_t, type)
		__field(int, index)
		__field(int, total)
		__array(__u32, prev_bits, 8)
		__array(__u32, curr_bits, 8)
	),
	TP_fast_assign(
		__entry->card = substream->pcm->card->number;
		__entry->device = substream->pcm->device;
		__entry->subdevice = substream->number;
		__entry->direction = substream->stream;
		__entry->type = type;
		__entry->index = index;
		__entry->total = substream->runtime->hw_constraints.rules_num;
		memcpy(__entry->prev_bits, prev->bits, sizeof(__u32) * 8);
		memcpy(__entry->curr_bits, curr->bits, sizeof(__u32) * 8);
	),
	TP_printk("pcmC%dD%d%s:%d %03d/%03d %s %08x%08x%08x%08x %08x%08x%08x%08x",
		  __entry->card,
		  __entry->device,
		  __entry->direction ? "c" : "p",
		  __entry->subdevice,
		  __entry->index,
		  __entry->total,
		  __print_symbolic(__entry->type, hw_param_labels),
		  __entry->prev_bits[3], __entry->prev_bits[2],
		  __entry->prev_bits[1], __entry->prev_bits[0],
		  __entry->curr_bits[3], __entry->curr_bits[2],
		  __entry->curr_bits[1], __entry->curr_bits[0]
	)
);

TRACE_EVENT(hw_interval_param,
	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),
	TP_ARGS(substream, type, index, prev, curr),
	TP_STRUCT__entry(
		__field(int, card)
		__field(int, device)
		__field(int, subdevice)
		__field(int, direction)
		__field(snd_pcm_hw_param_t, type)
		__field(int, index)
		__field(int, total)
		__field(unsigned int, prev_min)
		__field(unsigned int, prev_max)
		__field(unsigned int, prev_openmin)
		__field(unsigned int, prev_openmax)
		__field(unsigned int, prev_integer)
		__field(unsigned int, prev_empty)
		__field(unsigned int, curr_min)
		__field(unsigned int, curr_max)
		__field(unsigned int, curr_openmin)
		__field(unsigned int, curr_openmax)
		__field(unsigned int, curr_integer)
		__field(unsigned int, curr_empty)
	),
	TP_fast_assign(
		__entry->card = substream->pcm->card->number;
		__entry->device = substream->pcm->device;
		__entry->subdevice = substream->number;
		__entry->direction = substream->stream;
		__entry->type = type;
		__entry->index = index;
		__entry->total = substream->runtime->hw_constraints.rules_num;
		__entry->prev_min = prev->min;
		__entry->prev_max = prev->max;
		__entry->prev_openmin = prev->openmin;
		__entry->prev_openmax = prev->openmax;
		__entry->prev_integer = prev->integer;
		__entry->prev_empty = prev->empty;
		__entry->curr_min = curr->min;
		__entry->curr_max = curr->max;
		__entry->curr_openmin = curr->openmin;
		__entry->curr_openmax = curr->openmax;
		__entry->curr_integer = curr->integer;
		__entry->curr_empty = curr->empty;
	),
	TP_printk("pcmC%dD%d%s:%d %03d/%03d %s %d %d %s%u %u%s %d %d %s%u %u%s",
		  __entry->card,
		  __entry->device,
		  __entry->direction ? "c" : "p",
		  __entry->subdevice,
		  __entry->index,
		  __entry->total,
		  __print_symbolic(__entry->type, hw_param_labels),
		  __entry->prev_empty,
		  __entry->prev_integer,
		  __entry->prev_openmin ? "(" : "[",
		  __entry->prev_min,
		  __entry->prev_max,
		  __entry->prev_openmax ? ")" : "]",
		  __entry->curr_empty,
		  __entry->curr_integer,
		  __entry->curr_openmin ? "(" : "[",
		  __entry->curr_min,
		  __entry->curr_max,
		  __entry->curr_openmax ? ")" : "]"
	)
);

#endif /* _PCM_PARAMS_TRACE_H */

/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE pcm_param_trace
#include <trace/define_trace.h>
OpenPOWER on IntegriCloud