From: mengdong.lin@linux.intel.com
To: alsa-devel@alsa-project.org, broonie@kernel.org
Cc: lars@metafoo.de, vinod.koul@intel.com, hardik.t.shah@intel.com,
liam.r.girdwood@linux.intel.com,
Mengdong Lin <mengdong.lin@linux.intel.com>,
mengdong.lin@intel.com, jeeja.kp@intel.com,
subhransu.s.prusty@intel.com
Subject: [PATCH v2]ASoC: topology: Fix setting of stream rates, rate_min and rate_max
Date: Mon, 22 Feb 2016 16:29:19 +0800 [thread overview]
Message-ID: <1456129759-24017-1-git-send-email-mengdong.lin@linux.intel.com> (raw)
From: Mengdong Lin <mengdong.lin@linux.intel.com>
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 <mengdong.lin@linux.intel.com>
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 0eb01e8..726cea7 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 void 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 */
--
2.5.0
next reply other threads:[~2016-02-22 8:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 8:29 mengdong.lin [this message]
2016-02-22 10:51 ` Applied "ASoC: topology: Fix setting of stream rates, rate_min and rate_max" to the asoc tree Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456129759-24017-1-git-send-email-mengdong.lin@linux.intel.com \
--to=mengdong.lin@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=hardik.t.shah@intel.com \
--cc=jeeja.kp@intel.com \
--cc=lars@metafoo.de \
--cc=liam.r.girdwood@linux.intel.com \
--cc=mengdong.lin@intel.com \
--cc=subhransu.s.prusty@intel.com \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).