.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168). |
---|
2 | 3 | * Copyright (C) 2002, 2005 - 2011 by Andreas Mohr <andi AT lisas.de> |
---|
3 | 4 | * |
---|
.. | .. |
---|
15 | 16 | * just to make sure that the right people hit this and get to know that, |
---|
16 | 17 | * despite the high level of Internet ignorance - as usual :-P - |
---|
17 | 18 | * about very good support for this card - on Linux!) |
---|
18 | | - * |
---|
19 | | - * GPL LICENSE |
---|
20 | | - * This program is free software; you can redistribute it and/or modify |
---|
21 | | - * it under the terms of the GNU General Public License as published by |
---|
22 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
23 | | - * (at your option) any later version. |
---|
24 | | - * |
---|
25 | | - * This program is distributed in the hope that it will be useful, |
---|
26 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
27 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
28 | | - * GNU General Public License for more details. |
---|
29 | | - |
---|
30 | | - * You should have received a copy of the GNU General Public License |
---|
31 | | - * along with this program; if not, write to the Free Software |
---|
32 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
33 | 19 | * |
---|
34 | 20 | * NOTES |
---|
35 | 21 | * Since Aztech does not provide any chipset documentation, |
---|
.. | .. |
---|
771 | 757 | { |
---|
772 | 758 | struct snd_ac97_bus *bus; |
---|
773 | 759 | struct snd_ac97_template ac97; |
---|
774 | | - static struct snd_ac97_bus_ops ops = { |
---|
| 760 | + static const struct snd_ac97_bus_ops ops = { |
---|
775 | 761 | .write = snd_azf3328_mixer_ac97_write, |
---|
776 | 762 | .read = snd_azf3328_mixer_ac97_read, |
---|
777 | 763 | }; |
---|
.. | .. |
---|
1108 | 1094 | return (nreg != oreg); |
---|
1109 | 1095 | } |
---|
1110 | 1096 | |
---|
1111 | | -static struct snd_kcontrol_new snd_azf3328_mixer_controls[] = { |
---|
| 1097 | +static const struct snd_kcontrol_new snd_azf3328_mixer_controls[] = { |
---|
1112 | 1098 | AZF3328_MIXER_SWITCH("Master Playback Switch", IDX_MIXER_PLAY_MASTER, 15, 1), |
---|
1113 | 1099 | AZF3328_MIXER_VOL_STEREO("Master Playback Volume", IDX_MIXER_PLAY_MASTER, 0x1f, 1), |
---|
1114 | 1100 | AZF3328_MIXER_SWITCH("PCM Playback Switch", IDX_MIXER_WAVEOUT, 15, 1), |
---|
.. | .. |
---|
1166 | 1152 | #endif |
---|
1167 | 1153 | }; |
---|
1168 | 1154 | |
---|
1169 | | -static u16 snd_azf3328_init_values[][2] = { |
---|
| 1155 | +static const u16 snd_azf3328_init_values[][2] = { |
---|
1170 | 1156 | { IDX_MIXER_PLAY_MASTER, MIXER_MUTE_MASK|0x1f1f }, |
---|
1171 | 1157 | { IDX_MIXER_MODEMOUT, MIXER_MUTE_MASK|0x1f1f }, |
---|
1172 | 1158 | { IDX_MIXER_BASSTREBLE, 0x0000 }, |
---|
.. | .. |
---|
1219 | 1205 | } |
---|
1220 | 1206 | #endif /* AZF_USE_AC97_LAYER */ |
---|
1221 | 1207 | |
---|
1222 | | -static int |
---|
1223 | | -snd_azf3328_hw_params(struct snd_pcm_substream *substream, |
---|
1224 | | - struct snd_pcm_hw_params *hw_params) |
---|
1225 | | -{ |
---|
1226 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
---|
1227 | | -} |
---|
1228 | | - |
---|
1229 | | -static int |
---|
1230 | | -snd_azf3328_hw_free(struct snd_pcm_substream *substream) |
---|
1231 | | -{ |
---|
1232 | | - snd_pcm_lib_free_pages(substream); |
---|
1233 | | - return 0; |
---|
1234 | | -} |
---|
1235 | | - |
---|
1236 | 1208 | static void |
---|
1237 | 1209 | snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec, |
---|
1238 | 1210 | enum azf_freq_t bitrate, |
---|
.. | .. |
---|
1260 | 1232 | case AZF_FREQ_32000: freq = SOUNDFORMAT_FREQ_32000; break; |
---|
1261 | 1233 | default: |
---|
1262 | 1234 | snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate); |
---|
1263 | | - /* fall-through */ |
---|
| 1235 | + fallthrough; |
---|
1264 | 1236 | case AZF_FREQ_44100: freq = SOUNDFORMAT_FREQ_44100; break; |
---|
1265 | 1237 | case AZF_FREQ_48000: freq = SOUNDFORMAT_FREQ_48000; break; |
---|
1266 | 1238 | case AZF_FREQ_66200: freq = SOUNDFORMAT_FREQ_SUSPECTED_66200; break; |
---|
.. | .. |
---|
2093 | 2065 | static const struct snd_pcm_ops snd_azf3328_playback_ops = { |
---|
2094 | 2066 | .open = snd_azf3328_pcm_playback_open, |
---|
2095 | 2067 | .close = snd_azf3328_pcm_close, |
---|
2096 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
2097 | | - .hw_params = snd_azf3328_hw_params, |
---|
2098 | | - .hw_free = snd_azf3328_hw_free, |
---|
2099 | 2068 | .prepare = snd_azf3328_pcm_prepare, |
---|
2100 | 2069 | .trigger = snd_azf3328_pcm_trigger, |
---|
2101 | 2070 | .pointer = snd_azf3328_pcm_pointer |
---|
.. | .. |
---|
2104 | 2073 | static const struct snd_pcm_ops snd_azf3328_capture_ops = { |
---|
2105 | 2074 | .open = snd_azf3328_pcm_capture_open, |
---|
2106 | 2075 | .close = snd_azf3328_pcm_close, |
---|
2107 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
2108 | | - .hw_params = snd_azf3328_hw_params, |
---|
2109 | | - .hw_free = snd_azf3328_hw_free, |
---|
2110 | 2076 | .prepare = snd_azf3328_pcm_prepare, |
---|
2111 | 2077 | .trigger = snd_azf3328_pcm_trigger, |
---|
2112 | 2078 | .pointer = snd_azf3328_pcm_pointer |
---|
.. | .. |
---|
2115 | 2081 | static const struct snd_pcm_ops snd_azf3328_i2s_out_ops = { |
---|
2116 | 2082 | .open = snd_azf3328_pcm_i2s_out_open, |
---|
2117 | 2083 | .close = snd_azf3328_pcm_close, |
---|
2118 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
2119 | | - .hw_params = snd_azf3328_hw_params, |
---|
2120 | | - .hw_free = snd_azf3328_hw_free, |
---|
2121 | 2084 | .prepare = snd_azf3328_pcm_prepare, |
---|
2122 | 2085 | .trigger = snd_azf3328_pcm_trigger, |
---|
2123 | 2086 | .pointer = snd_azf3328_pcm_pointer |
---|
.. | .. |
---|
2148 | 2111 | chip->pcm[AZF_CODEC_PLAYBACK] = pcm; |
---|
2149 | 2112 | chip->pcm[AZF_CODEC_CAPTURE] = pcm; |
---|
2150 | 2113 | |
---|
2151 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
2152 | | - snd_dma_pci_data(chip->pci), |
---|
2153 | | - 64*1024, 64*1024); |
---|
| 2114 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev, |
---|
| 2115 | + 64*1024, 64*1024); |
---|
2154 | 2116 | |
---|
2155 | 2117 | err = snd_pcm_new(chip->card, "AZF3328 I2S OUT", AZF_PCMDEV_I2S_OUT, |
---|
2156 | 2118 | 1, 0, &pcm); |
---|
.. | .. |
---|
2164 | 2126 | strcpy(pcm->name, chip->card->shortname); |
---|
2165 | 2127 | chip->pcm[AZF_CODEC_I2S_OUT] = pcm; |
---|
2166 | 2128 | |
---|
2167 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
2168 | | - snd_dma_pci_data(chip->pci), |
---|
2169 | | - 64*1024, 64*1024); |
---|
| 2129 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, &chip->pci->dev, |
---|
| 2130 | + 64*1024, 64*1024); |
---|
2170 | 2131 | |
---|
2171 | 2132 | return 0; |
---|
2172 | 2133 | } |
---|
.. | .. |
---|
2394 | 2355 | { |
---|
2395 | 2356 | struct snd_azf3328 *chip; |
---|
2396 | 2357 | int err; |
---|
2397 | | - static struct snd_device_ops ops = { |
---|
| 2358 | + static const struct snd_device_ops ops = { |
---|
2398 | 2359 | .dev_free = snd_azf3328_dev_free, |
---|
2399 | 2360 | }; |
---|
2400 | 2361 | u8 dma_init; |
---|
.. | .. |
---|
2462 | 2423 | goto out_err; |
---|
2463 | 2424 | } |
---|
2464 | 2425 | chip->irq = pci->irq; |
---|
| 2426 | + card->sync_irq = chip->irq; |
---|
2465 | 2427 | pci_set_master(pci); |
---|
2466 | | - synchronize_irq(chip->irq); |
---|
2467 | 2428 | |
---|
2468 | 2429 | snd_azf3328_debug_show_ports(chip); |
---|
2469 | 2430 | |
---|
.. | .. |
---|
2698 | 2659 | u16 *saved_regs_ctrl_u16; |
---|
2699 | 2660 | |
---|
2700 | 2661 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
---|
2701 | | - |
---|
2702 | | - /* same pcm object for playback/capture */ |
---|
2703 | | - snd_pcm_suspend_all(chip->pcm[AZF_CODEC_PLAYBACK]); |
---|
2704 | | - snd_pcm_suspend_all(chip->pcm[AZF_CODEC_I2S_OUT]); |
---|
2705 | 2662 | |
---|
2706 | 2663 | snd_azf3328_suspend_ac97(chip); |
---|
2707 | 2664 | |
---|