forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/soc/atmel/atmel_wm8904.c
....@@ -1,11 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * atmel_wm8904 - Atmel ASoC driver for boards with WM8904 codec.
34 *
45 * Copyright (C) 2012 Atmel
56 *
67 * Author: Bo Shen <voice.shen@atmel.com>
7
- *
8
- * GPLv2 or later
98 */
109
1110 #include <linux/clk.h>
....@@ -27,8 +26,8 @@
2726 static int atmel_asoc_wm8904_hw_params(struct snd_pcm_substream *substream,
2827 struct snd_pcm_hw_params *params)
2928 {
30
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
31
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
29
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
30
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
3231 int ret;
3332
3433 ret = snd_soc_dai_set_pll(codec_dai, WM8904_FLL_MCLK, WM8904_FLL_MCLK,
....@@ -57,14 +56,19 @@
5756 .hw_params = atmel_asoc_wm8904_hw_params,
5857 };
5958
59
+SND_SOC_DAILINK_DEFS(pcm,
60
+ DAILINK_COMP_ARRAY(COMP_EMPTY()),
61
+ DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8904-hifi")),
62
+ DAILINK_COMP_ARRAY(COMP_EMPTY()));
63
+
6064 static struct snd_soc_dai_link atmel_asoc_wm8904_dailink = {
6165 .name = "WM8904",
6266 .stream_name = "WM8904 PCM",
63
- .codec_dai_name = "wm8904-hifi",
6467 .dai_fmt = SND_SOC_DAIFMT_I2S
6568 | SND_SOC_DAIFMT_NB_NF
6669 | SND_SOC_DAIFMT_CBM_CFM,
6770 .ops = &atmel_asoc_wm8904_ops,
71
+ SND_SOC_DAILINK_REG(pcm),
6872 };
6973
7074 static struct snd_soc_card atmel_asoc_wm8904_card = {
....@@ -108,8 +112,8 @@
108112 ret = -EINVAL;
109113 return ret;
110114 }
111
- dailink->cpu_of_node = cpu_np;
112
- dailink->platform_of_node = cpu_np;
115
+ dailink->cpus->of_node = cpu_np;
116
+ dailink->platforms->of_node = cpu_np;
113117 of_node_put(cpu_np);
114118
115119 codec_np = of_parse_phandle(np, "atmel,audio-codec", 0);
....@@ -118,7 +122,7 @@
118122 ret = -EINVAL;
119123 return ret;
120124 }
121
- dailink->codec_of_node = codec_np;
125
+ dailink->codecs->of_node = codec_np;
122126 of_node_put(codec_np);
123127
124128 return 0;
....@@ -137,7 +141,7 @@
137141 return ret;
138142 }
139143
140
- id = of_alias_get_id((struct device_node *)dailink->cpu_of_node, "ssc");
144
+ id = of_alias_get_id((struct device_node *)dailink->cpus->of_node, "ssc");
141145 ret = atmel_ssc_set_audio(id);
142146 if (ret != 0) {
143147 dev_err(&pdev->dev, "failed to set SSC %d for audio\n", id);
....@@ -163,7 +167,7 @@
163167 struct snd_soc_dai_link *dailink = &atmel_asoc_wm8904_dailink;
164168 int id;
165169
166
- id = of_alias_get_id((struct device_node *)dailink->cpu_of_node, "ssc");
170
+ id = of_alias_get_id((struct device_node *)dailink->cpus->of_node, "ssc");
167171
168172 snd_soc_unregister_card(card);
169173 atmel_ssc_put_audio(id);