From patchwork Tue Feb 16 06:12:26 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: 8321701 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9C6E7C02AA for ; Tue, 16 Feb 2016 06:11:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BF9E6202A1 for ; Tue, 16 Feb 2016 06:11:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 94A0E2024F for ; Tue, 16 Feb 2016 06:11:43 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3C12D2657C6; Tue, 16 Feb 2016 07:11:42 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E52E92655DB; Tue, 16 Feb 2016 07:11:35 +0100 (CET) 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 CF109265654; Tue, 16 Feb 2016 07:11:33 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id 34D5A2655DB for ; Tue, 16 Feb 2016 07:11:25 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 15 Feb 2016 22:11:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,454,1449561600"; d="scan'208";a="913141876" Received: from amanda-haswell-pc.sh.intel.com ([10.239.159.169]) by orsmga002.jf.intel.com with ESMTP; 15 Feb 2016 22:11:21 -0800 From: mengdong.lin@linux.intel.com To: alsa-devel@alsa-project.org, broonie@kernel.org Date: Tue, 16 Feb 2016 14:12:26 +0800 Message-Id: <1455603146-6138-1-git-send-email-mengdong.lin@linux.intel.com> X-Mailer: git-send-email 2.5.0 Cc: lars@metafoo.de, vinod.koul@intel.com, hardik.t.shah@intel.com, liam.r.girdwood@linux.intel.com, Mengdong Lin , mengdong.lin@intel.com, jeeja.kp@intel.com, subhransu.s.prusty@intel.com Subject: [alsa-devel] [PATCH] ASoC: topology: Fix setting of stream rates, rate_min and rate_max 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 Directly set a stream's rates, rate_min and rate_max from the topology info. Also define set_stream_info to wrap setting of the stream info. Signed-off-by: Mengdong Lin diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 0eb01e8..2f7da32 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -1575,6 +1575,18 @@ static int soc_tplg_dapm_complete(struct soc_tplg *tplg) return 0; } +static int set_stream_info(struct snd_soc_pcm_stream *stream, + struct snd_soc_tplg_stream_caps *caps) +{ + stream->stream_name = kstrdup(caps->name, GFP_KERNEL); + stream->channels_min = caps->channels_min; + stream->channels_max = caps->channels_max; + stream->rates = caps->rates; + stream->rate_min = caps->rate_min; + stream->rate_max = caps->rate_max; + stream->formats = caps->formats; +} + static int soc_tplg_dai_create(struct soc_tplg *tplg, struct snd_soc_tplg_pcm *pcm) { @@ -1593,25 +1605,13 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg, if (pcm->playback) { stream = &dai_drv->playback; caps = &pcm->caps[SND_SOC_TPLG_STREAM_PLAYBACK]; - - stream->stream_name = kstrdup(caps->name, GFP_KERNEL); - stream->channels_min = caps->channels_min; - stream->channels_max = caps->channels_max; - stream->rates = snd_pcm_rate_range_to_bits(caps->rate_min, - caps->rate_max); - stream->formats = caps->formats; + set_stream_info(stream, caps); } if (pcm->capture) { stream = &dai_drv->capture; caps = &pcm->caps[SND_SOC_TPLG_STREAM_CAPTURE]; - - stream->stream_name = kstrdup(caps->name, GFP_KERNEL); - stream->channels_min = caps->channels_min; - stream->channels_max = caps->channels_max; - stream->rates = snd_pcm_rate_range_to_bits(caps->rate_min, - caps->rate_max); - stream->formats = caps->formats; + set_stream_info(stream, caps); } /* pass control to component driver for optional further init */