forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/fsl/imx-pcm-fiq.c
....@@ -1,16 +1,11 @@
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
+
149 #include <linux/clk.h>
1510 #include <linux/delay.h>
1611 #include <linux/device.h>
....@@ -74,8 +69,9 @@
7469 .name = DRV_NAME,
7570 };
7671
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)
7975 {
8076 struct snd_pcm_runtime *runtime = substream->runtime;
8177 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
....@@ -90,7 +86,8 @@
9086 return 0;
9187 }
9288
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)
9491 {
9592 struct snd_pcm_runtime *runtime = substream->runtime;
9693 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
....@@ -109,7 +106,8 @@
109106
110107 static int imx_pcm_fiq;
111108
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)
113111 {
114112 struct snd_pcm_runtime *runtime = substream->runtime;
115113 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
....@@ -146,7 +144,9 @@
146144 return 0;
147145 }
148146
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)
150150 {
151151 struct snd_pcm_runtime *runtime = substream->runtime;
152152 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
....@@ -170,7 +170,8 @@
170170 .fifo_size = 0,
171171 };
172172
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)
174175 {
175176 struct snd_pcm_runtime *runtime = substream->runtime;
176177 struct imx_pcm_runtime_data *iprtd;
....@@ -199,7 +200,8 @@
199200 return 0;
200201 }
201202
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)
203205 {
204206 struct snd_pcm_runtime *runtime = substream->runtime;
205207 struct imx_pcm_runtime_data *iprtd = runtime->private_data;
....@@ -211,8 +213,9 @@
211213 return 0;
212214 }
213215
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)
216219 {
217220 struct snd_pcm_runtime *runtime = substream->runtime;
218221 int ret;
....@@ -226,17 +229,6 @@
226229 runtime->dma_bytes);
227230 return ret;
228231 }
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
-};
240232
241233 static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
242234 {
....@@ -284,7 +276,8 @@
284276
285277 static int ssi_irq;
286278
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)
288281 {
289282 struct snd_pcm *pcm = rtd->pcm;
290283 struct snd_pcm_substream *substream;
....@@ -334,7 +327,8 @@
334327 }
335328 }
336329
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)
338332 {
339333 mxc_set_irq_fiq(ssi_irq, 0);
340334 release_fiq(&fh);
....@@ -342,9 +336,15 @@
342336 }
343337
344338 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,
348348 };
349349
350350 int imx_pcm_fiq_init(struct platform_device *pdev,