Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  * uapi/sound/asoc.h -- ALSA SoC Firmware Controls and DAPM
0004  *
0005  * Copyright (C) 2012 Texas Instruments Inc.
0006  * Copyright (C) 2015 Intel Corporation.
0007  *
0008  * This program is free software; you can redistribute it and/or modify
0009  * it under the terms of the GNU General Public License version 2 as
0010  * published by the Free Software Foundation.
0011  *
0012  * Simple file API to load FW that includes mixers, coefficients, DAPM graphs,
0013  * algorithms, equalisers, DAIs, widgets etc.
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  * Maximum number of channels topology kcontrol can represent.
0024  */
0025 #define SND_SOC_TPLG_MAX_CHAN       8
0026 
0027 /*
0028  * Maximum number of PCM formats capability
0029  */
0030 #define SND_SOC_TPLG_MAX_FORMATS    16
0031 
0032 /*
0033  * Maximum number of PCM stream configs
0034  */
0035 #define SND_SOC_TPLG_STREAM_CONFIG_MAX  8
0036 
0037 /*
0038  * Maximum number of physical link's hardware configs
0039  */
0040 #define SND_SOC_TPLG_HW_CONFIG_MAX  8
0041 
0042 /* individual kcontrol info types - can be mixed with other types */
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 /* individual widget kcontrol info types - can be mixed with other types */
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 /* DAPM widget types - add new items to the end */
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 /* Header magic number and string sizes */
0088 #define SND_SOC_TPLG_MAGIC      0x41536F43 /* ASoC */
0089 
0090 /* string sizes */
0091 #define SND_SOC_TPLG_NUM_TEXTS      16
0092 
0093 /* ABI version */
0094 #define SND_SOC_TPLG_ABI_VERSION    0x5 /* current version */
0095 #define SND_SOC_TPLG_ABI_VERSION_MIN    0x4 /* oldest version supported */
0096 
0097 /* Max size of TLV data */
0098 #define SND_SOC_TPLG_TLV_SIZE       32
0099 
0100 /*
0101  * File and Block header data types.
0102  * Add new generic and vendor types to end of list.
0103  * Generic types are handled by the core whilst vendors types are passed
0104  * to the component drivers for handling.
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 /* vendor block IDs - please add new vendor types to end */
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 /* vendor tuple types */
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 /* DAI flags */
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 /* DAI clock gating */
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 /* DAI mclk_direction */
0148 #define SND_SOC_TPLG_MCLK_CO            0 /* for codec, mclk is output */
0149 #define SND_SOC_TPLG_MCLK_CI            1 /* for codec, mclk is input */
0150 
0151 /* DAI physical PCM data formats.
0152  * Add new formats to the end of the list.
0153  */
0154 #define SND_SOC_DAI_FORMAT_I2S          1 /* I2S mode */
0155 #define SND_SOC_DAI_FORMAT_RIGHT_J      2 /* Right Justified mode */
0156 #define SND_SOC_DAI_FORMAT_LEFT_J       3 /* Left Justified mode */
0157 #define SND_SOC_DAI_FORMAT_DSP_A        4 /* L data MSB after FRM LRC */
0158 #define SND_SOC_DAI_FORMAT_DSP_B        5 /* L data MSB during FRM LRC */
0159 #define SND_SOC_DAI_FORMAT_AC97         6 /* AC97 */
0160 #define SND_SOC_DAI_FORMAT_PDM          7 /* Pulse density modulation */
0161 
0162 /* left and right justified also known as MSB and LSB respectively */
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 /* DAI link flags */
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 /* DAI topology BCLK parameter
0173  * For the backwards capability, by default codec is bclk provider
0174  */
0175 #define SND_SOC_TPLG_BCLK_CP         0 /* codec is bclk provider */
0176 #define SND_SOC_TPLG_BCLK_CC         1 /* codec is bclk consumer */
0177 /* keep previous definitions for compatibility */
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 /* DAI topology FSYNC parameter
0182  * For the backwards capability, by default codec is fsync provider
0183  */
0184 #define SND_SOC_TPLG_FSYNC_CP         0 /* codec is fsync provider */
0185 #define SND_SOC_TPLG_FSYNC_CC         1 /* codec is fsync consumer */
0186 /* keep previous definitions for compatibility */
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  * Block Header.
0192  * This header precedes all object and object arrays below.
0193  */
0194 struct snd_soc_tplg_hdr {
0195     __le32 magic;       /* magic number */
0196     __le32 abi;     /* ABI version */
0197     __le32 version;     /* optional vendor specific version details */
0198     __le32 type;        /* SND_SOC_TPLG_TYPE_ */
0199     __le32 size;        /* size of this structure */
0200     __le32 vendor_type; /* optional vendor specific type info */
0201     __le32 payload_size;    /* data bytes, excluding this header */
0202     __le32 index;       /* identifier for block */
0203     __le32 count;       /* number of elements in block */
0204 } __attribute__((packed));
0205 
0206 /* vendor tuple for uuid */
0207 struct snd_soc_tplg_vendor_uuid_elem {
0208     __le32 token;
0209     char uuid[16];
0210 } __attribute__((packed));
0211 
0212 /* vendor tuple for a bool/byte/short/word value */
0213 struct snd_soc_tplg_vendor_value_elem {
0214     __le32 token;
0215     __le32 value;
0216 } __attribute__((packed));
0217 
0218 /* vendor tuple for string */
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;    /* size in bytes of the array, including all elements */
0226     __le32 type;    /* SND_SOC_TPLG_TUPLE_TYPE_ */
0227     __le32 num_elems;   /* number of elements in array */
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  * Private data.
0237  * All topology objects may have private data that can be used by the driver or
0238  * firmware. Core will ignore this data.
0239  */
0240 struct snd_soc_tplg_private {
0241     __le32 size;    /* in bytes of private data */
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  * Kcontrol TLV data.
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;    /* in bytes of this structure */
0259     __le32 type;    /* SNDRV_CTL_TLVT_*, type of TLV */
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  * Kcontrol channel data
0268  */
0269 struct snd_soc_tplg_channel {
0270     __le32 size;    /* in bytes of this structure */
0271     __le32 reg;
0272     __le32 shift;
0273     __le32 id;  /* ID maps to Left, Right, LFE etc */
0274 } __attribute__((packed));
0275 
0276 /*
0277  * Genericl Operations IDs, for binding Kcontrol or Bytes ext ops
0278  * Kcontrol ops need get/put/info.
0279  * Bytes ext ops need get/put.
0280  */
0281 struct snd_soc_tplg_io_ops {
0282     __le32 get;
0283     __le32 put;
0284     __le32 info;
0285 } __attribute__((packed));
0286 
0287 /*
0288  * kcontrol header
0289  */
0290 struct snd_soc_tplg_ctl_hdr {
0291     __le32 size;    /* in bytes of this structure */
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  * Stream Capabilities
0301  */
0302 struct snd_soc_tplg_stream_caps {
0303     __le32 size;        /* in bytes of this structure */
0304     char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0305     __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
0306     __le32 rates;       /* supported rates SNDRV_PCM_RATE_* */
0307     __le32 rate_min;    /* min rate */
0308     __le32 rate_max;    /* max rate */
0309     __le32 channels_min;    /* min channels */
0310     __le32 channels_max;    /* max channels */
0311     __le32 periods_min; /* min number of periods */
0312     __le32 periods_max; /* max number of periods */
0313     __le32 period_size_min; /* min period size bytes */
0314     __le32 period_size_max; /* max period size bytes */
0315     __le32 buffer_size_min; /* min buffer size bytes */
0316     __le32 buffer_size_max; /* max buffer size bytes */
0317     __le32 sig_bits;        /* number of bits of content */
0318 } __attribute__((packed));
0319 
0320 /*
0321  * FE or BE Stream configuration supported by SW/FW
0322  */
0323 struct snd_soc_tplg_stream {
0324     __le32 size;        /* in bytes of this structure */
0325     char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */
0326     __le64 format;      /* SNDRV_PCM_FMTBIT_* */
0327     __le32 rate;        /* SNDRV_PCM_RATE_* */
0328     __le32 period_bytes;    /* size of period in bytes */
0329     __le32 buffer_bytes;    /* size of buffer in bytes */
0330     __le32 channels;    /* channels */
0331 } __attribute__((packed));
0332 
0333 
0334 /*
0335  * Describes a physical link's runtime supported hardware config,
0336  * i.e. hardware audio formats.
0337  */
0338 struct snd_soc_tplg_hw_config {
0339     __le32 size;            /* in bytes of this structure */
0340     __le32 id;      /* unique ID - - used to match */
0341     __le32 fmt;     /* SND_SOC_DAI_FORMAT_ format value */
0342     __u8 clock_gated;   /* SND_SOC_TPLG_DAI_CLK_GATE_ value */
0343     __u8 invert_bclk;   /* 1 for inverted BCLK, 0 for normal */
0344     __u8 invert_fsync;  /* 1 for inverted frame clock, 0 for normal */
0345     __u8 bclk_provider; /* SND_SOC_TPLG_BCLK_ value */
0346     __u8 fsync_provider;    /* SND_SOC_TPLG_FSYNC_ value */
0347     __u8 mclk_direction;    /* SND_SOC_TPLG_MCLK_ value */
0348     __le16 reserved;    /* for 32bit alignment */
0349     __le32 mclk_rate;   /* MCLK or SYSCLK freqency in Hz */
0350     __le32 bclk_rate;   /* BCLK freqency in Hz */
0351     __le32 fsync_rate;  /* frame clock in Hz */
0352     __le32 tdm_slots;   /* number of TDM slots in use */
0353     __le32 tdm_slot_width;  /* width in bits for each slot */
0354     __le32 tx_slots;    /* bit mask for active Tx slots */
0355     __le32 rx_slots;    /* bit mask for active Rx slots */
0356     __le32 tx_channels; /* number of Tx channels */
0357     __le32 tx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
0358     __le32 rx_channels; /* number of Rx channels */
0359     __le32 rx_chanmap[SND_SOC_TPLG_MAX_CHAN]; /* array of slot number */
0360 } __attribute__((packed));
0361 
0362 /*
0363  * Manifest. List totals for each payload type. Not used in parsing, but will
0364  * be passed to the component driver before any other objects in order for any
0365  * global component resource allocations.
0366  *
0367  * File block representation for manifest :-
0368  * +-----------------------------------+----+
0369  * | struct snd_soc_tplg_hdr           |  1 |
0370  * +-----------------------------------+----+
0371  * | struct snd_soc_tplg_manifest      |  1 |
0372  * +-----------------------------------+----+
0373  */
0374 struct snd_soc_tplg_manifest {
0375     __le32 size;        /* in bytes of this structure */
0376     __le32 control_elems;   /* number of control elements */
0377     __le32 widget_elems;    /* number of widget elements */
0378     __le32 graph_elems; /* number of graph elements */
0379     __le32 pcm_elems;   /* number of PCM elements */
0380     __le32 dai_link_elems;  /* number of DAI link elements */
0381     __le32 dai_elems;   /* number of physical DAI elements */
0382     __le32 reserved[20];    /* reserved for new ABI element types */
0383     struct snd_soc_tplg_private priv;
0384 } __attribute__((packed));
0385 
0386 /*
0387  * Mixer kcontrol.
0388  *
0389  * File block representation for mixer kcontrol :-
0390  * +-----------------------------------+----+
0391  * | struct snd_soc_tplg_hdr           |  1 |
0392  * +-----------------------------------+----+
0393  * | struct snd_soc_tplg_mixer_control |  N |
0394  * +-----------------------------------+----+
0395  */
0396 struct snd_soc_tplg_mixer_control {
0397     struct snd_soc_tplg_ctl_hdr hdr;
0398     __le32 size;    /* in bytes of this structure */
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  * Enumerated kcontrol
0410  *
0411  * File block representation for enum kcontrol :-
0412  * +-----------------------------------+----+
0413  * | struct snd_soc_tplg_hdr           |  1 |
0414  * +-----------------------------------+----+
0415  * | struct snd_soc_tplg_enum_control  |  N |
0416  * +-----------------------------------+----+
0417  */
0418 struct snd_soc_tplg_enum_control {
0419     struct snd_soc_tplg_ctl_hdr hdr;
0420     __le32 size;    /* in bytes of this structure */
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  * Bytes kcontrol
0433  *
0434  * File block representation for bytes kcontrol :-
0435  * +-----------------------------------+----+
0436  * | struct snd_soc_tplg_hdr           |  1 |
0437  * +-----------------------------------+----+
0438  * | struct snd_soc_tplg_bytes_control |  N |
0439  * +-----------------------------------+----+
0440  */
0441 struct snd_soc_tplg_bytes_control {
0442     struct snd_soc_tplg_ctl_hdr hdr;
0443     __le32 size;    /* in bytes of this structure */
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  * DAPM Graph Element
0454  *
0455  * File block representation for DAPM graph elements :-
0456  * +-------------------------------------+----+
0457  * | struct snd_soc_tplg_hdr             |  1 |
0458  * +-------------------------------------+----+
0459  * | struct snd_soc_tplg_dapm_graph_elem |  N |
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  * DAPM Widget.
0470  *
0471  * File block representation for DAPM widget :-
0472  * +-------------------------------------+-----+
0473  * | struct snd_soc_tplg_hdr             |  1  |
0474  * +-------------------------------------+-----+
0475  * | struct snd_soc_tplg_dapm_widget     |  N  |
0476  * +-------------------------------------+-----+
0477  * |   struct snd_soc_tplg_enum_control  | 0|1 |
0478  * |   struct snd_soc_tplg_mixer_control | 0|N |
0479  * +-------------------------------------+-----+
0480  *
0481  * Optional enum or mixer control can be appended to the end of each widget
0482  * in the block.
0483  */
0484 struct snd_soc_tplg_dapm_widget {
0485     __le32 size;        /* in bytes of this structure */
0486     __le32 id;      /* SND_SOC_DAPM_CTL */
0487     char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0488     char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0489 
0490     __le32 reg;     /* negative reg = no direct dapm */
0491     __le32 shift;       /* bits to shift */
0492     __le32 mask;        /* non-shifted mask */
0493     __le32 subseq;      /* sort within widget type */
0494     __le32 invert;      /* invert the power bit */
0495     __le32 ignore_suspend;  /* kept enabled over suspend */
0496     __le16 event_flags;
0497     __le16 event_type;
0498     __le32 num_kcontrols;
0499     struct snd_soc_tplg_private priv;
0500     /*
0501      * kcontrols that relate to this widget
0502      * follow here after widget private data
0503      */
0504 } __attribute__((packed));
0505 
0506 
0507 /*
0508  * Describes SW/FW specific features of PCM (FE DAI & DAI link).
0509  *
0510  * File block representation for PCM :-
0511  * +-----------------------------------+-----+
0512  * | struct snd_soc_tplg_hdr           |  1  |
0513  * +-----------------------------------+-----+
0514  * | struct snd_soc_tplg_pcm           |  N  |
0515  * +-----------------------------------+-----+
0516  */
0517 struct snd_soc_tplg_pcm {
0518     __le32 size;        /* in bytes of this structure */
0519     char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0520     char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0521     __le32 pcm_id;      /* unique ID - used to match with DAI link */
0522     __le32 dai_id;      /* unique ID - used to match */
0523     __le32 playback;    /* supports playback mode */
0524     __le32 capture;     /* supports capture mode */
0525     __le32 compress;    /* 1 = compressed; 0 = PCM */
0526     struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
0527     __le32 num_streams; /* number of streams */
0528     struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
0529     __le32 flag_mask;       /* bitmask of flags to configure */
0530     __le32 flags;           /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
0531     struct snd_soc_tplg_private priv;
0532 } __attribute__((packed));
0533 
0534 
0535 /*
0536  * Describes the physical link runtime supported configs or params
0537  *
0538  * File block representation for physical link config :-
0539  * +-----------------------------------+-----+
0540  * | struct snd_soc_tplg_hdr           |  1  |
0541  * +-----------------------------------+-----+
0542  * | struct snd_soc_tplg_link_config   |  N  |
0543  * +-----------------------------------+-----+
0544  */
0545 struct snd_soc_tplg_link_config {
0546     __le32 size;            /* in bytes of this structure */
0547     __le32 id;              /* unique ID - used to match */
0548     char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
0549     char stream_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* stream name - used to match */
0550     struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
0551     __le32 num_streams;     /* number of streams */
0552     struct snd_soc_tplg_hw_config hw_config[SND_SOC_TPLG_HW_CONFIG_MAX]; /* hw configs */
0553     __le32 num_hw_configs;         /* number of hw configs */
0554     __le32 default_hw_config_id;   /* default hw config ID for init */
0555     __le32 flag_mask;       /* bitmask of flags to configure */
0556     __le32 flags;           /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
0557     struct snd_soc_tplg_private priv;
0558 } __attribute__((packed));
0559 
0560 /*
0561  * Describes SW/FW specific features of physical DAI.
0562  * It can be used to configure backend DAIs for DPCM.
0563  *
0564  * File block representation for physical DAI :-
0565  * +-----------------------------------+-----+
0566  * | struct snd_soc_tplg_hdr           |  1  |
0567  * +-----------------------------------+-----+
0568  * | struct snd_soc_tplg_dai           |  N  |
0569  * +-----------------------------------+-----+
0570  */
0571 struct snd_soc_tplg_dai {
0572     __le32 size;            /* in bytes of this structure */
0573     char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* name - used to match */
0574     __le32 dai_id;          /* unique ID - used to match */
0575     __le32 playback;        /* supports playback mode */
0576     __le32 capture;         /* supports capture mode */
0577     struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
0578     __le32 flag_mask;       /* bitmask of flags to configure */
0579     __le32 flags;           /* SND_SOC_TPLG_DAI_FLGBIT_* */
0580     struct snd_soc_tplg_private priv;
0581 } __attribute__((packed));
0582 
0583 /*
0584  * Old version of ABI structs, supported for backward compatibility.
0585  */
0586 
0587 /* Manifest v4 */
0588 struct snd_soc_tplg_manifest_v4 {
0589     __le32 size;        /* in bytes of this structure */
0590     __le32 control_elems;   /* number of control elements */
0591     __le32 widget_elems;    /* number of widget elements */
0592     __le32 graph_elems; /* number of graph elements */
0593     __le32 pcm_elems;   /* number of PCM elements */
0594     __le32 dai_link_elems;  /* number of DAI link elements */
0595     struct snd_soc_tplg_private priv;
0596 } __packed;
0597 
0598 /* Stream Capabilities v4 */
0599 struct snd_soc_tplg_stream_caps_v4 {
0600     __le32 size;        /* in bytes of this structure */
0601     char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0602     __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */
0603     __le32 rates;       /* supported rates SNDRV_PCM_RATE_* */
0604     __le32 rate_min;    /* min rate */
0605     __le32 rate_max;    /* max rate */
0606     __le32 channels_min;    /* min channels */
0607     __le32 channels_max;    /* max channels */
0608     __le32 periods_min; /* min number of periods */
0609     __le32 periods_max; /* max number of periods */
0610     __le32 period_size_min; /* min period size bytes */
0611     __le32 period_size_max; /* max period size bytes */
0612     __le32 buffer_size_min; /* min buffer size bytes */
0613     __le32 buffer_size_max; /* max buffer size bytes */
0614 } __packed;
0615 
0616 /* PCM v4 */
0617 struct snd_soc_tplg_pcm_v4 {
0618     __le32 size;        /* in bytes of this structure */
0619     char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0620     char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
0621     __le32 pcm_id;      /* unique ID - used to match with DAI link */
0622     __le32 dai_id;      /* unique ID - used to match */
0623     __le32 playback;    /* supports playback mode */
0624     __le32 capture;     /* supports capture mode */
0625     __le32 compress;    /* 1 = compressed; 0 = PCM */
0626     struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */
0627     __le32 num_streams; /* number of streams */
0628     struct snd_soc_tplg_stream_caps_v4 caps[2]; /* playback and capture for DAI */
0629 } __packed;
0630 
0631 /* Physical link config v4 */
0632 struct snd_soc_tplg_link_config_v4 {
0633     __le32 size;            /* in bytes of this structure */
0634     __le32 id;              /* unique ID - used to match */
0635     struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */
0636     __le32 num_streams;     /* number of streams */
0637 } __packed;
0638 
0639 #endif