| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for S3 SonicVibes soundcard |
|---|
| 3 | 4 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
|---|
| .. | .. |
|---|
| 5 | 6 | * BUGS: |
|---|
| 6 | 7 | * It looks like 86c617 rev 3 doesn't supports DDMA buffers above 16MB? |
|---|
| 7 | 8 | * 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 | | - * |
|---|
| 23 | 9 | */ |
|---|
| 24 | 10 | |
|---|
| 25 | 11 | #include <linux/delay.h> |
|---|
| .. | .. |
|---|
| 695 | 681 | return snd_sonicvibes_trigger(sonic, 2, cmd); |
|---|
| 696 | 682 | } |
|---|
| 697 | 683 | |
|---|
| 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 | | - |
|---|
| 709 | 684 | static int snd_sonicvibes_playback_prepare(struct snd_pcm_substream *substream) |
|---|
| 710 | 685 | { |
|---|
| 711 | 686 | struct sonicvibes *sonic = snd_pcm_substream_chip(substream); |
|---|
| .. | .. |
|---|
| 860 | 835 | static const struct snd_pcm_ops snd_sonicvibes_playback_ops = { |
|---|
| 861 | 836 | .open = snd_sonicvibes_playback_open, |
|---|
| 862 | 837 | .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, |
|---|
| 866 | 838 | .prepare = snd_sonicvibes_playback_prepare, |
|---|
| 867 | 839 | .trigger = snd_sonicvibes_playback_trigger, |
|---|
| 868 | 840 | .pointer = snd_sonicvibes_playback_pointer, |
|---|
| .. | .. |
|---|
| 871 | 843 | static const struct snd_pcm_ops snd_sonicvibes_capture_ops = { |
|---|
| 872 | 844 | .open = snd_sonicvibes_capture_open, |
|---|
| 873 | 845 | .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, |
|---|
| 877 | 846 | .prepare = snd_sonicvibes_capture_prepare, |
|---|
| 878 | 847 | .trigger = snd_sonicvibes_capture_trigger, |
|---|
| 879 | 848 | .pointer = snd_sonicvibes_capture_pointer, |
|---|
| .. | .. |
|---|
| 897 | 866 | strcpy(pcm->name, "S3 SonicVibes"); |
|---|
| 898 | 867 | sonic->pcm = pcm; |
|---|
| 899 | 868 | |
|---|
| 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); |
|---|
| 902 | 871 | |
|---|
| 903 | 872 | return 0; |
|---|
| 904 | 873 | } |
|---|
| .. | .. |
|---|
| 1081 | 1050 | return change; |
|---|
| 1082 | 1051 | } |
|---|
| 1083 | 1052 | |
|---|
| 1084 | | -static struct snd_kcontrol_new snd_sonicvibes_controls[] = { |
|---|
| 1053 | +static const struct snd_kcontrol_new snd_sonicvibes_controls[] = { |
|---|
| 1085 | 1054 | SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0), |
|---|
| 1086 | 1055 | SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1), |
|---|
| 1087 | 1056 | SONICVIBES_DOUBLE("Aux Playback Volume", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 0, 0, 31, 1), |
|---|
| .. | .. |
|---|
| 1171 | 1140 | |
|---|
| 1172 | 1141 | static void snd_sonicvibes_proc_init(struct sonicvibes *sonic) |
|---|
| 1173 | 1142 | { |
|---|
| 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); |
|---|
| 1178 | 1145 | } |
|---|
| 1179 | 1146 | |
|---|
| 1180 | 1147 | /* |
|---|
| .. | .. |
|---|
| 1182 | 1149 | */ |
|---|
| 1183 | 1150 | |
|---|
| 1184 | 1151 | #ifdef SUPPORT_JOYSTICK |
|---|
| 1185 | | -static struct snd_kcontrol_new snd_sonicvibes_game_control = |
|---|
| 1152 | +static const struct snd_kcontrol_new snd_sonicvibes_game_control = |
|---|
| 1186 | 1153 | SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0); |
|---|
| 1187 | 1154 | |
|---|
| 1188 | 1155 | static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) |
|---|
| .. | .. |
|---|
| 1254 | 1221 | struct sonicvibes *sonic; |
|---|
| 1255 | 1222 | unsigned int dmaa, dmac; |
|---|
| 1256 | 1223 | int err; |
|---|
| 1257 | | - static struct snd_device_ops ops = { |
|---|
| 1224 | + static const struct snd_device_ops ops = { |
|---|
| 1258 | 1225 | .dev_free = snd_sonicvibes_dev_free, |
|---|
| 1259 | 1226 | }; |
|---|
| 1260 | 1227 | |
|---|
| .. | .. |
|---|
| 1300 | 1267 | return -EBUSY; |
|---|
| 1301 | 1268 | } |
|---|
| 1302 | 1269 | sonic->irq = pci->irq; |
|---|
| 1270 | + card->sync_irq = sonic->irq; |
|---|
| 1303 | 1271 | |
|---|
| 1304 | 1272 | pci_read_config_dword(pci, 0x40, &dmaa); |
|---|
| 1305 | 1273 | pci_read_config_dword(pci, 0x48, &dmac); |
|---|
| .. | .. |
|---|
| 1407 | 1375 | * MIDI section |
|---|
| 1408 | 1376 | */ |
|---|
| 1409 | 1377 | |
|---|
| 1410 | | -static struct snd_kcontrol_new snd_sonicvibes_midi_controls[] = { |
|---|
| 1378 | +static const struct snd_kcontrol_new snd_sonicvibes_midi_controls[] = { |
|---|
| 1411 | 1379 | SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0), |
|---|
| 1412 | 1380 | SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0), |
|---|
| 1413 | 1381 | SONICVIBES_SINGLE("SonicVibes Onboard Synth", 0, SV_IREG_MPU401, 0, 1, 0), |
|---|