1 /*
2  * This header was generated from the Linux kernel headers by update_headers.py,
3  * to provide necessary information from kernel to userspace, such as constants,
4  * structures, and macros, and thus, contains no copyrightable information.
5  */
6 #ifndef __LINUX_UAPI_SND_ASOC_H
7 #define __LINUX_UAPI_SND_ASOC_H
8 #include <linux/types.h>
9 #include <sound/asound.h>
10 #define SND_SOC_TPLG_MAX_CHAN		8
11 #define SND_SOC_TPLG_MAX_FORMATS	16
12 #define SND_SOC_TPLG_STREAM_CONFIG_MAX  8
13 #define SND_SOC_TPLG_HW_CONFIG_MAX	8
14 #define SND_SOC_TPLG_CTL_VOLSW		1
15 #define SND_SOC_TPLG_CTL_VOLSW_SX	2
16 #define SND_SOC_TPLG_CTL_VOLSW_XR_SX	3
17 #define SND_SOC_TPLG_CTL_ENUM		4
18 #define SND_SOC_TPLG_CTL_BYTES		5
19 #define SND_SOC_TPLG_CTL_ENUM_VALUE	6
20 #define SND_SOC_TPLG_CTL_RANGE		7
21 #define SND_SOC_TPLG_CTL_STROBE		8
22 #define SND_SOC_TPLG_DAPM_CTL_VOLSW		64
23 #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE	65
24 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT		66
25 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE	67
26 #define SND_SOC_TPLG_DAPM_CTL_PIN		68
27 #define SND_SOC_TPLG_DAPM_INPUT		0
28 #define SND_SOC_TPLG_DAPM_OUTPUT	1
29 #define SND_SOC_TPLG_DAPM_MUX		2
30 #define SND_SOC_TPLG_DAPM_MIXER		3
31 #define SND_SOC_TPLG_DAPM_PGA		4
32 #define SND_SOC_TPLG_DAPM_OUT_DRV	5
33 #define SND_SOC_TPLG_DAPM_ADC		6
34 #define SND_SOC_TPLG_DAPM_DAC		7
35 #define SND_SOC_TPLG_DAPM_SWITCH	8
36 #define SND_SOC_TPLG_DAPM_PRE		9
37 #define SND_SOC_TPLG_DAPM_POST		10
38 #define SND_SOC_TPLG_DAPM_AIF_IN	11
39 #define SND_SOC_TPLG_DAPM_AIF_OUT	12
40 #define SND_SOC_TPLG_DAPM_DAI_IN	13
41 #define SND_SOC_TPLG_DAPM_DAI_OUT	14
42 #define SND_SOC_TPLG_DAPM_DAI_LINK	15
43 #define SND_SOC_TPLG_DAPM_BUFFER	16
44 #define SND_SOC_TPLG_DAPM_SCHEDULER	17
45 #define SND_SOC_TPLG_DAPM_EFFECT	18
46 #define SND_SOC_TPLG_DAPM_SIGGEN	19
47 #define SND_SOC_TPLG_DAPM_SRC		20
48 #define SND_SOC_TPLG_DAPM_ASRC		21
49 #define SND_SOC_TPLG_DAPM_ENCODER	22
50 #define SND_SOC_TPLG_DAPM_DECODER	23
51 #define SND_SOC_TPLG_DAPM_LAST		SND_SOC_TPLG_DAPM_DECODER
52 #define SND_SOC_TPLG_MAGIC		0x41536F43
53 #define SND_SOC_TPLG_NUM_TEXTS		16
54 #define SND_SOC_TPLG_ABI_VERSION	0x5
55 #define SND_SOC_TPLG_ABI_VERSION_MIN	0x4
56 #define SND_SOC_TPLG_TLV_SIZE		32
57 #define SND_SOC_TPLG_TYPE_MIXER		1
58 #define SND_SOC_TPLG_TYPE_BYTES		2
59 #define SND_SOC_TPLG_TYPE_ENUM		3
60 #define SND_SOC_TPLG_TYPE_DAPM_GRAPH	4
61 #define SND_SOC_TPLG_TYPE_DAPM_WIDGET	5
62 #define SND_SOC_TPLG_TYPE_DAI_LINK	6
63 #define SND_SOC_TPLG_TYPE_PCM		7
64 #define SND_SOC_TPLG_TYPE_MANIFEST	8
65 #define SND_SOC_TPLG_TYPE_CODEC_LINK	9
66 #define SND_SOC_TPLG_TYPE_BACKEND_LINK	10
67 #define SND_SOC_TPLG_TYPE_PDATA		11
68 #define SND_SOC_TPLG_TYPE_DAI		12
69 #define SND_SOC_TPLG_TYPE_MAX		SND_SOC_TPLG_TYPE_DAI
70 #define SND_SOC_TPLG_TYPE_VENDOR_FW	1000
71 #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG	1001
72 #define SND_SOC_TPLG_TYPE_VENDOR_COEFF	1002
73 #define SND_SOC_TPLG_TYPEVENDOR_CODEC	1003
74 #define SND_SOC_TPLG_STREAM_PLAYBACK	0
75 #define SND_SOC_TPLG_STREAM_CAPTURE	1
76 #define SND_SOC_TPLG_TUPLE_TYPE_UUID	0
77 #define SND_SOC_TPLG_TUPLE_TYPE_STRING	1
78 #define SND_SOC_TPLG_TUPLE_TYPE_BOOL	2
79 #define SND_SOC_TPLG_TUPLE_TYPE_BYTE	3
80 #define SND_SOC_TPLG_TUPLE_TYPE_WORD	4
81 #define SND_SOC_TPLG_TUPLE_TYPE_SHORT	5
82 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES         (1 << 0)
83 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS      (1 << 1)
84 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS    (1 << 2)
85 #define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED	0
86 #define SND_SOC_TPLG_DAI_CLK_GATE_GATED	1
87 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT		2
88 #define SND_SOC_TPLG_MCLK_CO            0
89 #define SND_SOC_TPLG_MCLK_CI            1
90 #define SND_SOC_DAI_FORMAT_I2S          1
91 #define SND_SOC_DAI_FORMAT_RIGHT_J      2
92 #define SND_SOC_DAI_FORMAT_LEFT_J       3
93 #define SND_SOC_DAI_FORMAT_DSP_A        4
94 #define SND_SOC_DAI_FORMAT_DSP_B        5
95 #define SND_SOC_DAI_FORMAT_AC97         6
96 #define SND_SOC_DAI_FORMAT_PDM          7
97 #define SND_SOC_DAI_FORMAT_MSB          SND_SOC_DAI_FORMAT_LEFT_J
98 #define SND_SOC_DAI_FORMAT_LSB          SND_SOC_DAI_FORMAT_RIGHT_J
99 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES         (1 << 0)
100 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS      (1 << 1)
101 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS    (1 << 2)
102 #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP            (1 << 3)
103 #define SND_SOC_TPLG_BCLK_CM         0
104 #define SND_SOC_TPLG_BCLK_CS         1
105 #define SND_SOC_TPLG_FSYNC_CM         0
106 #define SND_SOC_TPLG_FSYNC_CS         1
107 struct snd_soc_tplg_hdr {
108 	__le32 magic;
109 	__le32 abi;
110 	__le32 version;
111 	__le32 type;
112 	__le32 size;
113 	__le32 vendor_type;
114 	__le32 payload_size;
115 	__le32 index;
116 	__le32 count;
117 } __attribute__((packed));
118 struct snd_soc_tplg_vendor_uuid_elem {
119 	__le32 token;
120 	char uuid[16];
121 } __attribute__((packed));
122 struct snd_soc_tplg_vendor_value_elem {
123 	__le32 token;
124 	__le32 value;
125 } __attribute__((packed));
126 struct snd_soc_tplg_vendor_string_elem {
127 	__le32 token;
128 	char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
129 } __attribute__((packed));
130 struct snd_soc_tplg_vendor_array {
131 	__le32 size;
132 	__le32 type;
133 	__le32 num_elems;
134 	union {
135 		struct snd_soc_tplg_vendor_uuid_elem uuid[0];
136 		struct snd_soc_tplg_vendor_value_elem value[0];
137 		struct snd_soc_tplg_vendor_string_elem string[0];
138 	};
139 } __attribute__((packed));
140 struct snd_soc_tplg_private {
141 	__le32 size;
142 	union {
143 		char data[0];
144 		struct snd_soc_tplg_vendor_array array[0];
145 	};
146 } __attribute__((packed));
147 struct snd_soc_tplg_tlv_dbscale {
148 	__le32 min;
149 	__le32 step;
150 	__le32 mute;
151 } __attribute__((packed));
152 struct snd_soc_tplg_ctl_tlv {
153 	__le32 size;
154 	__le32 type;
155 	union {
156 		__le32 data[SND_SOC_TPLG_TLV_SIZE];
157 		struct snd_soc_tplg_tlv_dbscale scale;
158 	};
159 } __attribute__((packed));
160 struct snd_soc_tplg_channel {
161 	__le32 size;
162 	__le32 reg;
163 	__le32 shift;
164 	__le32 id;
165 } __attribute__((packed));
166 struct snd_soc_tplg_io_ops {
167 	__le32 get;
168 	__le32 put;
169 	__le32 info;
170 } __attribute__((packed));
171 struct snd_soc_tplg_ctl_hdr {
172 	__le32 size;
173 	__le32 type;
174 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
175 	__le32 access;
176 	struct snd_soc_tplg_io_ops ops;
177 	struct snd_soc_tplg_ctl_tlv tlv;
178 } __attribute__((packed));
179 struct snd_soc_tplg_stream_caps {
180 	__le32 size;
181 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
182 	__le64 formats;
183 	__le32 rates;
184 	__le32 rate_min;
185 	__le32 rate_max;
186 	__le32 channels_min;
187 	__le32 channels_max;
188 	__le32 periods_min;
189 	__le32 periods_max;
190 	__le32 period_size_min;
191 	__le32 period_size_max;
192 	__le32 buffer_size_min;
193 	__le32 buffer_size_max;
194 	__le32 sig_bits;
195 } __attribute__((packed));
196 struct snd_soc_tplg_stream {
197 	__le32 size;
198 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
199 	__le64 format;
200 	__le32 rate;
201 	__le32 period_bytes;
202 	__le32 buffer_bytes;
203 	__le32 channels;
204 } __attribute__((packed));
205 struct snd_soc_tplg_hw_config {
206 	__le32 size;
207 	__le32 id;
208 	__le32 fmt;
209 	__u8 clock_gated;
210 	__u8 invert_bclk;
211 	__u8 invert_fsync;
212 	__u8 bclk_master;
213 	__u8 fsync_master;
214 	__u8 mclk_direction;
215 	__le16 reserved;
216 	__le32 mclk_rate;
217 	__le32 bclk_rate;
218 	__le32 fsync_rate;
219 	__le32 tdm_slots;
220 	__le32 tdm_slot_width;
221 	__le32 tx_slots;
222 	__le32 rx_slots;
223 	__le32 tx_channels;
224 	__le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN];
225 	__le32 rx_channels;
226 	__le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN];
227 } __attribute__((packed));
228 struct snd_soc_tplg_manifest {
229 	__le32 size;
230 	__le32 control_elems;
231 	__le32 widget_elems;
232 	__le32 graph_elems;
233 	__le32 pcm_elems;
234 	__le32 dai_link_elems;
235 	__le32 dai_elems;
236 	__le32 reserved[20];
237 	struct snd_soc_tplg_private priv;
238 } __attribute__((packed));
239 struct snd_soc_tplg_mixer_control {
240 	struct snd_soc_tplg_ctl_hdr hdr;
241 	__le32 size;
242 	__le32 min;
243 	__le32 max;
244 	__le32 platform_max;
245 	__le32 invert;
246 	__le32 num_channels;
247 	struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
248 	struct snd_soc_tplg_private priv;
249 } __attribute__((packed));
250 struct snd_soc_tplg_enum_control {
251 	struct snd_soc_tplg_ctl_hdr hdr;
252 	__le32 size;
253 	__le32 num_channels;
254 	struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
255 	__le32 items;
256 	__le32 mask;
257 	__le32 count;
258 	char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
259 	__le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
260 	struct snd_soc_tplg_private priv;
261 } __attribute__((packed));
262 struct snd_soc_tplg_bytes_control {
263 	struct snd_soc_tplg_ctl_hdr hdr;
264 	__le32 size;
265 	__le32 max;
266 	__le32 mask;
267 	__le32 base;
268 	__le32 num_regs;
269 	struct snd_soc_tplg_io_ops ext_ops;
270 	struct snd_soc_tplg_private priv;
271 } __attribute__((packed));
272 struct snd_soc_tplg_dapm_graph_elem {
273 	char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
274 	char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
275 	char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
276 } __attribute__((packed));
277 struct snd_soc_tplg_dapm_widget {
278 	__le32 size;
279 	__le32 id;
280 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
281 	char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
282 	__le32 reg;
283 	__le32 shift;
284 	__le32 mask;
285 	__le32 subseq;
286 	__le32 invert;
287 	__le32 ignore_suspend;
288 	__le16 event_flags;
289 	__le16 event_type;
290 	__le32 num_kcontrols;
291 	struct snd_soc_tplg_private priv;
292 
293 } __attribute__((packed));
294 struct snd_soc_tplg_pcm {
295 	__le32 size;
296 	char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
297 	char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
298 	__le32 pcm_id;
299 	__le32 dai_id;
300 	__le32 playback;
301 	__le32 capture;
302 	__le32 compress;
303 	struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
304 	__le32 num_streams;
305 	struct snd_soc_tplg_stream_caps caps[2];
306 	__le32 flag_mask;
307 	__le32 flags;
308 	struct snd_soc_tplg_private priv;
309 } __attribute__((packed));
310 struct snd_soc_tplg_link_config {
311 	__le32 size;
312 	__le32 id;
313 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
314 	char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
315 	struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
316 	__le32 num_streams;
317 	struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX];
318 	__le32 num_hw_configs;
319 	__le32 default_hw_config_id;
320 	__le32 flag_mask;
321 	__le32 flags;
322 	struct snd_soc_tplg_private priv;
323 } __attribute__((packed));
324 struct snd_soc_tplg_dai {
325 	__le32 size;
326 	char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
327 	__le32 dai_id;
328 	__le32 playback;
329 	__le32 capture;
330 	struct snd_soc_tplg_stream_caps caps[2];
331 	__le32 flag_mask;
332 	__le32 flags;
333 	struct snd_soc_tplg_private priv;
334 } __attribute__((packed));
335 struct snd_soc_tplg_manifest_v4 {
336 	__le32 size;
337 	__le32 control_elems;
338 	__le32 widget_elems;
339 	__le32 graph_elems;
340 	__le32 pcm_elems;
341 	__le32 dai_link_elems;
342 	struct snd_soc_tplg_private priv;
343 } __packed;
344 struct snd_soc_tplg_stream_caps_v4 {
345 	__le32 size;
346 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
347 	__le64 formats;
348 	__le32 rates;
349 	__le32 rate_min;
350 	__le32 rate_max;
351 	__le32 channels_min;
352 	__le32 channels_max;
353 	__le32 periods_min;
354 	__le32 periods_max;
355 	__le32 period_size_min;
356 	__le32 period_size_max;
357 	__le32 buffer_size_min;
358 	__le32 buffer_size_max;
359 } __packed;
360 struct snd_soc_tplg_pcm_v4 {
361 	__le32 size;
362 	char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
363 	char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
364 	__le32 pcm_id;
365 	__le32 dai_id;
366 	__le32 playback;
367 	__le32 capture;
368 	__le32 compress;
369 	struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
370 	__le32 num_streams;
371 	struct snd_soc_tplg_stream_caps_v4 caps[2];
372 } __packed;
373 struct snd_soc_tplg_link_config_v4 {
374 	__le32 size;
375 	__le32 id;
376 	struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
377 	__le32 num_streams;
378 } __packed;
379 #endif
380