.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * kirkwood-dma.c |
---|
3 | 4 | * |
---|
4 | 5 | * (c) 2010 Arnaud Patard <apatard@mandriva.com> |
---|
5 | 6 | * (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. |
---|
11 | 7 | */ |
---|
12 | 8 | |
---|
13 | 9 | #include <linux/init.h> |
---|
.. | .. |
---|
24 | 20 | static struct kirkwood_dma_data *kirkwood_priv(struct snd_pcm_substream *subs) |
---|
25 | 21 | { |
---|
26 | 22 | 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)); |
---|
28 | 24 | } |
---|
29 | 25 | |
---|
30 | 26 | static const struct snd_pcm_hardware kirkwood_dma_snd_hw = { |
---|
.. | .. |
---|
90 | 86 | |
---|
91 | 87 | /* try to find matching cs for current dma address */ |
---|
92 | 88 | 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]; |
---|
94 | 90 | if ((cs->base & 0xffff0000) < (dma & 0xffff0000)) { |
---|
95 | 91 | writel(cs->base & 0xffff0000, |
---|
96 | 92 | base + KIRKWOOD_AUDIO_WIN_BASE_REG(win)); |
---|
.. | .. |
---|
102 | 98 | } |
---|
103 | 99 | } |
---|
104 | 100 | |
---|
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) |
---|
106 | 103 | { |
---|
107 | 104 | int err; |
---|
108 | 105 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
.. | .. |
---|
164 | 161 | return 0; |
---|
165 | 162 | } |
---|
166 | 163 | |
---|
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) |
---|
168 | 166 | { |
---|
169 | 167 | struct kirkwood_dma_data *priv = kirkwood_priv(substream); |
---|
170 | 168 | |
---|
.. | .. |
---|
184 | 182 | return 0; |
---|
185 | 183 | } |
---|
186 | 184 | |
---|
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) |
---|
189 | 188 | { |
---|
190 | 189 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
191 | 190 | |
---|
.. | .. |
---|
195 | 194 | return 0; |
---|
196 | 195 | } |
---|
197 | 196 | |
---|
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) |
---|
199 | 199 | { |
---|
200 | 200 | snd_pcm_set_runtime_buffer(substream, NULL); |
---|
201 | 201 | return 0; |
---|
202 | 202 | } |
---|
203 | 203 | |
---|
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) |
---|
205 | 206 | { |
---|
206 | 207 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
207 | 208 | struct kirkwood_dma_data *priv = kirkwood_priv(substream); |
---|
.. | .. |
---|
226 | 227 | return 0; |
---|
227 | 228 | } |
---|
228 | 229 | |
---|
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) |
---|
231 | 233 | { |
---|
232 | 234 | struct kirkwood_dma_data *priv = kirkwood_priv(substream); |
---|
233 | 235 | snd_pcm_uframes_t count; |
---|
.. | .. |
---|
241 | 243 | |
---|
242 | 244 | return count; |
---|
243 | 245 | } |
---|
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 | | -}; |
---|
254 | 246 | |
---|
255 | 247 | static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm, |
---|
256 | 248 | int stream) |
---|
.. | .. |
---|
271 | 263 | return 0; |
---|
272 | 264 | } |
---|
273 | 265 | |
---|
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) |
---|
275 | 268 | { |
---|
276 | 269 | struct snd_card *card = rtd->card->snd_card; |
---|
277 | 270 | struct snd_pcm *pcm = rtd->pcm; |
---|
.. | .. |
---|
298 | 291 | return 0; |
---|
299 | 292 | } |
---|
300 | 293 | |
---|
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) |
---|
302 | 296 | { |
---|
303 | 297 | struct snd_pcm_substream *substream; |
---|
304 | 298 | struct snd_dma_buffer *buf; |
---|
.. | .. |
---|
320 | 314 | |
---|
321 | 315 | const struct snd_soc_component_driver kirkwood_soc_component = { |
---|
322 | 316 | .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, |
---|
326 | 325 | }; |
---|