struct device *dev = card->dev;
struct snd_soc_dai_link *link;
struct of_phandle_args args;
+ struct snd_soc_dai_link_component *dlc;
int ret, num_links;
ret = snd_soc_of_parse_card_name(card, "model");
card->num_links = num_links;
link = card->dai_link;
+
+ dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL);
+ if (!dlc)
+ return -ENOMEM;
+
+ link->cpus = &dlc[0];
+ link->platforms = &dlc[1];
+
+ link->num_cpus = 1;
+ link->num_platforms = 1;
+
for_each_child_of_node(dev->of_node, np) {
cpu = of_get_child_by_name(np, "cpu");
platform = of_get_child_by_name(np, "platform");
dev_err(card->dev, "error getting cpu phandle\n");
goto err;
}
- link->cpu_of_node = args.np;
+ link->cpus->of_node = args.np;
link->id = args.args[0];
- ret = snd_soc_of_get_dai_name(cpu, &link->cpu_dai_name);
+ ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name);
if (ret) {
dev_err(card->dev, "error getting cpu dai name\n");
goto err;
}
if (codec && platform) {
- link->platform_of_node = of_parse_phandle(platform,
+ link->platforms->of_node = of_parse_phandle(platform,
"sound-dai",
0);
- if (!link->platform_of_node) {
+ if (!link->platforms->of_node) {
dev_err(card->dev, "platform dai not found\n");
ret = -EINVAL;
goto err;
link->no_pcm = 1;
link->ignore_pmdown_time = 1;
} else {
- link->platform_of_node = link->cpu_of_node;
- link->codec_dai_name = "snd-soc-dummy-dai";
- link->codec_name = "snd-soc-dummy";
+ dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
+ if (!dlc)
+ return -ENOMEM;
+
+ link->codecs = dlc;
+ link->num_codecs = 1;
+
+ link->platforms->of_node = link->cpus->of_node;
+ link->codecs->dai_name = "snd-soc-dummy-dai";
+ link->codecs->name = "snd-soc-dummy";
link->dynamic = 1;
}