hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/pci/emu10k1/emu10k1x.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com>
34 * Driver EMU10K1X chips
....@@ -13,21 +14,6 @@
1314 * Chips (SB0200 model):
1415 * - EMU10K1X-DBQ
1516 * - STAC 9708T
16
- *
17
- * This program is free software; you can redistribute it and/or modify
18
- * it under the terms of the GNU General Public License as published by
19
- * the Free Software Foundation; either version 2 of the License, or
20
- * (at your option) any later version.
21
- *
22
- * This program is distributed in the hope that it will be useful,
23
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
- * GNU General Public License for more details.
26
- *
27
- * You should have received a copy of the GNU General Public License
28
- * along with this program; if not, write to the Free Software
29
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
- *
3117 */
3218 #include <linux/init.h>
3319 #include <linux/interrupt.h>
....@@ -425,8 +411,7 @@
425411 epcm->voice->epcm = epcm;
426412 }
427413
428
- return snd_pcm_lib_malloc_pages(substream,
429
- params_buffer_bytes(hw_params));
414
+ return 0;
430415 }
431416
432417 /* hw_free callback */
....@@ -446,7 +431,7 @@
446431 epcm->voice = NULL;
447432 }
448433
449
- return snd_pcm_lib_free_pages(substream);
434
+ return 0;
450435 }
451436
452437 /* prepare callback */
....@@ -551,7 +536,6 @@
551536 static const struct snd_pcm_ops snd_emu10k1x_playback_ops = {
552537 .open = snd_emu10k1x_playback_open,
553538 .close = snd_emu10k1x_playback_close,
554
- .ioctl = snd_pcm_lib_ioctl,
555539 .hw_params = snd_emu10k1x_pcm_hw_params,
556540 .hw_free = snd_emu10k1x_pcm_hw_free,
557541 .prepare = snd_emu10k1x_pcm_prepare,
....@@ -608,8 +592,7 @@
608592 epcm->voice->use = 1;
609593 }
610594
611
- return snd_pcm_lib_malloc_pages(substream,
612
- params_buffer_bytes(hw_params));
595
+ return 0;
613596 }
614597
615598 /* hw_free callback */
....@@ -629,7 +612,7 @@
629612 epcm->voice = NULL;
630613 }
631614
632
- return snd_pcm_lib_free_pages(substream);
615
+ return 0;
633616 }
634617
635618 /* prepare capture callback */
....@@ -697,7 +680,6 @@
697680 static const struct snd_pcm_ops snd_emu10k1x_capture_ops = {
698681 .open = snd_emu10k1x_pcm_open_capture,
699682 .close = snd_emu10k1x_pcm_close_capture,
700
- .ioctl = snd_pcm_lib_ioctl,
701683 .hw_params = snd_emu10k1x_pcm_hw_params_capture,
702684 .hw_free = snd_emu10k1x_pcm_hw_free_capture,
703685 .prepare = snd_emu10k1x_pcm_prepare_capture,
....@@ -736,7 +718,7 @@
736718 struct snd_ac97_bus *pbus;
737719 struct snd_ac97_template ac97;
738720 int err;
739
- static struct snd_ac97_bus_ops ops = {
721
+ static const struct snd_ac97_bus_ops ops = {
740722 .write = snd_emu10k1x_ac97_write,
741723 .read = snd_emu10k1x_ac97_read,
742724 };
....@@ -890,9 +872,8 @@
890872 }
891873 emu->pcm = pcm;
892874
893
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
894
- snd_dma_pci_data(emu->pci),
895
- 32*1024, 32*1024);
875
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
876
+ &emu->pci->dev, 32*1024, 32*1024);
896877
897878 return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2,
898879 1 << 2, NULL);
....@@ -905,7 +886,7 @@
905886 struct emu10k1x *chip;
906887 int err;
907888 int ch;
908
- static struct snd_device_ops ops = {
889
+ static const struct snd_device_ops ops = {
909890 .dev_free = snd_emu10k1x_dev_free,
910891 };
911892
....@@ -949,9 +930,10 @@
949930 return -EBUSY;
950931 }
951932 chip->irq = pci->irq;
933
+ card->sync_irq = chip->irq;
952934
953
- if(snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
954
- 4 * 1024, &chip->dma_buffer) < 0) {
935
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
936
+ 4 * 1024, &chip->dma_buffer) < 0) {
955937 snd_emu10k1x_free(chip);
956938 return -ENOMEM;
957939 }
....@@ -1058,22 +1040,16 @@
10581040 if (sscanf(line, "%x %x %x", &reg, &channel_id, &val) != 3)
10591041 continue;
10601042
1061
- if (reg < 0x49 && val <= 0xffffffff && channel_id <= 2)
1043
+ if (reg < 0x49 && channel_id <= 2)
10621044 snd_emu10k1x_ptr_write(emu, reg, channel_id, val);
10631045 }
10641046 }
10651047
10661048 static int snd_emu10k1x_proc_init(struct emu10k1x *emu)
10671049 {
1068
- struct snd_info_entry *entry;
1069
-
1070
- if(! snd_card_proc_new(emu->card, "emu10k1x_regs", &entry)) {
1071
- snd_info_set_text_ops(entry, emu, snd_emu10k1x_proc_reg_read);
1072
- entry->c.text.write = snd_emu10k1x_proc_reg_write;
1073
- entry->mode |= 0200;
1074
- entry->private_data = emu;
1075
- }
1076
-
1050
+ snd_card_rw_proc_new(emu->card, "emu10k1x_regs", emu,
1051
+ snd_emu10k1x_proc_reg_read,
1052
+ snd_emu10k1x_proc_reg_write);
10771053 return 0;
10781054 }
10791055
....@@ -1094,7 +1070,6 @@
10941070 {
10951071 struct emu10k1x *emu = snd_kcontrol_chip(kcontrol);
10961072 unsigned int val;
1097
- int change = 0;
10981073
10991074 val = ucontrol->value.integer.value[0] ;
11001075
....@@ -1109,7 +1084,7 @@
11091084 snd_emu10k1x_ptr_write(emu, ROUTING, 0, 0x1003F);
11101085 snd_emu10k1x_gpio_write(emu, 0x1080);
11111086 }
1112
- return change;
1087
+ return 0;
11131088 }
11141089
11151090 static const struct snd_kcontrol_new snd_emu10k1x_shared_spdif =