From: Rander Wang <rander.wang@linux.intel.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org,
pierre-louis.bossart@linux.intel.com,
Rander Wang <rander.wang@linux.intel.com>
Subject: [PATCH 1/3] ASoC:soc-pcm:fix a codec fixup issue in TDM case
Date: Fri, 8 Mar 2019 16:38:57 +0800 [thread overview]
Message-ID: <20190308083859.50026-2-rander.wang@linux.intel.com> (raw)
In-Reply-To: <20190308083859.50026-1-rander.wang@linux.intel.com>
On HDaudio platforms, if playback is started when capture is working,
there is no audible output.
This can be root-caused to the use of the rx|tx_mask to store an HDaudio
stream tag.
If capture is stared before playback, rx_mask would be non-zero on HDaudio
platform, then the channel number of playback, which is in the same codec
dai with the capture, would be changed by soc_pcm_codec_params_fixup based
on the tx_mask at first, then overwritten by this function based on rx_mask
at last.
According to the author of tx|rx_mask, tx_mask is for playback and rx_mask
is for capture. And stream direction is checked at all other references of
tx|rx_mask in ASoC, so here should be an error. This patch checks stream
direction for tx|rx_mask for fixup function.
This issue would affect not only HDaudio+ASoC, but also I2S codecs if the
channel number based on rx_mask is not equal to the one for tx_mask. It could
be rarely reproduecd because most drivers in kernel set the same channel number
to tx|rx_mask or rx_mask is zero.
Tested on all platforms using stream_tag & HDaudio and intel I2S platforms.
Signed-off-by: Rander Wang <rander.wang@linux.intel.com>
---
sound/soc/soc-pcm.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index a5b40e82dea4..e70555a4ea06 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -954,10 +954,13 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
codec_params = *params;
/* fixup params based on TDM slot masks */
- if (codec_dai->tx_mask)
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
+ codec_dai->tx_mask)
soc_pcm_codec_params_fixup(&codec_params,
codec_dai->tx_mask);
- if (codec_dai->rx_mask)
+
+ if (substream->stream == SNDRV_PCM_STREAM_CAPTURE &&
+ codec_dai->rx_mask)
soc_pcm_codec_params_fixup(&codec_params,
codec_dai->rx_mask);
--
2.14.1
next prev parent reply other threads:[~2019-03-08 8:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 8:38 [PATCH 0/3] ASoC: hda: capture-related fixes Rander Wang
2019-03-08 8:38 ` Rander Wang [this message]
2019-03-11 17:23 ` Applied "ASoC:soc-pcm:fix a codec fixup issue in TDM case" to the asoc tree Mark Brown
2019-03-08 8:38 ` [PATCH 2/3] ASoC:hdac_hda:use correct format to setup hda codec Rander Wang
2019-03-08 8:38 ` [PATCH 3/3] ASoC:intel:skl:fix a simultaneous playback & capture issue on hda platform Rander Wang
2019-03-11 17:23 ` Applied "ASoC:intel:skl:fix a simultaneous playback & capture issue on hda platform" to the asoc tree Mark Brown
2019-03-08 15:27 ` [PATCH 0/3] ASoC: hda: capture-related fixes Pierre-Louis Bossart
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=20190308083859.50026-2-rander.wang@linux.intel.com \
--to=rander.wang@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=pierre-louis.bossart@linux.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).