0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef __LINUX_UAPI_SND_ASOC_H
0017 #define __LINUX_UAPI_SND_ASOC_H
0018
0019 #include <linux/types.h>
0020 #include <sound/asound.h>
0021
0022
0023
0024
0025 #define SND_SOC_TPLG_MAX_CHAN 8
0026
0027
0028
0029
0030 #define SND_SOC_TPLG_MAX_FORMATS 16
0031
0032
0033
0034
0035 #define SND_SOC_TPLG_STREAM_CONFIG_MAX 8
0036
0037
0038
0039
0040 #define SND_SOC_TPLG_HW_CONFIG_MAX 8
0041
0042
0043 #define SND_SOC_TPLG_CTL_VOLSW 1
0044 #define SND_SOC_TPLG_CTL_VOLSW_SX 2
0045 #define SND_SOC_TPLG_CTL_VOLSW_XR_SX 3
0046 #define SND_SOC_TPLG_CTL_ENUM 4
0047 #define SND_SOC_TPLG_CTL_BYTES 5
0048 #define SND_SOC_TPLG_CTL_ENUM_VALUE 6
0049 #define SND_SOC_TPLG_CTL_RANGE 7
0050 #define SND_SOC_TPLG_CTL_STROBE 8
0051
0052
0053
0054 #define SND_SOC_TPLG_DAPM_CTL_VOLSW 64
0055 #define SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE 65
0056 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT 66
0057 #define SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE 67
0058 #define SND_SOC_TPLG_DAPM_CTL_PIN 68
0059
0060
0061 #define SND_SOC_TPLG_DAPM_INPUT 0
0062 #define SND_SOC_TPLG_DAPM_OUTPUT 1
0063 #define SND_SOC_TPLG_DAPM_MUX 2
0064 #define SND_SOC_TPLG_DAPM_MIXER 3
0065 #define SND_SOC_TPLG_DAPM_PGA 4
0066 #define SND_SOC_TPLG_DAPM_OUT_DRV 5
0067 #define SND_SOC_TPLG_DAPM_ADC 6
0068 #define SND_SOC_TPLG_DAPM_DAC 7
0069 #define SND_SOC_TPLG_DAPM_SWITCH 8
0070 #define SND_SOC_TPLG_DAPM_PRE 9
0071 #define SND_SOC_TPLG_DAPM_POST 10
0072 #define SND_SOC_TPLG_DAPM_AIF_IN 11
0073 #define SND_SOC_TPLG_DAPM_AIF_OUT 12
0074 #define SND_SOC_TPLG_DAPM_DAI_IN 13
0075 #define SND_SOC_TPLG_DAPM_DAI_OUT 14
0076 #define SND_SOC_TPLG_DAPM_DAI_LINK 15
0077 #define SND_SOC_TPLG_DAPM_BUFFER 16
0078 #define SND_SOC_TPLG_DAPM_SCHEDULER 17
0079 #define SND_SOC_TPLG_DAPM_EFFECT 18
0080 #define SND_SOC_TPLG_DAPM_SIGGEN 19
0081 #define SND_SOC_TPLG_DAPM_SRC 20
0082 #define SND_SOC_TPLG_DAPM_ASRC 21
0083 #define SND_SOC_TPLG_DAPM_ENCODER 22
0084 #define SND_SOC_TPLG_DAPM_DECODER 23
0085 #define SND_SOC_TPLG_DAPM_LAST SND_SOC_TPLG_DAPM_DECODER
0086
0087
0088 #define SND_SOC_TPLG_MAGIC 0x41536F43
0089
0090
0091 #define SND_SOC_TPLG_NUM_TEXTS 16
0092
0093
0094 #define SND_SOC_TPLG_ABI_VERSION 0x5
0095 #define SND_SOC_TPLG_ABI_VERSION_MIN 0x4
0096
0097
0098 #define SND_SOC_TPLG_TLV_SIZE 32
0099
0100
0101
0102
0103
0104
0105
0106 #define SND_SOC_TPLG_TYPE_MIXER 1
0107 #define SND_SOC_TPLG_TYPE_BYTES 2
0108 #define SND_SOC_TPLG_TYPE_ENUM 3
0109 #define SND_SOC_TPLG_TYPE_DAPM_GRAPH 4
0110 #define SND_SOC_TPLG_TYPE_DAPM_WIDGET 5
0111 #define SND_SOC_TPLG_TYPE_DAI_LINK 6
0112 #define SND_SOC_TPLG_TYPE_PCM 7
0113 #define SND_SOC_TPLG_TYPE_MANIFEST 8
0114 #define SND_SOC_TPLG_TYPE_CODEC_LINK 9
0115 #define SND_SOC_TPLG_TYPE_BACKEND_LINK 10
0116 #define SND_SOC_TPLG_TYPE_PDATA 11
0117 #define SND_SOC_TPLG_TYPE_DAI 12
0118 #define SND_SOC_TPLG_TYPE_MAX SND_SOC_TPLG_TYPE_DAI
0119
0120
0121 #define SND_SOC_TPLG_TYPE_VENDOR_FW 1000
0122 #define SND_SOC_TPLG_TYPE_VENDOR_CONFIG 1001
0123 #define SND_SOC_TPLG_TYPE_VENDOR_COEFF 1002
0124 #define SND_SOC_TPLG_TYPEVENDOR_CODEC 1003
0125
0126 #define SND_SOC_TPLG_STREAM_PLAYBACK 0
0127 #define SND_SOC_TPLG_STREAM_CAPTURE 1
0128
0129
0130 #define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
0131 #define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
0132 #define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
0133 #define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
0134 #define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
0135 #define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
0136
0137
0138 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES (1 << 0)
0139 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
0140 #define SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
0141
0142
0143 #define SND_SOC_TPLG_DAI_CLK_GATE_UNDEFINED 0
0144 #define SND_SOC_TPLG_DAI_CLK_GATE_GATED 1
0145 #define SND_SOC_TPLG_DAI_CLK_GATE_CONT 2
0146
0147
0148 #define SND_SOC_TPLG_MCLK_CO 0
0149 #define SND_SOC_TPLG_MCLK_CI 1
0150
0151
0152
0153
0154 #define SND_SOC_DAI_FORMAT_I2S 1
0155 #define SND_SOC_DAI_FORMAT_RIGHT_J 2
0156 #define SND_SOC_DAI_FORMAT_LEFT_J 3
0157 #define SND_SOC_DAI_FORMAT_DSP_A 4
0158 #define SND_SOC_DAI_FORMAT_DSP_B 5
0159 #define SND_SOC_DAI_FORMAT_AC97 6
0160 #define SND_SOC_DAI_FORMAT_PDM 7
0161
0162
0163 #define SND_SOC_DAI_FORMAT_MSB SND_SOC_DAI_FORMAT_LEFT_J
0164 #define SND_SOC_DAI_FORMAT_LSB SND_SOC_DAI_FORMAT_RIGHT_J
0165
0166
0167 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES (1 << 0)
0168 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS (1 << 1)
0169 #define SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS (1 << 2)
0170 #define SND_SOC_TPLG_LNK_FLGBIT_VOICE_WAKEUP (1 << 3)
0171
0172
0173
0174
0175 #define SND_SOC_TPLG_BCLK_CP 0
0176 #define SND_SOC_TPLG_BCLK_CC 1
0177
0178 #define SND_SOC_TPLG_BCLK_CM SND_SOC_TPLG_BCLK_CP
0179 #define SND_SOC_TPLG_BCLK_CS SND_SOC_TPLG_BCLK_CC
0180
0181
0182
0183
0184 #define SND_SOC_TPLG_FSYNC_CP 0
0185 #define SND_SOC_TPLG_FSYNC_CC 1
0186
0187 #define SND_SOC_TPLG_FSYNC_CM SND_SOC_TPLG_FSYNC_CP
0188 #define SND_SOC_TPLG_FSYNC_CS SND_SOC_TPLG_FSYNC_CC
0189
0190
0191
0192
0193
0194 struct snd_soc_tplg_hdr {
0195 __le32 magic;
0196 __le32 abi;
0197 __le32 version;
0198 __le32 type;
0199 __le32 size;
0200 __le32 vendor_type;
0201 __le32 payload_size;
0202 __le32 index;
0203 __le32 count;
0204 } __attribute__((packed));
0205
0206
0207 struct snd_soc_tplg_vendor_uuid_elem {
0208 __le32 token;
0209 char uuid[16];
0210 } __attribute__((packed));
0211
0212
0213 struct snd_soc_tplg_vendor_value_elem {
0214 __le32 token;
0215 __le32 value;
0216 } __attribute__((packed));
0217
0218
0219 struct snd_soc_tplg_vendor_string_elem {
0220 __le32 token;
0221 char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0222 } __attribute__((packed));
0223
0224 struct snd_soc_tplg_vendor_array {
0225 __le32 size;
0226 __le32 type;
0227 __le32 num_elems;
0228 union {
0229 struct snd_soc_tplg_vendor_uuid_elem uuid[0];
0230 struct snd_soc_tplg_vendor_value_elem value[0];
0231 struct snd_soc_tplg_vendor_string_elem string[0];
0232 };
0233 } __attribute__((packed));
0234
0235
0236
0237
0238
0239
0240 struct snd_soc_tplg_private {
0241 __le32 size;
0242 union {
0243 __DECLARE_FLEX_ARRAY(char, data);
0244 __DECLARE_FLEX_ARRAY(struct snd_soc_tplg_vendor_array, array);
0245 };
0246 } __attribute__((packed));
0247
0248
0249
0250
0251 struct snd_soc_tplg_tlv_dbscale {
0252 __le32 min;
0253 __le32 step;
0254 __le32 mute;
0255 } __attribute__((packed));
0256
0257 struct snd_soc_tplg_ctl_tlv {
0258 __le32 size;
0259 __le32 type;
0260 union {
0261 __le32 data[SND_SOC_TPLG_TLV_SIZE];
0262 struct snd_soc_tplg_tlv_dbscale scale;
0263 };
0264 } __attribute__((packed));
0265
0266
0267
0268
0269 struct snd_soc_tplg_channel {
0270 __le32 size;
0271 __le32 reg;
0272 __le32 shift;
0273 __le32 id;
0274 } __attribute__((packed));
0275
0276
0277
0278
0279
0280
0281 struct snd_soc_tplg_io_ops {
0282 __le32 get;
0283 __le32 put;
0284 __le32 info;
0285 } __attribute__((packed));
0286
0287
0288
0289
0290 struct snd_soc_tplg_ctl_hdr {
0291 __le32 size;
0292 __le32 type;
0293 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0294 __le32 access;
0295 struct snd_soc_tplg_io_ops ops;
0296 struct snd_soc_tplg_ctl_tlv tlv;
0297 } __attribute__((packed));
0298
0299
0300
0301
0302 struct snd_soc_tplg_stream_caps {
0303 __le32 size;
0304 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0305 __le64 formats;
0306 __le32 rates;
0307 __le32 rate_min;
0308 __le32 rate_max;
0309 __le32 channels_min;
0310 __le32 channels_max;
0311 __le32 periods_min;
0312 __le32 periods_max;
0313 __le32 period_size_min;
0314 __le32 period_size_max;
0315 __le32 buffer_size_min;
0316 __le32 buffer_size_max;
0317 __le32 sig_bits;
0318 } __attribute__((packed));
0319
0320
0321
0322
0323 struct snd_soc_tplg_stream {
0324 __le32 size;
0325 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0326 __le64 format;
0327 __le32 rate;
0328 __le32 period_bytes;
0329 __le32 buffer_bytes;
0330 __le32 channels;
0331 } __attribute__((packed));
0332
0333
0334
0335
0336
0337
0338 struct snd_soc_tplg_hw_config {
0339 __le32 size;
0340 __le32 id;
0341 __le32 fmt;
0342 __u8 clock_gated;
0343 __u8 invert_bclk;
0344 __u8 invert_fsync;
0345 __u8 bclk_provider;
0346 __u8 fsync_provider;
0347 __u8 mclk_direction;
0348 __le16 reserved;
0349 __le32 mclk_rate;
0350 __le32 bclk_rate;
0351 __le32 fsync_rate;
0352 __le32 tdm_slots;
0353 __le32 tdm_slot_width;
0354 __le32 tx_slots;
0355 __le32 rx_slots;
0356 __le32 tx_channels;
0357 __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN];
0358 __le32 rx_channels;
0359 __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN];
0360 } __attribute__((packed));
0361
0362
0363
0364
0365
0366
0367
0368
0369
0370
0371
0372
0373
0374 struct snd_soc_tplg_manifest {
0375 __le32 size;
0376 __le32 control_elems;
0377 __le32 widget_elems;
0378 __le32 graph_elems;
0379 __le32 pcm_elems;
0380 __le32 dai_link_elems;
0381 __le32 dai_elems;
0382 __le32 reserved[20];
0383 struct snd_soc_tplg_private priv;
0384 } __attribute__((packed));
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396 struct snd_soc_tplg_mixer_control {
0397 struct snd_soc_tplg_ctl_hdr hdr;
0398 __le32 size;
0399 __le32 min;
0400 __le32 max;
0401 __le32 platform_max;
0402 __le32 invert;
0403 __le32 num_channels;
0404 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
0405 struct snd_soc_tplg_private priv;
0406 } __attribute__((packed));
0407
0408
0409
0410
0411
0412
0413
0414
0415
0416
0417
0418 struct snd_soc_tplg_enum_control {
0419 struct snd_soc_tplg_ctl_hdr hdr;
0420 __le32 size;
0421 __le32 num_channels;
0422 struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN];
0423 __le32 items;
0424 __le32 mask;
0425 __le32 count;
0426 char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0427 __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4];
0428 struct snd_soc_tplg_private priv;
0429 } __attribute__((packed));
0430
0431
0432
0433
0434
0435
0436
0437
0438
0439
0440
0441 struct snd_soc_tplg_bytes_control {
0442 struct snd_soc_tplg_ctl_hdr hdr;
0443 __le32 size;
0444 __le32 max;
0445 __le32 mask;
0446 __le32 base;
0447 __le32 num_regs;
0448 struct snd_soc_tplg_io_ops ext_ops;
0449 struct snd_soc_tplg_private priv;
0450 } __attribute__((packed));
0451
0452
0453
0454
0455
0456
0457
0458
0459
0460
0461
0462 struct snd_soc_tplg_dapm_graph_elem {
0463 char sink[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0464 char control[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0465 char source[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0466 } __attribute__((packed));
0467
0468
0469
0470
0471
0472
0473
0474
0475
0476
0477
0478
0479
0480
0481
0482
0483
0484 struct snd_soc_tplg_dapm_widget {
0485 __le32 size;
0486 __le32 id;
0487 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0488 char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0489
0490 __le32 reg;
0491 __le32 shift;
0492 __le32 mask;
0493 __le32 subseq;
0494 __le32 invert;
0495 __le32 ignore_suspend;
0496 __le16 event_flags;
0497 __le16 event_type;
0498 __le32 num_kcontrols;
0499 struct snd_soc_tplg_private priv;
0500
0501
0502
0503
0504 } __attribute__((packed));
0505
0506
0507
0508
0509
0510
0511
0512
0513
0514
0515
0516
0517 struct snd_soc_tplg_pcm {
0518 __le32 size;
0519 char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0520 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0521 __le32 pcm_id;
0522 __le32 dai_id;
0523 __le32 playback;
0524 __le32 capture;
0525 __le32 compress;
0526 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
0527 __le32 num_streams;
0528 struct snd_soc_tplg_stream_caps caps[2];
0529 __le32 flag_mask;
0530 __le32 flags;
0531 struct snd_soc_tplg_private priv;
0532 } __attribute__((packed));
0533
0534
0535
0536
0537
0538
0539
0540
0541
0542
0543
0544
0545 struct snd_soc_tplg_link_config {
0546 __le32 size;
0547 __le32 id;
0548 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0549 char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0550 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
0551 __le32 num_streams;
0552 struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX];
0553 __le32 num_hw_configs;
0554 __le32 default_hw_config_id;
0555 __le32 flag_mask;
0556 __le32 flags;
0557 struct snd_soc_tplg_private priv;
0558 } __attribute__((packed));
0559
0560
0561
0562
0563
0564
0565
0566
0567
0568
0569
0570
0571 struct snd_soc_tplg_dai {
0572 __le32 size;
0573 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0574 __le32 dai_id;
0575 __le32 playback;
0576 __le32 capture;
0577 struct snd_soc_tplg_stream_caps caps[2];
0578 __le32 flag_mask;
0579 __le32 flags;
0580 struct snd_soc_tplg_private priv;
0581 } __attribute__((packed));
0582
0583
0584
0585
0586
0587
0588 struct snd_soc_tplg_manifest_v4 {
0589 __le32 size;
0590 __le32 control_elems;
0591 __le32 widget_elems;
0592 __le32 graph_elems;
0593 __le32 pcm_elems;
0594 __le32 dai_link_elems;
0595 struct snd_soc_tplg_private priv;
0596 } __packed;
0597
0598
0599 struct snd_soc_tplg_stream_caps_v4 {
0600 __le32 size;
0601 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0602 __le64 formats;
0603 __le32 rates;
0604 __le32 rate_min;
0605 __le32 rate_max;
0606 __le32 channels_min;
0607 __le32 channels_max;
0608 __le32 periods_min;
0609 __le32 periods_max;
0610 __le32 period_size_min;
0611 __le32 period_size_max;
0612 __le32 buffer_size_min;
0613 __le32 buffer_size_max;
0614 } __packed;
0615
0616
0617 struct snd_soc_tplg_pcm_v4 {
0618 __le32 size;
0619 char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0620 char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0621 __le32 pcm_id;
0622 __le32 dai_id;
0623 __le32 playback;
0624 __le32 capture;
0625 __le32 compress;
0626 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
0627 __le32 num_streams;
0628 struct snd_soc_tplg_stream_caps_v4 caps[2];
0629 } __packed;
0630
0631
0632 struct snd_soc_tplg_link_config_v4 {
0633 __le32 size;
0634 __le32 id;
0635 struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX];
0636 __le32 num_streams;
0637 } __packed;
0638
0639 #endif