Re: [PATCH for-5.15 0/5] ASoC: fsl: register platform component before registering cpu dai
From: Shengjiu Wang
Date: Mon Sep 06 2021 - 22:43:43 EST
Hi Mark
On Mon, Sep 6, 2021 at 7:48 PM Mark Brown <broonie@xxxxxxxxxx> 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