forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/samsung/smdk_wm8994.c
....@@ -1,11 +1,4 @@
1
-/*
2
- * smdk_wm8994.c
3
- *
4
- * This program is free software; you can redistribute it and/or modify it
5
- * under the terms of the GNU General Public License as published by the
6
- * Free Software Foundation; either version 2 of the License, or (at your
7
- * option) any later version.
8
- */
1
+// SPDX-License-Identifier: GPL-2.0+
92
103 #include "../codecs/wm8994.h"
114 #include <sound/pcm_params.h>
....@@ -51,8 +44,8 @@
5144 static int smdk_hw_params(struct snd_pcm_substream *substream,
5245 struct snd_pcm_hw_params *params)
5346 {
54
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
55
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
47
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
48
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
5649 unsigned int pll_out;
5750 int ret;
5851
....@@ -107,28 +100,32 @@
107100 return 0;
108101 }
109102
103
+SND_SOC_DAILINK_DEFS(aif1,
104
+ DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s.0")),
105
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm8994-codec", "wm8994-aif1")),
106
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s.0")));
107
+
108
+SND_SOC_DAILINK_DEFS(fifo_tx,
109
+ DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s-sec")),
110
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm8994-codec", "wm8994-aif1")),
111
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s-sec")));
112
+
110113 static struct snd_soc_dai_link smdk_dai[] = {
111114 { /* Primary DAI i/f */
112115 .name = "WM8994 AIF1",
113116 .stream_name = "Pri_Dai",
114
- .cpu_dai_name = "samsung-i2s.0",
115
- .codec_dai_name = "wm8994-aif1",
116
- .platform_name = "samsung-i2s.0",
117
- .codec_name = "wm8994-codec",
118117 .init = smdk_wm8994_init_paiftx,
119118 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
120119 SND_SOC_DAIFMT_CBM_CFM,
121120 .ops = &smdk_ops,
121
+ SND_SOC_DAILINK_REG(aif1),
122122 }, { /* Sec_Fifo Playback i/f */
123123 .name = "Sec_FIFO TX",
124124 .stream_name = "Sec_Dai",
125
- .cpu_dai_name = "samsung-i2s-sec",
126
- .codec_dai_name = "wm8994-aif1",
127
- .platform_name = "samsung-i2s-sec",
128
- .codec_name = "wm8994-codec",
129125 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
130126 SND_SOC_DAIFMT_CBM_CFM,
131127 .ops = &smdk_ops,
128
+ SND_SOC_DAILINK_REG(fifo_tx),
132129 },
133130 };
134131
....@@ -160,17 +157,17 @@
160157 return -ENOMEM;
161158
162159 if (np) {
163
- smdk_dai[0].cpu_dai_name = NULL;
164
- smdk_dai[0].cpu_of_node = of_parse_phandle(np,
160
+ smdk_dai[0].cpus->dai_name = NULL;
161
+ smdk_dai[0].cpus->of_node = of_parse_phandle(np,
165162 "samsung,i2s-controller", 0);
166
- if (!smdk_dai[0].cpu_of_node) {
163
+ if (!smdk_dai[0].cpus->of_node) {
167164 dev_err(&pdev->dev,
168165 "Property 'samsung,i2s-controller' missing or invalid\n");
169166 ret = -EINVAL;
170167 }
171168
172
- smdk_dai[0].platform_name = NULL;
173
- smdk_dai[0].platform_of_node = smdk_dai[0].cpu_of_node;
169
+ smdk_dai[0].platforms->name = NULL;
170
+ smdk_dai[0].platforms->of_node = smdk_dai[0].cpus->of_node;
174171 }
175172
176173 id = of_match_device(of_match_ptr(samsung_wm8994_of_match), &pdev->dev);
....@@ -182,7 +179,7 @@
182179 ret = devm_snd_soc_register_card(&pdev->dev, card);
183180
184181 if (ret)
185
- dev_err(&pdev->dev, "snd_soc_register_card() failed:%d\n", ret);
182
+ dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
186183
187184 return ret;
188185 }