forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/sound/pci/emu10k1/p16v.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by James Courtier-Dutton <James@superbug.demon.co.uk>
34 * Driver p16v chips
....@@ -71,21 +72,6 @@
7172 *
7273 * This code was initially based on code from ALSA's emu10k1x.c which is:
7374 * Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com>
74
- *
75
- * This program is free software; you can redistribute it and/or modify
76
- * it under the terms of the GNU General Public License as published by
77
- * the Free Software Foundation; either version 2 of the License, or
78
- * (at your option) any later version.
79
- *
80
- * This program is distributed in the hope that it will be useful,
81
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
82
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83
- * GNU General Public License for more details.
84
- *
85
- * You should have received a copy of the GNU General Public License
86
- * along with this program; if not, write to the Free Software
87
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
88
- *
8975 */
9076 #include <linux/delay.h>
9177 #include <linux/init.h>
....@@ -295,36 +281,6 @@
295281 // Only using channel 0 for now, but the card has 2 channels.
296282 return snd_p16v_pcm_open_capture_channel(substream, 0);
297283 }
298
-
299
-/* hw_params callback */
300
-static int snd_p16v_pcm_hw_params_playback(struct snd_pcm_substream *substream,
301
- struct snd_pcm_hw_params *hw_params)
302
-{
303
- return snd_pcm_lib_malloc_pages(substream,
304
- params_buffer_bytes(hw_params));
305
-}
306
-
307
-/* hw_params callback */
308
-static int snd_p16v_pcm_hw_params_capture(struct snd_pcm_substream *substream,
309
- struct snd_pcm_hw_params *hw_params)
310
-{
311
- return snd_pcm_lib_malloc_pages(substream,
312
- params_buffer_bytes(hw_params));
313
-}
314
-
315
-
316
-/* hw_free callback */
317
-static int snd_p16v_pcm_hw_free_playback(struct snd_pcm_substream *substream)
318
-{
319
- return snd_pcm_lib_free_pages(substream);
320
-}
321
-
322
-/* hw_free callback */
323
-static int snd_p16v_pcm_hw_free_capture(struct snd_pcm_substream *substream)
324
-{
325
- return snd_pcm_lib_free_pages(substream);
326
-}
327
-
328284
329285 /* prepare playback callback */
330286 static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream)
....@@ -596,9 +552,6 @@
596552 static const struct snd_pcm_ops snd_p16v_playback_front_ops = {
597553 .open = snd_p16v_pcm_open_playback_front,
598554 .close = snd_p16v_pcm_close_playback,
599
- .ioctl = snd_pcm_lib_ioctl,
600
- .hw_params = snd_p16v_pcm_hw_params_playback,
601
- .hw_free = snd_p16v_pcm_hw_free_playback,
602555 .prepare = snd_p16v_pcm_prepare_playback,
603556 .trigger = snd_p16v_pcm_trigger_playback,
604557 .pointer = snd_p16v_pcm_pointer_playback,
....@@ -607,9 +560,6 @@
607560 static const struct snd_pcm_ops snd_p16v_capture_ops = {
608561 .open = snd_p16v_pcm_open_capture,
609562 .close = snd_p16v_pcm_close_capture,
610
- .ioctl = snd_pcm_lib_ioctl,
611
- .hw_params = snd_p16v_pcm_hw_params_capture,
612
- .hw_free = snd_p16v_pcm_hw_free_capture,
613563 .prepare = snd_p16v_pcm_prepare_capture,
614564 .trigger = snd_p16v_pcm_trigger_capture,
615565 .pointer = snd_p16v_pcm_pointer_capture,
....@@ -656,11 +606,10 @@
656606 for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
657607 substream;
658608 substream = substream->next) {
659
- if ((err = snd_pcm_lib_preallocate_pages(substream,
660
- SNDRV_DMA_TYPE_DEV,
661
- snd_dma_pci_data(emu->pci),
662
- ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0)
663
- return err;
609
+ snd_pcm_set_managed_buffer(substream, SNDRV_DMA_TYPE_DEV,
610
+ &emu->pci->dev,
611
+ (65536 - 64) * 8,
612
+ (65536 - 64) * 8);
664613 /*
665614 dev_dbg(emu->card->dev,
666615 "preallocate playback substream: err=%d\n", err);
....@@ -670,11 +619,9 @@
670619 for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
671620 substream;
672621 substream = substream->next) {
673
- if ((err = snd_pcm_lib_preallocate_pages(substream,
674
- SNDRV_DMA_TYPE_DEV,
675
- snd_dma_pci_data(emu->pci),
676
- 65536 - 64, 65536 - 64)) < 0)
677
- return err;
622
+ snd_pcm_set_managed_buffer(substream, SNDRV_DMA_TYPE_DEV,
623
+ &emu->pci->dev,
624
+ 65536 - 64, 65536 - 64);
678625 /*
679626 dev_dbg(emu->card->dev,
680627 "preallocate capture substream: err=%d\n", err);
....@@ -829,7 +776,7 @@
829776 .private_value = ((xreg) | ((xhl) << 8)) \
830777 }
831778
832
-static struct snd_kcontrol_new p16v_mixer_controls[] = {
779
+static const struct snd_kcontrol_new p16v_mixer_controls[] = {
833780 P16V_VOL("HD Analog Front Playback Volume", PLAYBACK_VOLUME_MIXER9, 0),
834781 P16V_VOL("HD Analog Rear Playback Volume", PLAYBACK_VOLUME_MIXER10, 1),
835782 P16V_VOL("HD Analog Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER9, 1),