forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/kirkwood/kirkwood-dma.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * kirkwood-dma.c
34 *
45 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
56 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms of the GNU General Public License as published by the
9
- * Free Software Foundation; either version 2 of the License, or (at your
10
- * option) any later version.
117 */
128
139 #include <linux/init.h>
....@@ -24,7 +20,7 @@
2420 static struct kirkwood_dma_data *kirkwood_priv(struct snd_pcm_substream *subs)
2521 {
2622 struct snd_soc_pcm_runtime *soc_runtime = subs->private_data;
27
- return snd_soc_dai_get_drvdata(soc_runtime->cpu_dai);
23
+ return snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(soc_runtime, 0));
2824 }
2925
3026 static const struct snd_pcm_hardware kirkwood_dma_snd_hw = {
....@@ -90,7 +86,7 @@
9086
9187 /* try to find matching cs for current dma address */
9288 for (i = 0; i < dram->num_cs; i++) {
93
- const struct mbus_dram_window *cs = dram->cs + i;
89
+ const struct mbus_dram_window *cs = &dram->cs[i];
9490 if ((cs->base & 0xffff0000) < (dma & 0xffff0000)) {
9591 writel(cs->base & 0xffff0000,
9692 base + KIRKWOOD_AUDIO_WIN_BASE_REG(win));
....@@ -102,7 +98,8 @@
10298 }
10399 }
104100
105
-static int kirkwood_dma_open(struct snd_pcm_substream *substream)
101
+static int kirkwood_dma_open(struct snd_soc_component *component,
102
+ struct snd_pcm_substream *substream)
106103 {
107104 int err;
108105 struct snd_pcm_runtime *runtime = substream->runtime;
....@@ -164,7 +161,8 @@
164161 return 0;
165162 }
166163
167
-static int kirkwood_dma_close(struct snd_pcm_substream *substream)
164
+static int kirkwood_dma_close(struct snd_soc_component *component,
165
+ struct snd_pcm_substream *substream)
168166 {
169167 struct kirkwood_dma_data *priv = kirkwood_priv(substream);
170168
....@@ -184,8 +182,9 @@
184182 return 0;
185183 }
186184
187
-static int kirkwood_dma_hw_params(struct snd_pcm_substream *substream,
188
- struct snd_pcm_hw_params *params)
185
+static int kirkwood_dma_hw_params(struct snd_soc_component *component,
186
+ struct snd_pcm_substream *substream,
187
+ struct snd_pcm_hw_params *params)
189188 {
190189 struct snd_pcm_runtime *runtime = substream->runtime;
191190
....@@ -195,13 +194,15 @@
195194 return 0;
196195 }
197196
198
-static int kirkwood_dma_hw_free(struct snd_pcm_substream *substream)
197
+static int kirkwood_dma_hw_free(struct snd_soc_component *component,
198
+ struct snd_pcm_substream *substream)
199199 {
200200 snd_pcm_set_runtime_buffer(substream, NULL);
201201 return 0;
202202 }
203203
204
-static int kirkwood_dma_prepare(struct snd_pcm_substream *substream)
204
+static int kirkwood_dma_prepare(struct snd_soc_component *component,
205
+ struct snd_pcm_substream *substream)
205206 {
206207 struct snd_pcm_runtime *runtime = substream->runtime;
207208 struct kirkwood_dma_data *priv = kirkwood_priv(substream);
....@@ -226,8 +227,9 @@
226227 return 0;
227228 }
228229
229
-static snd_pcm_uframes_t kirkwood_dma_pointer(struct snd_pcm_substream
230
- *substream)
230
+static snd_pcm_uframes_t kirkwood_dma_pointer(
231
+ struct snd_soc_component *component,
232
+ struct snd_pcm_substream *substream)
231233 {
232234 struct kirkwood_dma_data *priv = kirkwood_priv(substream);
233235 snd_pcm_uframes_t count;
....@@ -241,16 +243,6 @@
241243
242244 return count;
243245 }
244
-
245
-static const struct snd_pcm_ops kirkwood_dma_ops = {
246
- .open = kirkwood_dma_open,
247
- .close = kirkwood_dma_close,
248
- .ioctl = snd_pcm_lib_ioctl,
249
- .hw_params = kirkwood_dma_hw_params,
250
- .hw_free = kirkwood_dma_hw_free,
251
- .prepare = kirkwood_dma_prepare,
252
- .pointer = kirkwood_dma_pointer,
253
-};
254246
255247 static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm,
256248 int stream)
....@@ -271,7 +263,8 @@
271263 return 0;
272264 }
273265
274
-static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
266
+static int kirkwood_dma_new(struct snd_soc_component *component,
267
+ struct snd_soc_pcm_runtime *rtd)
275268 {
276269 struct snd_card *card = rtd->card->snd_card;
277270 struct snd_pcm *pcm = rtd->pcm;
....@@ -298,7 +291,8 @@
298291 return 0;
299292 }
300293
301
-static void kirkwood_dma_free_dma_buffers(struct snd_pcm *pcm)
294
+static void kirkwood_dma_free_dma_buffers(struct snd_soc_component *component,
295
+ struct snd_pcm *pcm)
302296 {
303297 struct snd_pcm_substream *substream;
304298 struct snd_dma_buffer *buf;
....@@ -320,7 +314,12 @@
320314
321315 const struct snd_soc_component_driver kirkwood_soc_component = {
322316 .name = DRV_NAME,
323
- .ops = &kirkwood_dma_ops,
324
- .pcm_new = kirkwood_dma_new,
325
- .pcm_free = kirkwood_dma_free_dma_buffers,
317
+ .open = kirkwood_dma_open,
318
+ .close = kirkwood_dma_close,
319
+ .hw_params = kirkwood_dma_hw_params,
320
+ .hw_free = kirkwood_dma_hw_free,
321
+ .prepare = kirkwood_dma_prepare,
322
+ .pointer = kirkwood_dma_pointer,
323
+ .pcm_construct = kirkwood_dma_new,
324
+ .pcm_destruct = kirkwood_dma_free_dma_buffers,
326325 };