Commit | Line | Data |
---|---|---|
e2be04c7 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
c147c0e1 LG |
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 | #include <sound/asound.h> | |
21 | ||
22 | /* | |
23 | * Maximum number of channels topology kcontrol can represent. | |
24 | */ | |
25 | #define SND_SOC_TPLG_MAX_CHAN 8 | |
26 | ||
27 | /* | |
28 | * Maximum number of PCM formats capability | |
29 | */ | |
30 | #define SND_SOC_TPLG_MAX_FORMATS 16 | |
31 | ||
32 | /* | |
33 | * Maximum number of PCM stream configs | |
34 | */ | |
35 | #define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 | |
36 | ||
676c6b52 ML |
37 | /* |
38 | * Maximum number of physical link's hardware configs | |
39 | */ | |
40 | #define SND_SOC_TPLG_HW_CONFIG_MAX 8 | |
41 | ||
c147c0e1 LG |
42 | /* individual kcontrol info types - can be mixed with other types */ |
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 | /* individual widget kcontrol info types - can be mixed with other types */ | |
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 | /* DAPM widget types - add new items to the end */ | |
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 | |
8a70b454 LG |
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 | |
c147c0e1 LG |
86 | |
87 | /* Header magic number and string sizes */ | |
88 | #define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ | |
89 | ||
90 | /* string sizes */ | |
91 | #define SND_SOC_TPLG_NUM_TEXTS 16 | |
92 | ||
93 | /* ABI version */ | |
288b8da7 ML |
94 | #define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ |
95 | #define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */ | |
c147c0e1 LG |
96 | |
97 | /* Max size of TLV data */ | |
98 | #define SND_SOC_TPLG_TLV_SIZE 32 | |
99 | ||
100 | /* | |
101 | * File and Block header data types. | |
102 | * Add new generic and vendor types to end of list. | |
103 | * Generic types are handled by the core whilst vendors types are passed | |
104 | * to the component drivers for handling. | |
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 | |
7c545b32 VP |
115 | #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 |
116 | #define SND_SOC_TPLG_TYPE_PDATA 11 | |
3fbf7935 ML |
117 | #define SND_SOC_TPLG_TYPE_DAI 12 |
118 | #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI | |
c147c0e1 LG |
119 | |
120 | /* vendor block IDs - please add new vendor types to end */ | |
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 | ||
e42839b0 ML |
129 | /* vendor tuple types */ |
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 | ||
3fbf7935 | 137 | /* DAI flags */ |
dc31e741 ML |
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 | ||
933e1c4a KM |
142 | /* DAI clock gating */ |
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 | ||
e590522a KM |
147 | /* DAI mclk_direction */ |
148 | #define SND_SOC_TPLG_MCLK_CO 0 /* for codec, mclk is output */ | |
149 | #define SND_SOC_TPLG_MCLK_CI 1 /* for codec, mclk is input */ | |
150 | ||
d2e3cb85 ML |
151 | /* DAI physical PCM data formats. |
152 | * Add new formats to the end of the list. | |
153 | */ | |
154 | #define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */ | |
155 | #define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */ | |
156 | #define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */ | |
157 | #define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */ | |
158 | #define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */ | |
159 | #define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */ | |
160 | #define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */ | |
161 | ||
162 | /* left and right justified also known as MSB and LSB respectively */ | |
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 | ||
717a8e72 ML |
166 | /* DAI link flags */ |
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) | |
6ff67cca | 170 | #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) |
717a8e72 | 171 | |
a941e2fa KM |
172 | /* DAI topology BCLK parameter |
173 | * For the backwards capability, by default codec is bclk master | |
174 | */ | |
175 | #define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ | |
176 | #define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ | |
177 | ||
178 | /* DAI topology FSYNC parameter | |
179 | * For the backwards capability, by default codec is fsync master | |
180 | */ | |
181 | #define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ | |
182 | #define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ | |
183 | ||
c147c0e1 LG |
184 | /* |
185 | * Block Header. | |
9c3a4732 | 186 | * This header precedes all object and object arrays below. |
c147c0e1 LG |
187 | */ |
188 | struct snd_soc_tplg_hdr { | |
189 | __le32 magic; /* magic number */ | |
190 | __le32 abi; /* ABI version */ | |
191 | __le32 version; /* optional vendor specific version details */ | |
192 | __le32 type; /* SND_SOC_TPLG_TYPE_ */ | |
193 | __le32 size; /* size of this structure */ | |
194 | __le32 vendor_type; /* optional vendor specific type info */ | |
195 | __le32 payload_size; /* data bytes, excluding this header */ | |
196 | __le32 index; /* identifier for block */ | |
197 | __le32 count; /* number of elements in block */ | |
198 | } __attribute__((packed)); | |
199 | ||
e42839b0 ML |
200 | /* vendor tuple for uuid */ |
201 | struct snd_soc_tplg_vendor_uuid_elem { | |
202 | __le32 token; | |
203 | char uuid[16]; | |
204 | } __attribute__((packed)); | |
205 | ||
206 | /* vendor tuple for a bool/byte/short/word value */ | |
207 | struct snd_soc_tplg_vendor_value_elem { | |
208 | __le32 token; | |
209 | __le32 value; | |
210 | } __attribute__((packed)); | |
211 | ||
212 | /* vendor tuple for string */ | |
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; /* size in bytes of the array, including all elements */ | |
220 | __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ | |
221 | __le32 num_elems; /* number of elements in array */ | |
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 | ||
c147c0e1 LG |
229 | /* |
230 | * Private data. | |
231 | * All topology objects may have private data that can be used by the driver or | |
232 | * firmware. Core will ignore this data. | |
233 | */ | |
234 | struct snd_soc_tplg_private { | |
235 | __le32 size; /* in bytes of private data */ | |
e42839b0 ML |
236 | union { |
237 | char data[0]; | |
238 | struct snd_soc_tplg_vendor_array array[0]; | |
239 | }; | |
c147c0e1 LG |
240 | } __attribute__((packed)); |
241 | ||
242 | /* | |
243 | * Kcontrol TLV data. | |
244 | */ | |
28a87eeb ML |
245 | struct snd_soc_tplg_tlv_dbscale { |
246 | __le32 min; | |
247 | __le32 step; | |
248 | __le32 mute; | |
249 | } __attribute__((packed)); | |
250 | ||
c147c0e1 | 251 | struct snd_soc_tplg_ctl_tlv { |
28a87eeb ML |
252 | __le32 size; /* in bytes of this structure */ |
253 | __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ | |
254 | union { | |
255 | __le32 data[SND_SOC_TPLG_TLV_SIZE]; | |
256 | struct snd_soc_tplg_tlv_dbscale scale; | |
257 | }; | |
c147c0e1 LG |
258 | } __attribute__((packed)); |
259 | ||
260 | /* | |
261 | * Kcontrol channel data | |
262 | */ | |
263 | struct snd_soc_tplg_channel { | |
264 | __le32 size; /* in bytes of this structure */ | |
265 | __le32 reg; | |
266 | __le32 shift; | |
267 | __le32 id; /* ID maps to Left, Right, LFE etc */ | |
268 | } __attribute__((packed)); | |
269 | ||
270 | /* | |
cb88498b ML |
271 | * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops |
272 | * Kcontrol ops need get/put/info. | |
273 | * Bytes ext ops need get/put. | |
c147c0e1 | 274 | */ |
cb88498b | 275 | struct snd_soc_tplg_io_ops { |
c147c0e1 LG |
276 | __le32 get; |
277 | __le32 put; | |
278 | __le32 info; | |
279 | } __attribute__((packed)); | |
280 | ||
281 | /* | |
282 | * kcontrol header | |
283 | */ | |
284 | struct snd_soc_tplg_ctl_hdr { | |
285 | __le32 size; /* in bytes of this structure */ | |
286 | __le32 type; | |
287 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; | |
288 | __le32 access; | |
cb88498b | 289 | struct snd_soc_tplg_io_ops ops; |
28a87eeb | 290 | struct snd_soc_tplg_ctl_tlv tlv; |
c147c0e1 LG |
291 | } __attribute__((packed)); |
292 | ||
293 | /* | |
294 | * Stream Capabilities | |
295 | */ | |
296 | struct snd_soc_tplg_stream_caps { | |
297 | __le32 size; /* in bytes of this structure */ | |
298 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; | |
478d0d39 | 299 | __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ |
c147c0e1 LG |
300 | __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ |
301 | __le32 rate_min; /* min rate */ | |
302 | __le32 rate_max; /* max rate */ | |
303 | __le32 channels_min; /* min channels */ | |
304 | __le32 channels_max; /* max channels */ | |
305 | __le32 periods_min; /* min number of periods */ | |
306 | __le32 periods_max; /* max number of periods */ | |
307 | __le32 period_size_min; /* min period size bytes */ | |
308 | __le32 period_size_max; /* max period size bytes */ | |
309 | __le32 buffer_size_min; /* min buffer size bytes */ | |
310 | __le32 buffer_size_max; /* max buffer size bytes */ | |
f918e169 | 311 | __le32 sig_bits; /* number of bits of content */ |
c147c0e1 LG |
312 | } __attribute__((packed)); |
313 | ||
314 | /* | |
315 | * FE or BE Stream configuration supported by SW/FW | |
316 | */ | |
317 | struct snd_soc_tplg_stream { | |
318 | __le32 size; /* in bytes of this structure */ | |
731324f5 | 319 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ |
c147c0e1 LG |
320 | __le64 format; /* SNDRV_PCM_FMTBIT_* */ |
321 | __le32 rate; /* SNDRV_PCM_RATE_* */ | |
322 | __le32 period_bytes; /* size of period in bytes */ | |
323 | __le32 buffer_bytes; /* size of buffer in bytes */ | |
324 | __le32 channels; /* channels */ | |
c147c0e1 LG |
325 | } __attribute__((packed)); |
326 | ||
676c6b52 ML |
327 | |
328 | /* | |
329 | * Describes a physical link's runtime supported hardware config, | |
330 | * i.e. hardware audio formats. | |
331 | */ | |
332 | struct snd_soc_tplg_hw_config { | |
333 | __le32 size; /* in bytes of this structure */ | |
334 | __le32 id; /* unique ID - - used to match */ | |
335 | __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ | |
933e1c4a | 336 | __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ |
676c6b52 ML |
337 | __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ |
338 | __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ | |
a941e2fa KM |
339 | __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ |
340 | __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ | |
e590522a | 341 | __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ |
676c6b52 ML |
342 | __le16 reserved; /* for 32bit alignment */ |
343 | __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ | |
344 | __le32 bclk_rate; /* BCLK freqency in Hz */ | |
345 | __le32 fsync_rate; /* frame clock in Hz */ | |
346 | __le32 tdm_slots; /* number of TDM slots in use */ | |
347 | __le32 tdm_slot_width; /* width in bits for each slot */ | |
348 | __le32 tx_slots; /* bit mask for active Tx slots */ | |
349 | __le32 rx_slots; /* bit mask for active Rx slots */ | |
350 | __le32 tx_channels; /* number of Tx channels */ | |
351 | __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ | |
352 | __le32 rx_channels; /* number of Rx channels */ | |
353 | __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ | |
354 | } __attribute__((packed)); | |
355 | ||
c147c0e1 LG |
356 | /* |
357 | * Manifest. List totals for each payload type. Not used in parsing, but will | |
358 | * be passed to the component driver before any other objects in order for any | |
9c3a4732 | 359 | * global component resource allocations. |
c147c0e1 LG |
360 | * |
361 | * File block representation for manifest :- | |
362 | * +-----------------------------------+----+ | |
363 | * | struct snd_soc_tplg_hdr | 1 | | |
364 | * +-----------------------------------+----+ | |
365 | * | struct snd_soc_tplg_manifest | 1 | | |
366 | * +-----------------------------------+----+ | |
367 | */ | |
368 | struct snd_soc_tplg_manifest { | |
369 | __le32 size; /* in bytes of this structure */ | |
370 | __le32 control_elems; /* number of control elements */ | |
371 | __le32 widget_elems; /* number of widget elements */ | |
372 | __le32 graph_elems; /* number of graph elements */ | |
4b6c56c2 | 373 | __le32 pcm_elems; /* number of PCM elements */ |
c147c0e1 | 374 | __le32 dai_link_elems; /* number of DAI link elements */ |
17e593e3 | 375 | __le32 dai_elems; /* number of physical DAI elements */ |
dc31e741 | 376 | __le32 reserved[20]; /* reserved for new ABI element types */ |
c3879956 | 377 | struct snd_soc_tplg_private priv; |
c147c0e1 LG |
378 | } __attribute__((packed)); |
379 | ||
380 | /* | |
381 | * Mixer kcontrol. | |
382 | * | |
383 | * File block representation for mixer kcontrol :- | |
384 | * +-----------------------------------+----+ | |
385 | * | struct snd_soc_tplg_hdr | 1 | | |
386 | * +-----------------------------------+----+ | |
387 | * | struct snd_soc_tplg_mixer_control | N | | |
388 | * +-----------------------------------+----+ | |
389 | */ | |
390 | struct snd_soc_tplg_mixer_control { | |
391 | struct snd_soc_tplg_ctl_hdr hdr; | |
392 | __le32 size; /* in bytes of this structure */ | |
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]; | |
c147c0e1 LG |
399 | struct snd_soc_tplg_private priv; |
400 | } __attribute__((packed)); | |
401 | ||
402 | /* | |
403 | * Enumerated kcontrol | |
404 | * | |
405 | * File block representation for enum kcontrol :- | |
406 | * +-----------------------------------+----+ | |
407 | * | struct snd_soc_tplg_hdr | 1 | | |
408 | * +-----------------------------------+----+ | |
409 | * | struct snd_soc_tplg_enum_control | N | | |
410 | * +-----------------------------------+----+ | |
411 | */ | |
412 | struct snd_soc_tplg_enum_control { | |
413 | struct snd_soc_tplg_ctl_hdr hdr; | |
414 | __le32 size; /* in bytes of this structure */ | |
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 | * Bytes kcontrol | |
427 | * | |
428 | * File block representation for bytes kcontrol :- | |
429 | * +-----------------------------------+----+ | |
430 | * | struct snd_soc_tplg_hdr | 1 | | |
431 | * +-----------------------------------+----+ | |
432 | * | struct snd_soc_tplg_bytes_control | N | | |
433 | * +-----------------------------------+----+ | |
434 | */ | |
435 | struct snd_soc_tplg_bytes_control { | |
436 | struct snd_soc_tplg_ctl_hdr hdr; | |
437 | __le32 size; /* in bytes of this structure */ | |
438 | __le32 max; | |
439 | __le32 mask; | |
440 | __le32 base; | |
441 | __le32 num_regs; | |
cb88498b | 442 | struct snd_soc_tplg_io_ops ext_ops; |
c147c0e1 LG |
443 | struct snd_soc_tplg_private priv; |
444 | } __attribute__((packed)); | |
445 | ||
446 | /* | |
447 | * DAPM Graph Element | |
448 | * | |
449 | * File block representation for DAPM graph elements :- | |
450 | * +-------------------------------------+----+ | |
451 | * | struct snd_soc_tplg_hdr | 1 | | |
452 | * +-------------------------------------+----+ | |
453 | * | struct snd_soc_tplg_dapm_graph_elem | N | | |
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 | * DAPM Widget. | |
464 | * | |
465 | * File block representation for DAPM widget :- | |
466 | * +-------------------------------------+-----+ | |
467 | * | struct snd_soc_tplg_hdr | 1 | | |
468 | * +-------------------------------------+-----+ | |
469 | * | struct snd_soc_tplg_dapm_widget | N | | |
470 | * +-------------------------------------+-----+ | |
471 | * | struct snd_soc_tplg_enum_control | 0|1 | | |
472 | * | struct snd_soc_tplg_mixer_control | 0|N | | |
473 | * +-------------------------------------+-----+ | |
474 | * | |
475 | * Optional enum or mixer control can be appended to the end of each widget | |
476 | * in the block. | |
477 | */ | |
478 | struct snd_soc_tplg_dapm_widget { | |
479 | __le32 size; /* in bytes of this structure */ | |
480 | __le32 id; /* SND_SOC_DAPM_CTL */ | |
481 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; | |
482 | char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; | |
483 | ||
484 | __le32 reg; /* negative reg = no direct dapm */ | |
485 | __le32 shift; /* bits to shift */ | |
486 | __le32 mask; /* non-shifted mask */ | |
6dc6db79 | 487 | __le32 subseq; /* sort within widget type */ |
e8b3fe8f VP |
488 | __le32 invert; /* invert the power bit */ |
489 | __le32 ignore_suspend; /* kept enabled over suspend */ | |
490 | __le16 event_flags; | |
491 | __le16 event_type; | |
492 | __le32 num_kcontrols; | |
c147c0e1 LG |
493 | struct snd_soc_tplg_private priv; |
494 | /* | |
495 | * kcontrols that relate to this widget | |
496 | * follow here after widget private data | |
497 | */ | |
498 | } __attribute__((packed)); | |
499 | ||
c147c0e1 LG |
500 | |
501 | /* | |
5b2688a5 | 502 | * Describes SW/FW specific features of PCM (FE DAI & DAI link). |
c147c0e1 | 503 | * |
5b2688a5 | 504 | * File block representation for PCM :- |
c147c0e1 LG |
505 | * +-----------------------------------+-----+ |
506 | * | struct snd_soc_tplg_hdr | 1 | | |
507 | * +-----------------------------------+-----+ | |
5b2688a5 | 508 | * | struct snd_soc_tplg_pcm | N | |
c147c0e1 LG |
509 | * +-----------------------------------+-----+ |
510 | */ | |
5b2688a5 | 511 | struct snd_soc_tplg_pcm { |
c147c0e1 | 512 | __le32 size; /* in bytes of this structure */ |
5b2688a5 VP |
513 | char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
514 | char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; | |
b84fff5a | 515 | __le32 pcm_id; /* unique ID - used to match with DAI link */ |
5b2688a5 VP |
516 | __le32 dai_id; /* unique ID - used to match */ |
517 | __le32 playback; /* supports playback mode */ | |
518 | __le32 capture; /* supports capture mode */ | |
519 | __le32 compress; /* 1 = compressed; 0 = PCM */ | |
520 | struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ | |
521 | __le32 num_streams; /* number of streams */ | |
522 | struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ | |
717a8e72 ML |
523 | __le32 flag_mask; /* bitmask of flags to configure */ |
524 | __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ | |
525 | struct snd_soc_tplg_private priv; | |
c147c0e1 LG |
526 | } __attribute__((packed)); |
527 | ||
e2a9df65 VP |
528 | |
529 | /* | |
676c6b52 | 530 | * Describes the physical link runtime supported configs or params |
e2a9df65 | 531 | * |
676c6b52 | 532 | * File block representation for physical link config :- |
e2a9df65 VP |
533 | * +-----------------------------------+-----+ |
534 | * | struct snd_soc_tplg_hdr | 1 | | |
535 | * +-----------------------------------+-----+ | |
536 | * | struct snd_soc_tplg_link_config | N | | |
537 | * +-----------------------------------+-----+ | |
538 | */ | |
539 | struct snd_soc_tplg_link_config { | |
540 | __le32 size; /* in bytes of this structure */ | |
541 | __le32 id; /* unique ID - used to match */ | |
676c6b52 ML |
542 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ |
543 | char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */ | |
e2a9df65 VP |
544 | struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ |
545 | __le32 num_streams; /* number of streams */ | |
676c6b52 ML |
546 | struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ |
547 | __le32 num_hw_configs; /* number of hw configs */ | |
548 | __le32 default_hw_config_id; /* default hw config ID for init */ | |
549 | __le32 flag_mask; /* bitmask of flags to configure */ | |
550 | __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ | |
551 | struct snd_soc_tplg_private priv; | |
e2a9df65 | 552 | } __attribute__((packed)); |
dc31e741 ML |
553 | |
554 | /* | |
3fbf7935 ML |
555 | * Describes SW/FW specific features of physical DAI. |
556 | * It can be used to configure backend DAIs for DPCM. | |
dc31e741 | 557 | * |
3fbf7935 | 558 | * File block representation for physical DAI :- |
dc31e741 ML |
559 | * +-----------------------------------+-----+ |
560 | * | struct snd_soc_tplg_hdr | 1 | | |
561 | * +-----------------------------------+-----+ | |
3fbf7935 | 562 | * | struct snd_soc_tplg_dai | N | |
dc31e741 ML |
563 | * +-----------------------------------+-----+ |
564 | */ | |
3fbf7935 | 565 | struct snd_soc_tplg_dai { |
dc31e741 ML |
566 | __le32 size; /* in bytes of this structure */ |
567 | char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ | |
568 | __le32 dai_id; /* unique ID - used to match */ | |
569 | __le32 playback; /* supports playback mode */ | |
570 | __le32 capture; /* supports capture mode */ | |
571 | struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ | |
572 | __le32 flag_mask; /* bitmask of flags to configure */ | |
573 | __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ | |
574 | struct snd_soc_tplg_private priv; | |
575 | } __attribute__((packed)); | |
348f4822 GR |
576 | |
577 | /* | |
578 | * Old version of ABI structs, supported for backward compatibility. | |
579 | */ | |
580 | ||
581 | /* Manifest v4 */ | |
582 | struct snd_soc_tplg_manifest_v4 { | |
583 | __le32 size; /* in bytes of this structure */ | |
584 | __le32 control_elems; /* number of control elements */ | |
585 | __le32 widget_elems; /* number of widget elements */ | |
586 | __le32 graph_elems; /* number of graph elements */ | |
587 | __le32 pcm_elems; /* number of PCM elements */ | |
588 | __le32 dai_link_elems; /* number of DAI link elements */ | |
589 | struct snd_soc_tplg_private priv; | |
590 | } __packed; | |
591 | ||
592 | /* Stream Capabilities v4 */ | |
593 | struct snd_soc_tplg_stream_caps_v4 { | |
594 | __le32 size; /* in bytes of this structure */ | |
595 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; | |
596 | __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ | |
597 | __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ | |
598 | __le32 rate_min; /* min rate */ | |
599 | __le32 rate_max; /* max rate */ | |
600 | __le32 channels_min; /* min channels */ | |
601 | __le32 channels_max; /* max channels */ | |
602 | __le32 periods_min; /* min number of periods */ | |
603 | __le32 periods_max; /* max number of periods */ | |
604 | __le32 period_size_min; /* min period size bytes */ | |
605 | __le32 period_size_max; /* max period size bytes */ | |
606 | __le32 buffer_size_min; /* min buffer size bytes */ | |
607 | __le32 buffer_size_max; /* max buffer size bytes */ | |
608 | } __packed; | |
609 | ||
610 | /* PCM v4 */ | |
611 | struct snd_soc_tplg_pcm_v4 { | |
612 | __le32 size; /* in bytes of this structure */ | |
613 | char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; | |
614 | char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; | |
615 | __le32 pcm_id; /* unique ID - used to match with DAI link */ | |
616 | __le32 dai_id; /* unique ID - used to match */ | |
617 | __le32 playback; /* supports playback mode */ | |
618 | __le32 capture; /* supports capture mode */ | |
619 | __le32 compress; /* 1 = compressed; 0 = PCM */ | |
620 | struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ | |
621 | __le32 num_streams; /* number of streams */ | |
622 | struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */ | |
623 | } __packed; | |
624 | ||
625 | /* Physical link config v4 */ | |
626 | struct snd_soc_tplg_link_config_v4 { | |
627 | __le32 size; /* in bytes of this structure */ | |
628 | __le32 id; /* unique ID - used to match */ | |
629 | struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ | |
630 | __le32 num_streams; /* number of streams */ | |
631 | } __packed; | |
632 | ||
c147c0e1 | 633 | #endif |