From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Shengjiu Wang <shengjiu.wang@nxp.com>
Cc: shengjiu.wang@gmail.com, lgirdwood@gmail.com, broonie@kernel.org,
perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: soc-pcm: fix hw->formats cleared by soc_pcm_hw_init() for dpcm
Date: Sun, 12 Mar 2023 23:58:59 +0000 [thread overview]
Message-ID: <875yb5frnl.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <1678346017-3660-1-git-send-email-shengjiu.wang@nxp.com>
Hi Shengjiu
> The hw->formats may be set by snd_dmaengine_pcm_refine_runtime_hwparams()
> in component's startup()/open(), but soc_pcm_hw_init() will init
> hw->formats in dpcm_runtime_setup_fe() after component's startup()/open(),
> which causes the valuable hw->formats to be cleared.
>
> So need to store the hw->formats before initialization, then restore
> it after initialization.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> ---
> sound/soc/soc-pcm.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index 5eb056b942ce..7958c9defd49 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -1661,10 +1661,14 @@ static void dpcm_runtime_setup_fe(struct snd_pcm_substream *substream)
> struct snd_pcm_hardware *hw = &runtime->hw;
> struct snd_soc_dai *dai;
> int stream = substream->stream;
> + u64 formats = hw->formats;
> int i;
>
> soc_pcm_hw_init(hw);
>
> + if (formats)
> + hw->formats &= formats;
> +
If my understanding was correct, dpcm_runtime_setup_fe() (B) is called
after __soc_pcm_open() (A), and you updated (B) part.
static int dpcm_fe_dai_startup(...) {
...
(A) ret = __soc_pcm_open(fe, fe_substream);
...
(B) dpcm_runtime_setup_fe(fe_substream);
...
}
But, it is doing same things under (A), too.
Do we need to initialize hw many times ? I'm not sure.
Can we simply remove soc_pcm_hw_init() from dpcm_runtime_setup_fe() ?
(A) static int __soc_pcm_open()
{
...
(X) soc_pcm_init_runtime_hw(substream);
...
}
(X) static void soc_pcm_init_runtime_hw(...)
{
=> u64 formats = hw->formats;
(Y) snd_soc_runtime_calc_hw(rtd, hw, substream->stream);
=> if (formats)
=> hw->formats &= formats;
}
(Y) int snd_soc_runtime_calc_hw(...)
{
...
=> soc_pcm_hw_init(hw);
...
}
Thank you for your help !!
Best regards
---
Kuninori Morimoto
next prev parent reply other threads:[~2023-03-12 23:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 7:13 Shengjiu Wang
2023-03-12 23:58 ` Kuninori Morimoto [this message]
[not found] ` <CAA+D8AOztY7Qp3hs3OOhKuhCDFzqWjSrk240S0CzLR7cg94GLA@mail.gmail.com>
2023-03-13 6:15 ` Kuninori Morimoto
2023-03-14 15:12 ` 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=875yb5frnl.wl-kuninori.morimoto.gx@renesas.com \
--to=kuninori.morimoto.gx@renesas.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shengjiu.wang@gmail.com \
--cc=shengjiu.wang@nxp.com \
--cc=tiwai@suse.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
all inboxes | Powered by JetHome®