]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/asoc-soc-pcm-fix-a-codec-fixup-issue-in-tdm-case.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / asoc-soc-pcm-fix-a-codec-fixup-issue-in-tdm-case.patch
CommitLineData
7264e8a9
SL
1From 63233ede4779d7d8993abd85214df5433e3b90a9 Mon Sep 17 00:00:00 2001
2From: Rander Wang <rander.wang@linux.intel.com>
3Date: Fri, 8 Mar 2019 16:38:57 +0800
4Subject: ASoC:soc-pcm:fix a codec fixup issue in TDM case
5
6[ Upstream commit 570f18b6a8d1f0e60e8caf30e66161b6438dcc91 ]
7
8On HDaudio platforms, if playback is started when capture is working,
9there is no audible output.
10
11This can be root-caused to the use of the rx|tx_mask to store an HDaudio
12stream tag.
13
14If capture is stared before playback, rx_mask would be non-zero on HDaudio
15platform, then the channel number of playback, which is in the same codec
16dai with the capture, would be changed by soc_pcm_codec_params_fixup based
17on the tx_mask at first, then overwritten by this function based on rx_mask
18at last.
19
20According to the author of tx|rx_mask, tx_mask is for playback and rx_mask
21is for capture. And stream direction is checked at all other references of
22tx|rx_mask in ASoC, so here should be an error. This patch checks stream
23direction for tx|rx_mask for fixup function.
24
25This issue would affect not only HDaudio+ASoC, but also I2S codecs if the
26channel number based on rx_mask is not equal to the one for tx_mask. It could
27be rarely reproduecd because most drivers in kernel set the same channel number
28to tx|rx_mask or rx_mask is zero.
29
30Tested on all platforms using stream_tag & HDaudio and intel I2S platforms.
31
32Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
33Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
34Signed-off-by: Mark Brown <broonie@kernel.org>
35Signed-off-by: Sasha Levin <sashal@kernel.org>
36---
37 sound/soc/soc-pcm.c | 7 +++++--
38 1 file changed, 5 insertions(+), 2 deletions(-)
39
40diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
41index f99eb8f442829..1c0d44c86c018 100644
42--- a/sound/soc/soc-pcm.c
43+++ b/sound/soc/soc-pcm.c
44@@ -882,10 +882,13 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
45 codec_params = *params;
46
47 /* fixup params based on TDM slot masks */
48- if (codec_dai->tx_mask)
49+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
50+ codec_dai->tx_mask)
51 soc_pcm_codec_params_fixup(&codec_params,
52 codec_dai->tx_mask);
53- if (codec_dai->rx_mask)
54+
55+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
56+ codec_dai->rx_mask)
57 soc_pcm_codec_params_fixup(&codec_params,
58 codec_dai->rx_mask);
59
60--
612.20.1
62