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