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 provider 173 */ 174 #define SND_SOC_TPLG_BCLK_CP 0 /* codec is bclk provider */ 175 #define SND_SOC_TPLG_BCLK_CC 1 /* codec is bclk consumer */ 176 /* keep previous definitions for compatibility */ 177 #define SND_SOC_TPLG_BCLK_CM SND_SOC_TPLG_BCLK_CP 178 #define SND_SOC_TPLG_BCLK_CS SND_SOC_TPLG_BCLK_CC 179 180 /* DAI topology FSYNC parameter 181 * For the backwards capability, by default codec is fsync provider 182 */ 183 #define SND_SOC_TPLG_FSYNC_CP 0 /* codec is fsync provider */ 184 #define SND_SOC_TPLG_FSYNC_CC 1 /* codec is fsync consumer */ 185 /* keep previous definitions for compatibility */ 186 #define SND_SOC_TPLG_FSYNC_CM SND_SOC_TPLG_FSYNC_CP 187 #define SND_SOC_TPLG_FSYNC_CS SND_SOC_TPLG_FSYNC_CC 188 189 /* 190 * Block Header. 191 * This header precedes all object and object arrays below. 192 */ 193 struct snd_soc_tplg_hdr { 194 __le32 magic; /* magic number */ 195 __le32 abi; /* ABI version */ 196 __le32 version; /* optional vendor specific version details */ 197 __le32 type; /* SND_SOC_TPLG_TYPE_ */ 198 __le32 size; /* size of this structure */ 199 __le32 vendor_type; /* optional vendor specific type info */ 200 __le32 payload_size; /* data bytes, excluding this header */ 201 __le32 index; /* identifier for block */ 202 __le32 count; /* number of elements in block */ 203 } __attribute__((packed)); 204 205 /* vendor tuple for uuid */ 206 struct snd_soc_tplg_vendor_uuid_elem { 207 __le32 token; 208 char uuid[16]; 209 } __attribute__((packed)); 210 211 /* vendor tuple for a bool/byte/short/word value */ 212 struct snd_soc_tplg_vendor_value_elem { 213 __le32 token; 214 __le32 value; 215 } __attribute__((packed)); 216 217 /* vendor tuple for string */ 218 struct snd_soc_tplg_vendor_string_elem { 219 __le32 token; 220 char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 221 } __attribute__((packed)); 222 223 struct snd_soc_tplg_vendor_array { 224 __le32 size; /* size in bytes of the array, including all elements */ 225 __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ 226 __le32 num_elems; /* number of elements in array */ 227 union { 228 struct snd_soc_tplg_vendor_uuid_elem uuid[0]; 229 struct snd_soc_tplg_vendor_value_elem value[0]; 230 struct snd_soc_tplg_vendor_string_elem string[0]; 231 }; 232 } __attribute__((packed)); 233 234 /* 235 * Private data. 236 * All topology objects may have private data that can be used by the driver or 237 * firmware. Core will ignore this data. 238 */ 239 struct snd_soc_tplg_private { 240 __le32 size; /* in bytes of private data */ 241 union { 242 char data[0]; 243 struct snd_soc_tplg_vendor_array array[0]; 244 }; 245 } __attribute__((packed)); 246 247 /* 248 * Kcontrol TLV data. 249 */ 250 struct snd_soc_tplg_tlv_dbscale { 251 __le32 min; 252 __le32 step; 253 __le32 mute; 254 } __attribute__((packed)); 255 256 struct snd_soc_tplg_ctl_tlv { 257 __le32 size; /* in bytes of this structure */ 258 __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ 259 union { 260 __le32 data[SND_SOC_TPLG_TLV_SIZE]; 261 struct snd_soc_tplg_tlv_dbscale scale; 262 }; 263 } __attribute__((packed)); 264 265 /* 266 * Kcontrol channel data 267 */ 268 struct snd_soc_tplg_channel { 269 __le32 size; /* in bytes of this structure */ 270 __le32 reg; 271 __le32 shift; 272 __le32 id; /* ID maps to Left, Right, LFE etc */ 273 } __attribute__((packed)); 274 275 /* 276 * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops 277 * Kcontrol ops need get/put/info. 278 * Bytes ext ops need get/put. 279 */ 280 struct snd_soc_tplg_io_ops { 281 __le32 get; 282 __le32 put; 283 __le32 info; 284 } __attribute__((packed)); 285 286 /* 287 * kcontrol header 288 */ 289 struct snd_soc_tplg_ctl_hdr { 290 __le32 size; /* in bytes of this structure */ 291 __le32 type; 292 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 293 __le32 access; 294 struct snd_soc_tplg_io_ops ops; 295 struct snd_soc_tplg_ctl_tlv tlv; 296 } __attribute__((packed)); 297 298 /* 299 * Stream Capabilities 300 */ 301 struct snd_soc_tplg_stream_caps { 302 __le32 size; /* in bytes of this structure */ 303 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 304 __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ 305 __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ 306 __le32 rate_min; /* min rate */ 307 __le32 rate_max; /* max rate */ 308 __le32 channels_min; /* min channels */ 309 __le32 channels_max; /* max channels */ 310 __le32 periods_min; /* min number of periods */ 311 __le32 periods_max; /* max number of periods */ 312 __le32 period_size_min; /* min period size bytes */ 313 __le32 period_size_max; /* max period size bytes */ 314 __le32 buffer_size_min; /* min buffer size bytes */ 315 __le32 buffer_size_max; /* max buffer size bytes */ 316 __le32 sig_bits; /* number of bits of content */ 317 } __attribute__((packed)); 318 319 /* 320 * FE or BE Stream configuration supported by SW/FW 321 */ 322 struct snd_soc_tplg_stream { 323 __le32 size; /* in bytes of this structure */ 324 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ 325 __le64 format; /* SNDRV_PCM_FMTBIT_* */ 326 __le32 rate; /* SNDRV_PCM_RATE_* */ 327 __le32 period_bytes; /* size of period in bytes */ 328 __le32 buffer_bytes; /* size of buffer in bytes */ 329 __le32 channels; /* channels */ 330 } __attribute__((packed)); 331 332 333 /* 334 * Describes a physical link's runtime supported hardware config, 335 * i.e. hardware audio formats. 336 */ 337 struct snd_soc_tplg_hw_config { 338 __le32 size; /* in bytes of this structure */ 339 __le32 id; /* unique ID - - used to match */ 340 __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ 341 __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ 342 __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ 343 __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ 344 __u8 bclk_provider; /* SND_SOC_TPLG_BCLK_ value */ 345 __u8 fsync_provider; /* SND_SOC_TPLG_FSYNC_ value */ 346 __u8 mclk_direction; /* SND_SOC_TPLG_MCLK_ value */ 347 __le16 reserved; /* for 32bit alignment */ 348 __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ 349 __le32 bclk_rate; /* BCLK freqency in Hz */ 350 __le32 fsync_rate; /* frame clock in Hz */ 351 __le32 tdm_slots; /* number of TDM slots in use */ 352 __le32 tdm_slot_width; /* width in bits for each slot */ 353 __le32 tx_slots; /* bit mask for active Tx slots */ 354 __le32 rx_slots; /* bit mask for active Rx slots */ 355 __le32 tx_channels; /* number of Tx channels */ 356 __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ 357 __le32 rx_channels; /* number of Rx channels */ 358 __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ 359 } __attribute__((packed)); 360 361 /* 362 * Manifest. List totals for each payload type. Not used in parsing, but will 363 * be passed to the component driver before any other objects in order for any 364 * global component resource allocations. 365 * 366 * File block representation for manifest :- 367 * +-----------------------------------+----+ 368 * | struct snd_soc_tplg_hdr | 1 | 369 * +-----------------------------------+----+ 370 * | struct snd_soc_tplg_manifest | 1 | 371 * +-----------------------------------+----+ 372 */ 373 struct snd_soc_tplg_manifest { 374 __le32 size; /* in bytes of this structure */ 375 __le32 control_elems; /* number of control elements */ 376 __le32 widget_elems; /* number of widget elements */ 377 __le32 graph_elems; /* number of graph elements */ 378 __le32 pcm_elems; /* number of PCM elements */ 379 __le32 dai_link_elems; /* number of DAI link elements */ 380 __le32 dai_elems; /* number of physical DAI elements */ 381 __le32 reserved[20]; /* reserved for new ABI element types */ 382 struct snd_soc_tplg_private priv; 383 } __attribute__((packed)); 384 385 /* 386 * Mixer kcontrol. 387 * 388 * File block representation for mixer kcontrol :- 389 * +-----------------------------------+----+ 390 * | struct snd_soc_tplg_hdr | 1 | 391 * +-----------------------------------+----+ 392 * | struct snd_soc_tplg_mixer_control | N | 393 * +-----------------------------------+----+ 394 */ 395 struct snd_soc_tplg_mixer_control { 396 struct snd_soc_tplg_ctl_hdr hdr; 397 __le32 size; /* in bytes of this structure */ 398 __le32 min; 399 __le32 max; 400 __le32 platform_max; 401 __le32 invert; 402 __le32 num_channels; 403 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; 404 struct snd_soc_tplg_private priv; 405 } __attribute__((packed)); 406 407 /* 408 * Enumerated kcontrol 409 * 410 * File block representation for enum kcontrol :- 411 * +-----------------------------------+----+ 412 * | struct snd_soc_tplg_hdr | 1 | 413 * +-----------------------------------+----+ 414 * | struct snd_soc_tplg_enum_control | N | 415 * +-----------------------------------+----+ 416 */ 417 struct snd_soc_tplg_enum_control { 418 struct snd_soc_tplg_ctl_hdr hdr; 419 __le32 size; /* in bytes of this structure */ 420 __le32 num_channels; 421 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; 422 __le32 items; 423 __le32 mask; 424 __le32 count; 425 char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 426 __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; 427 struct snd_soc_tplg_private priv; 428 } __attribute__((packed)); 429 430 /* 431 * Bytes kcontrol 432 * 433 * File block representation for bytes kcontrol :- 434 * +-----------------------------------+----+ 435 * | struct snd_soc_tplg_hdr | 1 | 436 * +-----------------------------------+----+ 437 * | struct snd_soc_tplg_bytes_control | N | 438 * +-----------------------------------+----+ 439 */ 440 struct snd_soc_tplg_bytes_control { 441 struct snd_soc_tplg_ctl_hdr hdr; 442 __le32 size; /* in bytes of this structure */ 443 __le32 max; 444 __le32 mask; 445 __le32 base; 446 __le32 num_regs; 447 struct snd_soc_tplg_io_ops ext_ops; 448 struct snd_soc_tplg_private priv; 449 } __attribute__((packed)); 450 451 /* 452 * DAPM Graph Element 453 * 454 * File block representation for DAPM graph elements :- 455 * +-------------------------------------+----+ 456 * | struct snd_soc_tplg_hdr | 1 | 457 * +-------------------------------------+----+ 458 * | struct snd_soc_tplg_dapm_graph_elem | N | 459 * +-------------------------------------+----+ 460 */ 461 struct snd_soc_tplg_dapm_graph_elem { 462 char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 463 char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 464 char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 465 } __attribute__((packed)); 466 467 /* 468 * DAPM Widget. 469 * 470 * File block representation for DAPM widget :- 471 * +-------------------------------------+-----+ 472 * | struct snd_soc_tplg_hdr | 1 | 473 * +-------------------------------------+-----+ 474 * | struct snd_soc_tplg_dapm_widget | N | 475 * +-------------------------------------+-----+ 476 * | struct snd_soc_tplg_enum_control | 0|1 | 477 * | struct snd_soc_tplg_mixer_control | 0|N | 478 * +-------------------------------------+-----+ 479 * 480 * Optional enum or mixer control can be appended to the end of each widget 481 * in the block. 482 */ 483 struct snd_soc_tplg_dapm_widget { 484 __le32 size; /* in bytes of this structure */ 485 __le32 id; /* SND_SOC_DAPM_CTL */ 486 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 487 char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 488 489 __le32 reg; /* negative reg = no direct dapm */ 490 __le32 shift; /* bits to shift */ 491 __le32 mask; /* non-shifted mask */ 492 __le32 subseq; /* sort within widget type */ 493 __le32 invert; /* invert the power bit */ 494 __le32 ignore_suspend; /* kept enabled over suspend */ 495 __le16 event_flags; 496 __le16 event_type; 497 __le32 num_kcontrols; 498 struct snd_soc_tplg_private priv; 499 /* 500 * kcontrols that relate to this widget 501 * follow here after widget private data 502 */ 503 } __attribute__((packed)); 504 505 506 /* 507 * Describes SW/FW specific features of PCM (FE DAI & DAI link). 508 * 509 * File block representation for PCM :- 510 * +-----------------------------------+-----+ 511 * | struct snd_soc_tplg_hdr | 1 | 512 * +-----------------------------------+-----+ 513 * | struct snd_soc_tplg_pcm | N | 514 * +-----------------------------------+-----+ 515 */ 516 struct snd_soc_tplg_pcm { 517 __le32 size; /* in bytes of this structure */ 518 char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 519 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 520 __le32 pcm_id; /* unique ID - used to match with DAI link */ 521 __le32 dai_id; /* unique ID - used to match */ 522 __le32 playback; /* supports playback mode */ 523 __le32 capture; /* supports capture mode */ 524 __le32 compress; /* 1 = compressed; 0 = PCM */ 525 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ 526 __le32 num_streams; /* number of streams */ 527 struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ 528 __le32 flag_mask; /* bitmask of flags to configure */ 529 __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ 530 struct snd_soc_tplg_private priv; 531 } __attribute__((packed)); 532 533 534 /* 535 * Describes the physical link runtime supported configs or params 536 * 537 * File block representation for physical link config :- 538 * +-----------------------------------+-----+ 539 * | struct snd_soc_tplg_hdr | 1 | 540 * +-----------------------------------+-----+ 541 * | struct snd_soc_tplg_link_config | N | 542 * +-----------------------------------+-----+ 543 */ 544 struct snd_soc_tplg_link_config { 545 __le32 size; /* in bytes of this structure */ 546 __le32 id; /* unique ID - used to match */ 547 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ 548 char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */ 549 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ 550 __le32 num_streams; /* number of streams */ 551 struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ 552 __le32 num_hw_configs; /* number of hw configs */ 553 __le32 default_hw_config_id; /* default hw config ID for init */ 554 __le32 flag_mask; /* bitmask of flags to configure */ 555 __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ 556 struct snd_soc_tplg_private priv; 557 } __attribute__((packed)); 558 559 /* 560 * Describes SW/FW specific features of physical DAI. 561 * It can be used to configure backend DAIs for DPCM. 562 * 563 * File block representation for physical DAI :- 564 * +-----------------------------------+-----+ 565 * | struct snd_soc_tplg_hdr | 1 | 566 * +-----------------------------------+-----+ 567 * | struct snd_soc_tplg_dai | N | 568 * +-----------------------------------+-----+ 569 */ 570 struct snd_soc_tplg_dai { 571 __le32 size; /* in bytes of this structure */ 572 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ 573 __le32 dai_id; /* unique ID - used to match */ 574 __le32 playback; /* supports playback mode */ 575 __le32 capture; /* supports capture mode */ 576 struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ 577 __le32 flag_mask; /* bitmask of flags to configure */ 578 __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ 579 struct snd_soc_tplg_private priv; 580 } __attribute__((packed)); 581 582 /* 583 * Old version of ABI structs, supported for backward compatibility. 584 */ 585 586 /* Manifest v4 */ 587 struct snd_soc_tplg_manifest_v4 { 588 __le32 size; /* in bytes of this structure */ 589 __le32 control_elems; /* number of control elements */ 590 __le32 widget_elems; /* number of widget elements */ 591 __le32 graph_elems; /* number of graph elements */ 592 __le32 pcm_elems; /* number of PCM elements */ 593 __le32 dai_link_elems; /* number of DAI link elements */ 594 struct snd_soc_tplg_private priv; 595 } __attribute__((packed)); 596 597 /* Stream Capabilities v4 */ 598 struct snd_soc_tplg_stream_caps_v4 { 599 __le32 size; /* in bytes of this structure */ 600 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 601 __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ 602 __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ 603 __le32 rate_min; /* min rate */ 604 __le32 rate_max; /* max rate */ 605 __le32 channels_min; /* min channels */ 606 __le32 channels_max; /* max channels */ 607 __le32 periods_min; /* min number of periods */ 608 __le32 periods_max; /* max number of periods */ 609 __le32 period_size_min; /* min period size bytes */ 610 __le32 period_size_max; /* max period size bytes */ 611 __le32 buffer_size_min; /* min buffer size bytes */ 612 __le32 buffer_size_max; /* max buffer size bytes */ 613 } __attribute__((packed)); 614 615 /* PCM v4 */ 616 struct snd_soc_tplg_pcm_v4 { 617 __le32 size; /* in bytes of this structure */ 618 char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 619 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 620 __le32 pcm_id; /* unique ID - used to match with DAI link */ 621 __le32 dai_id; /* unique ID - used to match */ 622 __le32 playback; /* supports playback mode */ 623 __le32 capture; /* supports capture mode */ 624 __le32 compress; /* 1 = compressed; 0 = PCM */ 625 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ 626 __le32 num_streams; /* number of streams */ 627 struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */ 628 } __attribute__((packed)); 629 630 /* Physical link config v4 */ 631 struct snd_soc_tplg_link_config_v4 { 632 __le32 size; /* in bytes of this structure */ 633 __le32 id; /* unique ID - used to match */ 634 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ 635 __le32 num_streams; /* number of streams */ 636 } __attribute__((packed)); 637 638 #endif 639