forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/sound/pci/es1968.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for ESS Maestro 1/2/2E Sound Card (started 21.8.99)
34 * Copyright (c) by Matze Braun <MatzeBraun@gmx.de>.
....@@ -9,21 +10,6 @@
910 *
1011 * TODO:
1112 * Perhaps Synth
12
- *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License as published by
15
- * the Free Software Foundation; either version 2 of the License, or
16
- * (at your option) any later version.
17
- *
18
- * This program is distributed in the hope that it will be useful,
19
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- * GNU General Public License for more details.
22
- *
23
- * You should have received a copy of the GNU General Public License
24
- * along with this program; if not, write to the Free Software
25
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
- *
2713 *
2814 * Notes from Zach Brown about the driver code
2915 *
....@@ -1436,10 +1422,8 @@
14361422 int err;
14371423 struct esm_memory *chunk;
14381424
1439
- chip->dma.dev.type = SNDRV_DMA_TYPE_DEV;
1440
- chip->dma.dev.dev = snd_dma_pci_data(chip->pci);
14411425 err = snd_dma_alloc_pages_fallback(SNDRV_DMA_TYPE_DEV,
1442
- snd_dma_pci_data(chip->pci),
1426
+ &chip->pci->dev,
14431427 chip->total_bufsize, &chip->dma);
14441428 if (err < 0 || ! chip->dma.area) {
14451429 dev_err(chip->card->dev,
....@@ -1680,7 +1664,6 @@
16801664 static const struct snd_pcm_ops snd_es1968_playback_ops = {
16811665 .open = snd_es1968_playback_open,
16821666 .close = snd_es1968_playback_close,
1683
- .ioctl = snd_pcm_lib_ioctl,
16841667 .hw_params = snd_es1968_hw_params,
16851668 .hw_free = snd_es1968_hw_free,
16861669 .prepare = snd_es1968_pcm_prepare,
....@@ -1691,7 +1674,6 @@
16911674 static const struct snd_pcm_ops snd_es1968_capture_ops = {
16921675 .open = snd_es1968_capture_open,
16931676 .close = snd_es1968_capture_close,
1694
- .ioctl = snd_pcm_lib_ioctl,
16951677 .hw_params = snd_es1968_hw_params,
16961678 .hw_free = snd_es1968_hw_free,
16971679 .prepare = snd_es1968_pcm_prepare,
....@@ -2025,7 +2007,7 @@
20252007 struct snd_ctl_elem_id elem_id;
20262008 #endif
20272009 int err;
2028
- static struct snd_ac97_bus_ops ops = {
2010
+ static const struct snd_ac97_bus_ops ops = {
20292011 .write = snd_es1968_ac97_write,
20302012 .read = snd_es1968_ac97_read,
20312013 };
....@@ -2392,7 +2374,6 @@
23922374 chip->in_suspend = 1;
23932375 cancel_work_sync(&chip->hwvol_work);
23942376 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2395
- snd_pcm_suspend_all(chip->pcm);
23962377 snd_ac97_suspend(chip->ac97);
23972378 snd_es1968_bob_stop(chip);
23982379 return 0;
....@@ -2548,7 +2529,7 @@
25482529 char *name;
25492530 };
25502531
2551
-static struct snd_es1968_tea575x_gpio snd_es1968_tea575x_gpios[] = {
2532
+static const struct snd_es1968_tea575x_gpio snd_es1968_tea575x_gpios[] = {
25522533 { .data = 6, .clk = 7, .wren = 8, .most = 9, .name = "SF64-PCE2" },
25532534 { .data = 7, .clk = 8, .wren = 6, .most = 10, .name = "M56VAP" },
25542535 };
....@@ -2621,8 +2602,6 @@
26212602 #endif
26222603
26232604 if (chip->io_port) {
2624
- if (chip->irq >= 0)
2625
- synchronize_irq(chip->irq);
26262605 outw(1, chip->io_port + 0x04); /* clear WP interrupts */
26272606 outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */
26282607 }
....@@ -2652,7 +2631,7 @@
26522631 unsigned short vendor; /* subsystem vendor id */
26532632 };
26542633
2655
-static struct ess_device_list pm_whitelist[] = {
2634
+static const struct ess_device_list pm_allowlist[] = {
26562635 { TYPE_MAESTRO2E, 0x0e11 }, /* Compaq Armada */
26572636 { TYPE_MAESTRO2E, 0x1028 },
26582637 { TYPE_MAESTRO2E, 0x103c },
....@@ -2663,7 +2642,7 @@
26632642 { TYPE_MAESTRO2, 0x125d }, /* a PCI card, e.g. SF64-PCE2 */
26642643 };
26652644
2666
-static struct ess_device_list mpu_blacklist[] = {
2645
+static const struct ess_device_list mpu_denylist[] = {
26672646 { TYPE_MAESTRO2, 0x125d },
26682647 };
26692648
....@@ -2677,7 +2656,7 @@
26772656 int radio_nr,
26782657 struct es1968 **chip_ret)
26792658 {
2680
- static struct snd_device_ops ops = {
2659
+ static const struct snd_device_ops ops = {
26812660 .dev_free = snd_es1968_dev_free,
26822661 };
26832662 struct es1968 *chip;
....@@ -2731,6 +2710,7 @@
27312710 return -EBUSY;
27322711 }
27332712 chip->irq = pci->irq;
2713
+ card->sync_irq = chip->irq;
27342714
27352715 /* Clear Maestro_map */
27362716 for (i = 0; i < 32; i++)
....@@ -2744,12 +2724,12 @@
27442724 pci_set_master(pci);
27452725
27462726 if (do_pm > 1) {
2747
- /* disable power-management if not on the whitelist */
2727
+ /* disable power-management if not on the allowlist */
27482728 unsigned short vend;
27492729 pci_read_config_word(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, &vend);
2750
- for (i = 0; i < (int)ARRAY_SIZE(pm_whitelist); i++) {
2751
- if (chip->type == pm_whitelist[i].type &&
2752
- vend == pm_whitelist[i].vendor) {
2730
+ for (i = 0; i < (int)ARRAY_SIZE(pm_allowlist); i++) {
2731
+ if (chip->type == pm_allowlist[i].type &&
2732
+ vend == pm_allowlist[i].vendor) {
27532733 do_pm = 1;
27542734 break;
27552735 }
....@@ -2868,12 +2848,12 @@
28682848 }
28692849
28702850 if (enable_mpu[dev] == 2) {
2871
- /* check the black list */
2851
+ /* check the deny list */
28722852 unsigned short vend;
28732853 pci_read_config_word(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, &vend);
2874
- for (i = 0; i < ARRAY_SIZE(mpu_blacklist); i++) {
2875
- if (chip->type == mpu_blacklist[i].type &&
2876
- vend == mpu_blacklist[i].vendor) {
2854
+ for (i = 0; i < ARRAY_SIZE(mpu_denylist); i++) {
2855
+ if (chip->type == mpu_denylist[i].type &&
2856
+ vend == mpu_denylist[i].vendor) {
28772857 enable_mpu[dev] = 0;
28782858 break;
28792859 }