hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/sound/pci/ens1370.c
....@@ -1,22 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for Ensoniq ES1370/ES1371 AudioPCI soundcard
34 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
45 * Thomas Sailer <sailer@ife.ee.ethz.ch>
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
- *
206 */
217
228 /* Power-Management-Code ( CONFIG_PM )
....@@ -870,17 +856,6 @@
870856 * PCM part
871857 */
872858
873
-static int snd_ensoniq_hw_params(struct snd_pcm_substream *substream,
874
- struct snd_pcm_hw_params *hw_params)
875
-{
876
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
877
-}
878
-
879
-static int snd_ensoniq_hw_free(struct snd_pcm_substream *substream)
880
-{
881
- return snd_pcm_lib_free_pages(substream);
882
-}
883
-
884859 static int snd_ensoniq_playback1_prepare(struct snd_pcm_substream *substream)
885860 {
886861 struct ensoniq *ensoniq = snd_pcm_substream_chip(substream);
....@@ -1229,9 +1204,6 @@
12291204 static const struct snd_pcm_ops snd_ensoniq_playback1_ops = {
12301205 .open = snd_ensoniq_playback1_open,
12311206 .close = snd_ensoniq_playback1_close,
1232
- .ioctl = snd_pcm_lib_ioctl,
1233
- .hw_params = snd_ensoniq_hw_params,
1234
- .hw_free = snd_ensoniq_hw_free,
12351207 .prepare = snd_ensoniq_playback1_prepare,
12361208 .trigger = snd_ensoniq_trigger,
12371209 .pointer = snd_ensoniq_playback1_pointer,
....@@ -1240,9 +1212,6 @@
12401212 static const struct snd_pcm_ops snd_ensoniq_playback2_ops = {
12411213 .open = snd_ensoniq_playback2_open,
12421214 .close = snd_ensoniq_playback2_close,
1243
- .ioctl = snd_pcm_lib_ioctl,
1244
- .hw_params = snd_ensoniq_hw_params,
1245
- .hw_free = snd_ensoniq_hw_free,
12461215 .prepare = snd_ensoniq_playback2_prepare,
12471216 .trigger = snd_ensoniq_trigger,
12481217 .pointer = snd_ensoniq_playback2_pointer,
....@@ -1251,9 +1220,6 @@
12511220 static const struct snd_pcm_ops snd_ensoniq_capture_ops = {
12521221 .open = snd_ensoniq_capture_open,
12531222 .close = snd_ensoniq_capture_close,
1254
- .ioctl = snd_pcm_lib_ioctl,
1255
- .hw_params = snd_ensoniq_hw_params,
1256
- .hw_free = snd_ensoniq_hw_free,
12571223 .prepare = snd_ensoniq_capture_prepare,
12581224 .trigger = snd_ensoniq_trigger,
12591225 .pointer = snd_ensoniq_capture_pointer,
....@@ -1288,8 +1254,8 @@
12881254 strcpy(pcm->name, CHIP_NAME " DAC2/ADC");
12891255 ensoniq->pcm1 = pcm;
12901256
1291
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1292
- snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024);
1257
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
1258
+ &ensoniq->pci->dev, 64*1024, 128*1024);
12931259
12941260 #ifdef CHIP1370
12951261 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
....@@ -1320,8 +1286,8 @@
13201286 strcpy(pcm->name, CHIP_NAME " DAC1");
13211287 ensoniq->pcm2 = pcm;
13221288
1323
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1324
- snd_dma_pci_data(ensoniq->pci), 64*1024, 128*1024);
1289
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
1290
+ &ensoniq->pci->dev, 64*1024, 128*1024);
13251291
13261292 #ifdef CHIP1370
13271293 err = snd_pcm_add_chmap_ctls(pcm, SNDRV_PCM_STREAM_PLAYBACK,
....@@ -1467,7 +1433,7 @@
14671433
14681434
14691435 /* spdif controls */
1470
-static struct snd_kcontrol_new snd_es1371_mixer_spdif[] = {
1436
+static const struct snd_kcontrol_new snd_es1371_mixer_spdif[] = {
14711437 ES1371_SPDIF(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH)),
14721438 {
14731439 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
....@@ -1596,7 +1562,7 @@
15961562 };
15971563
15981564 static int es1371_quirk_lookup(struct ensoniq *ensoniq,
1599
- struct es1371_quirk *list)
1565
+ const struct es1371_quirk *list)
16001566 {
16011567 while (list->vid != (unsigned short)PCI_ANY_ID) {
16021568 if (ensoniq->pci->vendor == list->vid &&
....@@ -1608,7 +1574,7 @@
16081574 return 0;
16091575 }
16101576
1611
-static struct es1371_quirk es1371_spdif_present[] = {
1577
+static const struct es1371_quirk es1371_spdif_present[] = {
16121578 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_C },
16131579 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_D },
16141580 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_E },
....@@ -1617,7 +1583,7 @@
16171583 { .vid = PCI_ANY_ID, .did = PCI_ANY_ID }
16181584 };
16191585
1620
-static struct snd_pci_quirk ens1373_line_quirk[] = {
1586
+static const struct snd_pci_quirk ens1373_line_quirk[] = {
16211587 SND_PCI_QUIRK_ID(0x1274, 0x2000), /* GA-7DXR */
16221588 SND_PCI_QUIRK_ID(0x1458, 0xa000), /* GA-8IEXP */
16231589 { } /* end */
....@@ -1630,7 +1596,7 @@
16301596 struct snd_ac97_bus *pbus;
16311597 struct snd_ac97_template ac97;
16321598 int err;
1633
- static struct snd_ac97_bus_ops ops = {
1599
+ static const struct snd_ac97_bus_ops ops = {
16341600 .write = snd_es1371_codec_write,
16351601 .read = snd_es1371_codec_read,
16361602 .wait = snd_es1371_codec_wait,
....@@ -1732,7 +1698,7 @@
17321698 * ENS1370 mixer
17331699 */
17341700
1735
-static struct snd_kcontrol_new snd_es1370_controls[2] = {
1701
+static const struct snd_kcontrol_new snd_es1370_controls[2] = {
17361702 ENSONIQ_CONTROL("PCM 0 Output also on Line-In Jack", ES_1370_XCTL0),
17371703 ENSONIQ_CONTROL("Mic +5V bias", ES_1370_XCTL1)
17381704 };
....@@ -1902,10 +1868,8 @@
19021868
19031869 static void snd_ensoniq_proc_init(struct ensoniq *ensoniq)
19041870 {
1905
- struct snd_info_entry *entry;
1906
-
1907
- if (! snd_card_proc_new(ensoniq->card, "audiopci", &entry))
1908
- snd_info_set_text_ops(entry, ensoniq, snd_ensoniq_proc_read);
1871
+ snd_card_ro_proc_new(ensoniq->card, "audiopci", ensoniq,
1872
+ snd_ensoniq_proc_read);
19091873 }
19101874
19111875 /*
....@@ -1924,8 +1888,6 @@
19241888 outl(0, ES_REG(ensoniq, CONTROL)); /* switch everything off */
19251889 outl(0, ES_REG(ensoniq, SERIAL)); /* clear serial interface */
19261890 #endif
1927
- if (ensoniq->irq >= 0)
1928
- synchronize_irq(ensoniq->irq);
19291891 pci_set_power_state(ensoniq->pci, PCI_D3hot);
19301892 __hw_end:
19311893 #ifdef CHIP1370
....@@ -1947,7 +1909,7 @@
19471909 }
19481910
19491911 #ifdef CHIP1371
1950
-static struct snd_pci_quirk es1371_amplifier_hack[] = {
1912
+static const struct snd_pci_quirk es1371_amplifier_hack[] = {
19511913 SND_PCI_QUIRK_ID(0x107b, 0x2150), /* Gateway Solo 2150 */
19521914 SND_PCI_QUIRK_ID(0x13bd, 0x100c), /* EV1938 on Mebius PC-MJ100V */
19531915 SND_PCI_QUIRK_ID(0x1102, 0x5938), /* Targa Xtender300 */
....@@ -1955,7 +1917,7 @@
19551917 { } /* end */
19561918 };
19571919
1958
-static struct es1371_quirk es1371_ac97_reset_hack[] = {
1920
+static const struct es1371_quirk es1371_ac97_reset_hack[] = {
19591921 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_C },
19601922 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_D },
19611923 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_E },
....@@ -2026,7 +1988,6 @@
20261988 outb(ensoniq->uartc = 0x00, ES_REG(ensoniq, UART_CONTROL));
20271989 outb(0x00, ES_REG(ensoniq, UART_RES));
20281990 outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));
2029
- synchronize_irq(ensoniq->irq);
20301991 }
20311992
20321993 #ifdef CONFIG_PM_SLEEP
....@@ -2037,9 +1998,6 @@
20371998
20381999 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
20392000
2040
- snd_pcm_suspend_all(ensoniq->pcm1);
2041
- snd_pcm_suspend_all(ensoniq->pcm2);
2042
-
20432001 #ifdef CHIP1371
20442002 snd_ac97_suspend(ensoniq->u.es1371.ac97);
20452003 #else
....@@ -2083,7 +2041,7 @@
20832041 {
20842042 struct ensoniq *ensoniq;
20852043 int err;
2086
- static struct snd_device_ops ops = {
2044
+ static const struct snd_device_ops ops = {
20872045 .dev_free = snd_ensoniq_dev_free,
20882046 };
20892047
....@@ -2113,8 +2071,9 @@
21132071 return -EBUSY;
21142072 }
21152073 ensoniq->irq = pci->irq;
2074
+ card->sync_irq = ensoniq->irq;
21162075 #ifdef CHIP1370
2117
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2076
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
21182077 16, &ensoniq->dma_bug) < 0) {
21192078 dev_err(card->dev, "unable to allocate space for phantom area - dma_bug\n");
21202079 snd_ensoniq_free(ensoniq);