From: mengdong.lin@linux.intel.com
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: Mengdong Lin <mengdong.lin@linux.intel.com>,
tiwai@suse.de, mengdong.lin@intel.com, vinod.koul@intel.com,
rakesh.a.ughreja@intel.com, liam.r.girdwood@intel.com,
hardik.t.shah@intel.com, subhransu.s.prusty@intel.com
Subject: [PATCH v3 4/7] topology: ABI - Define types for vendor tuples
Date: Thu, 7 Apr 2016 15:29:27 +0800 [thread overview]
Message-ID: <a75bdfc07ce0be766e1f5b8516cd02e921d0d138.1460013338.git.mengdong.lin@linux.intel.com> (raw)
In-Reply-To: <cover.1460013338.git.mengdong.lin@linux.intel.com>
From: Mengdong Lin <mengdong.lin@linux.intel.com>
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>
diff --git a/include/sound/asoc.h b/include/sound/asoc.h
index a29c05c..920c9e0 100644
--- a/include/sound/asoc.h
+++ b/include/sound/asoc.h
@@ -107,6 +107,14 @@
#define SND_SOC_TPLG_STREAM_PLAYBACK 0
#define SND_SOC_TPLG_STREAM_CAPTURE 1
+/* vendor tuple types */
+#define SND_SOC_TPLG_TUPLE_TYPE_UUID 0
+#define SND_SOC_TPLG_TUPLE_TYPE_STRING 1
+#define SND_SOC_TPLG_TUPLE_TYPE_BOOL 2
+#define SND_SOC_TPLG_TUPLE_TYPE_BYTE 3
+#define SND_SOC_TPLG_TUPLE_TYPE_WORD 4
+#define SND_SOC_TPLG_TUPLE_TYPE_SHORT 5
+
/*
* Block Header.
* This header precedes all object and object arrays below.
@@ -123,6 +131,35 @@ struct snd_soc_tplg_hdr {
__le32 count; /* number of elements in block */
} __attribute__((packed));
+/* vendor tuple for uuid */
+struct snd_soc_tplg_vendor_uuid_elem {
+ __le32 token;
+ char uuid[16];
+} __attribute__((packed));
+
+/* vendor tuple for a bool/byte/short/word value */
+struct snd_soc_tplg_vendor_value_elem {
+ __le32 token;
+ __le32 value;
+} __attribute__((packed));
+
+/* vendor tuple for string */
+struct snd_soc_tplg_vendor_string_elem {
+ __le32 token;
+ char string[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+} __attribute__((packed));
+
+struct snd_soc_tplg_vendor_array {
+ __le32 size; /* size in bytes of the array, including all elements */
+ __le32 type; /* SND_SOC_TPLG_TUPLE_TYPE_ */
+ __le32 num_elems; /* number of elements in array */
+ union {
+ struct snd_soc_tplg_vendor_uuid_elem uuid[0];
+ struct snd_soc_tplg_vendor_value_elem value[0];
+ struct snd_soc_tplg_vendor_string_elem string[0];
+ };
+} __attribute__((packed));
+
/*
* Private data.
* All topology objects may have private data that can be used by the driver or
@@ -130,7 +167,10 @@ struct snd_soc_tplg_hdr {
*/
struct snd_soc_tplg_private {
__le32 size; /* in bytes of private data */
- char data[0];
+ union {
+ char data[0];
+ struct snd_soc_tplg_vendor_array array[0];
+ };
} __attribute__((packed));
/*
--
2.5.0
next prev parent reply other threads:[~2016-04-07 7:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-07 7:27 [PATCH v3 0/7] topology: Add support for vendor tuples mengdong.lin
2016-04-07 7:28 ` [PATCH v3 1/7] topology: Use the generic pointer to free an element's object mengdong.lin
2016-04-07 7:29 ` [PATCH v3 2/7] topology: Define a free handler for the element mengdong.lin
2016-04-07 7:29 ` [PATCH v3 3/7] topology: Add doc for vendor tuples mengdong.lin
2016-04-07 7:29 ` mengdong.lin [this message]
2016-04-07 7:29 ` [PATCH v3 5/7] topology: Add support for vendor tokens mengdong.lin
2016-04-07 7:29 ` [PATCH v3 6/7] topology: Add support for parsing vendor tuples mengdong.lin
2016-04-07 7:29 ` [PATCH v3 7/7] topology: Build data objects with tuples mengdong.lin
2016-04-07 9:22 ` [PATCH v3 0/7] topology: Add support for vendor tuples Takashi Iwai
2016-04-07 14:33 ` Lin, Mengdong
2016-04-07 14:58 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a75bdfc07ce0be766e1f5b8516cd02e921d0d138.1460013338.git.mengdong.lin@linux.intel.com \
--to=mengdong.lin@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=hardik.t.shah@intel.com \
--cc=liam.r.girdwood@intel.com \
--cc=mengdong.lin@intel.com \
--cc=rakesh.a.ughreja@intel.com \
--cc=subhransu.s.prusty@intel.com \
--cc=tiwai@suse.de \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).