forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/pci/nm256/nm256.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for NeoMagic 256AV and 256ZX chipsets.
34 * Copyright (c) 2000 by Takashi Iwai <tiwai@suse.de>
....@@ -7,21 +8,6 @@
78 * so I just put my acknoledgment to him/her here.
89 * The original author's web page is found at
910 * http://www.uglx.org/sony.html
10
- *
11
- *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License as published by
14
- * the Free Software Foundation; either version 2 of the License, or
15
- * (at your option) any later version.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
21
- *
22
- * You should have received a copy of the GNU General Public License
23
- * along with this program; if not, write to the Free Software
24
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2511 */
2612
2713 #include <linux/io.h>
....@@ -313,7 +299,7 @@
313299 }
314300
315301 static inline void
316
-snd_nm256_write_buffer(struct nm256 *chip, void *src, int offset, int size)
302
+snd_nm256_write_buffer(struct nm256 *chip, const void *src, int offset, int size)
317303 {
318304 offset -= chip->buffer_start;
319305 #ifdef CONFIG_SND_DEBUG
....@@ -474,6 +460,7 @@
474460 return -EBUSY;
475461 }
476462 chip->irq = chip->pci->irq;
463
+ chip->card->sync_irq = chip->irq;
477464 }
478465 chip->irq_acks++;
479466 mutex_unlock(&chip->irq_mutex);
....@@ -489,6 +476,7 @@
489476 if (chip->irq_acks == 0 && chip->irq >= 0) {
490477 free_irq(chip->irq, chip);
491478 chip->irq = -1;
479
+ chip->card->sync_irq = -1;
492480 }
493481 mutex_unlock(&chip->irq_mutex);
494482 }
....@@ -572,7 +560,7 @@
572560 switch (cmd) {
573561 case SNDRV_PCM_TRIGGER_RESUME:
574562 s->suspended = 0;
575
- /* fallthru */
563
+ fallthrough;
576564 case SNDRV_PCM_TRIGGER_START:
577565 if (! s->running) {
578566 snd_nm256_playback_start(chip, s, substream);
....@@ -581,7 +569,7 @@
581569 break;
582570 case SNDRV_PCM_TRIGGER_SUSPEND:
583571 s->suspended = 1;
584
- /* fallthru */
572
+ fallthrough;
585573 case SNDRV_PCM_TRIGGER_STOP:
586574 if (s->running) {
587575 snd_nm256_playback_stop(chip);
....@@ -797,7 +785,7 @@
797785 /*
798786 * hardware info
799787 */
800
-static struct snd_pcm_hardware snd_nm256_playback =
788
+static const struct snd_pcm_hardware snd_nm256_playback =
801789 {
802790 .info = SNDRV_PCM_INFO_MMAP_IOMEM |SNDRV_PCM_INFO_MMAP_VALID |
803791 SNDRV_PCM_INFO_INTERLEAVED |
....@@ -816,7 +804,7 @@
816804 .period_bytes_max = 128 * 1024,
817805 };
818806
819
-static struct snd_pcm_hardware snd_nm256_capture =
807
+static const struct snd_pcm_hardware snd_nm256_capture =
820808 {
821809 .info = SNDRV_PCM_INFO_MMAP_IOMEM | SNDRV_PCM_INFO_MMAP_VALID |
822810 SNDRV_PCM_INFO_INTERLEAVED |
....@@ -850,7 +838,7 @@
850838 */
851839 static void snd_nm256_setup_stream(struct nm256 *chip, struct nm256_stream *s,
852840 struct snd_pcm_substream *substream,
853
- struct snd_pcm_hardware *hw_ptr)
841
+ const struct snd_pcm_hardware *hw_ptr)
854842 {
855843 struct snd_pcm_runtime *runtime = substream->runtime;
856844
....@@ -920,7 +908,6 @@
920908 static const struct snd_pcm_ops snd_nm256_playback_ops = {
921909 .open = snd_nm256_playback_open,
922910 .close = snd_nm256_playback_close,
923
- .ioctl = snd_pcm_lib_ioctl,
924911 .hw_params = snd_nm256_pcm_hw_params,
925912 .prepare = snd_nm256_pcm_prepare,
926913 .trigger = snd_nm256_playback_trigger,
....@@ -936,7 +923,6 @@
936923 static const struct snd_pcm_ops snd_nm256_capture_ops = {
937924 .open = snd_nm256_capture_open,
938925 .close = snd_nm256_capture_close,
939
- .ioctl = snd_pcm_lib_ioctl,
940926 .hw_params = snd_nm256_pcm_hw_params,
941927 .prepare = snd_nm256_pcm_prepare,
942928 .trigger = snd_nm256_capture_trigger,
....@@ -1193,7 +1179,7 @@
11931179 unsigned short value;
11941180 };
11951181
1196
-static struct initialValues nm256_ac97_init_val[] =
1182
+static const struct initialValues nm256_ac97_init_val[] =
11971183 {
11981184 { AC97_MASTER, 0x8000 },
11991185 { AC97_HEADPHONE, 0x8000 },
....@@ -1323,7 +1309,7 @@
13231309 struct snd_ac97_bus *pbus;
13241310 struct snd_ac97_template ac97;
13251311 int err;
1326
- static struct snd_ac97_bus_ops ops = {
1312
+ static const struct snd_ac97_bus_ops ops = {
13271313 .reset = snd_nm256_ac97_reset,
13281314 .write = snd_nm256_ac97_write,
13291315 .read = snd_nm256_ac97_read,
....@@ -1367,7 +1353,7 @@
13671353 unsigned long pointer_found = chip->buffer_end - 0x1400;
13681354 u32 sig;
13691355
1370
- temp = ioremap_nocache(chip->buffer_addr + chip->buffer_end - 0x400, 16);
1356
+ temp = ioremap(chip->buffer_addr + chip->buffer_end - 0x400, 16);
13711357 if (temp == NULL) {
13721358 dev_err(chip->card->dev,
13731359 "Unable to scan for card signature in video RAM\n");
....@@ -1413,7 +1399,6 @@
14131399 struct nm256 *chip = card->private_data;
14141400
14151401 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1416
- snd_pcm_suspend_all(chip->pcm);
14171402 snd_ac97_suspend(chip->ac97);
14181403 chip->coeffs_current = 0;
14191404 return 0;
....@@ -1486,7 +1471,7 @@
14861471 {
14871472 struct nm256 *chip;
14881473 int err, pval;
1489
- static struct snd_device_ops ops = {
1474
+ static const struct snd_device_ops ops = {
14901475 .dev_free = snd_nm256_dev_free,
14911476 };
14921477 u32 addr;
....@@ -1533,7 +1518,7 @@
15331518 err = -EBUSY;
15341519 goto __error;
15351520 }
1536
- chip->cport = ioremap_nocache(chip->cport_addr, NM_PORT2_SIZE);
1521
+ chip->cport = ioremap(chip->cport_addr, NM_PORT2_SIZE);
15371522 if (chip->cport == NULL) {
15381523 dev_err(card->dev, "unable to map control port %lx\n",
15391524 chip->cport_addr);
....@@ -1604,7 +1589,7 @@
16041589 err = -EBUSY;
16051590 goto __error;
16061591 }
1607
- chip->buffer = ioremap_nocache(chip->buffer_addr, chip->buffer_size);
1592
+ chip->buffer = ioremap(chip->buffer_addr, chip->buffer_size);
16081593 if (chip->buffer == NULL) {
16091594 err = -ENOMEM;
16101595 dev_err(card->dev, "unable to map ring buffer at %lx\n",
....@@ -1647,11 +1632,11 @@
16471632 }
16481633
16491634
1650
-enum { NM_BLACKLISTED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 };
1635
+enum { NM_IGNORED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 };
16511636
1652
-static struct snd_pci_quirk nm256_quirks[] = {
1637
+static const struct snd_pci_quirk nm256_quirks[] = {
16531638 /* HP omnibook 4150 has cs4232 codec internally */
1654
- SND_PCI_QUIRK(0x103c, 0x0007, "HP omnibook 4150", NM_BLACKLISTED),
1639
+ SND_PCI_QUIRK(0x103c, 0x0007, "HP omnibook 4150", NM_IGNORED),
16551640 /* Reset workarounds to avoid lock-ups */
16561641 SND_PCI_QUIRK(0x104d, 0x8041, "Sony PCG-F305", NM_RESET_WORKAROUND),
16571642 SND_PCI_QUIRK(0x1028, 0x0080, "Dell Latitude LS", NM_RESET_WORKAROUND),
....@@ -1673,13 +1658,13 @@
16731658 dev_dbg(&pci->dev, "Enabled quirk for %s.\n",
16741659 snd_pci_quirk_name(q));
16751660 switch (q->value) {
1676
- case NM_BLACKLISTED:
1661
+ case NM_IGNORED:
16771662 dev_info(&pci->dev,
1678
- "The device is blacklisted. Loading stopped\n");
1663
+ "The device is on the denylist. Loading stopped\n");
16791664 return -ENODEV;
16801665 case NM_RESET_WORKAROUND_2:
16811666 reset_workaround_2 = 1;
1682
- /* Fall-through */
1667
+ fallthrough;
16831668 case NM_RESET_WORKAROUND:
16841669 reset_workaround = 1;
16851670 break;