hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/sound/soc/rockchip/rk3288_hdmi_analog.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Rockchip machine ASoC driver for RK3288 boards that have an HDMI and analog
34 * audio output
....@@ -6,19 +7,6 @@
67 *
78 * Authors: Sjoerd Simons <sjoerd.simons@collabora.com>,
89 * Romain Perier <romain.perier@collabora.com>
9
- *
10
- * This program is free software; you can redistribute it and/or modify it
11
- * under the terms and conditions of the GNU General Public License,
12
- * version 2, as published by the Free Software Foundation.
13
- *
14
- * This program is distributed in the hope it will be useful, but WITHOUT
15
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17
- * more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
- *
2210 */
2311
2412 #include <linux/module.h>
....@@ -78,9 +66,9 @@
7866 struct snd_pcm_hw_params *params)
7967 {
8068 int ret = 0;
81
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
82
- struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
83
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
69
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
70
+ struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0);
71
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
8472 int mclk;
8573
8674 switch (params_rate(params)) {
....@@ -151,24 +139,21 @@
151139 .hw_params = rk_hw_params,
152140 };
153141
154
-static struct snd_soc_dai_link_component rk_codecs[] = {
155
- { },
156
- {
157
- .name = "hdmi-audio-codec.2.auto",
158
- .dai_name = "i2s-hifi",
159
- },
160
-};
142
+SND_SOC_DAILINK_DEFS(audio,
143
+ DAILINK_COMP_ARRAY(COMP_EMPTY()),
144
+ DAILINK_COMP_ARRAY(COMP_CODEC(NULL, NULL),
145
+ COMP_CODEC("hdmi-audio-codec.2.auto", "i2s-hifi")),
146
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
161147
162148 static struct snd_soc_dai_link rk_dailink = {
163149 .name = "Codecs",
164150 .stream_name = "Audio",
165151 .init = rk_init,
166152 .ops = &rk_ops,
167
- .codecs = rk_codecs,
168
- .num_codecs = ARRAY_SIZE(rk_codecs),
169153 /* Set codecs as slave */
170154 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
171155 SND_SOC_DAIFMT_CBS_CFS,
156
+ SND_SOC_DAILINK_REG(audio),
172157 };
173158
174159 static struct snd_soc_card snd_soc_card_rk = {
....@@ -244,15 +229,15 @@
244229 return ret;
245230 }
246231
247
- rk_dailink.cpu_of_node = of_parse_phandle(np, "rockchip,i2s-controller",
232
+ rk_dailink.cpus->of_node = of_parse_phandle(np, "rockchip,i2s-controller",
248233 0);
249
- if (!rk_dailink.cpu_of_node) {
234
+ if (!rk_dailink.cpus->of_node) {
250235 dev_err(&pdev->dev,
251236 "Property 'rockchip,i2s-controller' missing or invalid\n");
252237 return -EINVAL;
253238 }
254239
255
- rk_dailink.platform_of_node = rk_dailink.cpu_of_node;
240
+ rk_dailink.platforms->of_node = rk_dailink.cpus->of_node;
256241
257242 ret = snd_soc_of_parse_audio_routing(card, "rockchip,routing");
258243 if (ret) {
....@@ -286,7 +271,6 @@
286271 .probe = snd_rk_mc_probe,
287272 .driver = {
288273 .name = DRV_NAME,
289
- .owner = THIS_MODULE,
290274 .pm = &snd_soc_pm_ops,
291275 .of_match_table = rockchip_sound_of_match,
292276 },