| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ALSA driver for ATI IXP 150/200/250 AC97 modem controllers |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 19 | | - * |
|---|
| 20 | 6 | */ |
|---|
| 21 | 7 | |
|---|
| 22 | 8 | #include <linux/io.h> |
|---|
| .. | .. |
|---|
| 335 | 321 | return -ENOMEM; |
|---|
| 336 | 322 | |
|---|
| 337 | 323 | if (dma->desc_buf.area == NULL) { |
|---|
| 338 | | - if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), |
|---|
| 324 | + if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev, |
|---|
| 339 | 325 | ATI_DESC_LIST_SIZE, &dma->desc_buf) < 0) |
|---|
| 340 | 326 | return -ENOMEM; |
|---|
| 341 | 327 | dma->period_bytes = dma->periods = 0; /* clear */ |
|---|
| .. | .. |
|---|
| 797 | 783 | int err; |
|---|
| 798 | 784 | int i; |
|---|
| 799 | 785 | |
|---|
| 800 | | - err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
|---|
| 801 | | - if (err < 0) |
|---|
| 802 | | - return err; |
|---|
| 803 | 786 | dma->buf_addr = substream->runtime->dma_addr; |
|---|
| 804 | 787 | dma->buf_bytes = params_buffer_bytes(hw_params); |
|---|
| 805 | 788 | |
|---|
| .. | .. |
|---|
| 826 | 809 | struct atiixp_dma *dma = substream->runtime->private_data; |
|---|
| 827 | 810 | |
|---|
| 828 | 811 | atiixp_clear_dma_packets(chip, dma, substream); |
|---|
| 829 | | - snd_pcm_lib_free_pages(substream); |
|---|
| 830 | 812 | return 0; |
|---|
| 831 | 813 | } |
|---|
| 832 | 814 | |
|---|
| .. | .. |
|---|
| 950 | 932 | static const struct snd_pcm_ops snd_atiixp_playback_ops = { |
|---|
| 951 | 933 | .open = snd_atiixp_playback_open, |
|---|
| 952 | 934 | .close = snd_atiixp_playback_close, |
|---|
| 953 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 954 | 935 | .hw_params = snd_atiixp_pcm_hw_params, |
|---|
| 955 | 936 | .hw_free = snd_atiixp_pcm_hw_free, |
|---|
| 956 | 937 | .prepare = snd_atiixp_playback_prepare, |
|---|
| .. | .. |
|---|
| 962 | 943 | static const struct snd_pcm_ops snd_atiixp_capture_ops = { |
|---|
| 963 | 944 | .open = snd_atiixp_capture_open, |
|---|
| 964 | 945 | .close = snd_atiixp_capture_close, |
|---|
| 965 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 966 | 946 | .hw_params = snd_atiixp_pcm_hw_params, |
|---|
| 967 | 947 | .hw_free = snd_atiixp_pcm_hw_free, |
|---|
| 968 | 948 | .prepare = snd_atiixp_capture_prepare, |
|---|
| .. | .. |
|---|
| 1008 | 988 | strcpy(pcm->name, "ATI IXP MC97"); |
|---|
| 1009 | 989 | chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm; |
|---|
| 1010 | 990 | |
|---|
| 1011 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 1012 | | - snd_dma_pci_data(chip->pci), |
|---|
| 1013 | | - 64*1024, 128*1024); |
|---|
| 991 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 992 | + &chip->pci->dev, 64*1024, 128*1024); |
|---|
| 1014 | 993 | |
|---|
| 1015 | 994 | return 0; |
|---|
| 1016 | 995 | } |
|---|
| .. | .. |
|---|
| 1067 | 1046 | struct snd_ac97_template ac97; |
|---|
| 1068 | 1047 | int i, err; |
|---|
| 1069 | 1048 | int codec_count; |
|---|
| 1070 | | - static struct snd_ac97_bus_ops ops = { |
|---|
| 1049 | + static const struct snd_ac97_bus_ops ops = { |
|---|
| 1071 | 1050 | .write = snd_atiixp_ac97_write, |
|---|
| 1072 | 1051 | .read = snd_atiixp_ac97_read, |
|---|
| 1073 | 1052 | }; |
|---|
| 1074 | | - static unsigned int codec_skip[NUM_ATI_CODECS] = { |
|---|
| 1053 | + static const unsigned int codec_skip[NUM_ATI_CODECS] = { |
|---|
| 1075 | 1054 | ATI_REG_ISR_CODEC0_NOT_READY, |
|---|
| 1076 | 1055 | ATI_REG_ISR_CODEC1_NOT_READY, |
|---|
| 1077 | 1056 | ATI_REG_ISR_CODEC2_NOT_READY, |
|---|
| .. | .. |
|---|
| 1125 | 1104 | int i; |
|---|
| 1126 | 1105 | |
|---|
| 1127 | 1106 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
|---|
| 1128 | | - for (i = 0; i < NUM_ATI_PCMDEVS; i++) |
|---|
| 1129 | | - snd_pcm_suspend_all(chip->pcmdevs[i]); |
|---|
| 1130 | 1107 | for (i = 0; i < NUM_ATI_CODECS; i++) |
|---|
| 1131 | 1108 | snd_ac97_suspend(chip->ac97[i]); |
|---|
| 1132 | 1109 | snd_atiixp_aclink_down(chip); |
|---|
| .. | .. |
|---|
| 1172 | 1149 | |
|---|
| 1173 | 1150 | static void snd_atiixp_proc_init(struct atiixp_modem *chip) |
|---|
| 1174 | 1151 | { |
|---|
| 1175 | | - struct snd_info_entry *entry; |
|---|
| 1176 | | - |
|---|
| 1177 | | - if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry)) |
|---|
| 1178 | | - snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read); |
|---|
| 1152 | + snd_card_ro_proc_new(chip->card, "atiixp-modem", chip, |
|---|
| 1153 | + snd_atiixp_proc_read); |
|---|
| 1179 | 1154 | } |
|---|
| 1180 | 1155 | |
|---|
| 1181 | 1156 | |
|---|
| .. | .. |
|---|
| 1212 | 1187 | struct pci_dev *pci, |
|---|
| 1213 | 1188 | struct atiixp_modem **r_chip) |
|---|
| 1214 | 1189 | { |
|---|
| 1215 | | - static struct snd_device_ops ops = { |
|---|
| 1190 | + static const struct snd_device_ops ops = { |
|---|
| 1216 | 1191 | .dev_free = snd_atiixp_dev_free, |
|---|
| 1217 | 1192 | }; |
|---|
| 1218 | 1193 | struct atiixp_modem *chip; |
|---|
| .. | .. |
|---|
| 1252 | 1227 | return -EBUSY; |
|---|
| 1253 | 1228 | } |
|---|
| 1254 | 1229 | chip->irq = pci->irq; |
|---|
| 1230 | + card->sync_irq = chip->irq; |
|---|
| 1255 | 1231 | pci_set_master(pci); |
|---|
| 1256 | | - synchronize_irq(chip->irq); |
|---|
| 1257 | 1232 | |
|---|
| 1258 | 1233 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { |
|---|
| 1259 | 1234 | snd_atiixp_free(chip); |
|---|