.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com> |
---|
3 | 4 | * Driver EMU10K1X chips |
---|
.. | .. |
---|
13 | 14 | * Chips (SB0200 model): |
---|
14 | 15 | * - EMU10K1X-DBQ |
---|
15 | 16 | * - 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 | | - * |
---|
31 | 17 | */ |
---|
32 | 18 | #include <linux/init.h> |
---|
33 | 19 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
425 | 411 | epcm->voice->epcm = epcm; |
---|
426 | 412 | } |
---|
427 | 413 | |
---|
428 | | - return snd_pcm_lib_malloc_pages(substream, |
---|
429 | | - params_buffer_bytes(hw_params)); |
---|
| 414 | + return 0; |
---|
430 | 415 | } |
---|
431 | 416 | |
---|
432 | 417 | /* hw_free callback */ |
---|
.. | .. |
---|
446 | 431 | epcm->voice = NULL; |
---|
447 | 432 | } |
---|
448 | 433 | |
---|
449 | | - return snd_pcm_lib_free_pages(substream); |
---|
| 434 | + return 0; |
---|
450 | 435 | } |
---|
451 | 436 | |
---|
452 | 437 | /* prepare callback */ |
---|
.. | .. |
---|
551 | 536 | static const struct snd_pcm_ops snd_emu10k1x_playback_ops = { |
---|
552 | 537 | .open = snd_emu10k1x_playback_open, |
---|
553 | 538 | .close = snd_emu10k1x_playback_close, |
---|
554 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
555 | 539 | .hw_params = snd_emu10k1x_pcm_hw_params, |
---|
556 | 540 | .hw_free = snd_emu10k1x_pcm_hw_free, |
---|
557 | 541 | .prepare = snd_emu10k1x_pcm_prepare, |
---|
.. | .. |
---|
608 | 592 | epcm->voice->use = 1; |
---|
609 | 593 | } |
---|
610 | 594 | |
---|
611 | | - return snd_pcm_lib_malloc_pages(substream, |
---|
612 | | - params_buffer_bytes(hw_params)); |
---|
| 595 | + return 0; |
---|
613 | 596 | } |
---|
614 | 597 | |
---|
615 | 598 | /* hw_free callback */ |
---|
.. | .. |
---|
629 | 612 | epcm->voice = NULL; |
---|
630 | 613 | } |
---|
631 | 614 | |
---|
632 | | - return snd_pcm_lib_free_pages(substream); |
---|
| 615 | + return 0; |
---|
633 | 616 | } |
---|
634 | 617 | |
---|
635 | 618 | /* prepare capture callback */ |
---|
.. | .. |
---|
697 | 680 | static const struct snd_pcm_ops snd_emu10k1x_capture_ops = { |
---|
698 | 681 | .open = snd_emu10k1x_pcm_open_capture, |
---|
699 | 682 | .close = snd_emu10k1x_pcm_close_capture, |
---|
700 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
701 | 683 | .hw_params = snd_emu10k1x_pcm_hw_params_capture, |
---|
702 | 684 | .hw_free = snd_emu10k1x_pcm_hw_free_capture, |
---|
703 | 685 | .prepare = snd_emu10k1x_pcm_prepare_capture, |
---|
.. | .. |
---|
736 | 718 | struct snd_ac97_bus *pbus; |
---|
737 | 719 | struct snd_ac97_template ac97; |
---|
738 | 720 | int err; |
---|
739 | | - static struct snd_ac97_bus_ops ops = { |
---|
| 721 | + static const struct snd_ac97_bus_ops ops = { |
---|
740 | 722 | .write = snd_emu10k1x_ac97_write, |
---|
741 | 723 | .read = snd_emu10k1x_ac97_read, |
---|
742 | 724 | }; |
---|
.. | .. |
---|
890 | 872 | } |
---|
891 | 873 | emu->pcm = pcm; |
---|
892 | 874 | |
---|
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); |
---|
896 | 877 | |
---|
897 | 878 | return snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK, map, 2, |
---|
898 | 879 | 1 << 2, NULL); |
---|
.. | .. |
---|
905 | 886 | struct emu10k1x *chip; |
---|
906 | 887 | int err; |
---|
907 | 888 | int ch; |
---|
908 | | - static struct snd_device_ops ops = { |
---|
| 889 | + static const struct snd_device_ops ops = { |
---|
909 | 890 | .dev_free = snd_emu10k1x_dev_free, |
---|
910 | 891 | }; |
---|
911 | 892 | |
---|
.. | .. |
---|
949 | 930 | return -EBUSY; |
---|
950 | 931 | } |
---|
951 | 932 | chip->irq = pci->irq; |
---|
| 933 | + card->sync_irq = chip->irq; |
---|
952 | 934 | |
---|
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) { |
---|
955 | 937 | snd_emu10k1x_free(chip); |
---|
956 | 938 | return -ENOMEM; |
---|
957 | 939 | } |
---|
.. | .. |
---|
1058 | 1040 | if (sscanf(line, "%x %x %x", ®, &channel_id, &val) != 3) |
---|
1059 | 1041 | continue; |
---|
1060 | 1042 | |
---|
1061 | | - if (reg < 0x49 && val <= 0xffffffff && channel_id <= 2) |
---|
| 1043 | + if (reg < 0x49 && channel_id <= 2) |
---|
1062 | 1044 | snd_emu10k1x_ptr_write(emu, reg, channel_id, val); |
---|
1063 | 1045 | } |
---|
1064 | 1046 | } |
---|
1065 | 1047 | |
---|
1066 | 1048 | static int snd_emu10k1x_proc_init(struct emu10k1x *emu) |
---|
1067 | 1049 | { |
---|
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); |
---|
1077 | 1053 | return 0; |
---|
1078 | 1054 | } |
---|
1079 | 1055 | |
---|
.. | .. |
---|
1094 | 1070 | { |
---|
1095 | 1071 | struct emu10k1x *emu = snd_kcontrol_chip(kcontrol); |
---|
1096 | 1072 | unsigned int val; |
---|
1097 | | - int change = 0; |
---|
1098 | 1073 | |
---|
1099 | 1074 | val = ucontrol->value.integer.value[0] ; |
---|
1100 | 1075 | |
---|
.. | .. |
---|
1109 | 1084 | snd_emu10k1x_ptr_write(emu, ROUTING, 0, 0x1003F); |
---|
1110 | 1085 | snd_emu10k1x_gpio_write(emu, 0x1080); |
---|
1111 | 1086 | } |
---|
1112 | | - return change; |
---|
| 1087 | + return 0; |
---|
1113 | 1088 | } |
---|
1114 | 1089 | |
---|
1115 | 1090 | static const struct snd_kcontrol_new snd_emu10k1x_shared_spdif = |
---|