forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for Sound Core PDAudioCF soundcards
34 *
45 * PCM part
56 *
67 * Copyright (c) 2003 by Jaroslav Kysela <perex@perex.cz>
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
218 */
229
2310 #include <linux/delay.h>
....@@ -58,7 +45,7 @@
5845 case SNDRV_PCM_TRIGGER_START:
5946 chip->pcm_hwptr = 0;
6047 chip->pcm_tdone = 0;
61
- /* fall thru */
48
+ fallthrough;
6249 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
6350 case SNDRV_PCM_TRIGGER_RESUME:
6451 mask = 0;
....@@ -94,24 +81,6 @@
9481 mutex_unlock(&chip->reg_lock);
9582 snd_ak4117_check_rate_and_errors(chip->ak4117, AK4117_CHECK_NO_RATE);
9683 return ret;
97
-}
98
-
99
-/*
100
- * pdacf_pcm_hw_params - hw_params callback for playback and capture
101
- */
102
-static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs,
103
- struct snd_pcm_hw_params *hw_params)
104
-{
105
- return snd_pcm_lib_alloc_vmalloc_32_buffer
106
- (subs, params_buffer_bytes(hw_params));
107
-}
108
-
109
-/*
110
- * pdacf_pcm_hw_free - hw_free callback for playback and capture
111
- */
112
-static int pdacf_pcm_hw_free(struct snd_pcm_substream *subs)
113
-{
114
- return snd_pcm_lib_free_vmalloc_buffer(subs);
11584 }
11685
11786 /*
....@@ -163,7 +132,7 @@
163132 case SNDRV_PCM_FORMAT_S24_3LE:
164133 case SNDRV_PCM_FORMAT_S24_3BE:
165134 chip->pcm_sample = 3;
166
- /* fall through */
135
+ fallthrough;
167136 default: /* 24-bit */
168137 aval = AK4117_DIF_24R;
169138 chip->pcm_frame = 3;
....@@ -269,13 +238,9 @@
269238 static const struct snd_pcm_ops pdacf_pcm_capture_ops = {
270239 .open = pdacf_pcm_capture_open,
271240 .close = pdacf_pcm_capture_close,
272
- .ioctl = snd_pcm_lib_ioctl,
273
- .hw_params = pdacf_pcm_hw_params,
274
- .hw_free = pdacf_pcm_hw_free,
275241 .prepare = pdacf_pcm_prepare,
276242 .trigger = pdacf_pcm_trigger,
277243 .pointer = pdacf_pcm_capture_pointer,
278
- .page = snd_pcm_lib_get_vmalloc_page,
279244 };
280245
281246
....@@ -292,6 +257,9 @@
292257 return err;
293258
294259 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pdacf_pcm_capture_ops);
260
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC,
261
+ snd_dma_continuous_data(GFP_KERNEL | GFP_DMA32),
262
+ 0, 0);
295263
296264 pcm->private_data = chip;
297265 pcm->info_flags = 0;