hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/soc/tegra/trimslice.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * trimslice.c - TrimSlice machine ASoC driver
34 *
....@@ -7,21 +8,6 @@
78 * Based on code copyright/by:
89 * Author: Stephen Warren <swarren@nvidia.com>
910 * Copyright (C) 2010-2011 - NVIDIA, Inc.
10
- *
11
- * This program is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU General Public License
13
- * version 2 as published by the Free Software Foundation.
14
- *
15
- * This program is distributed in the hope that it will be useful, but
16
- * WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
- * General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; if not, write to the Free Software
22
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23
- * 02110-1301 USA
24
- *
2511 */
2612
2713 #include <linux/module.h>
....@@ -48,8 +34,8 @@
4834 static int trimslice_asoc_hw_params(struct snd_pcm_substream *substream,
4935 struct snd_pcm_hw_params *params)
5036 {
51
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
52
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
37
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
38
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
5339 struct snd_soc_card *card = rtd->card;
5440 struct tegra_trimslice *trimslice = snd_soc_card_get_drvdata(card);
5541 int srate, mclk;
....@@ -91,14 +77,19 @@
9177 {"RLINEIN", NULL, "Line In"},
9278 };
9379
80
+SND_SOC_DAILINK_DEFS(single_dsp,
81
+ DAILINK_COMP_ARRAY(COMP_EMPTY()),
82
+ DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "tlv320aic23-hifi")),
83
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
84
+
9485 static struct snd_soc_dai_link trimslice_tlv320aic23_dai = {
9586 .name = "TLV320AIC23",
9687 .stream_name = "AIC23",
97
- .codec_dai_name = "tlv320aic23-hifi",
9888 .ops = &trimslice_asoc_ops,
9989 .dai_fmt = SND_SOC_DAIFMT_I2S |
10090 SND_SOC_DAIFMT_NB_NF |
10191 SND_SOC_DAIFMT_CBS_CFS,
92
+ SND_SOC_DAILINK_REG(single_dsp),
10293 };
10394
10495 static struct snd_soc_card snd_soc_trimslice = {
....@@ -130,54 +121,35 @@
130121 card->dev = &pdev->dev;
131122 snd_soc_card_set_drvdata(card, trimslice);
132123
133
- trimslice_tlv320aic23_dai.codec_of_node = of_parse_phandle(np,
124
+ trimslice_tlv320aic23_dai.codecs->of_node = of_parse_phandle(np,
134125 "nvidia,audio-codec", 0);
135
- if (!trimslice_tlv320aic23_dai.codec_of_node) {
126
+ if (!trimslice_tlv320aic23_dai.codecs->of_node) {
136127 dev_err(&pdev->dev,
137128 "Property 'nvidia,audio-codec' missing or invalid\n");
138
- ret = -EINVAL;
139
- goto err;
129
+ return -EINVAL;
140130 }
141131
142
- trimslice_tlv320aic23_dai.cpu_of_node = of_parse_phandle(np,
132
+ trimslice_tlv320aic23_dai.cpus->of_node = of_parse_phandle(np,
143133 "nvidia,i2s-controller", 0);
144
- if (!trimslice_tlv320aic23_dai.cpu_of_node) {
134
+ if (!trimslice_tlv320aic23_dai.cpus->of_node) {
145135 dev_err(&pdev->dev,
146136 "Property 'nvidia,i2s-controller' missing or invalid\n");
147
- ret = -EINVAL;
148
- goto err;
137
+ return -EINVAL;
149138 }
150139
151
- trimslice_tlv320aic23_dai.platform_of_node =
152
- trimslice_tlv320aic23_dai.cpu_of_node;
140
+ trimslice_tlv320aic23_dai.platforms->of_node =
141
+ trimslice_tlv320aic23_dai.cpus->of_node;
153142
154143 ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev);
155144 if (ret)
156
- goto err;
145
+ return ret;
157146
158
- ret = snd_soc_register_card(card);
147
+ ret = devm_snd_soc_register_card(&pdev->dev, card);
159148 if (ret) {
160149 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
161150 ret);
162
- goto err_fini_utils;
151
+ return ret;
163152 }
164
-
165
- return 0;
166
-
167
-err_fini_utils:
168
- tegra_asoc_utils_fini(&trimslice->util_data);
169
-err:
170
- return ret;
171
-}
172
-
173
-static int tegra_snd_trimslice_remove(struct platform_device *pdev)
174
-{
175
- struct snd_soc_card *card = platform_get_drvdata(pdev);
176
- struct tegra_trimslice *trimslice = snd_soc_card_get_drvdata(card);
177
-
178
- snd_soc_unregister_card(card);
179
-
180
- tegra_asoc_utils_fini(&trimslice->util_data);
181153
182154 return 0;
183155 }
....@@ -194,7 +166,6 @@
194166 .of_match_table = trimslice_of_match,
195167 },
196168 .probe = tegra_snd_trimslice_probe,
197
- .remove = tegra_snd_trimslice_remove,
198169 };
199170 module_platform_driver(tegra_snd_trimslice_driver);
200171