hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/tegra/tegra_alc5632.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * tegra_alc5632.c -- Toshiba AC100(PAZ00) machine ASoC driver
34 *
....@@ -7,10 +8,6 @@
78 * Authors: Leon Romanovsky <leon@leon.nu>
89 * Andrey Danin <danindrey@mail.ru>
910 * Marc Dietrich <marvin24@gmx.de>
10
- *
11
- * This program is free software; you can redistribute it and/or modify
12
- * it under the terms of the GNU General Public License version 2 as
13
- * published by the Free Software Foundation.
1411 */
1512
1613 #include <linux/module.h>
....@@ -39,8 +36,8 @@
3936 static int tegra_alc5632_asoc_hw_params(struct snd_pcm_substream *substream,
4037 struct snd_pcm_hw_params *params)
4138 {
42
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
43
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
39
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
40
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
4441 struct snd_soc_card *card = rtd->card;
4542 struct tegra_alc5632 *alc5632 = snd_soc_card_get_drvdata(card);
4643 int srate, mclk;
....@@ -124,15 +121,20 @@
124121 return 0;
125122 }
126123
124
+SND_SOC_DAILINK_DEFS(pcm,
125
+ DAILINK_COMP_ARRAY(COMP_EMPTY()),
126
+ DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "alc5632-hifi")),
127
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
128
+
127129 static struct snd_soc_dai_link tegra_alc5632_dai = {
128130 .name = "ALC5632",
129131 .stream_name = "ALC5632 PCM",
130
- .codec_dai_name = "alc5632-hifi",
131132 .init = tegra_alc5632_asoc_init,
132133 .ops = &tegra_alc5632_asoc_ops,
133134 .dai_fmt = SND_SOC_DAIFMT_I2S
134135 | SND_SOC_DAIFMT_NB_NF
135136 | SND_SOC_DAIFMT_CBS_CFS,
137
+ SND_SOC_DAILINK_REG(pcm),
136138 };
137139
138140 static struct snd_soc_card snd_soc_tegra_alc5632 = {
....@@ -175,26 +177,26 @@
175177 if (ret)
176178 goto err;
177179
178
- tegra_alc5632_dai.codec_of_node = of_parse_phandle(
180
+ tegra_alc5632_dai.codecs->of_node = of_parse_phandle(
179181 pdev->dev.of_node, "nvidia,audio-codec", 0);
180182
181
- if (!tegra_alc5632_dai.codec_of_node) {
183
+ if (!tegra_alc5632_dai.codecs->of_node) {
182184 dev_err(&pdev->dev,
183185 "Property 'nvidia,audio-codec' missing or invalid\n");
184186 ret = -EINVAL;
185187 goto err;
186188 }
187189
188
- tegra_alc5632_dai.cpu_of_node = of_parse_phandle(np,
190
+ tegra_alc5632_dai.cpus->of_node = of_parse_phandle(np,
189191 "nvidia,i2s-controller", 0);
190
- if (!tegra_alc5632_dai.cpu_of_node) {
192
+ if (!tegra_alc5632_dai.cpus->of_node) {
191193 dev_err(&pdev->dev,
192194 "Property 'nvidia,i2s-controller' missing or invalid\n");
193195 ret = -EINVAL;
194196 goto err_put_codec_of_node;
195197 }
196198
197
- tegra_alc5632_dai.platform_of_node = tegra_alc5632_dai.cpu_of_node;
199
+ tegra_alc5632_dai.platforms->of_node = tegra_alc5632_dai.cpus->of_node;
198200
199201 ret = tegra_asoc_utils_init(&alc5632->util_data, &pdev->dev);
200202 if (ret)
....@@ -204,20 +206,18 @@
204206 if (ret) {
205207 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
206208 ret);
207
- goto err_fini_utils;
209
+ goto err_put_cpu_of_node;
208210 }
209211
210212 return 0;
211213
212
-err_fini_utils:
213
- tegra_asoc_utils_fini(&alc5632->util_data);
214214 err_put_cpu_of_node:
215
- of_node_put(tegra_alc5632_dai.cpu_of_node);
216
- tegra_alc5632_dai.cpu_of_node = NULL;
217
- tegra_alc5632_dai.platform_of_node = NULL;
215
+ of_node_put(tegra_alc5632_dai.cpus->of_node);
216
+ tegra_alc5632_dai.cpus->of_node = NULL;
217
+ tegra_alc5632_dai.platforms->of_node = NULL;
218218 err_put_codec_of_node:
219
- of_node_put(tegra_alc5632_dai.codec_of_node);
220
- tegra_alc5632_dai.codec_of_node = NULL;
219
+ of_node_put(tegra_alc5632_dai.codecs->of_node);
220
+ tegra_alc5632_dai.codecs->of_node = NULL;
221221 err:
222222 return ret;
223223 }
....@@ -225,17 +225,14 @@
225225 static int tegra_alc5632_remove(struct platform_device *pdev)
226226 {
227227 struct snd_soc_card *card = platform_get_drvdata(pdev);
228
- struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(card);
229228
230229 snd_soc_unregister_card(card);
231230
232
- tegra_asoc_utils_fini(&machine->util_data);
233
-
234
- of_node_put(tegra_alc5632_dai.cpu_of_node);
235
- tegra_alc5632_dai.cpu_of_node = NULL;
236
- tegra_alc5632_dai.platform_of_node = NULL;
237
- of_node_put(tegra_alc5632_dai.codec_of_node);
238
- tegra_alc5632_dai.codec_of_node = NULL;
231
+ of_node_put(tegra_alc5632_dai.cpus->of_node);
232
+ tegra_alc5632_dai.cpus->of_node = NULL;
233
+ tegra_alc5632_dai.platforms->of_node = NULL;
234
+ of_node_put(tegra_alc5632_dai.codecs->of_node);
235
+ tegra_alc5632_dai.codecs->of_node = NULL;
239236
240237 return 0;
241238 }