xref: /linux/include/uapi/sound/asoc.h (revision f86fd32d)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
4  *
5  * Copyright (C) 2012 Texas Instruments Inc.
6  * Copyright (C) 2015 Intel Corporation.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  * Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
13  * algorithms, equalisers, DAIs, widgets etc.
14 */
15 
16 #ifndef __LINUX_UAPI_SND_ASOC_H
17 #define __LINUX_UAPI_SND_ASOC_H
18 
19 #include <linux/types.h>
20 
21 /*
22  * Maximum number of channels topology kcontrol can represent.
23  */
24 #define SND_SOC_TPLG_MAX_CHAN		8
25 
26 /*
27  * Maximum number of PCM formats capability
28  */
29 #define SND_SOC_TPLG_MAX_FORMATS	16
30 
31 /*
32  * Maximum number of PCM stream configs
33  */
34 #define SND_SOC_TPLG_STREAM_CONFIG_MAX  8
35 
36 /*
37  * Maximum number of physical link's hardware configs
38  */
39 #define SND_SOC_TPLG_HW_CONFIG_MAX	8
40 
41 /* individual kcontrol info types - can be mixed with other types */
42 #define SND_SOC_TPLG_CTL_VOLSW		1
43 #define SND_SOC_TPLG_CTL_VOLSW_SX	2
44 #define SND_SOC_TPLG_CTL_VOLSW_XR_SX	3
45 #define SND_SOC_TPLG_CTL_ENUM		4
46 #define SND_SOC_TPLG_CTL_BYTES		5
47 #define SND_SOC_TPLG_CTL_ENUM_VALUE	6
48 #define SND_SOC_TPLG_CTL_RANGE		7
49 #define SND_SOC_TPLG_CTL_STROBE		8
50 
51 
52 /* individual widget kcontrol info types - can be mixed with other types */
53 #define SND_SOC_TPLG_DAPM_CTL_VOLSW		64
54 #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE	65
55 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT		66
56 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE	67
57 #define SND_SOC_TPLG_DAPM_CTL_PIN		68
58 
59 /* DAPM widget types - add new items to the end */
60 #define SND_SOC_TPLG_DAPM_INPUT		0
61 #define SND_SOC_TPLG_DAPM_OUTPUT	1
62 #define SND_SOC_TPLG_DAPM_MUX		2
63 #define SND_SOC_TPLG_DAPM_MIXER		3
64 #define SND_SOC_TPLG_DAPM_PGA		4
65 #define SND_SOC_TPLG_DAPM_OUT_DRV	5
66 #define SND_SOC_TPLG_DAPM_ADC		6
67 #define SND_SOC_TPLG_DAPM_DAC		7
68 #define SND_SOC_TPLG_DAPM_SWITCH	8
69 #define SND_SOC_TPLG_DAPM_PRE		9
70 #define SND_SOC_TPLG_DAPM_POST		10
71 #define SND_SOC_TPLG_DAPM_AIF_IN	11
72 #define SND_SOC_TPLG_DAPM_AIF_OUT	12
73 #define SND_SOC_TPLG_DAPM_DAI_IN	13
74 #define SND_SOC_TPLG_DAPM_DAI_OUT	14
75 #define SND_SOC_TPLG_DAPM_DAI_LINK	15
76 #define SND_SOC_TPLG_DAPM_BUFFER	16
77 #define SND_SOC_TPLG_DAPM_SCHEDULER	17
78 #define SND_SOC_TPLG_DAPM_EFFECT	18
79 #define SND_SOC_TPLG_DAPM_SIGGEN	19
80 #define SND_SOC_TPLG_DAPM_SRC		20
81 #define SND_SOC_TPLG_DAPM_ASRC		21
82 #define SND_SOC_TPLG_DAPM_ENCODER	22
83 #define SND_SOC_TPLG_DAPM_DECODER	23
84 #define SND_SOC_TPLG_DAPM_LAST		SND_SOC_TPLG_DAPM_DECODER
85 
86 /* Header magic number and string sizes */
87 #define SND_SOC_TPLG_MAGIC		0x41536F43 /* ASoC */
88 
89 /* string sizes */
90 #define SND_SOC_TPLG_NUM_TEXTS		16
91 
92 /* ABI version */
93 #define SND_SOC_TPLG_ABI_VERSION	0x5	/* current version */
94 #define SND_SOC_TPLG_ABI_VERSION_MIN	0x4	/* oldest version supported */
95 
96 /* Max size of TLV data */
97 #define SND_SOC_TPLG_TLV_SIZE		32
98 
99 /*
100  * File and Block header data types.
101  * Add new generic and vendor types to end of list.
102  * Generic types are handled by the core whilst vendors types are passed
103  * to the component drivers for handling.
104  */
105 #define SND_SOC_TPLG_TYPE_MIXER		1
106 #define SND_SOC_TPLG_TYPE_BYTES		2
107 #define SND_SOC_TPLG_TYPE_ENUM		3
108 #define SND_SOC_TPLG_TYPE_DAPM_GRAPH	4
109 #define SND_SOC_TPLG_TYPE_DAPM_WIDGET	5
110 #define SND_SOC_TPLG_TYPE_DAI_LINK	6
111 #define SND_SOC_TPLG_TYPE_PCM		7
112 #define SND_SOC_TPLG_TYPE_MANIFEST	8
113 #define SND_SOC_TPLG_TYPE_CODEC_LINK	9
114 #define SND_SOC_TPLG_TYPE_BACKEND_LINK	10
115 #define SND_SOC_TPLG_TYPE_PDATA		11
116 #define SND_SOC_TPLG_TYPE_DAI		12
117 #define SND_SOC_TPLG_TYPE_MAX		SND_SOC_TPLG_TYPE_DAI
118 
119 /* vendor block IDs - please add new vendor types to end */
120 #define SND_SOC_TPLG_TYPE_VENDOR_FW	1000
121 #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG	1001
122 #define SND_SOC_TPLG_TYPE_VENDOR_COEFF	1002
123 #define SND_SOC_TPLG_TYPEVENDOR_CODEC	1003
124 
125 #define SND_SOC_TPLG_STREAM_PLAYBACK	0
126 #define SND_SOC_TPLG_STREAM_CAPTURE	1
127 
128 /* vendor tuple types */
129 #define SND_SOC_TPLG_TUPLE_TYPE_UUID	0
130 #define SND_SOC_TPLG_TUPLE_TYPE_STRING	1
131 #define SND_SOC_TPLG_TUPLE_TYPE_BOOL	2
132 #define SND_SOC_TPLG_TUPLE_TYPE_BYTE	3
133 #define SND_SOC_TPLG_TUPLE_TYPE_WORD	4
134 #define SND_SOC_TPLG_TUPLE_TYPE_SHORT	5
135 
136 /* DAI flags */
137 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES         (1 << 0)
138 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS      (1 << 1)
139 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS    (1 << 2)
140 
141 /* DAI clock gating */
142 #define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED	0
143 #define SND_SOC_TPLG_DAI_CLK_GATE_GATED	1
144 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT		2
145 
146 /* DAI mclk_direction */
147 #define SND_SOC_TPLG_MCLK_CO            0 /* for codec, mclk is output */
148 #define SND_SOC_TPLG_MCLK_CI            1 /* for codec, mclk is input */
149 
150 /* DAI physical PCM data formats.
151  * Add new formats to the end of the list.
152  */
153 #define SND_SOC_DAI_FORMAT_I2S          1 /* I2S mode */
154 #define SND_SOC_DAI_FORMAT_RIGHT_J      2 /* Right Justified mode */
155 #define SND_SOC_DAI_FORMAT_LEFT_J       3 /* Left Justified mode */
156 #define SND_SOC_DAI_FORMAT_DSP_A        4 /* L data MSB after FRM LRC */
157 #define SND_SOC_DAI_FORMAT_DSP_B        5 /* L data MSB during FRM LRC */
158 #define SND_SOC_DAI_FORMAT_AC97         6 /* AC97 */
159 #define SND_SOC_DAI_FORMAT_PDM          7 /* Pulse density modulation */
160 
161 /* left and right justified also known as MSB and LSB respectively */
162 #define SND_SOC_DAI_FORMAT_MSB          SND_SOC_DAI_FORMAT_LEFT_J
163 #define SND_SOC_DAI_FORMAT_LSB          SND_SOC_DAI_FORMAT_RIGHT_J
164 
165 /* DAI link flags */
166 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES         (1 << 0)
167 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS      (1 << 1)
168 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS    (1 << 2)
169 #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP            (1 << 3)
170 
171 /* DAI topology BCLK parameter
172  * For the backwards capability, by default codec is bclk master
173  */
174 #define SND_SOC_TPLG_BCLK_CM         0 /* codec is bclk master */
175 #define SND_SOC_TPLG_BCLK_CS         1 /* codec is bclk slave */
176 
177 /* DAI topology FSYNC parameter
178  * For the backwards capability, by default codec is fsync master
179  */
180 #define SND_SOC_TPLG_FSYNC_CM         0 /* codec is fsync master */
181 #define SND_SOC_TPLG_FSYNC_CS         1 /* codec is fsync slave */
182 
183 /*
184  * Block Header.
185  * This header precedes all object and object arrays below.
186  */
187 struct snd_soc_tplg_hdr {
188 	__le32 magic;		/* magic number */
189 	__le32 abi;		/* ABI version */
190 	__le32 version;		/* optional vendor specific version details */
191 	__le32 type;		/* SND_SOC_TPLG_TYPE_ */
192 	__le32 size;		/* size of this structure */
193 	__le32 vendor_type;	/* optional vendor specific type info */
194 	__le32 payload_size;	/* data bytes, excluding this header */
195 	__le32 index;		/* identifier for block */
196 	__le32 count;		/* number of elements in block */
197 } __attribute__((packed));
198 
199 /* vendor tuple for uuid */
200 struct snd_soc_tplg_vendor_uuid_elem {
201 	__le32 token;
202 	char uuid[16];
203 } __attribute__((packed));
204 
205 /* vendor tuple for a bool/byte/short/word value */
206 struct snd_soc_tplg_vendor_value_elem {
207 	__le32 token;
208 	__le32 value;
209 } __attribute__((packed));
210 
211 /* vendor tuple for string */
212 struct snd_soc_tplg_vendor_string_elem {
213 	__le32 token;
214 	char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
215 } __attribute__((packed));
216 
217 struct snd_soc_tplg_vendor_array {
218 	__le32 size;	/* size in bytes of the array, including all elements */
219 	__le32 type;	/* SND_SOC_TPLG_TUPLE_TYPE_ */
220 	__le32 num_elems;	/* number of elements in array */
221 	union {
222 		struct snd_soc_tplg_vendor_uuid_elem uuid[0];
223 		struct snd_soc_tplg_vendor_value_elem value[0];
224 		struct snd_soc_tplg_vendor_string_elem string[0];
225 	};
226 } __attribute__((packed));
227 
228 /*
229  * Private data.
230  * All topology objects may have private data that can be used by the driver or
231  * firmware. Core will ignore this data.
232  */
233 struct snd_soc_tplg_private {
234 	__le32 size;	/* in bytes of private data */
235 	union {
236 		char data[0];
237 		struct snd_soc_tplg_vendor_array array[0];
238 	};
239 } __attribute__((packed));
240 
241 /*
242  * Kcontrol TLV data.
243  */
244 struct snd_soc_tplg_tlv_dbscale {
245 	__le32 min;
246 	__le32 step;
247 	__le32 mute;
248 } __attribute__((packed));
249 
250 struct snd_soc_tplg_ctl_tlv {
251 	__le32 size;	/* in bytes of this structure */
252 	__le32 type;	/* SNDRV_CTL_TLVT_*, type of TLV */
253 	union {
254 		__le32 data[SND_SOC_TPLG_TLV_SIZE];
255 		struct snd_soc_tplg_tlv_dbscale scale;
256 	};
257 } __attribute__((packed));
258 
259 /*
260  * Kcontrol channel data
261  */
262 struct snd_soc_tplg_channel {
263 	__le32 size;	/* in bytes of this structure */
264 	__le32 reg;
265 	__le32 shift;
266 	__le32 id;	/* ID maps to Left, Right, LFE etc */
267 } __attribute__((packed));
268 
269 /*
270  * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
271  * Kcontrol ops need get/put/info.
272  * Bytes ext ops need get/put.
273  */
274 struct snd_soc_tplg_io_ops {
275 	__le32 get;
276 	__le32 put;
277 	__le32 info;
278 } __attribute__((packed));
279 
280 /*
281  * kcontrol header
282  */
283 struct snd_soc_tplg_ctl_hdr {
284 	__le32 size;	/* in bytes of this structure */
285 	__le32 type;
286 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
287 	__le32 access;
288 	struct snd_soc_tplg_io_ops ops;
289 	struct snd_soc_tplg_ctl_tlv tlv;
290 } __attribute__((packed));
291 
292 /*
293  * Stream Capabilities
294  */
295 struct snd_soc_tplg_stream_caps {
296 	__le32 size;		/* in bytes of this structure */
297 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
298 	__le64 formats;	/* supported formats SNDRV_PCM_FMTBIT_* */
299 	__le32 rates;		/* supported rates SNDRV_PCM_RATE_* */
300 	__le32 rate_min;	/* min rate */
301 	__le32 rate_max;	/* max rate */
302 	__le32 channels_min;	/* min channels */
303 	__le32 channels_max;	/* max channels */
304 	__le32 periods_min;	/* min number of periods */
305 	__le32 periods_max;	/* max number of periods */
306 	__le32 period_size_min;	/* min period size bytes */
307 	__le32 period_size_max;	/* max period size bytes */
308 	__le32 buffer_size_min;	/* min buffer size bytes */
309 	__le32 buffer_size_max;	/* max buffer size bytes */
310 	__le32 sig_bits;        /* number of bits of content */
311 } __attribute__((packed));
312 
313 /*
314  * FE or BE Stream configuration supported by SW/FW
315  */
316 struct snd_soc_tplg_stream {
317 	__le32 size;		/* in bytes of this structure */
318 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */
319 	__le64 format;		/* SNDRV_PCM_FMTBIT_* */
320 	__le32 rate;		/* SNDRV_PCM_RATE_* */
321 	__le32 period_bytes;	/* size of period in bytes */
322 	__le32 buffer_bytes;	/* size of buffer in bytes */
323 	__le32 channels;	/* channels */
324 } __attribute__((packed));
325 
326 
327 /*
328  * Describes a physical link's runtime supported hardware config,
329  * i.e. hardware audio formats.
330  */
331 struct snd_soc_tplg_hw_config {
332 	__le32 size;            /* in bytes of this structure */
333 	__le32 id;		/* unique ID - - used to match */
334 	__le32 fmt;		/* SND_SOC_DAI_FORMAT_ format value */
335 	__u8 clock_gated;	/* SND_SOC_TPLG_DAI_CLK_GATE_ value */
336 	__u8 invert_bclk;	/* 1 for inverted BCLK, 0 for normal */
337 	__u8 invert_fsync;	/* 1 for inverted frame clock, 0 for normal */
338 	__u8 bclk_master;	/* SND_SOC_TPLG_BCLK_ value */
339 	__u8 fsync_master;	/* SND_SOC_TPLG_FSYNC_ value */
340 	__u8 mclk_direction;    /* SND_SOC_TPLG_MCLK_ value */
341 	__le16 reserved;	/* for 32bit alignment */
342 	__le32 mclk_rate;	/* MCLK or SYSCLK freqency in Hz */
343 	__le32 bclk_rate;	/* BCLK freqency in Hz */
344 	__le32 fsync_rate;	/* frame clock in Hz */
345 	__le32 tdm_slots;	/* number of TDM slots in use */
346 	__le32 tdm_slot_width;	/* width in bits for each slot */
347 	__le32 tx_slots;	/* bit mask for active Tx slots */
348 	__le32 rx_slots;	/* bit mask for active Rx slots */
349 	__le32 tx_channels;	/* number of Tx channels */
350 	__le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
351 	__le32 rx_channels;	/* number of Rx channels */
352 	__le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
353 } __attribute__((packed));
354 
355 /*
356  * Manifest. List totals for each payload type. Not used in parsing, but will
357  * be passed to the component driver before any other objects in order for any
358  * global component resource allocations.
359  *
360  * File block representation for manifest :-
361  * +-----------------------------------+----+
362  * | struct snd_soc_tplg_hdr           |  1 |
363  * +-----------------------------------+----+
364  * | struct snd_soc_tplg_manifest      |  1 |
365  * +-----------------------------------+----+
366  */
367 struct snd_soc_tplg_manifest {
368 	__le32 size;		/* in bytes of this structure */
369 	__le32 control_elems;	/* number of control elements */
370 	__le32 widget_elems;	/* number of widget elements */
371 	__le32 graph_elems;	/* number of graph elements */
372 	__le32 pcm_elems;	/* number of PCM elements */
373 	__le32 dai_link_elems;	/* number of DAI link elements */
374 	__le32 dai_elems;	/* number of physical DAI elements */
375 	__le32 reserved[20];	/* reserved for new ABI element types */
376 	struct snd_soc_tplg_private priv;
377 } __attribute__((packed));
378 
379 /*
380  * Mixer kcontrol.
381  *
382  * File block representation for mixer kcontrol :-
383  * +-----------------------------------+----+
384  * | struct snd_soc_tplg_hdr           |  1 |
385  * +-----------------------------------+----+
386  * | struct snd_soc_tplg_mixer_control |  N |
387  * +-----------------------------------+----+
388  */
389 struct snd_soc_tplg_mixer_control {
390 	struct snd_soc_tplg_ctl_hdr hdr;
391 	__le32 size;	/* in bytes of this structure */
392 	__le32 min;
393 	__le32 max;
394 	__le32 platform_max;
395 	__le32 invert;
396 	__le32 num_channels;
397 	struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
398 	struct snd_soc_tplg_private priv;
399 } __attribute__((packed));
400 
401 /*
402  * Enumerated kcontrol
403  *
404  * File block representation for enum kcontrol :-
405  * +-----------------------------------+----+
406  * | struct snd_soc_tplg_hdr           |  1 |
407  * +-----------------------------------+----+
408  * | struct snd_soc_tplg_enum_control  |  N |
409  * +-----------------------------------+----+
410  */
411 struct snd_soc_tplg_enum_control {
412 	struct snd_soc_tplg_ctl_hdr hdr;
413 	__le32 size;	/* in bytes of this structure */
414 	__le32 num_channels;
415 	struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
416 	__le32 items;
417 	__le32 mask;
418 	__le32 count;
419 	char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
420 	__le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
421 	struct snd_soc_tplg_private priv;
422 } __attribute__((packed));
423 
424 /*
425  * Bytes kcontrol
426  *
427  * File block representation for bytes kcontrol :-
428  * +-----------------------------------+----+
429  * | struct snd_soc_tplg_hdr           |  1 |
430  * +-----------------------------------+----+
431  * | struct snd_soc_tplg_bytes_control |  N |
432  * +-----------------------------------+----+
433  */
434 struct snd_soc_tplg_bytes_control {
435 	struct snd_soc_tplg_ctl_hdr hdr;
436 	__le32 size;	/* in bytes of this structure */
437 	__le32 max;
438 	__le32 mask;
439 	__le32 base;
440 	__le32 num_regs;
441 	struct snd_soc_tplg_io_ops ext_ops;
442 	struct snd_soc_tplg_private priv;
443 } __attribute__((packed));
444 
445 /*
446  * DAPM Graph Element
447  *
448  * File block representation for DAPM graph elements :-
449  * +-------------------------------------+----+
450  * | struct snd_soc_tplg_hdr             |  1 |
451  * +-------------------------------------+----+
452  * | struct snd_soc_tplg_dapm_graph_elem |  N |
453  * +-------------------------------------+----+
454  */
455 struct snd_soc_tplg_dapm_graph_elem {
456 	char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
457 	char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
458 	char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
459 } __attribute__((packed));
460 
461 /*
462  * DAPM Widget.
463  *
464  * File block representation for DAPM widget :-
465  * +-------------------------------------+-----+
466  * | struct snd_soc_tplg_hdr             |  1  |
467  * +-------------------------------------+-----+
468  * | struct snd_soc_tplg_dapm_widget     |  N  |
469  * +-------------------------------------+-----+
470  * |   struct snd_soc_tplg_enum_control  | 0|1 |
471  * |   struct snd_soc_tplg_mixer_control | 0|N |
472  * +-------------------------------------+-----+
473  *
474  * Optional enum or mixer control can be appended to the end of each widget
475  * in the block.
476  */
477 struct snd_soc_tplg_dapm_widget {
478 	__le32 size;		/* in bytes of this structure */
479 	__le32 id;		/* SND_SOC_DAPM_CTL */
480 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
481 	char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
482 
483 	__le32 reg;		/* negative reg = no direct dapm */
484 	__le32 shift;		/* bits to shift */
485 	__le32 mask;		/* non-shifted mask */
486 	__le32 subseq;		/* sort within widget type */
487 	__le32 invert;		/* invert the power bit */
488 	__le32 ignore_suspend;	/* kept enabled over suspend */
489 	__le16 event_flags;
490 	__le16 event_type;
491 	__le32 num_kcontrols;
492 	struct snd_soc_tplg_private priv;
493 	/*
494 	 * kcontrols that relate to this widget
495 	 * follow here after widget private data
496 	 */
497 } __attribute__((packed));
498 
499 
500 /*
501  * Describes SW/FW specific features of PCM (FE DAI & DAI link).
502  *
503  * File block representation for PCM :-
504  * +-----------------------------------+-----+
505  * | struct snd_soc_tplg_hdr           |  1  |
506  * +-----------------------------------+-----+
507  * | struct snd_soc_tplg_pcm           |  N  |
508  * +-----------------------------------+-----+
509  */
510 struct snd_soc_tplg_pcm {
511 	__le32 size;		/* in bytes of this structure */
512 	char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
513 	char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
514 	__le32 pcm_id;		/* unique ID - used to match with DAI link */
515 	__le32 dai_id;		/* unique ID - used to match */
516 	__le32 playback;	/* supports playback mode */
517 	__le32 capture;		/* supports capture mode */
518 	__le32 compress;	/* 1 = compressed; 0 = PCM */
519 	struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
520 	__le32 num_streams;	/* number of streams */
521 	struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
522 	__le32 flag_mask;       /* bitmask of flags to configure */
523 	__le32 flags;           /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
524 	struct snd_soc_tplg_private priv;
525 } __attribute__((packed));
526 
527 
528 /*
529  * Describes the physical link runtime supported configs or params
530  *
531  * File block representation for physical link config :-
532  * +-----------------------------------+-----+
533  * | struct snd_soc_tplg_hdr           |  1  |
534  * +-----------------------------------+-----+
535  * | struct snd_soc_tplg_link_config   |  N  |
536  * +-----------------------------------+-----+
537  */
538 struct snd_soc_tplg_link_config {
539 	__le32 size;            /* in bytes of this structure */
540 	__le32 id;              /* unique ID - used to match */
541 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
542 	char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
543 	struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
544 	__le32 num_streams;     /* number of streams */
545 	struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
546 	__le32 num_hw_configs;         /* number of hw configs */
547 	__le32 default_hw_config_id;   /* default hw config ID for init */
548 	__le32 flag_mask;       /* bitmask of flags to configure */
549 	__le32 flags;           /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
550 	struct snd_soc_tplg_private priv;
551 } __attribute__((packed));
552 
553 /*
554  * Describes SW/FW specific features of physical DAI.
555  * It can be used to configure backend DAIs for DPCM.
556  *
557  * File block representation for physical DAI :-
558  * +-----------------------------------+-----+
559  * | struct snd_soc_tplg_hdr           |  1  |
560  * +-----------------------------------+-----+
561  * | struct snd_soc_tplg_dai           |  N  |
562  * +-----------------------------------+-----+
563  */
564 struct snd_soc_tplg_dai {
565 	__le32 size;            /* in bytes of this structure */
566 	char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
567 	__le32 dai_id;          /* unique ID - used to match */
568 	__le32 playback;        /* supports playback mode */
569 	__le32 capture;         /* supports capture mode */
570 	struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
571 	__le32 flag_mask;       /* bitmask of flags to configure */
572 	__le32 flags;           /* SND_SOC_TPLG_DAI_FLGBIT_* */
573 	struct snd_soc_tplg_private priv;
574 } __attribute__((packed));
575 
576 /*
577  * Old version of ABI structs, supported for backward compatibility.
578  */
579 
580 /* Manifest v4 */
581 struct snd_soc_tplg_manifest_v4 {
582 	__le32 size;		/* in bytes of this structure */
583 	__le32 control_elems;	/* number of control elements */
584 	__le32 widget_elems;	/* number of widget elements */
585 	__le32 graph_elems;	/* number of graph elements */
586 	__le32 pcm_elems;	/* number of PCM elements */
587 	__le32 dai_link_elems;	/* number of DAI link elements */
588 	struct snd_soc_tplg_private priv;
589 } __packed;
590 
591 /* Stream Capabilities v4 */
592 struct snd_soc_tplg_stream_caps_v4 {
593 	__le32 size;		/* in bytes of this structure */
594 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
595 	__le64 formats;	/* supported formats SNDRV_PCM_FMTBIT_* */
596 	__le32 rates;		/* supported rates SNDRV_PCM_RATE_* */
597 	__le32 rate_min;	/* min rate */
598 	__le32 rate_max;	/* max rate */
599 	__le32 channels_min;	/* min channels */
600 	__le32 channels_max;	/* max channels */
601 	__le32 periods_min;	/* min number of periods */
602 	__le32 periods_max;	/* max number of periods */
603 	__le32 period_size_min;	/* min period size bytes */
604 	__le32 period_size_max;	/* max period size bytes */
605 	__le32 buffer_size_min;	/* min buffer size bytes */
606 	__le32 buffer_size_max;	/* max buffer size bytes */
607 } __packed;
608 
609 /* PCM v4 */
610 struct snd_soc_tplg_pcm_v4 {
611 	__le32 size;		/* in bytes of this structure */
612 	char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
613 	char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
614 	__le32 pcm_id;		/* unique ID - used to match with DAI link */
615 	__le32 dai_id;		/* unique ID - used to match */
616 	__le32 playback;	/* supports playback mode */
617 	__le32 capture;		/* supports capture mode */
618 	__le32 compress;	/* 1 = compressed; 0 = PCM */
619 	struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
620 	__le32 num_streams;	/* number of streams */
621 	struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */
622 } __packed;
623 
624 /* Physical link config v4 */
625 struct snd_soc_tplg_link_config_v4 {
626 	__le32 size;            /* in bytes of this structure */
627 	__le32 id;              /* unique ID - used to match */
628 	struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
629 	__le32 num_streams;     /* number of streams */
630 } __packed;
631 
632 #endif
633