forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/sound/pci/sonicvibes.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for S3 SonicVibes soundcard
34 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
....@@ -5,21 +6,6 @@
56 * BUGS:
67 * It looks like 86c617 rev 3 doesn't supports DDMA buffers above 16MB?
78 * Driver sometimes hangs... Nobody knows why at this moment...
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
22
- *
239 */
2410
2511 #include <linux/delay.h>
....@@ -695,17 +681,6 @@
695681 return snd_sonicvibes_trigger(sonic, 2, cmd);
696682 }
697683
698
-static int snd_sonicvibes_hw_params(struct snd_pcm_substream *substream,
699
- struct snd_pcm_hw_params *hw_params)
700
-{
701
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
702
-}
703
-
704
-static int snd_sonicvibes_hw_free(struct snd_pcm_substream *substream)
705
-{
706
- return snd_pcm_lib_free_pages(substream);
707
-}
708
-
709684 static int snd_sonicvibes_playback_prepare(struct snd_pcm_substream *substream)
710685 {
711686 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
....@@ -860,9 +835,6 @@
860835 static const struct snd_pcm_ops snd_sonicvibes_playback_ops = {
861836 .open = snd_sonicvibes_playback_open,
862837 .close = snd_sonicvibes_playback_close,
863
- .ioctl = snd_pcm_lib_ioctl,
864
- .hw_params = snd_sonicvibes_hw_params,
865
- .hw_free = snd_sonicvibes_hw_free,
866838 .prepare = snd_sonicvibes_playback_prepare,
867839 .trigger = snd_sonicvibes_playback_trigger,
868840 .pointer = snd_sonicvibes_playback_pointer,
....@@ -871,9 +843,6 @@
871843 static const struct snd_pcm_ops snd_sonicvibes_capture_ops = {
872844 .open = snd_sonicvibes_capture_open,
873845 .close = snd_sonicvibes_capture_close,
874
- .ioctl = snd_pcm_lib_ioctl,
875
- .hw_params = snd_sonicvibes_hw_params,
876
- .hw_free = snd_sonicvibes_hw_free,
877846 .prepare = snd_sonicvibes_capture_prepare,
878847 .trigger = snd_sonicvibes_capture_trigger,
879848 .pointer = snd_sonicvibes_capture_pointer,
....@@ -897,8 +866,8 @@
897866 strcpy(pcm->name, "S3 SonicVibes");
898867 sonic->pcm = pcm;
899868
900
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
901
- snd_dma_pci_data(sonic->pci), 64*1024, 128*1024);
869
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
870
+ &sonic->pci->dev, 64*1024, 128*1024);
902871
903872 return 0;
904873 }
....@@ -1081,7 +1050,7 @@
10811050 return change;
10821051 }
10831052
1084
-static struct snd_kcontrol_new snd_sonicvibes_controls[] = {
1053
+static const struct snd_kcontrol_new snd_sonicvibes_controls[] = {
10851054 SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0),
10861055 SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1),
10871056 SONICVIBES_DOUBLE("Aux Playback Volume", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 0, 0, 31, 1),
....@@ -1171,10 +1140,8 @@
11711140
11721141 static void snd_sonicvibes_proc_init(struct sonicvibes *sonic)
11731142 {
1174
- struct snd_info_entry *entry;
1175
-
1176
- if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry))
1177
- snd_info_set_text_ops(entry, sonic, snd_sonicvibes_proc_read);
1143
+ snd_card_ro_proc_new(sonic->card, "sonicvibes", sonic,
1144
+ snd_sonicvibes_proc_read);
11781145 }
11791146
11801147 /*
....@@ -1182,7 +1149,7 @@
11821149 */
11831150
11841151 #ifdef SUPPORT_JOYSTICK
1185
-static struct snd_kcontrol_new snd_sonicvibes_game_control =
1152
+static const struct snd_kcontrol_new snd_sonicvibes_game_control =
11861153 SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
11871154
11881155 static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic)
....@@ -1254,7 +1221,7 @@
12541221 struct sonicvibes *sonic;
12551222 unsigned int dmaa, dmac;
12561223 int err;
1257
- static struct snd_device_ops ops = {
1224
+ static const struct snd_device_ops ops = {
12581225 .dev_free = snd_sonicvibes_dev_free,
12591226 };
12601227
....@@ -1300,6 +1267,7 @@
13001267 return -EBUSY;
13011268 }
13021269 sonic->irq = pci->irq;
1270
+ card->sync_irq = sonic->irq;
13031271
13041272 pci_read_config_dword(pci, 0x40, &dmaa);
13051273 pci_read_config_dword(pci, 0x48, &dmac);
....@@ -1407,7 +1375,7 @@
14071375 * MIDI section
14081376 */
14091377
1410
-static struct snd_kcontrol_new snd_sonicvibes_midi_controls[] = {
1378
+static const struct snd_kcontrol_new snd_sonicvibes_midi_controls[] = {
14111379 SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0),
14121380 SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0),
14131381 SONICVIBES_SINGLE("SonicVibes Onboard Synth", 0, SV_IREG_MPU401, 0, 1, 0),