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