aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@linux.intel.com>2016-03-23 22:53:14 -0400
committerMark Brown <broonie@kernel.org>2016-03-29 14:44:05 -0400
commite42839b012eb8179ed2e3571bfcd133fba5df154 (patch)
treed2f0a7c0d304ce74da95270ed72980d020c4b18f
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
ASoC: topology: ABI - Define types for vendor tuples
Tuples, a pair of token and value, can be used to define vendor specific data, for controls and widgets. This can avoid importing binary data blob from other files. Vendor specific tuple arrays will be embeded in the private data buffer of a control or widget object. To be backward compatible, union is used to define the tuple arrays in the existing private data ABI object 'struct snd_soc_tplg_private'. Vendors need to make sure the token values defined by the topology conf file match those defined by their driver. Now supported tuple types are uuid, string, bool, byte, short and word. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/uapi/sound/asoc.h42
1 files changed, 41 insertions, 1 deletions
diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h
index c4cc1e40b35c..db86b447b515 100644
--- a/include/uapi/sound/asoc.h
+++ b/include/uapi/sound/asoc.h
@@ -116,6 +116,14 @@
116#define SND_SOC_TPLG_STREAM_PLAYBACK 0 116#define SND_SOC_TPLG_STREAM_PLAYBACK 0
117#define SND_SOC_TPLG_STREAM_CAPTURE 1 117#define SND_SOC_TPLG_STREAM_CAPTURE 1
118 118
119/* vendor tuple types */
120#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
121#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
122#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
123#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
124#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
125#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
126
119/* 127/*
120 * Block Header. 128 * Block Header.
121 * This header precedes all object and object arrays below. 129 * This header precedes all object and object arrays below.
@@ -132,6 +140,35 @@ struct snd_soc_tplg_hdr {
132 __le32 count; /* number of elements in block */ 140 __le32 count; /* number of elements in block */
133} __attribute__((packed)); 141} __attribute__((packed));
134 142
143/* vendor tuple for uuid */
144struct snd_soc_tplg_vendor_uuid_elem {
145 __le32 token;
146 char uuid[16];
147} __attribute__((packed));
148
149/* vendor tuple for a bool/byte/short/word value */
150struct snd_soc_tplg_vendor_value_elem {
151 __le32 token;
152 __le32 value;
153} __attribute__((packed));
154
155/* vendor tuple for string */
156struct snd_soc_tplg_vendor_string_elem {
157 __le32 token;
158 char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
159} __attribute__((packed));
160
161struct snd_soc_tplg_vendor_array {
162 __le32 size; /* size in bytes of the array, including all elements */
163 __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
164 __le32 num_elems; /* number of elements in array */
165 union {
166 struct snd_soc_tplg_vendor_uuid_elem uuid[0];
167 struct snd_soc_tplg_vendor_value_elem value[0];
168 struct snd_soc_tplg_vendor_string_elem string[0];
169 };
170} __attribute__((packed));
171
135/* 172/*
136 * Private data. 173 * Private data.
137 * All topology objects may have private data that can be used by the driver or 174 * All topology objects may have private data that can be used by the driver or
@@ -139,7 +176,10 @@ struct snd_soc_tplg_hdr {
139 */ 176 */
140struct snd_soc_tplg_private { 177struct snd_soc_tplg_private {
141 __le32 size; /* in bytes of private data */ 178 __le32 size; /* in bytes of private data */
142 char data[0]; 179 union {
180 char data[0];
181 struct snd_soc_tplg_vendor_array array[0];
182 };
143} __attribute__((packed)); 183} __attribute__((packed));
144 184
145/* 185/*