forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/sound/arm/pxa2xx-pcm-lib.c
....@@ -1,8 +1,4 @@
1
-/*
2
- * This program is free software; you can redistribute it and/or modify
3
- * it under the terms of the GNU General Public License version 2 as
4
- * published by the Free Software Foundation.
5
- */
1
+// SPDX-License-Identifier: GPL-2.0-only
62
73 #include <linux/slab.h>
84 #include <linux/module.h>
....@@ -42,7 +38,7 @@
4238 struct dma_slave_config config;
4339 int ret;
4440
45
- dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
41
+ dma_params = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
4642 if (!dma_params)
4743 return 0;
4844
....@@ -51,7 +47,7 @@
5147 return ret;
5248
5349 snd_dmaengine_pcm_set_config_from_dai_data(substream,
54
- snd_soc_dai_get_dma_data(rtd->cpu_dai, substream),
50
+ snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream),
5551 &config);
5652
5753 ret = dmaengine_slave_config(chan, &config);
....@@ -99,7 +95,7 @@
9995
10096 runtime->hw = pxa2xx_pcm_hardware;
10197
102
- dma_params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
98
+ dma_params = snd_soc_dai_get_dma_data(asoc_rtd_to_cpu(rtd, 0), substream);
10399 if (!dma_params)
104100 return 0;
105101
....@@ -124,7 +120,7 @@
124120 return ret;
125121
126122 return snd_dmaengine_pcm_open(
127
- substream, dma_request_slave_channel(rtd->cpu_dai->dev,
123
+ substream, dma_request_slave_channel(asoc_rtd_to_cpu(rtd, 0)->dev,
128124 dma_params->chan_name));
129125 }
130126 EXPORT_SYMBOL(pxa2xx_pcm_open);
....@@ -179,7 +175,15 @@
179175 }
180176 EXPORT_SYMBOL(pxa2xx_pcm_free_dma_buffers);
181177
182
-int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd)
178
+void pxa2xx_soc_pcm_free(struct snd_soc_component *component,
179
+ struct snd_pcm *pcm)
180
+{
181
+ pxa2xx_pcm_free_dma_buffers(pcm);
182
+}
183
+EXPORT_SYMBOL(pxa2xx_soc_pcm_free);
184
+
185
+int pxa2xx_soc_pcm_new(struct snd_soc_component *component,
186
+ struct snd_soc_pcm_runtime *rtd)
183187 {
184188 struct snd_card *card = rtd->card->snd_card;
185189 struct snd_pcm *pcm = rtd->pcm;
....@@ -207,18 +211,64 @@
207211 }
208212 EXPORT_SYMBOL(pxa2xx_soc_pcm_new);
209213
210
-const struct snd_pcm_ops pxa2xx_pcm_ops = {
211
- .open = pxa2xx_pcm_open,
212
- .close = pxa2xx_pcm_close,
213
- .ioctl = snd_pcm_lib_ioctl,
214
- .hw_params = pxa2xx_pcm_hw_params,
215
- .hw_free = pxa2xx_pcm_hw_free,
216
- .prepare = pxa2xx_pcm_prepare,
217
- .trigger = pxa2xx_pcm_trigger,
218
- .pointer = pxa2xx_pcm_pointer,
219
- .mmap = pxa2xx_pcm_mmap,
220
-};
221
-EXPORT_SYMBOL(pxa2xx_pcm_ops);
214
+int pxa2xx_soc_pcm_open(struct snd_soc_component *component,
215
+ struct snd_pcm_substream *substream)
216
+{
217
+ return pxa2xx_pcm_open(substream);
218
+}
219
+EXPORT_SYMBOL(pxa2xx_soc_pcm_open);
220
+
221
+int pxa2xx_soc_pcm_close(struct snd_soc_component *component,
222
+ struct snd_pcm_substream *substream)
223
+{
224
+ return pxa2xx_pcm_close(substream);
225
+}
226
+EXPORT_SYMBOL(pxa2xx_soc_pcm_close);
227
+
228
+int pxa2xx_soc_pcm_hw_params(struct snd_soc_component *component,
229
+ struct snd_pcm_substream *substream,
230
+ struct snd_pcm_hw_params *params)
231
+{
232
+ return pxa2xx_pcm_hw_params(substream, params);
233
+}
234
+EXPORT_SYMBOL(pxa2xx_soc_pcm_hw_params);
235
+
236
+int pxa2xx_soc_pcm_hw_free(struct snd_soc_component *component,
237
+ struct snd_pcm_substream *substream)
238
+{
239
+ return pxa2xx_pcm_hw_free(substream);
240
+}
241
+EXPORT_SYMBOL(pxa2xx_soc_pcm_hw_free);
242
+
243
+int pxa2xx_soc_pcm_prepare(struct snd_soc_component *component,
244
+ struct snd_pcm_substream *substream)
245
+{
246
+ return pxa2xx_pcm_prepare(substream);
247
+}
248
+EXPORT_SYMBOL(pxa2xx_soc_pcm_prepare);
249
+
250
+int pxa2xx_soc_pcm_trigger(struct snd_soc_component *component,
251
+ struct snd_pcm_substream *substream, int cmd)
252
+{
253
+ return pxa2xx_pcm_trigger(substream, cmd);
254
+}
255
+EXPORT_SYMBOL(pxa2xx_soc_pcm_trigger);
256
+
257
+snd_pcm_uframes_t
258
+pxa2xx_soc_pcm_pointer(struct snd_soc_component *component,
259
+ struct snd_pcm_substream *substream)
260
+{
261
+ return pxa2xx_pcm_pointer(substream);
262
+}
263
+EXPORT_SYMBOL(pxa2xx_soc_pcm_pointer);
264
+
265
+int pxa2xx_soc_pcm_mmap(struct snd_soc_component *component,
266
+ struct snd_pcm_substream *substream,
267
+ struct vm_area_struct *vma)
268
+{
269
+ return pxa2xx_pcm_mmap(substream, vma);
270
+}
271
+EXPORT_SYMBOL(pxa2xx_soc_pcm_mmap);
222272
223273 MODULE_AUTHOR("Nicolas Pitre");
224274 MODULE_DESCRIPTION("Intel PXA2xx sound library");