From patchwork Wed Jul 13 08:45:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mengdong.lin@linux.intel.com X-Patchwork-Id: 9227255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BC9F60868 for ; Wed, 13 Jul 2016 08:53:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0AA7A2756B for ; Wed, 13 Jul 2016 08:53:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3275277D9; Wed, 13 Jul 2016 08:53:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE1DF2756B for ; Wed, 13 Jul 2016 08:53:23 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id ABD5826651C; Wed, 13 Jul 2016 10:43:29 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 525BB266528; Wed, 13 Jul 2016 10:41:24 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 85718266534; Wed, 13 Jul 2016 10:41:22 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by alsa0.perex.cz (Postfix) with ESMTP id B7C8A266569 for ; Wed, 13 Jul 2016 10:40:19 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga104.fm.intel.com with ESMTP; 13 Jul 2016 01:40:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,356,1464678000"; d="scan'208";a="845374990" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.169]) by orsmga003.jf.intel.com with ESMTP; 13 Jul 2016 01:40:17 -0700 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org, broonie@kernel.org Date: Wed, 13 Jul 2016 16:45:10 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: Cc: Mengdong Lin , tiwai@suse.de, mengdong.lin@intel.com, liam.r.girdwood@intel.com, shreyas.nc@intel.com Subject: [alsa-devel] [PATCH 5/5] topology: Tuple type can have an extenstion X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mengdong Lin 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 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" { * } * } * + * 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.
+ * The parser will check the first few characters in ID to get the tuple type. + * Here is an example: + *
+ * 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"
+ *		...
+ *	}
+ *	...
+ * }
+ *
+ * 
* *
Mixer Controls
* 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);