From: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> Many drivers are constituting "Platform == CPU", so it has below settings on current "legacy style". dai_link->platform_of_node = dai_link->cpu_of_node; Because of it, soc_bind_dai_link() will pick-up "CPU component" as "Platform component", and try to add it to snd_soc_pcm_runtime. But it will be ignored, because it is already added when CPU bindings. This kind of "Platform" settings is pointless. This patch allows "no Platform" for "modern style" (= snd_soc_dai_link_component). Unfortunately, there are some sound card drivers which doesn't have platform_name, platform_of_node for legacy style. Of course it doesn't have platforms either for modern style. But, it is assuming that "snd_soc_dummy platform" is automatically selected by soc-core. Because of it, we need to judge that dai_link is using "legacy style" or "modern style" somehow. no Platform settings on "legacy style" -> select snd_soc_dummy no Platform settings on "modern style" -> real "no Platform" If sound card dirver is using "modern style", both codec/platform are using it. So this patch judges it as "modern style" if there is no settings for codec_name codec_of_node codec_dai_name platform_name platform_of_node Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx> --- include/sound/soc.h | 2 +- sound/soc/soc-core.c | 71 ++++++++++++++++++++++++++++++++++------------------ 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 9568968..c18e076 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -957,7 +957,7 @@ struct snd_soc_dai_link { /* * You MAY specify the link's platform/PCM/DMA driver, either by * device name, or by DT/OF node, but not both. Some forms of link - * do not need a platform. + * do not need a platform. In such case, platforms are not mandatory. */ const char *platform_name; struct device_node *platform_of_node; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d6b5edb..cefd121 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -768,6 +768,9 @@ static int snd_soc_is_matching_component( { struct device_node *component_of_node; + if (!dlc) + return 0; + component_of_node = component->dev->of_node; if (!component_of_node && component->dev->parent) component_of_node = component->dev->parent->of_node; @@ -1052,6 +1055,15 @@ static int snd_soc_init_platform(struct snd_soc_card *card, * see * soc.h :: struct snd_soc_dai_link */ + + /* it is already using modern style */ + if (!dai_link->codec_name && + !dai_link->codec_of_node && + !dai_link->codec_dai_name && + !dai_link->platform_name && + !dai_link->platform_of_node) + goto init_end; + /* convert Legacy platform link */ if (!platform || dai_link->legacy_platform) { platform = devm_kzalloc(card->dev, @@ -1068,6 +1080,7 @@ static int snd_soc_init_platform(struct snd_soc_card *card, platform->dai_name = NULL; } +init_end: /* if there's no platform we match on the empty platform */ if (!platform->name && !platform->of_node) @@ -1151,32 +1164,38 @@ static int soc_init_dai_link(struct snd_soc_card *card, } } - /* FIXME */ - if (link->num_platforms > 1) { - dev_err(card->dev, - "ASoC: multi platform is not yet supported %s\n", - link->name); - return -EINVAL; - } - /* - * Platform may be specified by either name or OF node, but - * can be left unspecified, and a dummy platform will be used. + * Platform may be specified by either name or OF node, + * or no Platform. + * + * FIXME + * + * We need multi-platform support */ - if (link->platforms->name && link->platforms->of_node) { - dev_err(card->dev, - "ASoC: Both platform name/of_node are set for %s\n", - link->name); - return -EINVAL; - } + if (link->num_platforms > 0) { - /* - * Defer card registartion if platform dai component is not added to - * component list. - */ - if ((link->platforms->of_node || link->platforms->name) && - !soc_find_component(link->platforms->of_node, link->platforms->name)) - return -EPROBE_DEFER; + if (link->num_platforms > 1) { + dev_err(card->dev, + "ASoC: multi platform is not yet supported %s\n", + link->name); + return -EINVAL; + } + + if (link->platforms->name && link->platforms->of_node) { + dev_err(card->dev, + "ASoC: Both platform name/of_node are set for %s\n", + link->name); + return -EINVAL; + } + + /* + * Defer card registartion if platform dai component is not added to + * component list. + */ + if ((link->platforms->of_node || link->platforms->name) && + !soc_find_component(link->platforms->of_node, link->platforms->name)) + return -EPROBE_DEFER; + } /* * CPU device may be specified by either name or OF node, but @@ -1975,7 +1994,11 @@ static void soc_check_tplg_fes(struct snd_soc_card *card) dev_err(card->dev, "init platform error"); continue; } - dai_link->platforms->name = component->name; + if (dai_link->platforms) + dai_link->platforms->name = component->name; + else + dev_err(card->dev, "no platform was selected %s\n", + dai_link->name); /* convert non BE into BE */ dai_link->no_pcm = 1; -- 2.7.4 _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel