Path: blob/master/thirdparty/linuxbsd_headers/alsa/sound/asoc.h
9918 views
/*1* uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM2*3* Copyright (C) 2012 Texas Instruments Inc.4* Copyright (C) 2015 Intel Corporation.5*6* This program is free software; you can redistribute it and/or modify7* it under the terms of the GNU General Public License version 2 as8* published by the Free Software Foundation.9*10* Simple file API to load FW that includes mixers, coefficients, DAPM graphs,11* algorithms, equalisers, DAIs, widgets etc.12*/1314#ifndef __LINUX_UAPI_SND_ASOC_H15#define __LINUX_UAPI_SND_ASOC_H1617/*18* Maximum number of channels topology kcontrol can represent.19*/20#define SND_SOC_TPLG_MAX_CHAN 82122/*23* Maximum number of PCM formats capability24*/25#define SND_SOC_TPLG_MAX_FORMATS 162627/*28* Maximum number of PCM stream configs29*/30#define SND_SOC_TPLG_STREAM_CONFIG_MAX 83132/*33* Maximum number of physical link's hardware configs34*/35#define SND_SOC_TPLG_HW_CONFIG_MAX 83637/* individual kcontrol info types - can be mixed with other types */38#define SND_SOC_TPLG_CTL_VOLSW 139#define SND_SOC_TPLG_CTL_VOLSW_SX 240#define SND_SOC_TPLG_CTL_VOLSW_XR_SX 341#define SND_SOC_TPLG_CTL_ENUM 442#define SND_SOC_TPLG_CTL_BYTES 543#define SND_SOC_TPLG_CTL_ENUM_VALUE 644#define SND_SOC_TPLG_CTL_RANGE 745#define SND_SOC_TPLG_CTL_STROBE 8464748/* individual widget kcontrol info types - can be mixed with other types */49#define SND_SOC_TPLG_DAPM_CTL_VOLSW 6450#define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 6551#define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 6652#define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 6753#define SND_SOC_TPLG_DAPM_CTL_PIN 685455/* DAPM widget types - add new items to the end */56#define SND_SOC_TPLG_DAPM_INPUT 057#define SND_SOC_TPLG_DAPM_OUTPUT 158#define SND_SOC_TPLG_DAPM_MUX 259#define SND_SOC_TPLG_DAPM_MIXER 360#define SND_SOC_TPLG_DAPM_PGA 461#define SND_SOC_TPLG_DAPM_OUT_DRV 562#define SND_SOC_TPLG_DAPM_ADC 663#define SND_SOC_TPLG_DAPM_DAC 764#define SND_SOC_TPLG_DAPM_SWITCH 865#define SND_SOC_TPLG_DAPM_PRE 966#define SND_SOC_TPLG_DAPM_POST 1067#define SND_SOC_TPLG_DAPM_AIF_IN 1168#define SND_SOC_TPLG_DAPM_AIF_OUT 1269#define SND_SOC_TPLG_DAPM_DAI_IN 1370#define SND_SOC_TPLG_DAPM_DAI_OUT 1471#define SND_SOC_TPLG_DAPM_DAI_LINK 1572#define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DAI_LINK7374/* Header magic number and string sizes */75#define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */7677/* string sizes */78#define SND_SOC_TPLG_NUM_TEXTS 167980/* ABI version */81#define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */82#define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */8384/* Max size of TLV data */85#define SND_SOC_TPLG_TLV_SIZE 328687/*88* File and Block header data types.89* Add new generic and vendor types to end of list.90* Generic types are handled by the core whilst vendors types are passed91* to the component drivers for handling.92*/93#define SND_SOC_TPLG_TYPE_MIXER 194#define SND_SOC_TPLG_TYPE_BYTES 295#define SND_SOC_TPLG_TYPE_ENUM 396#define SND_SOC_TPLG_TYPE_DAPM_GRAPH 497#define SND_SOC_TPLG_TYPE_DAPM_WIDGET 598#define SND_SOC_TPLG_TYPE_DAI_LINK 699#define SND_SOC_TPLG_TYPE_PCM 7100#define SND_SOC_TPLG_TYPE_MANIFEST 8101#define SND_SOC_TPLG_TYPE_CODEC_LINK 9102#define SND_SOC_TPLG_TYPE_BACKEND_LINK 10103#define SND_SOC_TPLG_TYPE_PDATA 11104#define SND_SOC_TPLG_TYPE_DAI 12105#define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI106107/* vendor block IDs - please add new vendor types to end */108#define SND_SOC_TPLG_TYPE_VENDOR_FW 1000109#define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001110#define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002111#define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003112113#define SND_SOC_TPLG_STREAM_PLAYBACK 0114#define SND_SOC_TPLG_STREAM_CAPTURE 1115116/* vendor tuple types */117#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0118#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1119#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2120#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3121#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4122#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5123124/* DAI flags */125#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)126#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)127#define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)128129/* DAI physical PCM data formats.130* Add new formats to the end of the list.131*/132#define SND_SOC_DAI_FORMAT_I2S 1 /* I2S mode */133#define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */134#define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */135#define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */136#define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */137#define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */138#define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */139140/* left and right justified also known as MSB and LSB respectively */141#define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J142#define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J143144/* DAI link flags */145#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)146#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)147#define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)148#define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)149150/*151* Block Header.152* This header precedes all object and object arrays below.153*/154struct snd_soc_tplg_hdr {155__le32 magic; /* magic number */156__le32 abi; /* ABI version */157__le32 version; /* optional vendor specific version details */158__le32 type; /* SND_SOC_TPLG_TYPE_ */159__le32 size; /* size of this structure */160__le32 vendor_type; /* optional vendor specific type info */161__le32 payload_size; /* data bytes, excluding this header */162__le32 index; /* identifier for block */163__le32 count; /* number of elements in block */164} __attribute__((packed));165166/* vendor tuple for uuid */167struct snd_soc_tplg_vendor_uuid_elem {168__le32 token;169char uuid[16];170} __attribute__((packed));171172/* vendor tuple for a bool/byte/short/word value */173struct snd_soc_tplg_vendor_value_elem {174__le32 token;175__le32 value;176} __attribute__((packed));177178/* vendor tuple for string */179struct snd_soc_tplg_vendor_string_elem {180__le32 token;181char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];182} __attribute__((packed));183184struct snd_soc_tplg_vendor_array {185__le32 size; /* size in bytes of the array, including all elements */186__le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */187__le32 num_elems; /* number of elements in array */188union {189struct snd_soc_tplg_vendor_uuid_elem uuid[0];190struct snd_soc_tplg_vendor_value_elem value[0];191struct snd_soc_tplg_vendor_string_elem string[0];192};193} __attribute__((packed));194195/*196* Private data.197* All topology objects may have private data that can be used by the driver or198* firmware. Core will ignore this data.199*/200struct snd_soc_tplg_private {201__le32 size; /* in bytes of private data */202union {203char data[0];204struct snd_soc_tplg_vendor_array array[0];205};206} __attribute__((packed));207208/*209* Kcontrol TLV data.210*/211struct snd_soc_tplg_tlv_dbscale {212__le32 min;213__le32 step;214__le32 mute;215} __attribute__((packed));216217struct snd_soc_tplg_ctl_tlv {218__le32 size; /* in bytes of this structure */219__le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */220union {221__le32 data[SND_SOC_TPLG_TLV_SIZE];222struct snd_soc_tplg_tlv_dbscale scale;223};224} __attribute__((packed));225226/*227* Kcontrol channel data228*/229struct snd_soc_tplg_channel {230__le32 size; /* in bytes of this structure */231__le32 reg;232__le32 shift;233__le32 id; /* ID maps to Left, Right, LFE etc */234} __attribute__((packed));235236/*237* Genericl Operations IDs, for binding Kcontrol or Bytes ext ops238* Kcontrol ops need get/put/info.239* Bytes ext ops need get/put.240*/241struct snd_soc_tplg_io_ops {242__le32 get;243__le32 put;244__le32 info;245} __attribute__((packed));246247/*248* kcontrol header249*/250struct snd_soc_tplg_ctl_hdr {251__le32 size; /* in bytes of this structure */252__le32 type;253char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];254__le32 access;255struct snd_soc_tplg_io_ops ops;256struct snd_soc_tplg_ctl_tlv tlv;257} __attribute__((packed));258259/*260* Stream Capabilities261*/262struct snd_soc_tplg_stream_caps {263__le32 size; /* in bytes of this structure */264char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];265__le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */266__le32 rates; /* supported rates SNDRV_PCM_RATE_* */267__le32 rate_min; /* min rate */268__le32 rate_max; /* max rate */269__le32 channels_min; /* min channels */270__le32 channels_max; /* max channels */271__le32 periods_min; /* min number of periods */272__le32 periods_max; /* max number of periods */273__le32 period_size_min; /* min period size bytes */274__le32 period_size_max; /* max period size bytes */275__le32 buffer_size_min; /* min buffer size bytes */276__le32 buffer_size_max; /* max buffer size bytes */277__le32 sig_bits; /* number of bits of content */278} __attribute__((packed));279280/*281* FE or BE Stream configuration supported by SW/FW282*/283struct snd_soc_tplg_stream {284__le32 size; /* in bytes of this structure */285char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */286__le64 format; /* SNDRV_PCM_FMTBIT_* */287__le32 rate; /* SNDRV_PCM_RATE_* */288__le32 period_bytes; /* size of period in bytes */289__le32 buffer_bytes; /* size of buffer in bytes */290__le32 channels; /* channels */291} __attribute__((packed));292293294/*295* Describes a physical link's runtime supported hardware config,296* i.e. hardware audio formats.297*/298struct snd_soc_tplg_hw_config {299__le32 size; /* in bytes of this structure */300__le32 id; /* unique ID - - used to match */301__le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */302__u8 clock_gated; /* 1 if clock can be gated to save power */303__u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */304__u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */305__u8 bclk_master; /* 1 for master of BCLK, 0 for slave */306__u8 fsync_master; /* 1 for master of FSYNC, 0 for slave */307__u8 mclk_direction; /* 0 for input, 1 for output */308__le16 reserved; /* for 32bit alignment */309__le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */310__le32 bclk_rate; /* BCLK freqency in Hz */311__le32 fsync_rate; /* frame clock in Hz */312__le32 tdm_slots; /* number of TDM slots in use */313__le32 tdm_slot_width; /* width in bits for each slot */314__le32 tx_slots; /* bit mask for active Tx slots */315__le32 rx_slots; /* bit mask for active Rx slots */316__le32 tx_channels; /* number of Tx channels */317__le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */318__le32 rx_channels; /* number of Rx channels */319__le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */320} __attribute__((packed));321322/*323* Manifest. List totals for each payload type. Not used in parsing, but will324* be passed to the component driver before any other objects in order for any325* global component resource allocations.326*327* File block representation for manifest :-328* +-----------------------------------+----+329* | struct snd_soc_tplg_hdr | 1 |330* +-----------------------------------+----+331* | struct snd_soc_tplg_manifest | 1 |332* +-----------------------------------+----+333*/334struct snd_soc_tplg_manifest {335__le32 size; /* in bytes of this structure */336__le32 control_elems; /* number of control elements */337__le32 widget_elems; /* number of widget elements */338__le32 graph_elems; /* number of graph elements */339__le32 pcm_elems; /* number of PCM elements */340__le32 dai_link_elems; /* number of DAI link elements */341__le32 dai_elems; /* number of physical DAI elements */342__le32 reserved[20]; /* reserved for new ABI element types */343struct snd_soc_tplg_private priv;344} __attribute__((packed));345346/*347* Mixer kcontrol.348*349* File block representation for mixer kcontrol :-350* +-----------------------------------+----+351* | struct snd_soc_tplg_hdr | 1 |352* +-----------------------------------+----+353* | struct snd_soc_tplg_mixer_control | N |354* +-----------------------------------+----+355*/356struct snd_soc_tplg_mixer_control {357struct snd_soc_tplg_ctl_hdr hdr;358__le32 size; /* in bytes of this structure */359__le32 min;360__le32 max;361__le32 platform_max;362__le32 invert;363__le32 num_channels;364struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];365struct snd_soc_tplg_private priv;366} __attribute__((packed));367368/*369* Enumerated kcontrol370*371* File block representation for enum kcontrol :-372* +-----------------------------------+----+373* | struct snd_soc_tplg_hdr | 1 |374* +-----------------------------------+----+375* | struct snd_soc_tplg_enum_control | N |376* +-----------------------------------+----+377*/378struct snd_soc_tplg_enum_control {379struct snd_soc_tplg_ctl_hdr hdr;380__le32 size; /* in bytes of this structure */381__le32 num_channels;382struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];383__le32 items;384__le32 mask;385__le32 count;386char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];387__le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];388struct snd_soc_tplg_private priv;389} __attribute__((packed));390391/*392* Bytes kcontrol393*394* File block representation for bytes kcontrol :-395* +-----------------------------------+----+396* | struct snd_soc_tplg_hdr | 1 |397* +-----------------------------------+----+398* | struct snd_soc_tplg_bytes_control | N |399* +-----------------------------------+----+400*/401struct snd_soc_tplg_bytes_control {402struct snd_soc_tplg_ctl_hdr hdr;403__le32 size; /* in bytes of this structure */404__le32 max;405__le32 mask;406__le32 base;407__le32 num_regs;408struct snd_soc_tplg_io_ops ext_ops;409struct snd_soc_tplg_private priv;410} __attribute__((packed));411412/*413* DAPM Graph Element414*415* File block representation for DAPM graph elements :-416* +-------------------------------------+----+417* | struct snd_soc_tplg_hdr | 1 |418* +-------------------------------------+----+419* | struct snd_soc_tplg_dapm_graph_elem | N |420* +-------------------------------------+----+421*/422struct snd_soc_tplg_dapm_graph_elem {423char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];424char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];425char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];426} __attribute__((packed));427428/*429* DAPM Widget.430*431* File block representation for DAPM widget :-432* +-------------------------------------+-----+433* | struct snd_soc_tplg_hdr | 1 |434* +-------------------------------------+-----+435* | struct snd_soc_tplg_dapm_widget | N |436* +-------------------------------------+-----+437* | struct snd_soc_tplg_enum_control | 0|1 |438* | struct snd_soc_tplg_mixer_control | 0|N |439* +-------------------------------------+-----+440*441* Optional enum or mixer control can be appended to the end of each widget442* in the block.443*/444struct snd_soc_tplg_dapm_widget {445__le32 size; /* in bytes of this structure */446__le32 id; /* SND_SOC_DAPM_CTL */447char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];448char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];449450__le32 reg; /* negative reg = no direct dapm */451__le32 shift; /* bits to shift */452__le32 mask; /* non-shifted mask */453__le32 subseq; /* sort within widget type */454__le32 invert; /* invert the power bit */455__le32 ignore_suspend; /* kept enabled over suspend */456__le16 event_flags;457__le16 event_type;458__le32 num_kcontrols;459struct snd_soc_tplg_private priv;460/*461* kcontrols that relate to this widget462* follow here after widget private data463*/464} __attribute__((packed));465466467/*468* Describes SW/FW specific features of PCM (FE DAI & DAI link).469*470* File block representation for PCM :-471* +-----------------------------------+-----+472* | struct snd_soc_tplg_hdr | 1 |473* +-----------------------------------+-----+474* | struct snd_soc_tplg_pcm | N |475* +-----------------------------------+-----+476*/477struct snd_soc_tplg_pcm {478__le32 size; /* in bytes of this structure */479char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];480char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];481__le32 pcm_id; /* unique ID - used to match with DAI link */482__le32 dai_id; /* unique ID - used to match */483__le32 playback; /* supports playback mode */484__le32 capture; /* supports capture mode */485__le32 compress; /* 1 = compressed; 0 = PCM */486struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */487__le32 num_streams; /* number of streams */488struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */489__le32 flag_mask; /* bitmask of flags to configure */490__le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */491struct snd_soc_tplg_private priv;492} __attribute__((packed));493494495/*496* Describes the physical link runtime supported configs or params497*498* File block representation for physical link config :-499* +-----------------------------------+-----+500* | struct snd_soc_tplg_hdr | 1 |501* +-----------------------------------+-----+502* | struct snd_soc_tplg_link_config | N |503* +-----------------------------------+-----+504*/505struct snd_soc_tplg_link_config {506__le32 size; /* in bytes of this structure */507__le32 id; /* unique ID - used to match */508char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */509char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */510struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */511__le32 num_streams; /* number of streams */512struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */513__le32 num_hw_configs; /* number of hw configs */514__le32 default_hw_config_id; /* default hw config ID for init */515__le32 flag_mask; /* bitmask of flags to configure */516__le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */517struct snd_soc_tplg_private priv;518} __attribute__((packed));519520/*521* Describes SW/FW specific features of physical DAI.522* It can be used to configure backend DAIs for DPCM.523*524* File block representation for physical DAI :-525* +-----------------------------------+-----+526* | struct snd_soc_tplg_hdr | 1 |527* +-----------------------------------+-----+528* | struct snd_soc_tplg_dai | N |529* +-----------------------------------+-----+530*/531struct snd_soc_tplg_dai {532__le32 size; /* in bytes of this structure */533char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */534__le32 dai_id; /* unique ID - used to match */535__le32 playback; /* supports playback mode */536__le32 capture; /* supports capture mode */537struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */538__le32 flag_mask; /* bitmask of flags to configure */539__le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */540struct snd_soc_tplg_private priv;541} __attribute__((packed));542#endif543544545