hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/sound/soc/samsung/littlemill.c
....@@ -1,13 +1,8 @@
1
-/*
2
- * Littlemill audio support
3
- *
4
- * Copyright 2011 Wolfson Microelectronics
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of the GNU General Public License as published by the
8
- * Free Software Foundation; either version 2 of the License, or (at your
9
- * option) any later version.
10
- */
1
+// SPDX-License-Identifier: GPL-2.0+
2
+//
3
+// Littlemill audio support
4
+//
5
+// Copyright 2011 Wolfson Microelectronics
116
127 #include <sound/soc.h>
138 #include <sound/soc-dapm.h>
....@@ -27,8 +22,8 @@
2722 struct snd_soc_dai *aif1_dai;
2823 int ret;
2924
30
- rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
31
- aif1_dai = rtd->codec_dai;
25
+ rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
26
+ aif1_dai = asoc_rtd_to_codec(rtd, 0);
3227
3328 if (dapm->dev != aif1_dai->dev)
3429 return 0;
....@@ -74,8 +69,8 @@
7469 struct snd_soc_dai *aif1_dai;
7570 int ret;
7671
77
- rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
78
- aif1_dai = rtd->codec_dai;
72
+ rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
73
+ aif1_dai = asoc_rtd_to_codec(rtd, 0);
7974
8075 if (dapm->dev != aif1_dai->dev)
8176 return 0;
....@@ -109,8 +104,8 @@
109104 static int littlemill_hw_params(struct snd_pcm_substream *substream,
110105 struct snd_pcm_hw_params *params)
111106 {
112
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
113
- struct snd_soc_dai *codec_dai = rtd->codec_dai;
107
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
108
+ struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
114109 int ret;
115110
116111 sample_rate = params_rate(params);
....@@ -147,28 +142,33 @@
147142 .channels_max = 2,
148143 };
149144
145
+SND_SOC_DAILINK_DEFS(cpu,
146
+ DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s.0")),
147
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm8994-codec", "wm8994-aif1")),
148
+ DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s.0")));
149
+
150
+SND_SOC_DAILINK_DEFS(baseband,
151
+ DAILINK_COMP_ARRAY(COMP_CPU("wm8994-aif2")),
152
+ DAILINK_COMP_ARRAY(COMP_CODEC("wm1250-ev1.1-0027",
153
+ "wm1250-ev1")));
154
+
150155 static struct snd_soc_dai_link littlemill_dai[] = {
151156 {
152157 .name = "CPU",
153158 .stream_name = "CPU",
154
- .cpu_dai_name = "samsung-i2s.0",
155
- .codec_dai_name = "wm8994-aif1",
156
- .platform_name = "samsung-i2s.0",
157
- .codec_name = "wm8994-codec",
158159 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
159160 | SND_SOC_DAIFMT_CBM_CFM,
160161 .ops = &littlemill_ops,
162
+ SND_SOC_DAILINK_REG(cpu),
161163 },
162164 {
163165 .name = "Baseband",
164166 .stream_name = "Baseband",
165
- .cpu_dai_name = "wm8994-aif2",
166
- .codec_dai_name = "wm1250-ev1",
167
- .codec_name = "wm1250-ev1.1-0027",
168167 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
169168 | SND_SOC_DAIFMT_CBM_CFM,
170169 .ignore_suspend = 1,
171170 .params = &baseband_params,
171
+ SND_SOC_DAILINK_REG(baseband),
172172 },
173173 };
174174
....@@ -180,8 +180,8 @@
180180 struct snd_soc_dai *aif2_dai;
181181 int ret;
182182
183
- rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name);
184
- aif2_dai = rtd->cpu_dai;
183
+ rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]);
184
+ aif2_dai = asoc_rtd_to_cpu(rtd, 0);
185185
186186 switch (event) {
187187 case SND_SOC_DAPM_PRE_PMU:
....@@ -263,12 +263,12 @@
263263 struct snd_soc_dai *aif2_dai;
264264 int ret;
265265
266
- rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name);
267
- component = rtd->codec_dai->component;
268
- aif1_dai = rtd->codec_dai;
266
+ rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[0]);
267
+ component = asoc_rtd_to_codec(rtd, 0)->component;
268
+ aif1_dai = asoc_rtd_to_codec(rtd, 0);
269269
270
- rtd = snd_soc_get_pcm_runtime(card, card->dai_link[1].name);
271
- aif2_dai = rtd->cpu_dai;
270
+ rtd = snd_soc_get_pcm_runtime(card, &card->dai_link[1]);
271
+ aif2_dai = asoc_rtd_to_cpu(rtd, 0);
272272
273273 ret = snd_soc_dai_set_sysclk(aif1_dai, WM8994_SYSCLK_MCLK2,
274274 32768, SND_SOC_CLOCK_IN);
....@@ -326,8 +326,7 @@
326326
327327 ret = devm_snd_soc_register_card(&pdev->dev, card);
328328 if (ret)
329
- dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
330
- ret);
329
+ dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
331330
332331 return ret;
333332 }