forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/isa/sb/sb8_main.c
....@@ -1,24 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
34 * Uros Bizjak <uros@kss-loka.si>
45 *
56 * Routines for control of 8-bit SoundBlaster cards and clones
67 * Please note: I don't have access to old SB8 soundcards.
7
- *
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License as published by
11
- * the Free Software Foundation; either version 2 of the License, or
12
- * (at your option) any later version.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- * GNU General Public License for more details.
18
- *
19
- * You should have received a copy of the GNU General Public License
20
- * along with this program; if not, write to the Free Software
21
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
228 *
239 * --
2410 *
....@@ -130,13 +116,13 @@
130116 chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
131117 break;
132118 }
133
- /* fallthru */
119
+ fallthrough;
134120 case SB_HW_201:
135121 if (rate > 23000) {
136122 chip->playback_format = SB_DSP_HI_OUTPUT_AUTO;
137123 break;
138124 }
139
- /* fallthru */
125
+ fallthrough;
140126 case SB_HW_20:
141127 chip->playback_format = SB_DSP_LO_OUTPUT_AUTO;
142128 break;
....@@ -239,18 +225,6 @@
239225 return 0;
240226 }
241227
242
-static int snd_sb8_hw_params(struct snd_pcm_substream *substream,
243
- struct snd_pcm_hw_params *hw_params)
244
-{
245
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
246
-}
247
-
248
-static int snd_sb8_hw_free(struct snd_pcm_substream *substream)
249
-{
250
- snd_pcm_lib_free_pages(substream);
251
- return 0;
252
-}
253
-
254228 static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream)
255229 {
256230 unsigned long flags;
....@@ -287,7 +261,7 @@
287261 chip->capture_format = SB_DSP_HI_INPUT_AUTO;
288262 break;
289263 }
290
- /* fallthru */
264
+ fallthrough;
291265 case SB_HW_20:
292266 chip->capture_format = SB_DSP_LO_INPUT_AUTO;
293267 break;
....@@ -387,7 +361,7 @@
387361 case SB_MODE_PLAYBACK_16: /* ok.. playback is active */
388362 if (chip->hardware != SB_HW_JAZZ16)
389363 break;
390
- /* fallthru */
364
+ fallthrough;
391365 case SB_MODE_PLAYBACK_8:
392366 substream = chip->playback_substream;
393367 if (chip->playback_format == SB_DSP_OUTPUT)
....@@ -397,7 +371,7 @@
397371 case SB_MODE_CAPTURE_16:
398372 if (chip->hardware != SB_HW_JAZZ16)
399373 break;
400
- /* fallthru */
374
+ fallthrough;
401375 case SB_MODE_CAPTURE_8:
402376 substream = chip->capture_substream;
403377 if (chip->capture_format == SB_DSP_INPUT)
....@@ -572,9 +546,6 @@
572546 static const struct snd_pcm_ops snd_sb8_playback_ops = {
573547 .open = snd_sb8_open,
574548 .close = snd_sb8_close,
575
- .ioctl = snd_pcm_lib_ioctl,
576
- .hw_params = snd_sb8_hw_params,
577
- .hw_free = snd_sb8_hw_free,
578549 .prepare = snd_sb8_playback_prepare,
579550 .trigger = snd_sb8_playback_trigger,
580551 .pointer = snd_sb8_playback_pointer,
....@@ -583,9 +554,6 @@
583554 static const struct snd_pcm_ops snd_sb8_capture_ops = {
584555 .open = snd_sb8_open,
585556 .close = snd_sb8_close,
586
- .ioctl = snd_pcm_lib_ioctl,
587
- .hw_params = snd_sb8_hw_params,
588
- .hw_free = snd_sb8_hw_free,
589557 .prepare = snd_sb8_capture_prepare,
590558 .trigger = snd_sb8_capture_trigger,
591559 .pointer = snd_sb8_capture_pointer,
....@@ -609,9 +577,8 @@
609577
610578 if (chip->dma8 > 3 || chip->dma16 >= 0)
611579 max_prealloc = 128 * 1024;
612
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
613
- snd_dma_isa_data(),
614
- 64*1024, max_prealloc);
580
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
581
+ card->dev, 64*1024, max_prealloc);
615582
616583 return 0;
617584 }