forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/aoa/soundbus/i2sbus/pcm.c
....@@ -1,9 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * i2sbus driver -- pcm routines
34 *
45 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
5
- *
6
- * GPL v2, can be found in COPYING.
76 */
87
98 #include <linux/io.h>
....@@ -255,12 +254,11 @@
255254 struct pcm_info *pi)
256255 {
257256 unsigned long flags;
258
- struct completion done;
257
+ DECLARE_COMPLETION_ONSTACK(done);
259258 long timeout;
260259
261260 spin_lock_irqsave(&i2sdev->low_lock, flags);
262261 if (pi->dbdma_ring.stopping) {
263
- init_completion(&done);
264262 pi->stop_completion = &done;
265263 spin_unlock_irqrestore(&i2sdev->low_lock, flags);
266264 timeout = wait_for_completion_timeout(&done, HZ);
....@@ -295,12 +293,6 @@
295293 }
296294 #endif
297295
298
-static int i2sbus_hw_params(struct snd_pcm_substream *substream,
299
- struct snd_pcm_hw_params *params)
300
-{
301
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params));
302
-}
303
-
304296 static inline int i2sbus_hw_free(struct snd_pcm_substream *substream, int in)
305297 {
306298 struct i2sbus_dev *i2sdev = snd_pcm_substream_chip(substream);
....@@ -309,7 +301,6 @@
309301 get_pcm_info(i2sdev, in, &pi, NULL);
310302 if (pi->dbdma_ring.stopping)
311303 i2sbus_wait_for_stop(i2sdev, pi);
312
- snd_pcm_lib_free_pages(substream);
313304 return 0;
314305 }
315306
....@@ -781,8 +772,6 @@
781772 static const struct snd_pcm_ops i2sbus_playback_ops = {
782773 .open = i2sbus_playback_open,
783774 .close = i2sbus_playback_close,
784
- .ioctl = snd_pcm_lib_ioctl,
785
- .hw_params = i2sbus_hw_params,
786775 .hw_free = i2sbus_playback_hw_free,
787776 .prepare = i2sbus_playback_prepare,
788777 .trigger = i2sbus_playback_trigger,
....@@ -851,8 +840,6 @@
851840 static const struct snd_pcm_ops i2sbus_record_ops = {
852841 .open = i2sbus_record_open,
853842 .close = i2sbus_record_close,
854
- .ioctl = snd_pcm_lib_ioctl,
855
- .hw_params = i2sbus_hw_params,
856843 .hw_free = i2sbus_record_hw_free,
857844 .prepare = i2sbus_record_prepare,
858845 .trigger = i2sbus_record_trigger,
....@@ -1027,9 +1014,9 @@
10271014 dev->pcm->private_free = i2sbus_private_free;
10281015
10291016 /* well, we really should support scatter/gather DMA */
1030
- snd_pcm_lib_preallocate_pages_for_all(
1017
+ snd_pcm_set_managed_buffer_all(
10311018 dev->pcm, SNDRV_DMA_TYPE_DEV,
1032
- snd_dma_pci_data(macio_get_pci_dev(i2sdev->macio)),
1019
+ &macio_get_pci_dev(i2sdev->macio)->dev,
10331020 64 * 1024, 64 * 1024);
10341021
10351022 return 0;