From patchwork Thu Oct 27 07:13:35 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: 9399243 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 55F3960233 for ; Thu, 27 Oct 2016 12:02:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 353372A1ED for ; Thu, 27 Oct 2016 12:02:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 275B92A1F0; Thu, 27 Oct 2016 12:02:38 +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 147432A1ED for ; Thu, 27 Oct 2016 12:02:32 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0792C2673C8; Thu, 27 Oct 2016 14:02:31 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 62E992673BB; Thu, 27 Oct 2016 14:00:04 +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 B93C4267338; Thu, 27 Oct 2016 09:12:28 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 9B44F267330 for ; Thu, 27 Oct 2016 09:12:20 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP; 27 Oct 2016 00:12:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,404,1473145200"; d="scan'208";a="24250820" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.21]) by fmsmga005.fm.intel.com with ESMTP; 27 Oct 2016 00:12:17 -0700 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org Date: Thu, 27 Oct 2016 15:13:35 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: Cc: Mengdong Lin , tiwai@suse.de, hardik.t.shah@intel.com, guneshwor.o.singh@intel.com, liam.r.girdwood@linux.intel.com, vinod.koul@intel.com, broonie@kernel.org, mengdong.lin@intel.com Subject: [alsa-devel] [PATCH 12/22] topology: Define new type and section name to configure physical links 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 Users may not use DPCM but still need to configure the physical links. So we should not only consider backend links for DPCM. - SND_TPLG_TYPE_LINK is defined to configure physical links by C API. And SND_TPLG_TYPE_BE is still supported to configure Backend links for DPCM cases. - SectionLink can be used to configure physical links in text conf file. And SectionBE is still supported to config Backend links for DPCM cases. Actually, users can also use SND_TPLG_TYPE_LINK and SectionLink to configure backend links for DPCM cases, because BE links are physical links. So the parsing is same and we rename the function from tplg_parse_be to tplg_parse_link. Signed-off-by: Mengdong Lin diff --git a/include/topology.h b/include/topology.h index f9e8285..d1ce69c 100644 --- a/include/topology.h +++ b/include/topology.h @@ -618,6 +618,24 @@ extern "C" { * } * * + *

Physical DAI Link Configurations

+ * The runtime configurations of a physical DAI link can be defined by + * SectionLink.
Backend DAI links belong to physical links, and can + * be configured by either SectionLink or SectionBE, with same syntax. + * But SectionBE is deprecated atm since the internal processing is + * actually same. + * + *
+ * SectionLink."name" {
+ *
+ *	index "1"			# Index number
+ *
+ *	id "0"				# used for binding to the link
+ *
+ *	data "name"			# optional private data
+ * }
+ * 
+ * *

Manifest Private Data

* Manfiest may have private data. Users need to define a manifest section * and add the references to 1 or multiple data sections. Please refer to @@ -658,6 +676,7 @@ enum snd_tplg_type { SND_TPLG_TYPE_MANIFEST, /*!< Topology manifest */ SND_TPLG_TYPE_TOKEN, /*!< Vendor tokens */ SND_TPLG_TYPE_TUPLE, /*!< Vendor tuples */ + SND_TPLG_TYPE_LINK, /*!< Physical DAI link */ }; /** diff --git a/src/topology/parser.c b/src/topology/parser.c index ded2eb7..ed5da87 100644 --- a/src/topology/parser.c +++ b/src/topology/parser.c @@ -133,8 +133,9 @@ static int tplg_parse_config(snd_tplg_t *tplg, snd_config_t *cfg) continue; } - if (strcmp(id, "SectionBE") == 0) { - err = tplg_parse_compound(tplg, n, tplg_parse_be, + if (strcmp(id, "SectionLink") == 0 + || strcmp(id, "SectionBE") == 0) { + err = tplg_parse_compound(tplg, n, tplg_parse_link, NULL); if (err < 0) return err; diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 3fe77aa..32beeb7 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -545,7 +545,8 @@ int tplg_parse_pcm(snd_tplg_t *tplg, return 0; } -int tplg_parse_be(snd_tplg_t *tplg, +/* Parse a physical link element in text conf file */ +int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, void *private ATTRIBUTE_UNUSED) { struct snd_soc_tplg_link_config *link; @@ -562,7 +563,7 @@ int tplg_parse_be(snd_tplg_t *tplg, link = elem->link; link->size = elem->size; - tplg_dbg(" BE: %s\n", elem->id); + tplg_dbg(" Link: %s\n", elem->id); snd_config_for_each(i, next, cfg) { @@ -766,7 +767,8 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) struct tplg_elem *elem; int i; - if (t->type != SND_TPLG_TYPE_BE && t->type != SND_TPLG_TYPE_CC) + if (t->type != SND_TPLG_TYPE_LINK && t->type != SND_TPLG_TYPE_BE + && t->type != SND_TPLG_TYPE_CC) return -EINVAL; /* here type can be either BE or CC. */ @@ -774,10 +776,7 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) if (!elem) return -ENOMEM; - if (t->type == SND_TPLG_TYPE_BE) - tplg_dbg("BE Link: %s", link_tpl->name); - else - tplg_dbg("CC Link: %s", link_tpl->name); + tplg_dbg("Link: %s", link_tpl->name); link = elem->link; link->size = elem->size; diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h index 548f42d..947f27e 100644 --- a/src/topology/tplg_local.h +++ b/src/topology/tplg_local.h @@ -220,7 +220,7 @@ int tplg_parse_stream_caps(snd_tplg_t *tplg, int tplg_parse_pcm(snd_tplg_t *tplg, snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); -int tplg_parse_be(snd_tplg_t *tplg, +int tplg_parse_link(snd_tplg_t *tplg, snd_config_t *cfg, void *private ATTRIBUTE_UNUSED); int tplg_parse_cc(snd_tplg_t *tplg,