[PATCH 6/7] ASoC: soc-pcm: Merge CPU/Codec MSB at soc_pcm_apply_msb()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Wed Mar 11 02:07:46 CET 2020
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
soc_pcm_apply_msb() is setting msb for both CPU/Codec,
but we can merge these into one.
This patch do it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
sound/soc/soc-pcm.c | 26 +++++++-------------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index dae1821c78dc..c0f318699fe4 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -530,35 +530,23 @@ static void soc_pcm_set_msb(struct snd_pcm_substream *substream, int bits)
static void soc_pcm_apply_msb(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
- struct snd_soc_dai *cpu_dai;
- struct snd_soc_dai *codec_dai;
- struct snd_soc_pcm_stream *pcm_codec, *pcm_cpu;
+ struct snd_soc_dai *dai;
+ struct snd_soc_pcm_stream *pcm;
int stream = substream->stream;
int i;
- unsigned int bits = 0, cpu_bits = 0;
+ unsigned int bits = 0;
- for_each_rtd_codec_dais(rtd, i, codec_dai) {
- pcm_codec = snd_soc_dai_get_pcm_stream(codec_dai, stream);
+ for_each_rtd_dais(rtd, i, dai) {
+ pcm = snd_soc_dai_get_pcm_stream(dai, stream);
- if (pcm_codec->sig_bits == 0) {
+ if (pcm->sig_bits == 0) {
bits = 0;
break;
}
- bits = max(pcm_codec->sig_bits, bits);
- }
-
- for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
- pcm_cpu = snd_soc_dai_get_pcm_stream(cpu_dai, stream);
-
- if (pcm_cpu->sig_bits == 0) {
- cpu_bits = 0;
- break;
- }
- cpu_bits = max(pcm_cpu->sig_bits, cpu_bits);
+ bits = max(pcm->sig_bits, bits);
}
soc_pcm_set_msb(substream, bits);
- soc_pcm_set_msb(substream, cpu_bits);
}
/**
--
2.17.1
More information about the Alsa-devel
mailing list