aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto2023-06-20 02:14:40 +0000
committerMark Brown2023-06-20 12:49:27 +0100
commitdb588ea1a352df9673464b1bc6d4acb83f5e8256 (patch)
treecae88088260aba486b65511a2f8294c669f0581f /sound
parent50233f28f9a2c06140a7bf539ef569ba1ad58ff6 (diff)
ASoC: loongson: use snd_soc_{of_}get_dlc()
Current ASoC has snd_soc_{of_}get_dai_name() to get DAI name for dlc (snd_soc_dai_link_component). But we now can use snd_soc_{of_}get_dlc() for it. Let's use it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87ilbidgmn.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/loongson/loongson_card.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/sound/soc/loongson/loongson_card.c b/sound/soc/loongson/loongson_card.c
index 94f02b787c98..9ded16329747 100644
--- a/sound/soc/loongson/loongson_card.c
+++ b/sound/soc/loongson/loongson_card.c
@@ -114,11 +114,9 @@ static int loongson_card_parse_acpi(struct loongson_card_data *data)
static int loongson_card_parse_of(struct loongson_card_data *data)
{
- const char *cpu_dai_name, *codec_dai_name;
struct device_node *cpu, *codec;
struct snd_soc_card *card = &data->snd_card;
struct device *dev = card->dev;
- struct of_phandle_args args;
int ret, i;
cpu = of_get_child_by_name(dev->of_node, "cpu");
@@ -133,30 +131,20 @@ static int loongson_card_parse_of(struct loongson_card_data *data)
goto err;
}
- ret = of_parse_phandle_with_args(cpu, "sound-dai",
- "#sound-dai-cells", 0, &args);
- if (ret) {
- dev_err(dev, "codec node missing #sound-dai-cells\n");
- goto err;
- }
- for (i = 0; i < card->num_links; i++)
- loongson_dai_links[i].cpus->of_node = args.np;
+ for (i = 0; i < card->num_links; i++) {
+ ret = snd_soc_of_get_dlc(cpu, NULL, loongson_dai_links[i].cpus, 0);
+ if (ret < 0) {
+ dev_err(dev, "getting cpu dlc error (%d)\n", ret);
+ goto err;
+ }
- ret = of_parse_phandle_with_args(codec, "sound-dai",
- "#sound-dai-cells", 0, &args);
- if (ret) {
- dev_err(dev, "codec node missing #sound-dai-cells\n");
- goto err;
+ ret = snd_soc_of_get_dlc(codec, NULL, loongson_dai_links[i].codecs, 0);
+ if (ret < 0) {
+ dev_err(dev, "getting codec dlc error (%d)\n", ret);
+ goto err;
+ }
}
- for (i = 0; i < card->num_links; i++)
- loongson_dai_links[i].codecs->of_node = args.np;
- snd_soc_of_get_dai_name(cpu, &cpu_dai_name, 0);
- snd_soc_of_get_dai_name(codec, &codec_dai_name, 0);
- for (i = 0; i < card->num_links; i++) {
- loongson_dai_links[i].cpus->dai_name = cpu_dai_name;
- loongson_dai_links[i].codecs->dai_name = codec_dai_name;
- }
of_node_put(cpu);
of_node_put(codec);