All of lore.kernel.org
 help / color / mirror / Atom feed
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, liam.r.girdwood@intel.com,
	shreyas.nc@intel.com
Subject: [PATCH 5/5] topology: Tuple type can have an extenstion
Date: Wed, 13 Jul 2016 16:45:10 +0800	[thread overview]
Message-ID: <b2c2ef51db1502a6f029257da9d95aafe01b7d35.1468397702.git.mengdong.lin@linux.intel.com> (raw)
In-Reply-To: <cover.1468397702.git.mengdong.lin@linux.intel.com>

From: Mengdong Lin <mengdong.lin@linux.intel.com>

After the type specific string ("uuid", "string", "byte", "short" and
"word"), users may append a string, like  "uuidxxx". The topology parser
will check the first few characters to get the tuple type.

This can allow users to put multiple tuples of the same type into one
vendor tuple section (SectionVendorTuples), e.g. parameters of multiple
firmware modules.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>

diff --git a/include/topology.h b/include/topology.h
index 644e548..0675b52 100644
--- a/include/topology.h
+++ b/include/topology.h
@@ -302,6 +302,29 @@ extern "C" {
  *	}
  * }
  * </pre>
+ * To define multiple vendor tuples of same type, please append some
+ * characters after the type string ("string", "uuid", "bool", "byte", "short"
+ * or "word"), to avoid ID duplication in the SectionVendorTuples.<br>
+ * The parser will check the first few characters in ID to get the tuple type.
+ * Here is an example:
+ * <pre>
+ * SectionVendorTuples."id of the vendor tuples" {
+ *    ...
+ *	tuples."word.module0" {
+ *		VENDOR_TOKEN_PARAM_ID1 "0x00112233"
+ *		VENDOR_TOKEN_PARAM_ID2 "0x44556677"
+ *		...
+ *	}
+ *
+ *	tuples."word.module2" {
+ *		VENDOR_TOKEN_PARAM_ID1 "0x11223344"
+ *		VENDOR_TOKEN_PARAM_ID2 "0x55667788"
+ *		...
+ *	}
+ *	...
+ * }
+ *
+ * </pre>
  *
  * <h5>Mixer Controls</h5>
  * A mixer control is defined as a new section that can include channel mapping,
diff --git a/src/topology/data.c b/src/topology/data.c
index f04544b..fb45d6a 100644
--- a/src/topology/data.c
+++ b/src/topology/data.c
@@ -536,17 +536,17 @@ static int parse_tuple_set(snd_tplg_t *tplg, snd_config_t *cfg,
 
 	snd_config_get_id(cfg, &id);
 
-	if (strcmp(id, "uuid") == 0)
+	if (strncmp(id, "uuid", 4) == 0)
 		type = SND_SOC_TPLG_TUPLE_TYPE_UUID;
-	else if (strcmp(id, "string") == 0)
+	else if (strncmp(id, "string", 5) == 0)
 		type = SND_SOC_TPLG_TUPLE_TYPE_STRING;
-	else if (strcmp(id, "bool") == 0)
+	else if (strncmp(id, "bool", 4) == 0)
 		type = SND_SOC_TPLG_TUPLE_TYPE_BOOL;
-	else if (strcmp(id, "byte") == 0)
+	else if (strncmp(id, "byte", 4) == 0)
 		type = SND_SOC_TPLG_TUPLE_TYPE_BYTE;
-	else if (strcmp(id, "short") == 0)
+	else if (strncmp(id, "short", 5) == 0)
 		type = SND_SOC_TPLG_TUPLE_TYPE_SHORT;
-	else if (strcmp(id, "word") == 0)
+	else if (strncmp(id, "word", 4) == 0)
 		type = SND_SOC_TPLG_TUPLE_TYPE_WORD;
 	else {
 		SNDERR("error: invalid tuple type '%s'\n", id);
-- 
2.5.0

      parent reply	other threads:[~2016-07-13  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13  8:44 [PATCH 0/5] topology: Enhance support for private data mengdong.lin
2016-07-13  8:44 ` [PATCH 1/5] topology: An element can refer to multipe data sections in text conf file mengdong.lin
2016-07-13  9:56   ` Takashi Sakamoto
2016-07-13  8:44 ` [PATCH 2/5] topology: Merge lookup for data reference into tplg_copy_data() mengdong.lin
2016-07-13  8:44 ` [PATCH 3/5] topology: Change uuid value to 16 separate characters in text conf file mengdong.lin
2016-07-13  9:46   ` Takashi Sakamoto
2016-07-13  8:45 ` [PATCH 4/5] topology: Parse vendor private data for manifest mengdong.lin
2016-07-13  9:56   ` Takashi Sakamoto
2016-07-13  8:45 ` mengdong.lin [this message]

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=b2c2ef51db1502a6f029257da9d95aafe01b7d35.1468397702.git.mengdong.lin@linux.intel.com \
    --to=mengdong.lin@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    --cc=mengdong.lin@intel.com \
    --cc=shreyas.nc@intel.com \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.