| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for SiS7019 Audio Accelerator |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Inspired by the Trident 4D-WaveDX/NX driver. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * All rights reserved. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 12 | | - * the Free Software Foundation, version 2. |
|---|
| 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 | 10 | */ |
|---|
| 23 | 11 | |
|---|
| 24 | 12 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 511 | 499 | return 0; |
|---|
| 512 | 500 | } |
|---|
| 513 | 501 | |
|---|
| 514 | | -static int sis_playback_hw_params(struct snd_pcm_substream *substream, |
|---|
| 515 | | - struct snd_pcm_hw_params *hw_params) |
|---|
| 516 | | -{ |
|---|
| 517 | | - return snd_pcm_lib_malloc_pages(substream, |
|---|
| 518 | | - params_buffer_bytes(hw_params)); |
|---|
| 519 | | -} |
|---|
| 520 | | - |
|---|
| 521 | | -static int sis_hw_free(struct snd_pcm_substream *substream) |
|---|
| 522 | | -{ |
|---|
| 523 | | - return snd_pcm_lib_free_pages(substream); |
|---|
| 524 | | -} |
|---|
| 525 | | - |
|---|
| 526 | 502 | static int sis_pcm_playback_prepare(struct snd_pcm_substream *substream) |
|---|
| 527 | 503 | { |
|---|
| 528 | 504 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| .. | .. |
|---|
| 713 | 689 | if (rc) |
|---|
| 714 | 690 | goto out; |
|---|
| 715 | 691 | |
|---|
| 716 | | - rc = snd_pcm_lib_malloc_pages(substream, |
|---|
| 717 | | - params_buffer_bytes(hw_params)); |
|---|
| 718 | | - if (rc < 0) |
|---|
| 719 | | - goto out; |
|---|
| 720 | | - |
|---|
| 721 | 692 | rc = sis_alloc_timing_voice(substream, hw_params); |
|---|
| 722 | 693 | |
|---|
| 723 | 694 | out: |
|---|
| .. | .. |
|---|
| 875 | 846 | static const struct snd_pcm_ops sis_playback_ops = { |
|---|
| 876 | 847 | .open = sis_playback_open, |
|---|
| 877 | 848 | .close = sis_substream_close, |
|---|
| 878 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 879 | | - .hw_params = sis_playback_hw_params, |
|---|
| 880 | | - .hw_free = sis_hw_free, |
|---|
| 881 | 849 | .prepare = sis_pcm_playback_prepare, |
|---|
| 882 | 850 | .trigger = sis_pcm_trigger, |
|---|
| 883 | 851 | .pointer = sis_pcm_pointer, |
|---|
| .. | .. |
|---|
| 886 | 854 | static const struct snd_pcm_ops sis_capture_ops = { |
|---|
| 887 | 855 | .open = sis_capture_open, |
|---|
| 888 | 856 | .close = sis_substream_close, |
|---|
| 889 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 890 | 857 | .hw_params = sis_capture_hw_params, |
|---|
| 891 | | - .hw_free = sis_hw_free, |
|---|
| 892 | 858 | .prepare = sis_pcm_capture_prepare, |
|---|
| 893 | 859 | .trigger = sis_pcm_trigger, |
|---|
| 894 | 860 | .pointer = sis_pcm_pointer, |
|---|
| .. | .. |
|---|
| 916 | 882 | /* Try to preallocate some memory, but it's not the end of the |
|---|
| 917 | 883 | * world if this fails. |
|---|
| 918 | 884 | */ |
|---|
| 919 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 920 | | - snd_dma_pci_data(sis->pci), 64*1024, 128*1024); |
|---|
| 885 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 886 | + &sis->pci->dev, 64*1024, 128*1024); |
|---|
| 921 | 887 | |
|---|
| 922 | 888 | return 0; |
|---|
| 923 | 889 | } |
|---|
| .. | .. |
|---|
| 1017 | 983 | { |
|---|
| 1018 | 984 | struct snd_ac97_bus *bus; |
|---|
| 1019 | 985 | struct snd_ac97_template ac97; |
|---|
| 1020 | | - static struct snd_ac97_bus_ops ops = { |
|---|
| 986 | + static const struct snd_ac97_bus_ops ops = { |
|---|
| 1021 | 987 | .write = sis_ac97_write, |
|---|
| 1022 | 988 | .read = sis_ac97_read, |
|---|
| 1023 | 989 | }; |
|---|
| .. | .. |
|---|
| 1214 | 1180 | int i; |
|---|
| 1215 | 1181 | |
|---|
| 1216 | 1182 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
|---|
| 1217 | | - snd_pcm_suspend_all(sis->pcm); |
|---|
| 1218 | 1183 | if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) |
|---|
| 1219 | 1184 | snd_ac97_suspend(sis->ac97[0]); |
|---|
| 1220 | 1185 | if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT) |
|---|
| .. | .. |
|---|
| 1315 | 1280 | { |
|---|
| 1316 | 1281 | struct sis7019 *sis = card->private_data; |
|---|
| 1317 | 1282 | struct voice *voice; |
|---|
| 1318 | | - static struct snd_device_ops ops = { |
|---|
| 1283 | + static const struct snd_device_ops ops = { |
|---|
| 1319 | 1284 | .dev_free = sis_dev_free, |
|---|
| 1320 | 1285 | }; |
|---|
| 1321 | 1286 | int rc; |
|---|
| .. | .. |
|---|
| 1346 | 1311 | } |
|---|
| 1347 | 1312 | |
|---|
| 1348 | 1313 | rc = -EIO; |
|---|
| 1349 | | - sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000); |
|---|
| 1314 | + sis->ioaddr = ioremap(pci_resource_start(pci, 1), 0x4000); |
|---|
| 1350 | 1315 | if (!sis->ioaddr) { |
|---|
| 1351 | 1316 | dev_err(&pci->dev, "unable to remap MMIO, aborting\n"); |
|---|
| 1352 | 1317 | goto error_out_cleanup; |
|---|
| .. | .. |
|---|
| 1370 | 1335 | } |
|---|
| 1371 | 1336 | |
|---|
| 1372 | 1337 | sis->irq = pci->irq; |
|---|
| 1338 | + card->sync_irq = sis->irq; |
|---|
| 1373 | 1339 | pci_set_master(pci); |
|---|
| 1374 | 1340 | |
|---|
| 1375 | 1341 | for (i = 0; i < 64; i++) { |
|---|