Greg Kroah-Hartman | e2be04c | 2017-11-01 15:09:13 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 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 | |
Mengdong Lin | 676c6b5 | 2016-11-03 01:03:52 +0800 | [diff] [blame] | 37 | /* |
| 38 | * Maximum number of physical link's hardware configs |
| 39 | */ |
| 40 | #define SND_SOC_TPLG_HW_CONFIG_MAX 8 |
| 41 | |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 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 |
Liam Girdwood | 8a70b45 | 2017-06-29 14:22:24 +0100 | [diff] [blame] | 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 |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 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 */ |
Mengdong Lin | 288b8da | 2016-11-03 01:03:17 +0800 | [diff] [blame] | 94 | #define SND_SOC_TPLG_ABI_VERSION 0x5 /* current version */ |
| 95 | #define SND_SOC_TPLG_ABI_VERSION_MIN 0x4 /* oldest version supported */ |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 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 |
Vedang Patel | 7c545b3 | 2015-09-30 17:32:04 +0800 | [diff] [blame] | 115 | #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10 |
| 116 | #define SND_SOC_TPLG_TYPE_PDATA 11 |
Mengdong Lin | 3fbf793 | 2016-11-03 01:05:01 +0800 | [diff] [blame] | 117 | #define SND_SOC_TPLG_TYPE_DAI 12 |
| 118 | #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 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 | |
Mengdong Lin | e42839b | 2016-03-24 10:53:14 +0800 | [diff] [blame] | 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 | |
Mengdong Lin | 3fbf793 | 2016-11-03 01:05:01 +0800 | [diff] [blame] | 137 | /* DAI flags */ |
Mengdong Lin | dc31e74 | 2016-07-26 14:32:18 +0800 | [diff] [blame] | 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 | |
Kirill Marinushkin | a2fdb85 | 2018-04-04 06:19:38 +0200 | [diff] [blame] | 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 | |
Mengdong Lin | d2e3cb8 | 2016-09-29 14:09:14 +0800 | [diff] [blame] | 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 /* I2S mode */ |
| 151 | #define SND_SOC_DAI_FORMAT_RIGHT_J 2 /* Right Justified mode */ |
| 152 | #define SND_SOC_DAI_FORMAT_LEFT_J 3 /* Left Justified mode */ |
| 153 | #define SND_SOC_DAI_FORMAT_DSP_A 4 /* L data MSB after FRM LRC */ |
| 154 | #define SND_SOC_DAI_FORMAT_DSP_B 5 /* L data MSB during FRM LRC */ |
| 155 | #define SND_SOC_DAI_FORMAT_AC97 6 /* AC97 */ |
| 156 | #define SND_SOC_DAI_FORMAT_PDM 7 /* Pulse density modulation */ |
| 157 | |
| 158 | /* left and right justified also known as MSB and LSB respectively */ |
| 159 | #define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J |
| 160 | #define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J |
| 161 | |
Mengdong Lin | 717a8e7 | 2016-11-03 01:03:34 +0800 | [diff] [blame] | 162 | /* DAI link flags */ |
| 163 | #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0) |
| 164 | #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1) |
| 165 | #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2) |
Mengdong Lin | 6ff67cc | 2016-11-03 01:05:32 +0800 | [diff] [blame] | 166 | #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3) |
Mengdong Lin | 717a8e7 | 2016-11-03 01:03:34 +0800 | [diff] [blame] | 167 | |
Kirill Marinushkin | b754906 | 2018-04-04 06:19:37 +0200 | [diff] [blame] | 168 | /* DAI topology BCLK parameter |
| 169 | * For the backwards capability, by default codec is bclk master |
| 170 | */ |
| 171 | #define SND_SOC_TPLG_BCLK_CM 0 /* codec is bclk master */ |
| 172 | #define SND_SOC_TPLG_BCLK_CS 1 /* codec is bclk slave */ |
| 173 | |
| 174 | /* DAI topology FSYNC parameter |
| 175 | * For the backwards capability, by default codec is fsync master |
| 176 | */ |
| 177 | #define SND_SOC_TPLG_FSYNC_CM 0 /* codec is fsync master */ |
| 178 | #define SND_SOC_TPLG_FSYNC_CS 1 /* codec is fsync slave */ |
| 179 | |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 180 | /* |
| 181 | * Block Header. |
Vinod Koul | 9c3a473 | 2015-06-29 17:36:45 +0100 | [diff] [blame] | 182 | * This header precedes all object and object arrays below. |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 183 | */ |
| 184 | struct snd_soc_tplg_hdr { |
| 185 | __le32 magic; /* magic number */ |
| 186 | __le32 abi; /* ABI version */ |
| 187 | __le32 version; /* optional vendor specific version details */ |
| 188 | __le32 type; /* SND_SOC_TPLG_TYPE_ */ |
| 189 | __le32 size; /* size of this structure */ |
| 190 | __le32 vendor_type; /* optional vendor specific type info */ |
| 191 | __le32 payload_size; /* data bytes, excluding this header */ |
| 192 | __le32 index; /* identifier for block */ |
| 193 | __le32 count; /* number of elements in block */ |
| 194 | } __attribute__((packed)); |
| 195 | |
Mengdong Lin | e42839b | 2016-03-24 10:53:14 +0800 | [diff] [blame] | 196 | /* vendor tuple for uuid */ |
| 197 | struct snd_soc_tplg_vendor_uuid_elem { |
| 198 | __le32 token; |
| 199 | char uuid[16]; |
| 200 | } __attribute__((packed)); |
| 201 | |
| 202 | /* vendor tuple for a bool/byte/short/word value */ |
| 203 | struct snd_soc_tplg_vendor_value_elem { |
| 204 | __le32 token; |
| 205 | __le32 value; |
| 206 | } __attribute__((packed)); |
| 207 | |
| 208 | /* vendor tuple for string */ |
| 209 | struct snd_soc_tplg_vendor_string_elem { |
| 210 | __le32 token; |
| 211 | char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 212 | } __attribute__((packed)); |
| 213 | |
| 214 | struct snd_soc_tplg_vendor_array { |
| 215 | __le32 size; /* size in bytes of the array, including all elements */ |
| 216 | __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */ |
| 217 | __le32 num_elems; /* number of elements in array */ |
| 218 | union { |
| 219 | struct snd_soc_tplg_vendor_uuid_elem uuid[0]; |
| 220 | struct snd_soc_tplg_vendor_value_elem value[0]; |
| 221 | struct snd_soc_tplg_vendor_string_elem string[0]; |
| 222 | }; |
| 223 | } __attribute__((packed)); |
| 224 | |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 225 | /* |
| 226 | * Private data. |
| 227 | * All topology objects may have private data that can be used by the driver or |
| 228 | * firmware. Core will ignore this data. |
| 229 | */ |
| 230 | struct snd_soc_tplg_private { |
| 231 | __le32 size; /* in bytes of private data */ |
Mengdong Lin | e42839b | 2016-03-24 10:53:14 +0800 | [diff] [blame] | 232 | union { |
| 233 | char data[0]; |
| 234 | struct snd_soc_tplg_vendor_array array[0]; |
| 235 | }; |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 236 | } __attribute__((packed)); |
| 237 | |
| 238 | /* |
| 239 | * Kcontrol TLV data. |
| 240 | */ |
Mengdong Lin | 28a87ee | 2015-08-05 14:41:13 +0100 | [diff] [blame] | 241 | struct snd_soc_tplg_tlv_dbscale { |
| 242 | __le32 min; |
| 243 | __le32 step; |
| 244 | __le32 mute; |
| 245 | } __attribute__((packed)); |
| 246 | |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 247 | struct snd_soc_tplg_ctl_tlv { |
Mengdong Lin | 28a87ee | 2015-08-05 14:41:13 +0100 | [diff] [blame] | 248 | __le32 size; /* in bytes of this structure */ |
| 249 | __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ |
| 250 | union { |
| 251 | __le32 data[SND_SOC_TPLG_TLV_SIZE]; |
| 252 | struct snd_soc_tplg_tlv_dbscale scale; |
| 253 | }; |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 254 | } __attribute__((packed)); |
| 255 | |
| 256 | /* |
| 257 | * Kcontrol channel data |
| 258 | */ |
| 259 | struct snd_soc_tplg_channel { |
| 260 | __le32 size; /* in bytes of this structure */ |
| 261 | __le32 reg; |
| 262 | __le32 shift; |
| 263 | __le32 id; /* ID maps to Left, Right, LFE etc */ |
| 264 | } __attribute__((packed)); |
| 265 | |
| 266 | /* |
Mengdong Lin | cb88498 | 2015-08-05 14:41:14 +0100 | [diff] [blame] | 267 | * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops |
| 268 | * Kcontrol ops need get/put/info. |
| 269 | * Bytes ext ops need get/put. |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 270 | */ |
Mengdong Lin | cb88498 | 2015-08-05 14:41:14 +0100 | [diff] [blame] | 271 | struct snd_soc_tplg_io_ops { |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 272 | __le32 get; |
| 273 | __le32 put; |
| 274 | __le32 info; |
| 275 | } __attribute__((packed)); |
| 276 | |
| 277 | /* |
| 278 | * kcontrol header |
| 279 | */ |
| 280 | struct snd_soc_tplg_ctl_hdr { |
| 281 | __le32 size; /* in bytes of this structure */ |
| 282 | __le32 type; |
| 283 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 284 | __le32 access; |
Mengdong Lin | cb88498 | 2015-08-05 14:41:14 +0100 | [diff] [blame] | 285 | struct snd_soc_tplg_io_ops ops; |
Mengdong Lin | 28a87ee | 2015-08-05 14:41:13 +0100 | [diff] [blame] | 286 | struct snd_soc_tplg_ctl_tlv tlv; |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 287 | } __attribute__((packed)); |
| 288 | |
| 289 | /* |
| 290 | * Stream Capabilities |
| 291 | */ |
| 292 | struct snd_soc_tplg_stream_caps { |
| 293 | __le32 size; /* in bytes of this structure */ |
| 294 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
Mengdong Lin | 478d0d3 | 2015-09-30 17:31:44 +0800 | [diff] [blame] | 295 | __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 296 | __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ |
| 297 | __le32 rate_min; /* min rate */ |
| 298 | __le32 rate_max; /* max rate */ |
| 299 | __le32 channels_min; /* min channels */ |
| 300 | __le32 channels_max; /* max channels */ |
| 301 | __le32 periods_min; /* min number of periods */ |
| 302 | __le32 periods_max; /* max number of periods */ |
| 303 | __le32 period_size_min; /* min period size bytes */ |
| 304 | __le32 period_size_max; /* max period size bytes */ |
| 305 | __le32 buffer_size_min; /* min buffer size bytes */ |
| 306 | __le32 buffer_size_max; /* max buffer size bytes */ |
Mengdong Lin | f918e16 | 2016-08-19 18:12:46 +0800 | [diff] [blame] | 307 | __le32 sig_bits; /* number of bits of content */ |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 308 | } __attribute__((packed)); |
| 309 | |
| 310 | /* |
| 311 | * FE or BE Stream configuration supported by SW/FW |
| 312 | */ |
| 313 | struct snd_soc_tplg_stream { |
| 314 | __le32 size; /* in bytes of this structure */ |
Vedang Patel | 731324f | 2015-09-30 17:31:34 +0800 | [diff] [blame] | 315 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 316 | __le64 format; /* SNDRV_PCM_FMTBIT_* */ |
| 317 | __le32 rate; /* SNDRV_PCM_RATE_* */ |
| 318 | __le32 period_bytes; /* size of period in bytes */ |
| 319 | __le32 buffer_bytes; /* size of buffer in bytes */ |
| 320 | __le32 channels; /* channels */ |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 321 | } __attribute__((packed)); |
| 322 | |
Mengdong Lin | 676c6b5 | 2016-11-03 01:03:52 +0800 | [diff] [blame] | 323 | |
| 324 | /* |
| 325 | * Describes a physical link's runtime supported hardware config, |
| 326 | * i.e. hardware audio formats. |
| 327 | */ |
| 328 | struct snd_soc_tplg_hw_config { |
| 329 | __le32 size; /* in bytes of this structure */ |
| 330 | __le32 id; /* unique ID - - used to match */ |
| 331 | __le32 fmt; /* SND_SOC_DAI_FORMAT_ format value */ |
Kirill Marinushkin | a2fdb85 | 2018-04-04 06:19:38 +0200 | [diff] [blame] | 332 | __u8 clock_gated; /* SND_SOC_TPLG_DAI_CLK_GATE_ value */ |
Mengdong Lin | 676c6b5 | 2016-11-03 01:03:52 +0800 | [diff] [blame] | 333 | __u8 invert_bclk; /* 1 for inverted BCLK, 0 for normal */ |
| 334 | __u8 invert_fsync; /* 1 for inverted frame clock, 0 for normal */ |
Kirill Marinushkin | b754906 | 2018-04-04 06:19:37 +0200 | [diff] [blame] | 335 | __u8 bclk_master; /* SND_SOC_TPLG_BCLK_ value */ |
| 336 | __u8 fsync_master; /* SND_SOC_TPLG_FSYNC_ value */ |
Mengdong Lin | 676c6b5 | 2016-11-03 01:03:52 +0800 | [diff] [blame] | 337 | __u8 mclk_direction; /* 0 for input, 1 for output */ |
| 338 | __le16 reserved; /* for 32bit alignment */ |
| 339 | __le32 mclk_rate; /* MCLK or SYSCLK freqency in Hz */ |
| 340 | __le32 bclk_rate; /* BCLK freqency in Hz */ |
| 341 | __le32 fsync_rate; /* frame clock in Hz */ |
| 342 | __le32 tdm_slots; /* number of TDM slots in use */ |
| 343 | __le32 tdm_slot_width; /* width in bits for each slot */ |
| 344 | __le32 tx_slots; /* bit mask for active Tx slots */ |
| 345 | __le32 rx_slots; /* bit mask for active Rx slots */ |
| 346 | __le32 tx_channels; /* number of Tx channels */ |
| 347 | __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ |
| 348 | __le32 rx_channels; /* number of Rx channels */ |
| 349 | __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */ |
| 350 | } __attribute__((packed)); |
| 351 | |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 352 | /* |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 353 | * Manifest. List totals for each payload type. Not used in parsing, but will |
| 354 | * 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] | 355 | * global component resource allocations. |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 356 | * |
| 357 | * File block representation for manifest :- |
| 358 | * +-----------------------------------+----+ |
| 359 | * | struct snd_soc_tplg_hdr | 1 | |
| 360 | * +-----------------------------------+----+ |
| 361 | * | struct snd_soc_tplg_manifest | 1 | |
| 362 | * +-----------------------------------+----+ |
| 363 | */ |
| 364 | struct snd_soc_tplg_manifest { |
| 365 | __le32 size; /* in bytes of this structure */ |
| 366 | __le32 control_elems; /* number of control elements */ |
| 367 | __le32 widget_elems; /* number of widget elements */ |
| 368 | __le32 graph_elems; /* number of graph elements */ |
Mengdong Lin | 4b6c56c | 2015-10-30 15:13:16 +0800 | [diff] [blame] | 369 | __le32 pcm_elems; /* number of PCM elements */ |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 370 | __le32 dai_link_elems; /* number of DAI link elements */ |
Mengdong Lin | 17e593e | 2016-11-05 08:42:24 +0800 | [diff] [blame] | 371 | __le32 dai_elems; /* number of physical DAI elements */ |
Mengdong Lin | dc31e74 | 2016-07-26 14:32:18 +0800 | [diff] [blame] | 372 | __le32 reserved[20]; /* reserved for new ABI element types */ |
Vinod Koul | c387995 | 2015-06-29 17:36:46 +0100 | [diff] [blame] | 373 | struct snd_soc_tplg_private priv; |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 374 | } __attribute__((packed)); |
| 375 | |
| 376 | /* |
| 377 | * Mixer kcontrol. |
| 378 | * |
| 379 | * File block representation for mixer kcontrol :- |
| 380 | * +-----------------------------------+----+ |
| 381 | * | struct snd_soc_tplg_hdr | 1 | |
| 382 | * +-----------------------------------+----+ |
| 383 | * | struct snd_soc_tplg_mixer_control | N | |
| 384 | * +-----------------------------------+----+ |
| 385 | */ |
| 386 | struct snd_soc_tplg_mixer_control { |
| 387 | struct snd_soc_tplg_ctl_hdr hdr; |
| 388 | __le32 size; /* in bytes of this structure */ |
| 389 | __le32 min; |
| 390 | __le32 max; |
| 391 | __le32 platform_max; |
| 392 | __le32 invert; |
| 393 | __le32 num_channels; |
| 394 | struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 395 | struct snd_soc_tplg_private priv; |
| 396 | } __attribute__((packed)); |
| 397 | |
| 398 | /* |
| 399 | * Enumerated kcontrol |
| 400 | * |
| 401 | * File block representation for enum kcontrol :- |
| 402 | * +-----------------------------------+----+ |
| 403 | * | struct snd_soc_tplg_hdr | 1 | |
| 404 | * +-----------------------------------+----+ |
| 405 | * | struct snd_soc_tplg_enum_control | N | |
| 406 | * +-----------------------------------+----+ |
| 407 | */ |
| 408 | struct snd_soc_tplg_enum_control { |
| 409 | struct snd_soc_tplg_ctl_hdr hdr; |
| 410 | __le32 size; /* in bytes of this structure */ |
| 411 | __le32 num_channels; |
| 412 | struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; |
| 413 | __le32 items; |
| 414 | __le32 mask; |
| 415 | __le32 count; |
| 416 | char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 417 | __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; |
| 418 | struct snd_soc_tplg_private priv; |
| 419 | } __attribute__((packed)); |
| 420 | |
| 421 | /* |
| 422 | * Bytes kcontrol |
| 423 | * |
| 424 | * File block representation for bytes kcontrol :- |
| 425 | * +-----------------------------------+----+ |
| 426 | * | struct snd_soc_tplg_hdr | 1 | |
| 427 | * +-----------------------------------+----+ |
| 428 | * | struct snd_soc_tplg_bytes_control | N | |
| 429 | * +-----------------------------------+----+ |
| 430 | */ |
| 431 | struct snd_soc_tplg_bytes_control { |
| 432 | struct snd_soc_tplg_ctl_hdr hdr; |
| 433 | __le32 size; /* in bytes of this structure */ |
| 434 | __le32 max; |
| 435 | __le32 mask; |
| 436 | __le32 base; |
| 437 | __le32 num_regs; |
Mengdong Lin | cb88498 | 2015-08-05 14:41:14 +0100 | [diff] [blame] | 438 | struct snd_soc_tplg_io_ops ext_ops; |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 439 | struct snd_soc_tplg_private priv; |
| 440 | } __attribute__((packed)); |
| 441 | |
| 442 | /* |
| 443 | * DAPM Graph Element |
| 444 | * |
| 445 | * File block representation for DAPM graph elements :- |
| 446 | * +-------------------------------------+----+ |
| 447 | * | struct snd_soc_tplg_hdr | 1 | |
| 448 | * +-------------------------------------+----+ |
| 449 | * | struct snd_soc_tplg_dapm_graph_elem | N | |
| 450 | * +-------------------------------------+----+ |
| 451 | */ |
| 452 | struct snd_soc_tplg_dapm_graph_elem { |
| 453 | char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 454 | char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 455 | char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 456 | } __attribute__((packed)); |
| 457 | |
| 458 | /* |
| 459 | * DAPM Widget. |
| 460 | * |
| 461 | * File block representation for DAPM widget :- |
| 462 | * +-------------------------------------+-----+ |
| 463 | * | struct snd_soc_tplg_hdr | 1 | |
| 464 | * +-------------------------------------+-----+ |
| 465 | * | struct snd_soc_tplg_dapm_widget | N | |
| 466 | * +-------------------------------------+-----+ |
| 467 | * | struct snd_soc_tplg_enum_control | 0|1 | |
| 468 | * | struct snd_soc_tplg_mixer_control | 0|N | |
| 469 | * +-------------------------------------+-----+ |
| 470 | * |
| 471 | * Optional enum or mixer control can be appended to the end of each widget |
| 472 | * in the block. |
| 473 | */ |
| 474 | struct snd_soc_tplg_dapm_widget { |
| 475 | __le32 size; /* in bytes of this structure */ |
| 476 | __le32 id; /* SND_SOC_DAPM_CTL */ |
| 477 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 478 | char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 479 | |
| 480 | __le32 reg; /* negative reg = no direct dapm */ |
| 481 | __le32 shift; /* bits to shift */ |
| 482 | __le32 mask; /* non-shifted mask */ |
Subhransu S. Prusty | 6dc6db7 | 2015-06-29 17:36:44 +0100 | [diff] [blame] | 483 | __le32 subseq; /* sort within widget type */ |
Vedang Patel | e8b3fe8 | 2015-09-30 17:30:05 +0800 | [diff] [blame] | 484 | __le32 invert; /* invert the power bit */ |
| 485 | __le32 ignore_suspend; /* kept enabled over suspend */ |
| 486 | __le16 event_flags; |
| 487 | __le16 event_type; |
| 488 | __le32 num_kcontrols; |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 489 | struct snd_soc_tplg_private priv; |
| 490 | /* |
| 491 | * kcontrols that relate to this widget |
| 492 | * follow here after widget private data |
| 493 | */ |
| 494 | } __attribute__((packed)); |
| 495 | |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 496 | |
| 497 | /* |
Vedang Patel | 5b2688a | 2015-09-30 17:28:47 +0800 | [diff] [blame] | 498 | * Describes SW/FW specific features of PCM (FE DAI & DAI link). |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 499 | * |
Vedang Patel | 5b2688a | 2015-09-30 17:28:47 +0800 | [diff] [blame] | 500 | * File block representation for PCM :- |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 501 | * +-----------------------------------+-----+ |
| 502 | * | struct snd_soc_tplg_hdr | 1 | |
| 503 | * +-----------------------------------+-----+ |
Vedang Patel | 5b2688a | 2015-09-30 17:28:47 +0800 | [diff] [blame] | 504 | * | struct snd_soc_tplg_pcm | N | |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 505 | * +-----------------------------------+-----+ |
| 506 | */ |
Vedang Patel | 5b2688a | 2015-09-30 17:28:47 +0800 | [diff] [blame] | 507 | struct snd_soc_tplg_pcm { |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 508 | __le32 size; /* in bytes of this structure */ |
Vedang Patel | 5b2688a | 2015-09-30 17:28:47 +0800 | [diff] [blame] | 509 | char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
| 510 | char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; |
Mengdong Lin | b84fff5 | 2016-04-19 13:12:43 +0800 | [diff] [blame] | 511 | __le32 pcm_id; /* unique ID - used to match with DAI link */ |
Vedang Patel | 5b2688a | 2015-09-30 17:28:47 +0800 | [diff] [blame] | 512 | __le32 dai_id; /* unique ID - used to match */ |
| 513 | __le32 playback; /* supports playback mode */ |
| 514 | __le32 capture; /* supports capture mode */ |
| 515 | __le32 compress; /* 1 = compressed; 0 = PCM */ |
| 516 | struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ |
| 517 | __le32 num_streams; /* number of streams */ |
| 518 | 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] | 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; |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 522 | } __attribute__((packed)); |
| 523 | |
Vedang Patel | e2a9df6 | 2015-09-30 17:32:22 +0800 | [diff] [blame] | 524 | |
| 525 | /* |
Mengdong Lin | 676c6b5 | 2016-11-03 01:03:52 +0800 | [diff] [blame] | 526 | * Describes the physical link runtime supported configs or params |
Vedang Patel | e2a9df6 | 2015-09-30 17:32:22 +0800 | [diff] [blame] | 527 | * |
Mengdong Lin | 676c6b5 | 2016-11-03 01:03:52 +0800 | [diff] [blame] | 528 | * File block representation for physical link config :- |
Vedang Patel | e2a9df6 | 2015-09-30 17:32:22 +0800 | [diff] [blame] | 529 | * +-----------------------------------+-----+ |
| 530 | * | struct snd_soc_tplg_hdr | 1 | |
| 531 | * +-----------------------------------+-----+ |
| 532 | * | struct snd_soc_tplg_link_config | N | |
| 533 | * +-----------------------------------+-----+ |
| 534 | */ |
| 535 | struct snd_soc_tplg_link_config { |
| 536 | __le32 size; /* in bytes of this structure */ |
| 537 | __le32 id; /* unique ID - used to match */ |
Mengdong Lin | 676c6b5 | 2016-11-03 01:03:52 +0800 | [diff] [blame] | 538 | char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ |
| 539 | 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] | 540 | struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ |
| 541 | __le32 num_streams; /* number of streams */ |
Mengdong Lin | 676c6b5 | 2016-11-03 01:03:52 +0800 | [diff] [blame] | 542 | struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */ |
| 543 | __le32 num_hw_configs; /* number of hw configs */ |
| 544 | __le32 default_hw_config_id; /* default hw config ID for init */ |
| 545 | __le32 flag_mask; /* bitmask of flags to configure */ |
| 546 | __le32 flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ |
| 547 | struct snd_soc_tplg_private priv; |
Vedang Patel | e2a9df6 | 2015-09-30 17:32:22 +0800 | [diff] [blame] | 548 | } __attribute__((packed)); |
Mengdong Lin | dc31e74 | 2016-07-26 14:32:18 +0800 | [diff] [blame] | 549 | |
| 550 | /* |
Mengdong Lin | 3fbf793 | 2016-11-03 01:05:01 +0800 | [diff] [blame] | 551 | * Describes SW/FW specific features of physical DAI. |
| 552 | * It can be used to configure backend DAIs for DPCM. |
Mengdong Lin | dc31e74 | 2016-07-26 14:32:18 +0800 | [diff] [blame] | 553 | * |
Mengdong Lin | 3fbf793 | 2016-11-03 01:05:01 +0800 | [diff] [blame] | 554 | * File block representation for physical DAI :- |
Mengdong Lin | dc31e74 | 2016-07-26 14:32:18 +0800 | [diff] [blame] | 555 | * +-----------------------------------+-----+ |
| 556 | * | struct snd_soc_tplg_hdr | 1 | |
| 557 | * +-----------------------------------+-----+ |
Mengdong Lin | 3fbf793 | 2016-11-03 01:05:01 +0800 | [diff] [blame] | 558 | * | struct snd_soc_tplg_dai | N | |
Mengdong Lin | dc31e74 | 2016-07-26 14:32:18 +0800 | [diff] [blame] | 559 | * +-----------------------------------+-----+ |
| 560 | */ |
Mengdong Lin | 3fbf793 | 2016-11-03 01:05:01 +0800 | [diff] [blame] | 561 | struct snd_soc_tplg_dai { |
Mengdong Lin | dc31e74 | 2016-07-26 14:32:18 +0800 | [diff] [blame] | 562 | __le32 size; /* in bytes of this structure */ |
| 563 | char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */ |
| 564 | __le32 dai_id; /* unique ID - used to match */ |
| 565 | __le32 playback; /* supports playback mode */ |
| 566 | __le32 capture; /* supports capture mode */ |
| 567 | struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ |
| 568 | __le32 flag_mask; /* bitmask of flags to configure */ |
| 569 | __le32 flags; /* SND_SOC_TPLG_DAI_FLGBIT_* */ |
| 570 | struct snd_soc_tplg_private priv; |
| 571 | } __attribute__((packed)); |
Liam Girdwood | c147c0e | 2015-05-29 19:06:13 +0100 | [diff] [blame] | 572 | #endif |