1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux << 2 /* 1 /* 3 * uapi/sound/asoc.h -- ALSA SoC Firmware Cont 2 * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM 4 * 3 * 5 * Copyright (C) 2012 Texas Instruments Inc. 4 * Copyright (C) 2012 Texas Instruments Inc. 6 * Copyright (C) 2015 Intel Corporation. 5 * Copyright (C) 2015 Intel Corporation. 7 * 6 * >> 7 * This program is free software; you can redistribute it and/or modify >> 8 * it under the terms of the GNU General Public License version 2 as >> 9 * published by the Free Software Foundation. >> 10 * 8 * Simple file API to load FW that includes mi 11 * Simple file API to load FW that includes mixers, coefficients, DAPM graphs, 9 * algorithms, equalisers, DAIs, widgets etc. 12 * algorithms, equalisers, DAIs, widgets etc. 10 */ 13 */ 11 14 12 #ifndef __LINUX_UAPI_SND_ASOC_H 15 #ifndef __LINUX_UAPI_SND_ASOC_H 13 #define __LINUX_UAPI_SND_ASOC_H 16 #define __LINUX_UAPI_SND_ASOC_H 14 17 15 #include <linux/types.h> 18 #include <linux/types.h> 16 #include <sound/asound.h> 19 #include <sound/asound.h> 17 20 >> 21 #ifndef __KERNEL__ >> 22 #error This API is an early revision and not enabled in the current >> 23 #error kernel release, it will be enabled in a future kernel version >> 24 #error with incompatible changes to what is here. >> 25 #endif >> 26 18 /* 27 /* 19 * Maximum number of channels topology kcontro 28 * Maximum number of channels topology kcontrol can represent. 20 */ 29 */ 21 #define SND_SOC_TPLG_MAX_CHAN 8 30 #define SND_SOC_TPLG_MAX_CHAN 8 22 31 23 /* 32 /* 24 * Maximum number of PCM formats capability 33 * Maximum number of PCM formats capability 25 */ 34 */ 26 #define SND_SOC_TPLG_MAX_FORMATS 16 35 #define SND_SOC_TPLG_MAX_FORMATS 16 27 36 28 /* 37 /* 29 * Maximum number of PCM stream configs 38 * Maximum number of PCM stream configs 30 */ 39 */ 31 #define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 40 #define SND_SOC_TPLG_STREAM_CONFIG_MAX 8 32 41 33 /* << 34 * Maximum number of physical link's hardware << 35 */ << 36 #define SND_SOC_TPLG_HW_CONFIG_MAX 8 << 37 << 38 /* individual kcontrol info types - can be mix 42 /* individual kcontrol info types - can be mixed with other types */ 39 #define SND_SOC_TPLG_CTL_VOLSW 1 43 #define SND_SOC_TPLG_CTL_VOLSW 1 40 #define SND_SOC_TPLG_CTL_VOLSW_SX 2 44 #define SND_SOC_TPLG_CTL_VOLSW_SX 2 41 #define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3 45 #define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3 42 #define SND_SOC_TPLG_CTL_ENUM 4 46 #define SND_SOC_TPLG_CTL_ENUM 4 43 #define SND_SOC_TPLG_CTL_BYTES 5 47 #define SND_SOC_TPLG_CTL_BYTES 5 44 #define SND_SOC_TPLG_CTL_ENUM_VALUE 6 48 #define SND_SOC_TPLG_CTL_ENUM_VALUE 6 45 #define SND_SOC_TPLG_CTL_RANGE 7 49 #define SND_SOC_TPLG_CTL_RANGE 7 46 #define SND_SOC_TPLG_CTL_STROBE 8 50 #define SND_SOC_TPLG_CTL_STROBE 8 47 51 48 52 49 /* individual widget kcontrol info types - can 53 /* individual widget kcontrol info types - can be mixed with other types */ 50 #define SND_SOC_TPLG_DAPM_CTL_VOLSW 54 #define SND_SOC_TPLG_DAPM_CTL_VOLSW 64 51 #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 55 #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65 52 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 56 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66 53 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 57 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67 54 #define SND_SOC_TPLG_DAPM_CTL_PIN 58 #define SND_SOC_TPLG_DAPM_CTL_PIN 68 55 59 56 /* DAPM widget types - add new items to the en 60 /* DAPM widget types - add new items to the end */ 57 #define SND_SOC_TPLG_DAPM_INPUT 0 61 #define SND_SOC_TPLG_DAPM_INPUT 0 58 #define SND_SOC_TPLG_DAPM_OUTPUT 1 62 #define SND_SOC_TPLG_DAPM_OUTPUT 1 59 #define SND_SOC_TPLG_DAPM_MUX 2 63 #define SND_SOC_TPLG_DAPM_MUX 2 60 #define SND_SOC_TPLG_DAPM_MIXER 3 64 #define SND_SOC_TPLG_DAPM_MIXER 3 61 #define SND_SOC_TPLG_DAPM_PGA 4 65 #define SND_SOC_TPLG_DAPM_PGA 4 62 #define SND_SOC_TPLG_DAPM_OUT_DRV 5 66 #define SND_SOC_TPLG_DAPM_OUT_DRV 5 63 #define SND_SOC_TPLG_DAPM_ADC 6 67 #define SND_SOC_TPLG_DAPM_ADC 6 64 #define SND_SOC_TPLG_DAPM_DAC 7 68 #define SND_SOC_TPLG_DAPM_DAC 7 65 #define SND_SOC_TPLG_DAPM_SWITCH 8 69 #define SND_SOC_TPLG_DAPM_SWITCH 8 66 #define SND_SOC_TPLG_DAPM_PRE 9 70 #define SND_SOC_TPLG_DAPM_PRE 9 67 #define SND_SOC_TPLG_DAPM_POST 10 71 #define SND_SOC_TPLG_DAPM_POST 10 68 #define SND_SOC_TPLG_DAPM_AIF_IN 11 72 #define SND_SOC_TPLG_DAPM_AIF_IN 11 69 #define SND_SOC_TPLG_DAPM_AIF_OUT 12 73 #define SND_SOC_TPLG_DAPM_AIF_OUT 12 70 #define SND_SOC_TPLG_DAPM_DAI_IN 13 74 #define SND_SOC_TPLG_DAPM_DAI_IN 13 71 #define SND_SOC_TPLG_DAPM_DAI_OUT 14 75 #define SND_SOC_TPLG_DAPM_DAI_OUT 14 72 #define SND_SOC_TPLG_DAPM_DAI_LINK 15 76 #define SND_SOC_TPLG_DAPM_DAI_LINK 15 73 #define SND_SOC_TPLG_DAPM_BUFFER 16 !! 77 #define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DAI_LINK 74 #define SND_SOC_TPLG_DAPM_SCHEDULER 17 << 75 #define SND_SOC_TPLG_DAPM_EFFECT 18 << 76 #define SND_SOC_TPLG_DAPM_SIGGEN 19 << 77 #define SND_SOC_TPLG_DAPM_SRC 20 << 78 #define SND_SOC_TPLG_DAPM_ASRC 21 << 79 #define SND_SOC_TPLG_DAPM_ENCODER 22 << 80 #define SND_SOC_TPLG_DAPM_DECODER 23 << 81 #define SND_SOC_TPLG_DAPM_LAST SND_SO << 82 78 83 /* Header magic number and string sizes */ 79 /* Header magic number and string sizes */ 84 #define SND_SOC_TPLG_MAGIC 0x4153 80 #define SND_SOC_TPLG_MAGIC 0x41536F43 /* ASoC */ 85 81 86 /* string sizes */ 82 /* string sizes */ 87 #define SND_SOC_TPLG_NUM_TEXTS 16 83 #define SND_SOC_TPLG_NUM_TEXTS 16 88 84 89 /* ABI version */ 85 /* ABI version */ 90 #define SND_SOC_TPLG_ABI_VERSION 0x5 !! 86 #define SND_SOC_TPLG_ABI_VERSION 0x4 91 #define SND_SOC_TPLG_ABI_VERSION_MIN 0x5 << 92 87 93 /* Max size of TLV data */ 88 /* Max size of TLV data */ 94 #define SND_SOC_TPLG_TLV_SIZE 32 89 #define SND_SOC_TPLG_TLV_SIZE 32 95 90 96 /* 91 /* 97 * File and Block header data types. 92 * File and Block header data types. 98 * Add new generic and vendor types to end of 93 * Add new generic and vendor types to end of list. 99 * Generic types are handled by the core whils 94 * Generic types are handled by the core whilst vendors types are passed 100 * to the component drivers for handling. 95 * to the component drivers for handling. 101 */ 96 */ 102 #define SND_SOC_TPLG_TYPE_MIXER 1 97 #define SND_SOC_TPLG_TYPE_MIXER 1 103 #define SND_SOC_TPLG_TYPE_BYTES 2 98 #define SND_SOC_TPLG_TYPE_BYTES 2 104 #define SND_SOC_TPLG_TYPE_ENUM 3 99 #define SND_SOC_TPLG_TYPE_ENUM 3 105 #define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4 100 #define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4 106 #define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5 101 #define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5 107 #define SND_SOC_TPLG_TYPE_DAI_LINK 6 102 #define SND_SOC_TPLG_TYPE_DAI_LINK 6 108 #define SND_SOC_TPLG_TYPE_PCM 7 103 #define SND_SOC_TPLG_TYPE_PCM 7 109 #define SND_SOC_TPLG_TYPE_MANIFEST 8 104 #define SND_SOC_TPLG_TYPE_MANIFEST 8 110 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9 105 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9 111 #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 106 #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 112 #define SND_SOC_TPLG_TYPE_PDATA 11 107 #define SND_SOC_TPLG_TYPE_PDATA 11 113 #define SND_SOC_TPLG_TYPE_DAI 12 !! 108 #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_PDATA 114 #define SND_SOC_TPLG_TYPE_MAX SND_SO << 115 109 116 /* vendor block IDs - please add new vendor ty 110 /* vendor block IDs - please add new vendor types to end */ 117 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 111 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000 118 #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001 112 #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001 119 #define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002 113 #define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002 120 #define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003 114 #define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003 121 115 122 #define SND_SOC_TPLG_STREAM_PLAYBACK 0 116 #define SND_SOC_TPLG_STREAM_PLAYBACK 0 123 #define SND_SOC_TPLG_STREAM_CAPTURE 1 117 #define SND_SOC_TPLG_STREAM_CAPTURE 1 124 118 125 /* vendor tuple types */ << 126 #define SND_SOC_TPLG_TUPLE_TYPE_UUID 0 << 127 #define SND_SOC_TPLG_TUPLE_TYPE_STRING 1 << 128 #define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2 << 129 #define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3 << 130 #define SND_SOC_TPLG_TUPLE_TYPE_WORD 4 << 131 #define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5 << 132 << 133 /* DAI flags */ << 134 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATE << 135 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHAN << 136 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMP << 137 << 138 /* DAI clock gating */ << 139 #define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED << 140 #define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1 << 141 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT << 142 << 143 /* DAI mclk_direction */ << 144 #define SND_SOC_TPLG_MCLK_CO 0 /* f << 145 #define SND_SOC_TPLG_MCLK_CI 1 /* f << 146 << 147 /* DAI physical PCM data formats. << 148 * Add new formats to the end of the list. << 149 */ << 150 #define SND_SOC_DAI_FORMAT_I2S 1 /* I << 151 #define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* R << 152 #define SND_SOC_DAI_FORMAT_LEFT_J 3 /* L << 153 #define SND_SOC_DAI_FORMAT_DSP_A 4 /* L << 154 #define SND_SOC_DAI_FORMAT_DSP_B 5 /* L << 155 #define SND_SOC_DAI_FORMAT_AC97 6 /* A << 156 #define SND_SOC_DAI_FORMAT_PDM 7 /* P << 157 << 158 /* left and right justified also known as MSB << 159 #define SND_SOC_DAI_FORMAT_MSB SND_SO << 160 #define SND_SOC_DAI_FORMAT_LSB SND_SO << 161 << 162 /* DAI link flags */ << 163 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATE << 164 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHAN << 165 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMP << 166 #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP << 167 << 168 /* DAI topology BCLK parameter << 169 * For the backwards capability, by default co << 170 */ << 171 #define SND_SOC_TPLG_BCLK_CP 0 /* code << 172 #define SND_SOC_TPLG_BCLK_CC 1 /* code << 173 /* keep previous definitions for compatibility << 174 #define SND_SOC_TPLG_BCLK_CM SND_SOC_T << 175 #define SND_SOC_TPLG_BCLK_CS SND_SOC_T << 176 << 177 /* DAI topology FSYNC parameter << 178 * For the backwards capability, by default co << 179 */ << 180 #define SND_SOC_TPLG_FSYNC_CP 0 /* cod << 181 #define SND_SOC_TPLG_FSYNC_CC 1 /* cod << 182 /* keep previous definitions for compatibility << 183 #define SND_SOC_TPLG_FSYNC_CM SND_SOC_ << 184 #define SND_SOC_TPLG_FSYNC_CS SND_SOC_ << 185 << 186 /* 119 /* 187 * Block Header. 120 * Block Header. 188 * This header precedes all object and object 121 * This header precedes all object and object arrays below. 189 */ 122 */ 190 struct snd_soc_tplg_hdr { 123 struct snd_soc_tplg_hdr { 191 __le32 magic; /* magic numbe 124 __le32 magic; /* magic number */ 192 __le32 abi; /* ABI version 125 __le32 abi; /* ABI version */ 193 __le32 version; /* optional ve 126 __le32 version; /* optional vendor specific version details */ 194 __le32 type; /* SND_SOC_TPL 127 __le32 type; /* SND_SOC_TPLG_TYPE_ */ 195 __le32 size; /* size of thi 128 __le32 size; /* size of this structure */ 196 __le32 vendor_type; /* optional ve 129 __le32 vendor_type; /* optional vendor specific type info */ 197 __le32 payload_size; /* data bytes, 130 __le32 payload_size; /* data bytes, excluding this header */ 198 __le32 index; /* identifier 131 __le32 index; /* identifier for block */ 199 __le32 count; /* number of e 132 __le32 count; /* number of elements in block */ 200 } __attribute__((packed)); 133 } __attribute__((packed)); 201 134 202 /* vendor tuple for uuid */ << 203 struct snd_soc_tplg_vendor_uuid_elem { << 204 __le32 token; << 205 char uuid[16]; << 206 } __attribute__((packed)); << 207 << 208 /* vendor tuple for a bool/byte/short/word val << 209 struct snd_soc_tplg_vendor_value_elem { << 210 __le32 token; << 211 __le32 value; << 212 } __attribute__((packed)); << 213 << 214 /* vendor tuple for string */ << 215 struct snd_soc_tplg_vendor_string_elem { << 216 __le32 token; << 217 char string[SNDRV_CTL_ELEM_ID_NAME_MAX << 218 } __attribute__((packed)); << 219 << 220 struct snd_soc_tplg_vendor_array { << 221 __le32 size; /* size in bytes of th << 222 __le32 type; /* SND_SOC_TPLG_TUPLE_ << 223 __le32 num_elems; /* number of e << 224 union { << 225 __DECLARE_FLEX_ARRAY(struct sn << 226 __DECLARE_FLEX_ARRAY(struct sn << 227 __DECLARE_FLEX_ARRAY(struct sn << 228 }; << 229 } __attribute__((packed)); << 230 << 231 /* 135 /* 232 * Private data. 136 * Private data. 233 * All topology objects may have private data 137 * All topology objects may have private data that can be used by the driver or 234 * firmware. Core will ignore this data. 138 * firmware. Core will ignore this data. 235 */ 139 */ 236 struct snd_soc_tplg_private { 140 struct snd_soc_tplg_private { 237 __le32 size; /* in bytes of private 141 __le32 size; /* in bytes of private data */ 238 union { !! 142 char data[0]; 239 __DECLARE_FLEX_ARRAY(char, dat << 240 __DECLARE_FLEX_ARRAY(struct sn << 241 }; << 242 } __attribute__((packed)); 143 } __attribute__((packed)); 243 144 244 /* 145 /* 245 * Kcontrol TLV data. 146 * Kcontrol TLV data. 246 */ 147 */ 247 struct snd_soc_tplg_tlv_dbscale { 148 struct snd_soc_tplg_tlv_dbscale { 248 __le32 min; 149 __le32 min; 249 __le32 step; 150 __le32 step; 250 __le32 mute; 151 __le32 mute; 251 } __attribute__((packed)); 152 } __attribute__((packed)); 252 153 253 struct snd_soc_tplg_ctl_tlv { 154 struct snd_soc_tplg_ctl_tlv { 254 __le32 size; /* in bytes of this st 155 __le32 size; /* in bytes of this structure */ 255 __le32 type; /* SNDRV_CTL_TLVT_*, t 156 __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ 256 union { 157 union { 257 __le32 data[SND_SOC_TPLG_TLV_S 158 __le32 data[SND_SOC_TPLG_TLV_SIZE]; 258 struct snd_soc_tplg_tlv_dbscal 159 struct snd_soc_tplg_tlv_dbscale scale; 259 }; 160 }; 260 } __attribute__((packed)); 161 } __attribute__((packed)); 261 162 262 /* 163 /* 263 * Kcontrol channel data 164 * Kcontrol channel data 264 */ 165 */ 265 struct snd_soc_tplg_channel { 166 struct snd_soc_tplg_channel { 266 __le32 size; /* in bytes of this st 167 __le32 size; /* in bytes of this structure */ 267 __le32 reg; 168 __le32 reg; 268 __le32 shift; 169 __le32 shift; 269 __le32 id; /* ID maps to Left, Ri 170 __le32 id; /* ID maps to Left, Right, LFE etc */ 270 } __attribute__((packed)); 171 } __attribute__((packed)); 271 172 272 /* 173 /* 273 * Genericl Operations IDs, for binding Kcontr 174 * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops 274 * Kcontrol ops need get/put/info. 175 * Kcontrol ops need get/put/info. 275 * Bytes ext ops need get/put. 176 * Bytes ext ops need get/put. 276 */ 177 */ 277 struct snd_soc_tplg_io_ops { 178 struct snd_soc_tplg_io_ops { 278 __le32 get; 179 __le32 get; 279 __le32 put; 180 __le32 put; 280 __le32 info; 181 __le32 info; 281 } __attribute__((packed)); 182 } __attribute__((packed)); 282 183 283 /* 184 /* 284 * kcontrol header 185 * kcontrol header 285 */ 186 */ 286 struct snd_soc_tplg_ctl_hdr { 187 struct snd_soc_tplg_ctl_hdr { 287 __le32 size; /* in bytes of this st 188 __le32 size; /* in bytes of this structure */ 288 __le32 type; 189 __le32 type; 289 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLE 190 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 290 __le32 access; 191 __le32 access; 291 struct snd_soc_tplg_io_ops ops; 192 struct snd_soc_tplg_io_ops ops; 292 struct snd_soc_tplg_ctl_tlv tlv; 193 struct snd_soc_tplg_ctl_tlv tlv; 293 } __attribute__((packed)); 194 } __attribute__((packed)); 294 195 295 /* 196 /* 296 * Stream Capabilities 197 * Stream Capabilities 297 */ 198 */ 298 struct snd_soc_tplg_stream_caps { 199 struct snd_soc_tplg_stream_caps { 299 __le32 size; /* in bytes of 200 __le32 size; /* in bytes of this structure */ 300 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLE 201 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 301 __le64 formats; /* supported formats S 202 __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ 302 __le32 rates; /* supported r 203 __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ 303 __le32 rate_min; /* min rate */ 204 __le32 rate_min; /* min rate */ 304 __le32 rate_max; /* max rate */ 205 __le32 rate_max; /* max rate */ 305 __le32 channels_min; /* min channel 206 __le32 channels_min; /* min channels */ 306 __le32 channels_max; /* max channel 207 __le32 channels_max; /* max channels */ 307 __le32 periods_min; /* min number 208 __le32 periods_min; /* min number of periods */ 308 __le32 periods_max; /* max number 209 __le32 periods_max; /* max number of periods */ 309 __le32 period_size_min; /* min period 210 __le32 period_size_min; /* min period size bytes */ 310 __le32 period_size_max; /* max period 211 __le32 period_size_max; /* max period size bytes */ 311 __le32 buffer_size_min; /* min buffer 212 __le32 buffer_size_min; /* min buffer size bytes */ 312 __le32 buffer_size_max; /* max buffer 213 __le32 buffer_size_max; /* max buffer size bytes */ 313 __le32 sig_bits; /* number of b << 314 } __attribute__((packed)); 214 } __attribute__((packed)); 315 215 316 /* 216 /* 317 * FE or BE Stream configuration supported by 217 * FE or BE Stream configuration supported by SW/FW 318 */ 218 */ 319 struct snd_soc_tplg_stream { 219 struct snd_soc_tplg_stream { 320 __le32 size; /* in bytes of 220 __le32 size; /* in bytes of this structure */ 321 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLE 221 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ 322 __le64 format; /* SNDRV_PCM_F 222 __le64 format; /* SNDRV_PCM_FMTBIT_* */ 323 __le32 rate; /* SNDRV_PCM_R 223 __le32 rate; /* SNDRV_PCM_RATE_* */ 324 __le32 period_bytes; /* size of per 224 __le32 period_bytes; /* size of period in bytes */ 325 __le32 buffer_bytes; /* size of buf 225 __le32 buffer_bytes; /* size of buffer in bytes */ 326 __le32 channels; /* channels */ 226 __le32 channels; /* channels */ 327 } __attribute__((packed)); 227 } __attribute__((packed)); 328 228 329 << 330 /* << 331 * Describes a physical link's runtime support << 332 * i.e. hardware audio formats. << 333 */ << 334 struct snd_soc_tplg_hw_config { << 335 __le32 size; /* in bytes of << 336 __le32 id; /* unique ID - << 337 __le32 fmt; /* SND_SOC_DAI << 338 __u8 clock_gated; /* SND_SOC_TPL << 339 __u8 invert_bclk; /* 1 for inver << 340 __u8 invert_fsync; /* 1 for inver << 341 __u8 bclk_provider; /* SND_SOC_TPL << 342 __u8 fsync_provider; /* SND_SOC_TPL << 343 __u8 mclk_direction; /* SND_SOC_TPL << 344 __le16 reserved; /* for 32bit a << 345 __le32 mclk_rate; /* MCLK or SYS << 346 __le32 bclk_rate; /* BCLK freqen << 347 __le32 fsync_rate; /* frame clock << 348 __le32 tdm_slots; /* number of T << 349 __le32 tdm_slot_width; /* width in bi << 350 __le32 tx_slots; /* bit mask fo << 351 __le32 rx_slots; /* bit mask fo << 352 __le32 tx_channels; /* number of T << 353 __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHA << 354 __le32 rx_channels; /* number of R << 355 __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHA << 356 } __attribute__((packed)); << 357 << 358 /* 229 /* 359 * Manifest. List totals for each payload type 230 * Manifest. List totals for each payload type. Not used in parsing, but will 360 * be passed to the component driver before an 231 * be passed to the component driver before any other objects in order for any 361 * global component resource allocations. 232 * global component resource allocations. 362 * 233 * 363 * File block representation for manifest :- 234 * File block representation for manifest :- 364 * +-----------------------------------+----+ 235 * +-----------------------------------+----+ 365 * | struct snd_soc_tplg_hdr | 1 | 236 * | struct snd_soc_tplg_hdr | 1 | 366 * +-----------------------------------+----+ 237 * +-----------------------------------+----+ 367 * | struct snd_soc_tplg_manifest | 1 | 238 * | struct snd_soc_tplg_manifest | 1 | 368 * +-----------------------------------+----+ 239 * +-----------------------------------+----+ 369 */ 240 */ 370 struct snd_soc_tplg_manifest { 241 struct snd_soc_tplg_manifest { 371 __le32 size; /* in bytes of 242 __le32 size; /* in bytes of this structure */ 372 __le32 control_elems; /* number of c 243 __le32 control_elems; /* number of control elements */ 373 __le32 widget_elems; /* number of w 244 __le32 widget_elems; /* number of widget elements */ 374 __le32 graph_elems; /* number of g 245 __le32 graph_elems; /* number of graph elements */ 375 __le32 pcm_elems; /* number of P !! 246 __le32 dai_elems; /* number of DAI elements */ 376 __le32 dai_link_elems; /* number of D 247 __le32 dai_link_elems; /* number of DAI link elements */ 377 __le32 dai_elems; /* number of p << 378 __le32 reserved[20]; /* reserved fo << 379 struct snd_soc_tplg_private priv; 248 struct snd_soc_tplg_private priv; 380 } __attribute__((packed)); 249 } __attribute__((packed)); 381 250 382 /* 251 /* 383 * Mixer kcontrol. 252 * Mixer kcontrol. 384 * 253 * 385 * File block representation for mixer kcontro 254 * File block representation for mixer kcontrol :- 386 * +-----------------------------------+----+ 255 * +-----------------------------------+----+ 387 * | struct snd_soc_tplg_hdr | 1 | 256 * | struct snd_soc_tplg_hdr | 1 | 388 * +-----------------------------------+----+ 257 * +-----------------------------------+----+ 389 * | struct snd_soc_tplg_mixer_control | N | 258 * | struct snd_soc_tplg_mixer_control | N | 390 * +-----------------------------------+----+ 259 * +-----------------------------------+----+ 391 */ 260 */ 392 struct snd_soc_tplg_mixer_control { 261 struct snd_soc_tplg_mixer_control { 393 struct snd_soc_tplg_ctl_hdr hdr; 262 struct snd_soc_tplg_ctl_hdr hdr; 394 __le32 size; /* in bytes of this st 263 __le32 size; /* in bytes of this structure */ 395 __le32 min; 264 __le32 min; 396 __le32 max; 265 __le32 max; 397 __le32 platform_max; 266 __le32 platform_max; 398 __le32 invert; 267 __le32 invert; 399 __le32 num_channels; 268 __le32 num_channels; 400 struct snd_soc_tplg_channel channel[SN 269 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; 401 struct snd_soc_tplg_private priv; 270 struct snd_soc_tplg_private priv; 402 } __attribute__((packed)); 271 } __attribute__((packed)); 403 272 404 /* 273 /* 405 * Enumerated kcontrol 274 * Enumerated kcontrol 406 * 275 * 407 * File block representation for enum kcontrol 276 * File block representation for enum kcontrol :- 408 * +-----------------------------------+----+ 277 * +-----------------------------------+----+ 409 * | struct snd_soc_tplg_hdr | 1 | 278 * | struct snd_soc_tplg_hdr | 1 | 410 * +-----------------------------------+----+ 279 * +-----------------------------------+----+ 411 * | struct snd_soc_tplg_enum_control | N | 280 * | struct snd_soc_tplg_enum_control | N | 412 * +-----------------------------------+----+ 281 * +-----------------------------------+----+ 413 */ 282 */ 414 struct snd_soc_tplg_enum_control { 283 struct snd_soc_tplg_enum_control { 415 struct snd_soc_tplg_ctl_hdr hdr; 284 struct snd_soc_tplg_ctl_hdr hdr; 416 __le32 size; /* in bytes of this st 285 __le32 size; /* in bytes of this structure */ 417 __le32 num_channels; 286 __le32 num_channels; 418 struct snd_soc_tplg_channel channel[SN 287 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; 419 __le32 items; 288 __le32 items; 420 __le32 mask; 289 __le32 mask; 421 __le32 count; 290 __le32 count; 422 char texts[SND_SOC_TPLG_NUM_TEXTS][SND 291 char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 423 __le32 values[SND_SOC_TPLG_NUM_TEXTS * 292 __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; 424 struct snd_soc_tplg_private priv; 293 struct snd_soc_tplg_private priv; 425 } __attribute__((packed)); 294 } __attribute__((packed)); 426 295 427 /* 296 /* 428 * Bytes kcontrol 297 * Bytes kcontrol 429 * 298 * 430 * File block representation for bytes kcontro 299 * File block representation for bytes kcontrol :- 431 * +-----------------------------------+----+ 300 * +-----------------------------------+----+ 432 * | struct snd_soc_tplg_hdr | 1 | 301 * | struct snd_soc_tplg_hdr | 1 | 433 * +-----------------------------------+----+ 302 * +-----------------------------------+----+ 434 * | struct snd_soc_tplg_bytes_control | N | 303 * | struct snd_soc_tplg_bytes_control | N | 435 * +-----------------------------------+----+ 304 * +-----------------------------------+----+ 436 */ 305 */ 437 struct snd_soc_tplg_bytes_control { 306 struct snd_soc_tplg_bytes_control { 438 struct snd_soc_tplg_ctl_hdr hdr; 307 struct snd_soc_tplg_ctl_hdr hdr; 439 __le32 size; /* in bytes of this st 308 __le32 size; /* in bytes of this structure */ 440 __le32 max; 309 __le32 max; 441 __le32 mask; 310 __le32 mask; 442 __le32 base; 311 __le32 base; 443 __le32 num_regs; 312 __le32 num_regs; 444 struct snd_soc_tplg_io_ops ext_ops; 313 struct snd_soc_tplg_io_ops ext_ops; 445 struct snd_soc_tplg_private priv; 314 struct snd_soc_tplg_private priv; 446 } __attribute__((packed)); 315 } __attribute__((packed)); 447 316 448 /* 317 /* 449 * DAPM Graph Element 318 * DAPM Graph Element 450 * 319 * 451 * File block representation for DAPM graph el 320 * File block representation for DAPM graph elements :- 452 * +-------------------------------------+---- 321 * +-------------------------------------+----+ 453 * | struct snd_soc_tplg_hdr | 1 322 * | struct snd_soc_tplg_hdr | 1 | 454 * +-------------------------------------+---- 323 * +-------------------------------------+----+ 455 * | struct snd_soc_tplg_dapm_graph_elem | N 324 * | struct snd_soc_tplg_dapm_graph_elem | N | 456 * +-------------------------------------+---- 325 * +-------------------------------------+----+ 457 */ 326 */ 458 struct snd_soc_tplg_dapm_graph_elem { 327 struct snd_soc_tplg_dapm_graph_elem { 459 char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLE 328 char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 460 char control[SNDRV_CTL_ELEM_ID_NAME_MA 329 char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 461 char source[SNDRV_CTL_ELEM_ID_NAME_MAX 330 char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 462 } __attribute__((packed)); 331 } __attribute__((packed)); 463 332 464 /* 333 /* 465 * DAPM Widget. 334 * DAPM Widget. 466 * 335 * 467 * File block representation for DAPM widget : 336 * File block representation for DAPM widget :- 468 * +-------------------------------------+---- 337 * +-------------------------------------+-----+ 469 * | struct snd_soc_tplg_hdr | 1 338 * | struct snd_soc_tplg_hdr | 1 | 470 * +-------------------------------------+---- 339 * +-------------------------------------+-----+ 471 * | struct snd_soc_tplg_dapm_widget | N 340 * | struct snd_soc_tplg_dapm_widget | N | 472 * +-------------------------------------+---- 341 * +-------------------------------------+-----+ 473 * | struct snd_soc_tplg_enum_control | 0|1 342 * | struct snd_soc_tplg_enum_control | 0|1 | 474 * | struct snd_soc_tplg_mixer_control | 0|N 343 * | struct snd_soc_tplg_mixer_control | 0|N | 475 * +-------------------------------------+---- 344 * +-------------------------------------+-----+ 476 * 345 * 477 * Optional enum or mixer control can be appen 346 * Optional enum or mixer control can be appended to the end of each widget 478 * in the block. 347 * in the block. 479 */ 348 */ 480 struct snd_soc_tplg_dapm_widget { 349 struct snd_soc_tplg_dapm_widget { 481 __le32 size; /* in bytes of 350 __le32 size; /* in bytes of this structure */ 482 __le32 id; /* SND_SOC_DAP 351 __le32 id; /* SND_SOC_DAPM_CTL */ 483 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLE 352 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 484 char sname[SNDRV_CTL_ELEM_ID_NAME_MAXL 353 char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 485 354 486 __le32 reg; /* negative re 355 __le32 reg; /* negative reg = no direct dapm */ 487 __le32 shift; /* bits to shi 356 __le32 shift; /* bits to shift */ 488 __le32 mask; /* non-shifted 357 __le32 mask; /* non-shifted mask */ 489 __le32 subseq; /* sort within 358 __le32 subseq; /* sort within widget type */ 490 __le32 invert; /* invert the 359 __le32 invert; /* invert the power bit */ 491 __le32 ignore_suspend; /* kept enable 360 __le32 ignore_suspend; /* kept enabled over suspend */ 492 __le16 event_flags; 361 __le16 event_flags; 493 __le16 event_type; 362 __le16 event_type; 494 __le32 num_kcontrols; 363 __le32 num_kcontrols; 495 struct snd_soc_tplg_private priv; 364 struct snd_soc_tplg_private priv; 496 /* 365 /* 497 * kcontrols that relate to this widge 366 * kcontrols that relate to this widget 498 * follow here after widget private da 367 * follow here after widget private data 499 */ 368 */ 500 } __attribute__((packed)); 369 } __attribute__((packed)); 501 370 502 371 503 /* 372 /* 504 * Describes SW/FW specific features of PCM (F 373 * Describes SW/FW specific features of PCM (FE DAI & DAI link). 505 * 374 * 506 * File block representation for PCM :- 375 * File block representation for PCM :- 507 * +-----------------------------------+-----+ 376 * +-----------------------------------+-----+ 508 * | struct snd_soc_tplg_hdr | 1 | 377 * | struct snd_soc_tplg_hdr | 1 | 509 * +-----------------------------------+-----+ 378 * +-----------------------------------+-----+ 510 * | struct snd_soc_tplg_pcm | N | 379 * | struct snd_soc_tplg_pcm | N | 511 * +-----------------------------------+-----+ 380 * +-----------------------------------+-----+ 512 */ 381 */ 513 struct snd_soc_tplg_pcm { 382 struct snd_soc_tplg_pcm { 514 __le32 size; /* in bytes of 383 __le32 size; /* in bytes of this structure */ 515 char pcm_name[SNDRV_CTL_ELEM_ID_NAME_M 384 char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 516 char dai_name[SNDRV_CTL_ELEM_ID_NAME_M 385 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 517 __le32 pcm_id; /* unique ID - !! 386 __le32 pcm_id; /* unique ID - used to match */ 518 __le32 dai_id; /* unique ID - 387 __le32 dai_id; /* unique ID - used to match */ 519 __le32 playback; /* supports pl 388 __le32 playback; /* supports playback mode */ 520 __le32 capture; /* supports ca 389 __le32 capture; /* supports capture mode */ 521 __le32 compress; /* 1 = compres 390 __le32 compress; /* 1 = compressed; 0 = PCM */ 522 struct snd_soc_tplg_stream stream[SND_ 391 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ 523 __le32 num_streams; /* number of s 392 __le32 num_streams; /* number of streams */ 524 struct snd_soc_tplg_stream_caps caps[2 393 struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ 525 __le32 flag_mask; /* bitmask of << 526 __le32 flags; /* SND_SOC_TPL << 527 struct snd_soc_tplg_private priv; << 528 } __attribute__((packed)); 394 } __attribute__((packed)); 529 395 530 396 531 /* 397 /* 532 * Describes the physical link runtime support !! 398 * Describes the BE or CC link runtime supported configs or params 533 * 399 * 534 * File block representation for physical link !! 400 * File block representation for BE/CC link config :- 535 * +-----------------------------------+-----+ 401 * +-----------------------------------+-----+ 536 * | struct snd_soc_tplg_hdr | 1 | 402 * | struct snd_soc_tplg_hdr | 1 | 537 * +-----------------------------------+-----+ 403 * +-----------------------------------+-----+ 538 * | struct snd_soc_tplg_link_config | N | 404 * | struct snd_soc_tplg_link_config | N | 539 * +-----------------------------------+-----+ 405 * +-----------------------------------+-----+ 540 */ 406 */ 541 struct snd_soc_tplg_link_config { 407 struct snd_soc_tplg_link_config { 542 __le32 size; /* in bytes of 408 __le32 size; /* in bytes of this structure */ 543 __le32 id; /* unique ID - 409 __le32 id; /* unique ID - used to match */ 544 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLE << 545 char stream_name[SNDRV_CTL_ELEM_ID_NAM << 546 struct snd_soc_tplg_stream stream[SND_ 410 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ 547 __le32 num_streams; /* number of s 411 __le32 num_streams; /* number of streams */ 548 struct snd_soc_tplg_hw_config hw_confi << 549 __le32 num_hw_configs; /* numb << 550 __le32 default_hw_config_id; /* defa << 551 __le32 flag_mask; /* bitmask of << 552 __le32 flags; /* SND_SOC_TPL << 553 struct snd_soc_tplg_private priv; << 554 } __attribute__((packed)); 412 } __attribute__((packed)); 555 << 556 /* << 557 * Describes SW/FW specific features of physic << 558 * It can be used to configure backend DAIs fo << 559 * << 560 * File block representation for physical DAI << 561 * +-----------------------------------+-----+ << 562 * | struct snd_soc_tplg_hdr | 1 | << 563 * +-----------------------------------+-----+ << 564 * | struct snd_soc_tplg_dai | N | << 565 * +-----------------------------------+-----+ << 566 */ << 567 struct snd_soc_tplg_dai { << 568 __le32 size; /* in bytes of << 569 char dai_name[SNDRV_CTL_ELEM_ID_NAME_M << 570 __le32 dai_id; /* unique ID - << 571 __le32 playback; /* supports pl << 572 __le32 capture; /* supports ca << 573 struct snd_soc_tplg_stream_caps caps[2 << 574 __le32 flag_mask; /* bitmask of << 575 __le32 flags; /* SND_SOC_TPL << 576 struct snd_soc_tplg_private priv; << 577 } __attribute__((packed)); << 578 << 579 #endif 413 #endif 580 414
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.