forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/sound/pci/maestro3.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for ESS Maestro3/Allegro (ES1988) soundcards.
34 * Copyright (c) 2000 by Zach Brown <zab@zabbo.net>
....@@ -6,26 +7,10 @@
67 * Most of the hardware init stuffs are based on maestro3 driver for
78 * OSS/Free by Zach Brown. Many thanks to Zach!
89 *
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
- *
2410 * ChangeLog:
2511 * Aug. 27, 2001
2612 * - Fixed deadlock on capture
2713 * - Added Canyon3D-2 support by Rob Riggs <rob@pangalactic.org>
28
- *
2914 */
3015
3116 #define CARD_NAME "ESS Maestro3/Allegro/Canyon3D-2"
....@@ -822,7 +807,7 @@
822807
823808 MODULE_DEVICE_TABLE(pci, snd_m3_ids);
824809
825
-static struct snd_pci_quirk m3_amp_quirk_list[] = {
810
+static const struct snd_pci_quirk m3_amp_quirk_list[] = {
826811 SND_PCI_QUIRK(0x0E11, 0x0094, "Compaq Evo N600c", 0x0c),
827812 SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d),
828813 SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d),
....@@ -831,7 +816,7 @@
831816 { } /* END */
832817 };
833818
834
-static struct snd_pci_quirk m3_irda_quirk_list[] = {
819
+static const struct snd_pci_quirk m3_irda_quirk_list[] = {
835820 SND_PCI_QUIRK(0x1028, 0x00b0, "Dell Inspiron 4000", 1),
836821 SND_PCI_QUIRK(0x1028, 0x00a4, "Dell Inspiron 8000", 1),
837822 SND_PCI_QUIRK(0x1028, 0x00e6, "Dell Inspiron 8100", 1),
....@@ -839,7 +824,7 @@
839824 };
840825
841826 /* hardware volume quirks */
842
-static struct snd_pci_quirk m3_hv_quirk_list[] = {
827
+static const struct snd_pci_quirk m3_hv_quirk_list[] = {
843828 /* Allegro chips */
844829 SND_PCI_QUIRK(0x0E11, 0x002E, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
845830 SND_PCI_QUIRK(0x0E11, 0x0094, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
....@@ -917,7 +902,7 @@
917902 };
918903
919904 /* HP Omnibook quirks */
920
-static struct snd_pci_quirk m3_omnibook_quirk_list[] = {
905
+static const struct snd_pci_quirk m3_omnibook_quirk_list[] = {
921906 SND_PCI_QUIRK_ID(0x103c, 0x0010), /* HP OmniBook 6000 */
922907 SND_PCI_QUIRK_ID(0x103c, 0x0011), /* HP OmniBook 500 */
923908 { } /* END */
....@@ -1396,10 +1381,7 @@
13961381 struct snd_pcm_hw_params *hw_params)
13971382 {
13981383 struct m3_dma *s = substream->runtime->private_data;
1399
- int err;
14001384
1401
- if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0)
1402
- return err;
14031385 /* set buffer address */
14041386 s->buffer_addr = substream->runtime->dma_addr;
14051387 if (s->buffer_addr & 0x3) {
....@@ -1416,7 +1398,6 @@
14161398 if (substream->runtime->private_data == NULL)
14171399 return 0;
14181400 s = substream->runtime->private_data;
1419
- snd_pcm_lib_free_pages(substream);
14201401 s->buffer_addr = 0;
14211402 return 0;
14221403 }
....@@ -1837,7 +1818,6 @@
18371818 static const struct snd_pcm_ops snd_m3_playback_ops = {
18381819 .open = snd_m3_playback_open,
18391820 .close = snd_m3_playback_close,
1840
- .ioctl = snd_pcm_lib_ioctl,
18411821 .hw_params = snd_m3_pcm_hw_params,
18421822 .hw_free = snd_m3_pcm_hw_free,
18431823 .prepare = snd_m3_pcm_prepare,
....@@ -1848,7 +1828,6 @@
18481828 static const struct snd_pcm_ops snd_m3_capture_ops = {
18491829 .open = snd_m3_capture_open,
18501830 .close = snd_m3_capture_close,
1851
- .ioctl = snd_pcm_lib_ioctl,
18521831 .hw_params = snd_m3_pcm_hw_params,
18531832 .hw_free = snd_m3_pcm_hw_free,
18541833 .prepare = snd_m3_pcm_prepare,
....@@ -1875,8 +1854,8 @@
18751854 strcpy(pcm->name, chip->card->driver);
18761855 chip->pcm = pcm;
18771856
1878
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1879
- snd_dma_pci_data(chip->pci), 64*1024, 64*1024);
1857
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
1858
+ &chip->pci->dev, 64*1024, 64*1024);
18801859
18811860 return 0;
18821861 }
....@@ -2057,7 +2036,7 @@
20572036 struct snd_ctl_elem_id elem_id;
20582037 #endif
20592038 int err;
2060
- static struct snd_ac97_bus_ops ops = {
2039
+ static const struct snd_ac97_bus_ops ops = {
20612040 .write = snd_m3_ac97_write,
20622041 .read = snd_m3_ac97_read,
20632042 };
....@@ -2422,7 +2401,6 @@
24222401 chip->in_suspend = 1;
24232402 cancel_work_sync(&chip->hwvol_work);
24242403 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2425
- snd_pcm_suspend_all(chip->pcm);
24262404 snd_ac97_suspend(chip->ac97);
24272405
24282406 msleep(10); /* give the assp a chance to idle.. */
....@@ -2544,7 +2522,7 @@
25442522 struct snd_m3 *chip;
25452523 int i, err;
25462524 const struct snd_pci_quirk *quirk;
2547
- static struct snd_device_ops ops = {
2525
+ static const struct snd_device_ops ops = {
25482526 .dev_free = snd_m3_dev_free,
25492527 };
25502528
....@@ -2655,6 +2633,7 @@
26552633 goto free_chip;
26562634 }
26572635 chip->irq = pci->irq;
2636
+ card->sync_irq = chip->irq;
26582637
26592638 #ifdef CONFIG_PM_SLEEP
26602639 chip->suspend_mem =