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