Skip to content

Commit db588ea

Browse files
morimotobroonie
authored andcommitted
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>
1 parent 50233f2 commit db588ea

1 file changed

Lines changed: 11 additions & 23 deletions

File tree

sound/soc/loongson/loongson_card.c

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,9 @@ static int loongson_card_parse_acpi(struct loongson_card_data *data)
114114

115115
static int loongson_card_parse_of(struct loongson_card_data *data)
116116
{
117-
const char *cpu_dai_name, *codec_dai_name;
118117
struct device_node *cpu, *codec;
119118
struct snd_soc_card *card = &data->snd_card;
120119
struct device *dev = card->dev;
121-
struct of_phandle_args args;
122120
int ret, i;
123121

124122
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)
133131
goto err;
134132
}
135133

136-
ret = of_parse_phandle_with_args(cpu, "sound-dai",
137-
"#sound-dai-cells", 0, &args);
138-
if (ret) {
139-
dev_err(dev, "codec node missing #sound-dai-cells\n");
140-
goto err;
141-
}
142-
for (i = 0; i < card->num_links; i++)
143-
loongson_dai_links[i].cpus->of_node = args.np;
134+
for (i = 0; i < card->num_links; i++) {
135+
ret = snd_soc_of_get_dlc(cpu, NULL, loongson_dai_links[i].cpus, 0);
136+
if (ret < 0) {
137+
dev_err(dev, "getting cpu dlc error (%d)\n", ret);
138+
goto err;
139+
}
144140

145-
ret = of_parse_phandle_with_args(codec, "sound-dai",
146-
"#sound-dai-cells", 0, &args);
147-
if (ret) {
148-
dev_err(dev, "codec node missing #sound-dai-cells\n");
149-
goto err;
141+
ret = snd_soc_of_get_dlc(codec, NULL, loongson_dai_links[i].codecs, 0);
142+
if (ret < 0) {
143+
dev_err(dev, "getting codec dlc error (%d)\n", ret);
144+
goto err;
145+
}
150146
}
151-
for (i = 0; i < card->num_links; i++)
152-
loongson_dai_links[i].codecs->of_node = args.np;
153147

154-
snd_soc_of_get_dai_name(cpu, &cpu_dai_name, 0);
155-
snd_soc_of_get_dai_name(codec, &codec_dai_name, 0);
156-
for (i = 0; i < card->num_links; i++) {
157-
loongson_dai_links[i].cpus->dai_name = cpu_dai_name;
158-
loongson_dai_links[i].codecs->dai_name = codec_dai_name;
159-
}
160148
of_node_put(cpu);
161149
of_node_put(codec);
162150

0 commit comments

Comments
 (0)