From patchwork Thu Oct 27 07:14:05 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: 9399263 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 0008B60588 for ; Thu, 27 Oct 2016 12:58:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8D0F2A26F for ; Thu, 27 Oct 2016 12:58:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD7552A272; Thu, 27 Oct 2016 12:58:40 +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 72FDD2A26F for ; Thu, 27 Oct 2016 12:58:37 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C95EB2673EE; Thu, 27 Oct 2016 14:58:36 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DF86A2673DD; Thu, 27 Oct 2016 14:56:08 +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 5AE92267330; Thu, 27 Oct 2016 09:12:56 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by alsa0.perex.cz (Postfix) with ESMTP id 9D4A72672C7 for ; Thu, 27 Oct 2016 09:12:50 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 27 Oct 2016 00:12:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.31,404,1473145200"; d="scan'208"; a="1076495243" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.21]) by fmsmga002.fm.intel.com with ESMTP; 27 Oct 2016 00:12:48 -0700 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org Date: Thu, 27 Oct 2016 15:14:05 +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 15/22] topology: Parse link flags of physical DAI 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 Parse physical DAI link flags in both text conf file or C API template. Signed-off-by: Mengdong Lin diff --git a/include/topology.h b/include/topology.h index cf25de5..d7971b7 100644 --- a/include/topology.h +++ b/include/topology.h @@ -640,6 +640,13 @@ extern "C" { * * default_hw_conf_id "1" #default HW config ID for init * + * # Optional flags, the default value is "false". + * symmetric_rates "true or false" + * symmetric_channels "true or false" + * symmetric_sample_bits "true or false" + * ignore_suspend "true or false" + * ignore_powerdown_time "true or false" + * * data "name" # optional private data * } * @@ -959,6 +966,10 @@ struct snd_tplg_link_template { struct snd_tplg_hw_config_template *hw_config; /*!< supported HW configs */ int num_hw_configs; /* number of hw configs */ int default_hw_config_id; /* default hw config ID for init */ + + unsigned int flag_mask; /* bitmask of flags to configure */ + unsigned int flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */ + struct snd_soc_tplg_private *priv; /*!< private data */ }; /** \struct snd_tplg_obj_template diff --git a/src/topology/pcm.c b/src/topology/pcm.c index 9e5bb8e..daeb32e 100644 --- a/src/topology/pcm.c +++ b/src/topology/pcm.c @@ -682,6 +682,53 @@ int tplg_parse_link(snd_tplg_t *tplg, continue; } + /* flags */ + if (strcmp(id, "symmetric_rates") == 0) { + err = parse_flag(n, + SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES, + &link->flag_mask, &link->flags); + if (err < 0) + return err; + continue; + } + + if (strcmp(id, "symmetric_channels") == 0) { + err = parse_flag(n, + SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS, + &link->flag_mask, &link->flags); + if (err < 0) + return err; + continue; + } + + if (strcmp(id, "symmetric_sample_bits") == 0) { + err = parse_flag(n, + SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS, + &link->flag_mask, &link->flags); + if (err < 0) + return err; + continue; + } + + if (strcmp(id, "ignore_suspend") == 0) { + err = parse_flag(n, + SND_SOC_TPLG_LNK_FLGBIT_IGNORE_SUSPEND, + &link->flag_mask, &link->flags); + if (err < 0) + return err; + continue; + } + + if (strcmp(id, "ignore_powerdown_time") == 0) { + err = parse_flag(n, + SND_SOC_TPLG_LNK_FLGBIT_IGNORE_POWERDOWN_TIME, + &link->flag_mask, &link->flags); + if (err < 0) + return err; + continue; + } + + /* private data */ if (strcmp(id, "data") == 0) { err = tplg_parse_data_refs(n, elem); if (err < 0) @@ -1028,5 +1075,9 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t) link->default_hw_config_id = link_tpl->default_hw_config_id; for (i = 0; i < link->num_hw_configs; i++) set_link_hw_config(&link->hw_config[i], &link_tpl->hw_config[i]); + + /* flags */ + link->flag_mask = link_tpl->flag_mask; + link->flags = link_tpl->flags; return 0; }