1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #ifndef __LINUX_UAPI_SND_ASOC_H
17 #define __LINUX_UAPI_SND_ASOC_H
18
19 #include <linux/types.h>
20 #include <sound/asound.h>
21
22
23
24
25 #define SND_SOC_TPLG_MAX_CHAN 8
26
27
28
29
30 #define SND_SOC_TPLG_MAX_FORMATS 16
31
32
33
34
35 #define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
36
37
38
39
40 #define SND_SOC_TPLG_HW_CONFIG_MAX 8
41
42
43 #define SND_SOC_TPLG_CTL_VOLSW 1
44 #define SND_SOC_TPLG_CTL_VOLSW_SX 2
45 #define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3
46 #define SND_SOC_TPLG_CTL_ENUM 4
47 #define SND_SOC_TPLG_CTL_BYTES 5
48 #define SND_SOC_TPLG_CTL_ENUM_VALUE 6
49 #define SND_SOC_TPLG_CTL_RANGE 7
50 #define SND_SOC_TPLG_CTL_STROBE 8
51
52
53
54 #define SND_SOC_TPLG_DAPM_CTL_VOLSW 64
55 #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65
56 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66
57 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67
58 #define SND_SOC_TPLG_DAPM_CTL_PIN 68
59
60
61 #define SND_SOC_TPLG_DAPM_INPUT 0
62 #define SND_SOC_TPLG_DAPM_OUTPUT 1
63 #define SND_SOC_TPLG_DAPM_MUX 2
64 #define SND_SOC_TPLG_DAPM_MIXER 3
65 #define SND_SOC_TPLG_DAPM_PGA 4
66 #define SND_SOC_TPLG_DAPM_OUT_DRV 5
67 #define SND_SOC_TPLG_DAPM_ADC 6
68 #define SND_SOC_TPLG_DAPM_DAC 7
69 #define SND_SOC_TPLG_DAPM_SWITCH 8
70 #define SND_SOC_TPLG_DAPM_PRE 9
71 #define SND_SOC_TPLG_DAPM_POST 10
72 #define SND_SOC_TPLG_DAPM_AIF_IN 11
73 #define SND_SOC_TPLG_DAPM_AIF_OUT 12
74 #define SND_SOC_TPLG_DAPM_DAI_IN 13
75 #define SND_SOC_TPLG_DAPM_DAI_OUT 14
76 #define SND_SOC_TPLG_DAPM_DAI_LINK 15
77 #define SND_SOC_TPLG_DAPM_BUFFER 16
78 #define SND_SOC_TPLG_DAPM_SCHEDULER 17
79 #define SND_SOC_TPLG_DAPM_EFFECT 18
80 #define SND_SOC_TPLG_DAPM_SIGGEN 19
81 #define SND_SOC_TPLG_DAPM_SRC 20
82 #define SND_SOC_TPLG_DAPM_ASRC 21
83 #define SND_SOC_TPLG_DAPM_ENCODER 22
84 #define SND_SOC_TPLG_DAPM_DECODER 23
85 #define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER
86
87
88 #define SND_SOC_TPLG_MAGIC 0x41536F43
89
90
91 #define SND_SOC_TPLG_NUM_TEXTS 16
92
93
94 #define SND_SOC_TPLG_ABI_VERSION 0x5
95 #define SND_SOC_TPLG_ABI_VERSION_MIN 0x4
96
97
98 #define SND_SOC_TPLG_TLV_SIZE 32
99
100
101
102
103
104
105
106 #define SND_SOC_TPLG_TYPE_MIXER 1
107 #define SND_SOC_TPLG_TYPE_BYTES 2
108 #define SND_SOC_TPLG_TYPE_ENUM 3
109 #define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4
110 #define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5
111 #define SND_SOC_TPLG_TYPE_DAI_LINK 6
112 #define SND_SOC_TPLG_TYPE_PCM 7
113 #define SND_SOC_TPLG_TYPE_MANIFEST 8
114 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9
115 #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
116 #define SND_SOC_TPLG_TYPE_PDATA 11
117 #define SND_SOC_TPLG_TYPE_DAI 12
118 #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
119
120
121 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
122 #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001
123 #define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002
124 #define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003
125
126 #define SND_SOC_TPLG_STREAM_PLAYBACK 0
127 #define SND_SOC_TPLG_STREAM_CAPTURE 1
128
129
130 #define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
131 #define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
132 #define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
133 #define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
134 #define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
135 #define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
136
137
138 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
139 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
140 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
141
142
143 #define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0
144 #define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1
145 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2
146
147
148 #define SND_SOC_TPLG_MCLK_CO 0
149 #define SND_SOC_TPLG_MCLK_CI 1
150
151
152
153
154 #define SND_SOC_DAI_FORMAT_I2S 1
155 #define SND_SOC_DAI_FORMAT_RIGHT_J 2
156 #define SND_SOC_DAI_FORMAT_LEFT_J 3
157 #define SND_SOC_DAI_FORMAT_DSP_A 4
158 #define SND_SOC_DAI_FORMAT_DSP_B 5
159 #define SND_SOC_DAI_FORMAT_AC97 6
160 #define SND_SOC_DAI_FORMAT_PDM 7
161
162
163 #define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
164 #define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
165
166
167 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
168 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
169 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
170 #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
171
172
173
174
175 #define SND_SOC_TPLG_BCLK_CM 0
176 #define SND_SOC_TPLG_BCLK_CS 1
177
178
179
180
181 #define SND_SOC_TPLG_FSYNC_CM 0
182 #define SND_SOC_TPLG_FSYNC_CS 1
183
184
185
186
187
188 struct snd_soc_tplg_hdr {
189 __le32 magic;
190 __le32 abi;
191 __le32 version;
192 __le32 type;
193 __le32 size;
194 __le32 vendor_type;
195 __le32 payload_size;
196 __le32 index;
197 __le32 count;
198 } __attribute__((packed));
199
200
201 struct snd_soc_tplg_vendor_uuid_elem {
202 __le32 token;
203 char uuid[16];
204 } __attribute__((packed));
205
206
207 struct snd_soc_tplg_vendor_value_elem {
208 __le32 token;
209 __le32 value;
210 } __attribute__((packed));
211
212
213 struct snd_soc_tplg_vendor_string_elem {
214 __le32 token;
215 char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
216 } __attribute__((packed));
217
218 struct snd_soc_tplg_vendor_array {
219 __le32 size;
220 __le32 type;
221 __le32 num_elems;
222 union {
223 struct snd_soc_tplg_vendor_uuid_elem uuid[0];
224 struct snd_soc_tplg_vendor_value_elem value[0];
225 struct snd_soc_tplg_vendor_string_elem string[0];
226 };
227 } __attribute__((packed));
228
229
230
231
232
233
234 struct snd_soc_tplg_private {
235 __le32 size;
236 union {
237 char data[0];
238 struct snd_soc_tplg_vendor_array array[0];
239 };
240 } __attribute__((packed));
241
242
243
244
245 struct snd_soc_tplg_tlv_dbscale {
246 __le32 min;
247 __le32 step;
248 __le32 mute;
249 } __attribute__((packed));
250
251 struct snd_soc_tplg_ctl_tlv {
252 __le32 size;
253 __le32 type;
254 union {
255 __le32 data[SND_SOC_TPLG_TLV_SIZE];
256 struct snd_soc_tplg_tlv_dbscale scale;
257 };
258 } __attribute__((packed));
259
260
261
262
263 struct snd_soc_tplg_channel {
264 __le32 size;
265 __le32 reg;
266 __le32 shift;
267 __le32 id;
268 } __attribute__((packed));
269
270
271
272
273
274
275 struct snd_soc_tplg_io_ops {
276 __le32 get;
277 __le32 put;
278 __le32 info;
279 } __attribute__((packed));
280
281
282
283
284 struct snd_soc_tplg_ctl_hdr {
285 __le32 size;
286 __le32 type;
287 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
288 __le32 access;
289 struct snd_soc_tplg_io_ops ops;
290 struct snd_soc_tplg_ctl_tlv tlv;
291 } __attribute__((packed));
292
293
294
295
296 struct snd_soc_tplg_stream_caps {
297 __le32 size;
298 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
299 __le64 formats;
300 __le32 rates;
301 __le32 rate_min;
302 __le32 rate_max;
303 __le32 channels_min;
304 __le32 channels_max;
305 __le32 periods_min;
306 __le32 periods_max;
307 __le32 period_size_min;
308 __le32 period_size_max;
309 __le32 buffer_size_min;
310 __le32 buffer_size_max;
311 __le32 sig_bits;
312 } __attribute__((packed));
313
314
315
316
317 struct snd_soc_tplg_stream {
318 __le32 size;
319 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
320 __le64 format;
321 __le32 rate;
322 __le32 period_bytes;
323 __le32 buffer_bytes;
324 __le32 channels;
325 } __attribute__((packed));
326
327
328
329
330
331
332 struct snd_soc_tplg_hw_config {
333 __le32 size;
334 __le32 id;
335 __le32 fmt;
336 __u8 clock_gated;
337 __u8 invert_bclk;
338 __u8 invert_fsync;
339 __u8 bclk_master;
340 __u8 fsync_master;
341 __u8 mclk_direction;
342 __le16 reserved;
343 __le32 mclk_rate;
344 __le32 bclk_rate;
345 __le32 fsync_rate;
346 __le32 tdm_slots;
347 __le32 tdm_slot_width;
348 __le32 tx_slots;
349 __le32 rx_slots;
350 __le32 tx_channels;
351 __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN];
352 __le32 rx_channels;
353 __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN];
354 } __attribute__((packed));
355
356
357
358
359
360
361
362
363
364
365
366
367
368 struct snd_soc_tplg_manifest {
369 __le32 size;
370 __le32 control_elems;
371 __le32 widget_elems;
372 __le32 graph_elems;
373 __le32 pcm_elems;
374 __le32 dai_link_elems;
375 __le32 dai_elems;
376 __le32 reserved[20];
377 struct snd_soc_tplg_private priv;
378 } __attribute__((packed));
379
380
381
382
383
384
385
386
387
388
389
390 struct snd_soc_tplg_mixer_control {
391 struct snd_soc_tplg_ctl_hdr hdr;
392 __le32 size;
393 __le32 min;
394 __le32 max;
395 __le32 platform_max;
396 __le32 invert;
397 __le32 num_channels;
398 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
399 struct snd_soc_tplg_private priv;
400 } __attribute__((packed));
401
402
403
404
405
406
407
408
409
410
411
412 struct snd_soc_tplg_enum_control {
413 struct snd_soc_tplg_ctl_hdr hdr;
414 __le32 size;
415 __le32 num_channels;
416 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
417 __le32 items;
418 __le32 mask;
419 __le32 count;
420 char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
421 __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
422 struct snd_soc_tplg_private priv;
423 } __attribute__((packed));
424
425
426
427
428
429
430
431
432
433
434
435 struct snd_soc_tplg_bytes_control {
436 struct snd_soc_tplg_ctl_hdr hdr;
437 __le32 size;
438 __le32 max;
439 __le32 mask;
440 __le32 base;
441 __le32 num_regs;
442 struct snd_soc_tplg_io_ops ext_ops;
443 struct snd_soc_tplg_private priv;
444 } __attribute__((packed));
445
446
447
448
449
450
451
452
453
454
455
456 struct snd_soc_tplg_dapm_graph_elem {
457 char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
458 char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
459 char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
460 } __attribute__((packed));
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478 struct snd_soc_tplg_dapm_widget {
479 __le32 size;
480 __le32 id;
481 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
482 char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
483
484 __le32 reg;
485 __le32 shift;
486 __le32 mask;
487 __le32 subseq;
488 __le32 invert;
489 __le32 ignore_suspend;
490 __le16 event_flags;
491 __le16 event_type;
492 __le32 num_kcontrols;
493 struct snd_soc_tplg_private priv;
494
495
496
497
498 } __attribute__((packed));
499
500
501
502
503
504
505
506
507
508
509
510
511 struct snd_soc_tplg_pcm {
512 __le32 size;
513 char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
514 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
515 __le32 pcm_id;
516 __le32 dai_id;
517 __le32 playback;
518 __le32 capture;
519 __le32 compress;
520 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
521 __le32 num_streams;
522 struct snd_soc_tplg_stream_caps caps[2];
523 __le32 flag_mask;
524 __le32 flags;
525 struct snd_soc_tplg_private priv;
526 } __attribute__((packed));
527
528
529
530
531
532
533
534
535
536
537
538
539 struct snd_soc_tplg_link_config {
540 __le32 size;
541 __le32 id;
542 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
543 char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
544 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
545 __le32 num_streams;
546 struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX];
547 __le32 num_hw_configs;
548 __le32 default_hw_config_id;
549 __le32 flag_mask;
550 __le32 flags;
551 struct snd_soc_tplg_private priv;
552 } __attribute__((packed));
553
554
555
556
557
558
559
560
561
562
563
564
565 struct snd_soc_tplg_dai {
566 __le32 size;
567 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
568 __le32 dai_id;
569 __le32 playback;
570 __le32 capture;
571 struct snd_soc_tplg_stream_caps caps[2];
572 __le32 flag_mask;
573 __le32 flags;
574 struct snd_soc_tplg_private priv;
575 } __attribute__((packed));
576
577
578
579
580
581
582 struct snd_soc_tplg_manifest_v4 {
583 __le32 size;
584 __le32 control_elems;
585 __le32 widget_elems;
586 __le32 graph_elems;
587 __le32 pcm_elems;
588 __le32 dai_link_elems;
589 struct snd_soc_tplg_private priv;
590 } __packed;
591
592
593 struct snd_soc_tplg_stream_caps_v4 {
594 __le32 size;
595 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
596 __le64 formats;
597 __le32 rates;
598 __le32 rate_min;
599 __le32 rate_max;
600 __le32 channels_min;
601 __le32 channels_max;
602 __le32 periods_min;
603 __le32 periods_max;
604 __le32 period_size_min;
605 __le32 period_size_max;
606 __le32 buffer_size_min;
607 __le32 buffer_size_max;
608 } __packed;
609
610
611 struct snd_soc_tplg_pcm_v4 {
612 __le32 size;
613 char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
614 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
615 __le32 pcm_id;
616 __le32 dai_id;
617 __le32 playback;
618 __le32 capture;
619 __le32 compress;
620 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
621 __le32 num_streams;
622 struct snd_soc_tplg_stream_caps_v4 caps[2];
623 } __packed;
624
625
626 struct snd_soc_tplg_link_config_v4 {
627 __le32 size;
628 __le32 id;
629 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
630 __le32 num_streams;
631 } __packed;
632
633 #endif