forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/sound/pci/korg1212/korg1212.c
....@@ -1,22 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for the Korg 1212 IO PCI card
34 *
45 * Copyright (c) 2001 Haroldo Gamal <gamal@alternex.com.br>
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 #include <linux/delay.h>
....@@ -44,7 +30,7 @@
4430 #if K1212_DEBUG_LEVEL > 0
4531 #define K1212_DEBUG_PRINTK(fmt,args...) printk(KERN_DEBUG fmt,##args)
4632 #else
47
-#define K1212_DEBUG_PRINTK(fmt,...)
33
+#define K1212_DEBUG_PRINTK(fmt,...) do { } while (0)
4834 #endif
4935 #if K1212_DEBUG_LEVEL > 1
5036 #define K1212_DEBUG_PRINTK_VERBOSE(fmt,args...) printk(KERN_DEBUG fmt,##args)
....@@ -429,7 +415,7 @@
429415
430416 MODULE_DEVICE_TABLE(pci, snd_korg1212_ids);
431417
432
-static char *stateName[] = {
418
+static const char * const stateName[] = {
433419 "Non-existent",
434420 "Uninitialized",
435421 "DSP download in process",
....@@ -469,7 +455,7 @@
469455 "SPDIF-R",
470456 };
471457
472
-static u16 ClockSourceSelector[] = {
458
+static const u16 ClockSourceSelector[] = {
473459 0x8000, // selects source as ADAT at 44.1 kHz
474460 0x0000, // selects source as ADAT at 48 kHz
475461 0x8001, // selects source as S/PDIF at 44.1 kHz
....@@ -827,12 +813,12 @@
827813
828814 static int snd_korg1212_SetRate(struct snd_korg1212 *korg1212, int rate)
829815 {
830
- static enum ClockSourceIndex s44[] = {
816
+ static const enum ClockSourceIndex s44[] = {
831817 K1212_CLKIDX_AdatAt44_1K,
832818 K1212_CLKIDX_WordAt44_1K,
833819 K1212_CLKIDX_LocalAt44_1K
834820 };
835
- static enum ClockSourceIndex s48[] = {
821
+ static const enum ClockSourceIndex s48[] = {
836822 K1212_CLKIDX_AdatAt48K,
837823 K1212_CLKIDX_WordAt48K,
838824 K1212_CLKIDX_LocalAt48K
....@@ -2033,7 +2019,7 @@
20332019 .private_value = ord, \
20342020 }
20352021
2036
-static struct snd_kcontrol_new snd_korg1212_controls[] = {
2022
+static const struct snd_kcontrol_new snd_korg1212_controls[] = {
20372023 MON_MIXER(8, "Analog"),
20382024 MON_MIXER(10, "SPDIF"),
20392025 MON_MIXER(0, "ADAT-1"), MON_MIXER(1, "ADAT-2"), MON_MIXER(2, "ADAT-3"), MON_MIXER(3, "ADAT-4"),
....@@ -2090,10 +2076,8 @@
20902076
20912077 static void snd_korg1212_proc_init(struct snd_korg1212 *korg1212)
20922078 {
2093
- struct snd_info_entry *entry;
2094
-
2095
- if (! snd_card_proc_new(korg1212->card, "korg1212", &entry))
2096
- snd_info_set_text_ops(entry, korg1212, snd_korg1212_proc_read);
2079
+ snd_card_ro_proc_new(korg1212->card, "korg1212", korg1212,
2080
+ snd_korg1212_proc_read);
20972081 }
20982082
20992083 static int
....@@ -2165,11 +2149,13 @@
21652149 {
21662150 int err, rc;
21672151 unsigned int i;
2168
- unsigned ioport_size, iomem_size, iomem2_size;
2152
+ unsigned iomem_size;
2153
+ __maybe_unused unsigned ioport_size;
2154
+ __maybe_unused unsigned iomem2_size;
21692155 struct snd_korg1212 * korg1212;
21702156 const struct firmware *dsp_code;
21712157
2172
- static struct snd_device_ops ops = {
2158
+ static const struct snd_device_ops ops = {
21732159 .dev_free = snd_korg1212_dev_free,
21742160 };
21752161
....@@ -2253,6 +2239,7 @@
22532239 }
22542240
22552241 korg1212->irq = pci->irq;
2242
+ card->sync_irq = korg1212->irq;
22562243
22572244 pci_set_master(korg1212->pci);
22582245
....@@ -2291,7 +2278,7 @@
22912278 korg1212->idRegPtr,
22922279 stateName[korg1212->cardState]);
22932280
2294
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2281
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
22952282 sizeof(struct KorgSharedBuffer), &korg1212->dma_shared) < 0) {
22962283 snd_printk(KERN_ERR "korg1212: can not allocate shared buffer memory (%zd bytes)\n", sizeof(struct KorgSharedBuffer));
22972284 snd_korg1212_free(korg1212);
....@@ -2306,7 +2293,7 @@
23062293
23072294 korg1212->DataBufsSize = sizeof(struct KorgAudioBuffer) * kNumBuffers;
23082295
2309
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2296
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
23102297 korg1212->DataBufsSize, &korg1212->dma_play) < 0) {
23112298 snd_printk(KERN_ERR "korg1212: can not allocate play data buffer memory (%d bytes)\n", korg1212->DataBufsSize);
23122299 snd_korg1212_free(korg1212);
....@@ -2318,7 +2305,7 @@
23182305 K1212_DEBUG_PRINTK("K1212_DEBUG: Play Data Area = 0x%p (0x%08x), %d bytes\n",
23192306 korg1212->playDataBufsPtr, korg1212->PlayDataPhy, korg1212->DataBufsSize);
23202307
2321
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2308
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
23222309 korg1212->DataBufsSize, &korg1212->dma_rec) < 0) {
23232310 snd_printk(KERN_ERR "korg1212: can not allocate record data buffer memory (%d bytes)\n", korg1212->DataBufsSize);
23242311 snd_korg1212_free(korg1212);
....@@ -2353,7 +2340,7 @@
23532340 return err;
23542341 }
23552342
2356
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
2343
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
23572344 dsp_code->size, &korg1212->dma_dsp) < 0) {
23582345 snd_printk(KERN_ERR "korg1212: cannot allocate dsp code memory (%zd bytes)\n", dsp_code->size);
23592346 snd_korg1212_free(korg1212);