.. | .. |
---|
1 | | -/* |
---|
2 | | - * imx-pcm-fiq.c -- ALSA Soc Audio Layer |
---|
3 | | - * |
---|
4 | | - * Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de> |
---|
5 | | - * |
---|
6 | | - * This code is based on code copyrighted by Freescale, |
---|
7 | | - * Liam Girdwood, Javier Martin and probably others. |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify it |
---|
10 | | - * under the terms of the GNU General Public License as published by the |
---|
11 | | - * Free Software Foundation; either version 2 of the License, or (at your |
---|
12 | | - * option) any later version. |
---|
13 | | - */ |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
---|
| 2 | +// imx-pcm-fiq.c -- ALSA Soc Audio Layer |
---|
| 3 | +// |
---|
| 4 | +// Copyright 2009 Sascha Hauer <s.hauer@pengutronix.de> |
---|
| 5 | +// |
---|
| 6 | +// This code is based on code copyrighted by Freescale, |
---|
| 7 | +// Liam Girdwood, Javier Martin and probably others. |
---|
| 8 | + |
---|
14 | 9 | #include <linux/clk.h> |
---|
15 | 10 | #include <linux/delay.h> |
---|
16 | 11 | #include <linux/device.h> |
---|
.. | .. |
---|
74 | 69 | .name = DRV_NAME, |
---|
75 | 70 | }; |
---|
76 | 71 | |
---|
77 | | -static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream, |
---|
78 | | - struct snd_pcm_hw_params *params) |
---|
| 72 | +static int snd_imx_pcm_hw_params(struct snd_soc_component *component, |
---|
| 73 | + struct snd_pcm_substream *substream, |
---|
| 74 | + struct snd_pcm_hw_params *params) |
---|
79 | 75 | { |
---|
80 | 76 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
81 | 77 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
---|
.. | .. |
---|
90 | 86 | return 0; |
---|
91 | 87 | } |
---|
92 | 88 | |
---|
93 | | -static int snd_imx_pcm_prepare(struct snd_pcm_substream *substream) |
---|
| 89 | +static int snd_imx_pcm_prepare(struct snd_soc_component *component, |
---|
| 90 | + struct snd_pcm_substream *substream) |
---|
94 | 91 | { |
---|
95 | 92 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
96 | 93 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
---|
.. | .. |
---|
109 | 106 | |
---|
110 | 107 | static int imx_pcm_fiq; |
---|
111 | 108 | |
---|
112 | | -static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
---|
| 109 | +static int snd_imx_pcm_trigger(struct snd_soc_component *component, |
---|
| 110 | + struct snd_pcm_substream *substream, int cmd) |
---|
113 | 111 | { |
---|
114 | 112 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
115 | 113 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
---|
.. | .. |
---|
146 | 144 | return 0; |
---|
147 | 145 | } |
---|
148 | 146 | |
---|
149 | | -static snd_pcm_uframes_t snd_imx_pcm_pointer(struct snd_pcm_substream *substream) |
---|
| 147 | +static snd_pcm_uframes_t |
---|
| 148 | +snd_imx_pcm_pointer(struct snd_soc_component *component, |
---|
| 149 | + struct snd_pcm_substream *substream) |
---|
150 | 150 | { |
---|
151 | 151 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
152 | 152 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
---|
.. | .. |
---|
170 | 170 | .fifo_size = 0, |
---|
171 | 171 | }; |
---|
172 | 172 | |
---|
173 | | -static int snd_imx_open(struct snd_pcm_substream *substream) |
---|
| 173 | +static int snd_imx_open(struct snd_soc_component *component, |
---|
| 174 | + struct snd_pcm_substream *substream) |
---|
174 | 175 | { |
---|
175 | 176 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
176 | 177 | struct imx_pcm_runtime_data *iprtd; |
---|
.. | .. |
---|
199 | 200 | return 0; |
---|
200 | 201 | } |
---|
201 | 202 | |
---|
202 | | -static int snd_imx_close(struct snd_pcm_substream *substream) |
---|
| 203 | +static int snd_imx_close(struct snd_soc_component *component, |
---|
| 204 | + struct snd_pcm_substream *substream) |
---|
203 | 205 | { |
---|
204 | 206 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
205 | 207 | struct imx_pcm_runtime_data *iprtd = runtime->private_data; |
---|
.. | .. |
---|
211 | 213 | return 0; |
---|
212 | 214 | } |
---|
213 | 215 | |
---|
214 | | -static int snd_imx_pcm_mmap(struct snd_pcm_substream *substream, |
---|
215 | | - struct vm_area_struct *vma) |
---|
| 216 | +static int snd_imx_pcm_mmap(struct snd_soc_component *component, |
---|
| 217 | + struct snd_pcm_substream *substream, |
---|
| 218 | + struct vm_area_struct *vma) |
---|
216 | 219 | { |
---|
217 | 220 | struct snd_pcm_runtime *runtime = substream->runtime; |
---|
218 | 221 | int ret; |
---|
.. | .. |
---|
226 | 229 | runtime->dma_bytes); |
---|
227 | 230 | return ret; |
---|
228 | 231 | } |
---|
229 | | - |
---|
230 | | -static const struct snd_pcm_ops imx_pcm_ops = { |
---|
231 | | - .open = snd_imx_open, |
---|
232 | | - .close = snd_imx_close, |
---|
233 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
234 | | - .hw_params = snd_imx_pcm_hw_params, |
---|
235 | | - .prepare = snd_imx_pcm_prepare, |
---|
236 | | - .trigger = snd_imx_pcm_trigger, |
---|
237 | | - .pointer = snd_imx_pcm_pointer, |
---|
238 | | - .mmap = snd_imx_pcm_mmap, |
---|
239 | | -}; |
---|
240 | 232 | |
---|
241 | 233 | static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) |
---|
242 | 234 | { |
---|
.. | .. |
---|
284 | 276 | |
---|
285 | 277 | static int ssi_irq; |
---|
286 | 278 | |
---|
287 | | -static int imx_pcm_fiq_new(struct snd_soc_pcm_runtime *rtd) |
---|
| 279 | +static int snd_imx_pcm_new(struct snd_soc_component *component, |
---|
| 280 | + struct snd_soc_pcm_runtime *rtd) |
---|
288 | 281 | { |
---|
289 | 282 | struct snd_pcm *pcm = rtd->pcm; |
---|
290 | 283 | struct snd_pcm_substream *substream; |
---|
.. | .. |
---|
334 | 327 | } |
---|
335 | 328 | } |
---|
336 | 329 | |
---|
337 | | -static void imx_pcm_fiq_free(struct snd_pcm *pcm) |
---|
| 330 | +static void snd_imx_pcm_free(struct snd_soc_component *component, |
---|
| 331 | + struct snd_pcm *pcm) |
---|
338 | 332 | { |
---|
339 | 333 | mxc_set_irq_fiq(ssi_irq, 0); |
---|
340 | 334 | release_fiq(&fh); |
---|
.. | .. |
---|
342 | 336 | } |
---|
343 | 337 | |
---|
344 | 338 | static const struct snd_soc_component_driver imx_soc_component_fiq = { |
---|
345 | | - .ops = &imx_pcm_ops, |
---|
346 | | - .pcm_new = imx_pcm_fiq_new, |
---|
347 | | - .pcm_free = imx_pcm_fiq_free, |
---|
| 339 | + .open = snd_imx_open, |
---|
| 340 | + .close = snd_imx_close, |
---|
| 341 | + .hw_params = snd_imx_pcm_hw_params, |
---|
| 342 | + .prepare = snd_imx_pcm_prepare, |
---|
| 343 | + .trigger = snd_imx_pcm_trigger, |
---|
| 344 | + .pointer = snd_imx_pcm_pointer, |
---|
| 345 | + .mmap = snd_imx_pcm_mmap, |
---|
| 346 | + .pcm_construct = snd_imx_pcm_new, |
---|
| 347 | + .pcm_destruct = snd_imx_pcm_free, |
---|
348 | 348 | }; |
---|
349 | 349 | |
---|
350 | 350 | int imx_pcm_fiq_init(struct platform_device *pdev, |
---|