All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [PATCH 1/5] ASoC: soc-pcm: remove strange format storing
Date: 22 Feb 2021 09:46:57 +0900	[thread overview]
Message-ID: <87sg5pvshq.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: 87tuq5vsin.wl-kuninori.morimoto.gx@renesas.com


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

dpcm_init_runtime_hw() (= A) is used from dpcm_set_fe_runtime() (= B)
with for_each_rtd_cpu_dais() loop (= C), and it checks formats (= D).

(A)	static void dpcm_init_runtime_hw(...)
	{
		...
 ^		if (runtime->hw.formats)
 | (D1)			runtime->hw.formats &= stream->formats;
(D)		else
 | (D2)			runtime->hw.formats = stream->formats;
 v	}

(B)	static void dpcm_set_fe_runtime(...)
	{
		...
(C)		for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
			...
(A)			dpcm_init_runtime_hw(...);
		}
	}

If this for_each_rtd_cpu_dais() loop (= C) calls
dpcm_init_runtime_hw() (= A) multiple times, this means it is Multi-CPU.

If we focus to format operation at (D), using mask (= D1) is understandable
because it restricts unsupported format.
But, enabling format when zero format case (= D2) is very strange,
because it might enables unsupported format.

This runtime->hw.formats is initialized by ULLONG_MAX at soc_pcm_hw_init(),
thus becoming zero format means it can't use such format.
And doing this strange format operation is only here.

This patch removes strange format operation (= D2), and use standard
soc_pcm_hw_update_format() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-pcm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 14d85ca1e435..bb912a94e895 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1533,10 +1533,7 @@ static void dpcm_init_runtime_hw(struct snd_pcm_runtime *runtime,
 
 	soc_pcm_hw_update_rate(hw, stream);
 	soc_pcm_hw_update_chan(hw, stream);
-	if (runtime->hw.formats)
-		runtime->hw.formats &= stream->formats;
-	else
-		runtime->hw.formats = stream->formats;
+	soc_pcm_hw_update_format(hw, stream);
 }
 
 static void dpcm_runtime_merge_format(struct snd_pcm_substream *substream,
-- 
2.25.1


  reply	other threads:[~2021-02-22  0:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-22  0:46 [PATCH 0/5] soc-pcm: tidyup snd_pcm_hardware setup for FE/BE Kuninori Morimoto
2021-02-22  0:46 ` Kuninori Morimoto [this message]
2021-02-22  0:47 ` [PATCH 2/5] ASoC: soc-pcm: unpack dpcm_init_runtime_hw() Kuninori Morimoto
2021-02-22  0:47 ` [PATCH 3/5] ASoC: soc-pcm: add dpcm_runtime_setup_fe() Kuninori Morimoto
2021-02-22  0:47 ` [PATCH 4/5] ASoC: soc-pcm: add dpcm_runtime_setup() Kuninori Morimoto
2021-02-22  0:47 ` [PATCH 5/5] ASoC: soc-pcm: unpack dpcm_set_fe_runtime() Kuninori Morimoto
2021-03-01 23:34 ` [PATCH 0/5] soc-pcm: tidyup snd_pcm_hardware setup for FE/BE Mark Brown

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=87sg5pvshq.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.