forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/drivers/vx/vx_pcm.c
....@@ -1,24 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for Digigram VX soundcards
34 *
45 * PCM part
56 *
67 * Copyright (c) 2002,2003 by Takashi Iwai <tiwai@suse.de>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
- *
228 *
239 * STRATEGY
2410 * for playback, we send series of "chunks", which size is equal with the
....@@ -38,7 +24,6 @@
3824 *
3925 * the current point of read buffer is kept in pipe->hw_ptr. note that
4026 * this is in bytes.
41
- *
4227 *
4328 * TODO
4429 * - linked trigger for full-duplex mode.
....@@ -75,7 +60,6 @@
7560 *buf++ = vx_inb(chip, RXL);
7661 if (++offset >= pipe->buffer_bytes) {
7762 offset = 0;
78
- buf = (unsigned char *)runtime->dma_area;
7963 }
8064 pipe->hw_ptr = offset;
8165 }
....@@ -545,7 +529,6 @@
545529 err = vx_alloc_pipe(chip, 0, audio, 2, &pipe); /* stereo playback */
546530 if (err < 0)
547531 return err;
548
- chip->playback_pipes[audio] = pipe;
549532 }
550533 /* open for playback */
551534 pipe->references++;
....@@ -788,24 +771,6 @@
788771 }
789772
790773 /*
791
- * vx_pcm_hw_params - hw_params callback for playback and capture
792
- */
793
-static int vx_pcm_hw_params(struct snd_pcm_substream *subs,
794
- struct snd_pcm_hw_params *hw_params)
795
-{
796
- return snd_pcm_lib_alloc_vmalloc_32_buffer
797
- (subs, params_buffer_bytes(hw_params));
798
-}
799
-
800
-/*
801
- * vx_pcm_hw_free - hw_free callback for playback and capture
802
- */
803
-static int vx_pcm_hw_free(struct snd_pcm_substream *subs)
804
-{
805
- return snd_pcm_lib_free_vmalloc_buffer(subs);
806
-}
807
-
808
-/*
809774 * vx_pcm_prepare - prepare callback for playback and capture
810775 */
811776 static int vx_pcm_prepare(struct snd_pcm_substream *subs)
....@@ -876,13 +841,9 @@
876841 static const struct snd_pcm_ops vx_pcm_playback_ops = {
877842 .open = vx_pcm_playback_open,
878843 .close = vx_pcm_playback_close,
879
- .ioctl = snd_pcm_lib_ioctl,
880
- .hw_params = vx_pcm_hw_params,
881
- .hw_free = vx_pcm_hw_free,
882844 .prepare = vx_pcm_prepare,
883845 .trigger = vx_pcm_trigger,
884846 .pointer = vx_pcm_playback_pointer,
885
- .page = snd_pcm_lib_get_vmalloc_page,
886847 };
887848
888849
....@@ -1097,13 +1058,9 @@
10971058 static const struct snd_pcm_ops vx_pcm_capture_ops = {
10981059 .open = vx_pcm_capture_open,
10991060 .close = vx_pcm_capture_close,
1100
- .ioctl = snd_pcm_lib_ioctl,
1101
- .hw_params = vx_pcm_hw_params,
1102
- .hw_free = vx_pcm_hw_free,
11031061 .prepare = vx_pcm_prepare,
11041062 .trigger = vx_pcm_trigger,
11051063 .pointer = vx_pcm_capture_pointer,
1106
- .page = snd_pcm_lib_get_vmalloc_page,
11071064 };
11081065
11091066
....@@ -1248,6 +1205,9 @@
12481205 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &vx_pcm_playback_ops);
12491206 if (ins)
12501207 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &vx_pcm_capture_ops);
1208
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
1209
+ snd_dma_continuous_data(GFP_KERNEL | GFP_DMA32),
1210
+ 0, 0);
12511211
12521212 pcm->private_data = chip;
12531213 pcm->private_free = snd_vx_pcm_free;