alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: soc-pcm: fix hw param limits calculation for multi-DAI
@ 2021-02-16 16:43 Kai Vehmanen
  2021-02-17 23:17 ` Kuninori Morimoto
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Vehmanen @ 2021-02-16 16:43 UTC (permalink / raw)
  To: alsa-devel, broonie, kuninori.morimoto.gx
  Cc: kai.vehmanen, yung-chuan.liao, lgirdwood, pierre-louis.bossart,
	ranjani.sridharan, daniel.baluta

In case DPCM runtime has multiple CPU DAIs, dpcm_init_runtime_hw()
is called multiple times, once for each CPU DAI. This will
will lead to ignoring hw limits of all but the first 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")
Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/soc/soc-pcm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 37094aeff440..14d85ca1e435 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -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
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: soc-pcm: fix hw param limits calculation for multi-DAI
  2021-02-16 16:43 [PATCH] ASoC: soc-pcm: fix hw param limits calculation for multi-DAI Kai Vehmanen
@ 2021-02-17 23:17 ` Kuninori Morimoto
  0 siblings, 0 replies; 2+ messages in thread
From: Kuninori Morimoto @ 2021-02-17 23:17 UTC (permalink / raw)
  To: Kai Vehmanen
  Cc: alsa-devel, lgirdwood, yung-chuan.liao, pierre-louis.bossart,
	ranjani.sridharan, broonie, daniel.baluta


Hi Kai

> In case DPCM runtime has multiple CPU DAIs, dpcm_init_runtime_hw()
> is called multiple times, once for each CPU DAI. This will
> will lead to ignoring hw limits of all but the first 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")
> Suggested-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> ---

Sorry I couldn't post patch because I had Holiday yesterday.
Thank you for this patch !
I'm happy it could solve your issue.

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-17 23:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 16:43 [PATCH] ASoC: soc-pcm: fix hw param limits calculation for multi-DAI Kai Vehmanen
2021-02-17 23:17 ` Kuninori Morimoto

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).