2021-09-03 11:49:44

by Shengjiu Wang

[permalink] [raw]
Subject: [PATCH for-5.15 0/5] ASoC: fsl: register platform component before registering cpu dai

There is no defer probe when adding platform component to
snd_soc_pcm_runtime(rtd), the code is in snd_soc_add_pcm_runtime()

snd_soc_register_card()
-> snd_soc_bind_card()
-> snd_soc_add_pcm_runtime()
-> adding cpu dai
-> adding codec dai
-> adding platform component.

So if the platform component is not ready at that time, then the
sound card still registered successfully, but platform component
is empty, the sound card can't be used.

As there is defer probe checking for cpu dai component, then register
platform component before cpu dai to avoid such issue.

This patch set is to fix this issue for SAI, ESAI, MICFIL, SPDIF,
XCVR drivers.

Shengjiu Wang (5):
ASoC: fsl_sai: register platform component before registering cpu dai
ASoC: fsl_esai: register platform component before registering cpu dai
ASoC: fsl_micfil: register platform component before registering cpu
dai
ASoC: fsl_spdif: register platform component before registering cpu
dai
ASoC: fsl_xcvr: register platform component before registering cpu dai

sound/soc/fsl/fsl_esai.c | 16 ++++++++++------
sound/soc/fsl/fsl_micfil.c | 15 ++++++++++-----
sound/soc/fsl/fsl_sai.c | 14 +++++++++-----
sound/soc/fsl/fsl_spdif.c | 14 +++++++++-----
sound/soc/fsl/fsl_xcvr.c | 15 ++++++++++-----
5 files changed, 48 insertions(+), 26 deletions(-)

--
2.17.1


2021-09-06 11:49:48

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH for-5.15 0/5] ASoC: fsl: register platform component before registering cpu dai

On Fri, Sep 03, 2021 at 06:30:01PM +0800, Shengjiu Wang wrote:

> There is no defer probe when adding platform component to
> snd_soc_pcm_runtime(rtd), the code is in snd_soc_add_pcm_runtime()

...

> So if the platform component is not ready at that time, then the
> sound card still registered successfully, but platform component
> is empty, the sound card can't be used.

This sounds like a bug which should be fixed there?


Attachments:
(No filename) (440.00 B)
signature.asc (499.00 B)
Download all attachments

2021-09-07 02:51:02

by Shengjiu Wang

[permalink] [raw]
Subject: Re: [PATCH for-5.15 0/5] ASoC: fsl: register platform component before registering cpu dai

Hi Mark

On Mon, Sep 6, 2021 at 7:48 PM Mark Brown <[email protected]> wrote:
>
> On Fri, Sep 03, 2021 at 06:30:01PM +0800, Shengjiu Wang wrote:
>
> > There is no defer probe when adding platform component to
> > snd_soc_pcm_runtime(rtd), the code is in snd_soc_add_pcm_runtime()
>
> ...
>
> > So if the platform component is not ready at that time, then the
> > sound card still registered successfully, but platform component
> > is empty, the sound card can't be used.
>
> This sounds like a bug which should be fixed there?

It is hard.

In cpu dai driver we always register two components, one is for
cpu dai, another is for platform, so for sound card platform and
cpu share the same node.

/* Find PLATFORM from registered PLATFORMs */
for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
if (!snd_soc_is_matching_component(platform, component))
continue;

snd_soc_rtd_add_component(rtd, component);
}
}

Above code in snd_soc_add_pcm_runtime() checks components
for the platform, because there are two components for the node,
the first one is the component of cpu dai, which is added by
registering dai, it is already added in the beginning, so it is
duplicated, but the second one (which is for platform) is not ready,
then issue happens.

It is hard to add conditions here for defer probe. And maybe
some drivers need the same components for cpu and platform.
Do you have any suggestions?

(The easy way is to fix in each drivers:))

Best Regards
Wang Shengjiu

2021-09-10 10:18:34

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH for-5.15 0/5] ASoC: fsl: register platform component before registering cpu dai

On Tue, Sep 07, 2021 at 10:43:26AM +0800, Shengjiu Wang wrote:

> It is hard to add conditions here for defer probe. And maybe
> some drivers need the same components for cpu and platform.
> Do you have any suggestions?

I would expect that in this situation the same component would be able
to fill both roles.


Attachments:
(No filename) (321.00 B)
signature.asc (499.00 B)
Download all attachments

2021-09-10 16:12:06

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH for-5.15 0/5] ASoC: fsl: register platform component before registering cpu dai

On Fri, 3 Sep 2021 18:30:01 +0800, Shengjiu Wang wrote:
> There is no defer probe when adding platform component to
> snd_soc_pcm_runtime(rtd), the code is in snd_soc_add_pcm_runtime()
>
> snd_soc_register_card()
> -> snd_soc_bind_card()
> -> snd_soc_add_pcm_runtime()
> -> adding cpu dai
> -> adding codec dai
> -> adding platform component.
>
> [...]

Applied to

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

Thanks!

[1/5] ASoC: fsl_sai: register platform component before registering cpu dai
commit: 9c3ad33b5a412d8bc0a377e7cd9baa53ed52f22d
[2/5] ASoC: fsl_esai: register platform component before registering cpu dai
commit: f12ce92e98b21c1fc669cd74e12c54a0fe3bc2eb
[3/5] ASoC: fsl_micfil: register platform component before registering cpu dai
commit: 0adf292069dcca8bab76a603251fcaabf77468ca
[4/5] ASoC: fsl_spdif: register platform component before registering cpu dai
commit: ee8ccc2eb5840e34fce088bdb174fd5329153ef0
[5/5] ASoC: fsl_xcvr: register platform component before registering cpu dai
commit: c590fa80b39287a91abeb487829f3190e7ae775f

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