From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH v2 095/146] ASoC: qcom: common: use modern dai_link style Date: 06 Jun 2019 13:16:58 +0900 Message-ID: <87o93bgy4w.wl-kuninori.morimoto.gx@renesas.com> References: <87h893mkvi.wl-kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 3BC03F898FB for ; Thu, 6 Jun 2019 06:16:58 +0200 (CEST) In-Reply-To: <87h893mkvi.wl-kuninori.morimoto.gx@renesas.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Mark Brown Cc: Linux-ALSA List-Id: alsa-devel@alsa-project.org From: Kuninori Morimoto 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: Kuninori Morimoto --- sound/soc/qcom/common.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index 5661025..c7a8785 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -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; } -- 2.7.4