struct snd_soc_dai_link *dai_link)
{
struct snd_soc_pcm_runtime *rtd;
- struct snd_soc_dai_link_component *codecs;
+ struct snd_soc_dai_link_component *codec, *platform;
struct snd_soc_component *component;
int i;
/* Find CODEC from registered CODECs */
rtd->num_codecs = dai_link->num_codecs;
- for_each_link_codecs(dai_link, i, codecs) {
- rtd->codec_dais[i] = snd_soc_find_dai(codecs);
+ for_each_link_codecs(dai_link, i, codec) {
+ rtd->codec_dais[i] = snd_soc_find_dai(codec);
if (!rtd->codec_dais[i]) {
dev_info(card->dev, "ASoC: CODEC DAI %s not registered\n",
- codecs->dai_name);
+ codec->dai_name);
goto _err_defer;
}
+
snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
rtd->codec_dai = rtd->codec_dais[0];
/* Find PLATFORM from registered PLATFORMs */
- for_each_component(component) {
- if (!snd_soc_is_matching_component(dai_link->platforms,
- component))
- continue;
+ for_each_link_platforms(dai_link, i, platform) {
+ for_each_component(component) {
+ if (!snd_soc_is_matching_component(platform, component))
+ continue;
- snd_soc_rtdcom_add(rtd, component);
+ snd_soc_rtdcom_add(rtd, component);
+ }
}
soc_add_pcm_runtime(card, rtd);
struct snd_soc_dai_link *link)
{
int i;
- struct snd_soc_dai_link_component *codec;
+ struct snd_soc_dai_link_component *codec, *platform;
for_each_link_codecs(link, i, codec) {
/*
* Codec must be specified by 1 of name or OF node,
* not both or neither.
*/
- if (!!codec->name ==
- !!codec->of_node) {
+ if (!!codec->name == !!codec->of_node) {
dev_err(card->dev, "ASoC: Neither/both codec name/of_node are set for %s\n",
link->name);
return -EINVAL;
return -EPROBE_DEFER;
}
- /*
- * Platform may be specified by either name or OF node,
- * or no Platform.
- *
- * FIXME
- *
- * We need multi-platform support
- */
- if (link->num_platforms > 0) {
-
- 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) {
+ for_each_link_platforms(link, i, platform) {
+ /*
+ * Platform may be specified by either name or OF node, but it
+ * can be left unspecified, then no components will be inserted
+ * in the rtdcom list
+ */
+ if (!!platform->name == !!platform->of_node) {
dev_err(card->dev,
- "ASoC: Both platform name/of_node are set for %s\n",
+ "ASoC: Neither/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.
+ * Defer card registration if platform component is not added to
+ * component list.
*/
- if ((link->platforms->of_node || link->platforms->name) &&
- !soc_find_component(link->platforms))
+ if (!soc_find_component(platform))
return -EPROBE_DEFER;
}