hc
2024-05-16 8d2a02b24d66aa359e83eebc1ed3c0f85367a1cb
kernel/sound/pci/azt3328.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* azt3328.c - driver for Aztech AZF3328 based soundcards (e.g. PCI168).
23 * Copyright (C) 2002, 2005 - 2011 by Andreas Mohr <andi AT lisas.de>
34 *
....@@ -15,21 +16,6 @@
1516 * just to make sure that the right people hit this and get to know that,
1617 * despite the high level of Internet ignorance - as usual :-P -
1718 * 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
3319 *
3420 * NOTES
3521 * Since Aztech does not provide any chipset documentation,
....@@ -771,7 +757,7 @@
771757 {
772758 struct snd_ac97_bus *bus;
773759 struct snd_ac97_template ac97;
774
- static struct snd_ac97_bus_ops ops = {
760
+ static const struct snd_ac97_bus_ops ops = {
775761 .write = snd_azf3328_mixer_ac97_write,
776762 .read = snd_azf3328_mixer_ac97_read,
777763 };
....@@ -1108,7 +1094,7 @@
11081094 return (nreg != oreg);
11091095 }
11101096
1111
-static struct snd_kcontrol_new snd_azf3328_mixer_controls[] = {
1097
+static const struct snd_kcontrol_new snd_azf3328_mixer_controls[] = {
11121098 AZF3328_MIXER_SWITCH("Master Playback Switch", IDX_MIXER_PLAY_MASTER, 15, 1),
11131099 AZF3328_MIXER_VOL_STEREO("Master Playback Volume", IDX_MIXER_PLAY_MASTER, 0x1f, 1),
11141100 AZF3328_MIXER_SWITCH("PCM Playback Switch", IDX_MIXER_WAVEOUT, 15, 1),
....@@ -1166,7 +1152,7 @@
11661152 #endif
11671153 };
11681154
1169
-static u16 snd_azf3328_init_values[][2] = {
1155
+static const u16 snd_azf3328_init_values[][2] = {
11701156 { IDX_MIXER_PLAY_MASTER, MIXER_MUTE_MASK|0x1f1f },
11711157 { IDX_MIXER_MODEMOUT, MIXER_MUTE_MASK|0x1f1f },
11721158 { IDX_MIXER_BASSTREBLE, 0x0000 },
....@@ -1219,20 +1205,6 @@
12191205 }
12201206 #endif /* AZF_USE_AC97_LAYER */
12211207
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
-
12361208 static void
12371209 snd_azf3328_codec_setfmt(struct snd_azf3328_codec_data *codec,
12381210 enum azf_freq_t bitrate,
....@@ -1260,7 +1232,7 @@
12601232 case AZF_FREQ_32000: freq = SOUNDFORMAT_FREQ_32000; break;
12611233 default:
12621234 snd_printk(KERN_WARNING "unknown bitrate %d, assuming 44.1kHz!\n", bitrate);
1263
- /* fall-through */
1235
+ fallthrough;
12641236 case AZF_FREQ_44100: freq = SOUNDFORMAT_FREQ_44100; break;
12651237 case AZF_FREQ_48000: freq = SOUNDFORMAT_FREQ_48000; break;
12661238 case AZF_FREQ_66200: freq = SOUNDFORMAT_FREQ_SUSPECTED_66200; break;
....@@ -2093,9 +2065,6 @@
20932065 static const struct snd_pcm_ops snd_azf3328_playback_ops = {
20942066 .open = snd_azf3328_pcm_playback_open,
20952067 .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,
20992068 .prepare = snd_azf3328_pcm_prepare,
21002069 .trigger = snd_azf3328_pcm_trigger,
21012070 .pointer = snd_azf3328_pcm_pointer
....@@ -2104,9 +2073,6 @@
21042073 static const struct snd_pcm_ops snd_azf3328_capture_ops = {
21052074 .open = snd_azf3328_pcm_capture_open,
21062075 .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,
21102076 .prepare = snd_azf3328_pcm_prepare,
21112077 .trigger = snd_azf3328_pcm_trigger,
21122078 .pointer = snd_azf3328_pcm_pointer
....@@ -2115,9 +2081,6 @@
21152081 static const struct snd_pcm_ops snd_azf3328_i2s_out_ops = {
21162082 .open = snd_azf3328_pcm_i2s_out_open,
21172083 .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,
21212084 .prepare = snd_azf3328_pcm_prepare,
21222085 .trigger = snd_azf3328_pcm_trigger,
21232086 .pointer = snd_azf3328_pcm_pointer
....@@ -2148,9 +2111,8 @@
21482111 chip->pcm[AZF_CODEC_PLAYBACK] = pcm;
21492112 chip->pcm[AZF_CODEC_CAPTURE] = pcm;
21502113
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);
21542116
21552117 err = snd_pcm_new(chip->card, "AZF3328 I2S OUT", AZF_PCMDEV_I2S_OUT,
21562118 1, 0, &pcm);
....@@ -2164,9 +2126,8 @@
21642126 strcpy(pcm->name, chip->card->shortname);
21652127 chip->pcm[AZF_CODEC_I2S_OUT] = pcm;
21662128
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);
21702131
21712132 return 0;
21722133 }
....@@ -2394,7 +2355,7 @@
23942355 {
23952356 struct snd_azf3328 *chip;
23962357 int err;
2397
- static struct snd_device_ops ops = {
2358
+ static const struct snd_device_ops ops = {
23982359 .dev_free = snd_azf3328_dev_free,
23992360 };
24002361 u8 dma_init;
....@@ -2462,8 +2423,8 @@
24622423 goto out_err;
24632424 }
24642425 chip->irq = pci->irq;
2426
+ card->sync_irq = chip->irq;
24652427 pci_set_master(pci);
2466
- synchronize_irq(chip->irq);
24672428
24682429 snd_azf3328_debug_show_ports(chip);
24692430
....@@ -2698,10 +2659,6 @@
26982659 u16 *saved_regs_ctrl_u16;
26992660
27002661 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]);
27052662
27062663 snd_azf3328_suspend_ac97(chip);
27072664