hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/soc/samsung/idma.c
....@@ -1,16 +1,10 @@
1
-/*
2
- * sound/soc/samsung/idma.c
3
- *
4
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
5
- * http://www.samsung.com
6
- *
7
- * I2S0's Internal DMA driver
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
+//
3
+// idma.c - I2S0 internal DMA driver
4
+//
5
+// Copyright (c) 2011 Samsung Electronics Co., Ltd.
6
+// http://www.samsung.com
7
+
148 #include <linux/interrupt.h>
159 #include <linux/platform_device.h>
1610 #include <linux/dma-mapping.h>
....@@ -143,8 +137,9 @@
143137 snd_pcm_period_elapsed(substream);
144138 }
145139
146
-static int idma_hw_params(struct snd_pcm_substream *substream,
147
- struct snd_pcm_hw_params *params)
140
+static int idma_hw_params(struct snd_soc_component *component,
141
+ struct snd_pcm_substream *substream,
142
+ struct snd_pcm_hw_params *params)
148143 {
149144 struct snd_pcm_runtime *runtime = substream->runtime;
150145 struct idma_ctrl *prtd = substream->runtime->private_data;
....@@ -169,14 +164,16 @@
169164 return 0;
170165 }
171166
172
-static int idma_hw_free(struct snd_pcm_substream *substream)
167
+static int idma_hw_free(struct snd_soc_component *component,
168
+ struct snd_pcm_substream *substream)
173169 {
174170 snd_pcm_set_runtime_buffer(substream, NULL);
175171
176172 return 0;
177173 }
178174
179
-static int idma_prepare(struct snd_pcm_substream *substream)
175
+static int idma_prepare(struct snd_soc_component *component,
176
+ struct snd_pcm_substream *substream)
180177 {
181178 struct idma_ctrl *prtd = substream->runtime->private_data;
182179
....@@ -189,7 +186,8 @@
189186 return 0;
190187 }
191188
192
-static int idma_trigger(struct snd_pcm_substream *substream, int cmd)
189
+static int idma_trigger(struct snd_soc_component *component,
190
+ struct snd_pcm_substream *substream, int cmd)
193191 {
194192 struct idma_ctrl *prtd = substream->runtime->private_data;
195193 int ret = 0;
....@@ -222,7 +220,8 @@
222220 }
223221
224222 static snd_pcm_uframes_t
225
- idma_pointer(struct snd_pcm_substream *substream)
223
+idma_pointer(struct snd_soc_component *component,
224
+ struct snd_pcm_substream *substream)
226225 {
227226 struct snd_pcm_runtime *runtime = substream->runtime;
228227 struct idma_ctrl *prtd = runtime->private_data;
....@@ -239,7 +238,8 @@
239238 return bytes_to_frames(substream->runtime, res);
240239 }
241240
242
-static int idma_mmap(struct snd_pcm_substream *substream,
241
+static int idma_mmap(struct snd_soc_component *component,
242
+ struct snd_pcm_substream *substream,
243243 struct vm_area_struct *vma)
244244 {
245245 struct snd_pcm_runtime *runtime = substream->runtime;
....@@ -284,7 +284,8 @@
284284 return IRQ_HANDLED;
285285 }
286286
287
-static int idma_open(struct snd_pcm_substream *substream)
287
+static int idma_open(struct snd_soc_component *component,
288
+ struct snd_pcm_substream *substream)
288289 {
289290 struct snd_pcm_runtime *runtime = substream->runtime;
290291 struct idma_ctrl *prtd;
....@@ -310,7 +311,8 @@
310311 return 0;
311312 }
312313
313
-static int idma_close(struct snd_pcm_substream *substream)
314
+static int idma_close(struct snd_soc_component *component,
315
+ struct snd_pcm_substream *substream)
314316 {
315317 struct snd_pcm_runtime *runtime = substream->runtime;
316318 struct idma_ctrl *prtd = runtime->private_data;
....@@ -325,19 +327,8 @@
325327 return 0;
326328 }
327329
328
-static const struct snd_pcm_ops idma_ops = {
329
- .open = idma_open,
330
- .close = idma_close,
331
- .ioctl = snd_pcm_lib_ioctl,
332
- .trigger = idma_trigger,
333
- .pointer = idma_pointer,
334
- .mmap = idma_mmap,
335
- .hw_params = idma_hw_params,
336
- .hw_free = idma_hw_free,
337
- .prepare = idma_prepare,
338
-};
339
-
340
-static void idma_free(struct snd_pcm *pcm)
330
+static void idma_free(struct snd_soc_component *component,
331
+ struct snd_pcm *pcm)
341332 {
342333 struct snd_pcm_substream *substream;
343334 struct snd_dma_buffer *buf;
....@@ -375,7 +366,8 @@
375366 return 0;
376367 }
377368
378
-static int idma_new(struct snd_soc_pcm_runtime *rtd)
369
+static int idma_new(struct snd_soc_component *component,
370
+ struct snd_soc_pcm_runtime *rtd)
379371 {
380372 struct snd_card *card = rtd->card->snd_card;
381373 struct snd_pcm *pcm = rtd->pcm;
....@@ -402,9 +394,16 @@
402394 EXPORT_SYMBOL_GPL(idma_reg_addr_init);
403395
404396 static const struct snd_soc_component_driver asoc_idma_platform = {
405
- .ops = &idma_ops,
406
- .pcm_new = idma_new,
407
- .pcm_free = idma_free,
397
+ .open = idma_open,
398
+ .close = idma_close,
399
+ .trigger = idma_trigger,
400
+ .pointer = idma_pointer,
401
+ .mmap = idma_mmap,
402
+ .hw_params = idma_hw_params,
403
+ .hw_free = idma_hw_free,
404
+ .prepare = idma_prepare,
405
+ .pcm_construct = idma_new,
406
+ .pcm_destruct = idma_free,
408407 };
409408
410409 static int asoc_idma_platform_probe(struct platform_device *pdev)