aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@linux.intel.com>2016-02-22 03:29:19 -0500
committerMark Brown <broonie@kernel.org>2016-02-22 05:40:36 -0500
commitb6b6e4d670c9285225dc826bf69620f69717ade0 (patch)
tree502d4a2bb061fd3f30a68f3024c61dc75c2998f5
parent3375cbe420a8987b30daf3c021bea6fb0b0fe344 (diff)
ASoC: topology: Fix setting of stream rates, rate_min and rate_max
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> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-topology.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 07f61a67aef6..1cf94d7fb9f4 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1530,6 +1530,18 @@ static int soc_tplg_dapm_complete(struct soc_tplg *tplg)
1530 return 0; 1530 return 0;
1531} 1531}
1532 1532
1533static void set_stream_info(struct snd_soc_pcm_stream *stream,
1534 struct snd_soc_tplg_stream_caps *caps)
1535{
1536 stream->stream_name = kstrdup(caps->name, GFP_KERNEL);
1537 stream->channels_min = caps->channels_min;
1538 stream->channels_max = caps->channels_max;
1539 stream->rates = caps->rates;
1540 stream->rate_min = caps->rate_min;
1541 stream->rate_max = caps->rate_max;
1542 stream->formats = caps->formats;
1543}
1544
1533static int soc_tplg_dai_create(struct soc_tplg *tplg, 1545static int soc_tplg_dai_create(struct soc_tplg *tplg,
1534 struct snd_soc_tplg_pcm *pcm) 1546 struct snd_soc_tplg_pcm *pcm)
1535{ 1547{
@@ -1548,25 +1560,13 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,
1548 if (pcm->playback) { 1560 if (pcm->playback) {
1549 stream = &dai_drv->playback; 1561 stream = &dai_drv->playback;
1550 caps = &pcm->caps[SND_SOC_TPLG_STREAM_PLAYBACK]; 1562 caps = &pcm->caps[SND_SOC_TPLG_STREAM_PLAYBACK];
1551 1563 set_stream_info(stream, caps);
1552 stream->stream_name = kstrdup(caps->name, GFP_KERNEL);
1553 stream->channels_min = caps->channels_min;
1554 stream->channels_max = caps->channels_max;
1555 stream->rates = snd_pcm_rate_range_to_bits(caps->rate_min,
1556 caps->rate_max);
1557 stream->formats = caps->formats;
1558 } 1564 }
1559 1565
1560 if (pcm->capture) { 1566 if (pcm->capture) {
1561 stream = &dai_drv->capture; 1567 stream = &dai_drv->capture;
1562 caps = &pcm->caps[SND_SOC_TPLG_STREAM_CAPTURE]; 1568 caps = &pcm->caps[SND_SOC_TPLG_STREAM_CAPTURE];
1563 1569 set_stream_info(stream, caps);
1564 stream->stream_name = kstrdup(caps->name, GFP_KERNEL);
1565 stream->channels_min = caps->channels_min;
1566 stream->channels_max = caps->channels_max;
1567 stream->rates = snd_pcm_rate_range_to_bits(caps->rate_min,
1568 caps->rate_max);
1569 stream->formats = caps->formats;
1570 } 1570 }
1571 1571
1572 /* pass control to component driver for optional further init */ 1572 /* pass control to component driver for optional further init */