Skip to contentSkip to conversation

ASoC: soc-pcm: fix hw param limits calculation for multi-DAI

PATCH In review Kai Vehmanen 2 participants 2 messages Feb 16, 2021 – Feb 17, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: soc-pcm: fix hw param limits calculation for multi-DAI

In case DPCM runtime has multiple CPU DAIs, dpcm_init_runtime_hw() is called multiple times, once for each CPU DAI. This will lead to ignoring hw limits of all but the last DAI.

Fix this by moving soc_pcm_hw_init() up by one level to dpcm_init_runtime_hw().

Fixes 140f553d1298 ("ASoC: soc-pcm: fix hwparams min/max init for dpcm")
---
 sound/soc/soc-pcm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

v2 changes:
- fixed incorrect text in commit message, no functional change

sound/soc/soc-pcm.c +7 -2
index 37094aeff440..14d85ca1e435 100644
@@ -1531,10 +1531,12 @@ static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime,
 {
 	struct snd_pcm_hardware *hw = &runtime->hw;
 
-	soc_pcm_hw_init(hw);
 	soc_pcm_hw_update_rate(hw, stream);
 	soc_pcm_hw_update_chan(hw, stream);
-	soc_pcm_hw_update_format(hw, stream);
+	if (runtime->hw.formats)
+		runtime->hw.formats &= stream->formats;
+	else
+		runtime->hw.formats = stream->formats;
 }
 
 static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
@@ -1662,10 +1664,13 @@ static void dpcm_runtime_merge_rate(struct snd_pcm_substream *substream,
 static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream)
 {
 	struct snd_pcm_runtime *runtime = substream->runtime;
+	struct snd_pcm_hardware *hw = &runtime->hw;
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	struct snd_soc_dai *cpu_dai;
 	int i;
 
+	soc_pcm_hw_init(hw);
+
 	for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
 		/*
 		 * Skip CPUs which don't support the current stream

base-commit: 140f553d1298e0ddbe21983efe5789fe8b484273

Signature · 1 line
2.29.2
maintainer
#1 lore raw
Quoted 6 lines · Kai Vehmanen

In case DPCM runtime has multiple CPU DAIs, dpcm_init_runtime_hw() is called multiple times, once for each CPU DAI. This will lead to ignoring hw limits of all but the last DAI.

Fix this by moving soc_pcm_hw_init() up by one level to dpcm_init_runtime_hw().

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: soc-pcm: fix hw param limits calculation for multi-DAI

      commit: 8a353d7bafddb447fae136ca68899a6ba6187be6

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark