Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+26 −7
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
	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");
@@ -40,6 +41,17 @@ int qcom_snd_parse_of(struct snd_soc_card *card)

	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");
@@ -57,20 +69,20 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
			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;
@@ -84,9 +96,16 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
			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;
		}