History

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.

Mengdong Lin committed 10 years ago

Commit e42839b1 parent f55532a1 file · +41 −1Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/sound/asoc.h+41−1
@@ -116,6 +116,14 @@ · 115 unmodified lines
116116 #define SND_SOC_TPLG_STREAM_PLAYBACK 0
117117 #define SND_SOC_TPLG_STREAM_CAPTURE 1
118118
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+
119127 /*
120128 * Block Header.
121129 * This header precedes all object and object arrays below.
@@ -132,6 +140,35 @@ struct snd_soc_tplg_hdr { · 10 unmodified lines
132140 __le32 count; /* number of elements in block */
133141 } __attribute__((packed));
134142
143+/* vendor tuple for uuid */
144+struct 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 */
150+struct snd_soc_tplg_vendor_value_elem {
151+ __le32 token;
152+ __le32 value;
153+} __attribute__((packed));
154+
155+/* vendor tuple for string */
156+struct snd_soc_tplg_vendor_string_elem {
157+ __le32 token;
158+ char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
159+} __attribute__((packed));
160+
161+struct 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+
135172 /*
136173 * Private data.
137174 * All topology objects may have private data that can be used by the driver or
@@ -139,7 +176,10 @@ struct snd_soc_tplg_hdr { · 1 unmodified line
139176 */
140177 struct snd_soc_tplg_private {
141178 __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+ };
143183 } __attribute__((packed));
144184
145185 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t