Commit 1e36ea36 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: qcom: common: use modern dai_link style

ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent fa350b77
...@@ -14,6 +14,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card) ...@@ -14,6 +14,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
struct device *dev = card->dev; struct device *dev = card->dev;
struct snd_soc_dai_link *link; struct snd_soc_dai_link *link;
struct of_phandle_args args; struct of_phandle_args args;
struct snd_soc_dai_link_component *dlc;
int ret, num_links; int ret, num_links;
ret = snd_soc_of_parse_card_name(card, "model"); ret = snd_soc_of_parse_card_name(card, "model");
...@@ -40,6 +41,17 @@ int qcom_snd_parse_of(struct snd_soc_card *card) ...@@ -40,6 +41,17 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
card->num_links = num_links; card->num_links = num_links;
link = card->dai_link; 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) { for_each_child_of_node(dev->of_node, np) {
cpu = of_get_child_by_name(np, "cpu"); cpu = of_get_child_by_name(np, "cpu");
platform = of_get_child_by_name(np, "platform"); platform = of_get_child_by_name(np, "platform");
...@@ -57,20 +69,20 @@ int qcom_snd_parse_of(struct snd_soc_card *card) ...@@ -57,20 +69,20 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
dev_err(card->dev, "error getting cpu phandle\n"); dev_err(card->dev, "error getting cpu phandle\n");
goto err; goto err;
} }
link->cpu_of_node = args.np; link->cpus->of_node = args.np;
link->id = args.args[0]; 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) { if (ret) {
dev_err(card->dev, "error getting cpu dai name\n"); dev_err(card->dev, "error getting cpu dai name\n");
goto err; goto err;
} }
if (codec && platform) { if (codec && platform) {
link->platform_of_node = of_parse_phandle(platform, link->platforms->of_node = of_parse_phandle(platform,
"sound-dai", "sound-dai",
0); 0);
if (!link->platform_of_node) { if (!link->platforms->of_node) {
dev_err(card->dev, "platform dai not found\n"); dev_err(card->dev, "platform dai not found\n");
ret = -EINVAL; ret = -EINVAL;
goto err; goto err;
...@@ -84,9 +96,16 @@ int qcom_snd_parse_of(struct snd_soc_card *card) ...@@ -84,9 +96,16 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
link->no_pcm = 1; link->no_pcm = 1;
link->ignore_pmdown_time = 1; link->ignore_pmdown_time = 1;
} else { } else {
link->platform_of_node = link->cpu_of_node; dlc = devm_kzalloc(dev, sizeof(*dlc), GFP_KERNEL);
link->codec_dai_name = "snd-soc-dummy-dai"; if (!dlc)
link->codec_name = "snd-soc-dummy"; 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; link->dynamic = 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment