]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: Tuple type can have an extenstion
authorMengdong Lin <mengdong.lin@linux.intel.com>
Fri, 15 Jul 2016 12:19:58 +0000 (20:19 +0800)
committerTakashi Iwai <tiwai@suse.de>
Sun, 17 Jul 2016 08:00:28 +0000 (10:00 +0200)
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>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/topology.h
src/topology/data.c

index 644e548943072323bb7e954991766e2271a503e0..0675b527bcdaf5443c6c13ac6334a33358ea845f 100644 (file)
@@ -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,
index 245a8340edbc20bceaacfeeecb048f2fee65fa2b..e81b7f12c70bdee433883aa3d645fe53dc4393fa 100644 (file)
@@ -534,17 +534,17 @@ static int parse_tuple_set(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);