.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for the Korg 1212 IO PCI card |
---|
3 | 4 | * |
---|
4 | 5 | * 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 | | - * |
---|
20 | 6 | */ |
---|
21 | 7 | |
---|
22 | 8 | #include <linux/delay.h> |
---|
.. | .. |
---|
44 | 30 | #if K1212_DEBUG_LEVEL > 0 |
---|
45 | 31 | #define K1212_DEBUG_PRINTK(fmt,args...) printk(KERN_DEBUG fmt,##args) |
---|
46 | 32 | #else |
---|
47 | | -#define K1212_DEBUG_PRINTK(fmt,...) |
---|
| 33 | +#define K1212_DEBUG_PRINTK(fmt,...) do { } while (0) |
---|
48 | 34 | #endif |
---|
49 | 35 | #if K1212_DEBUG_LEVEL > 1 |
---|
50 | 36 | #define K1212_DEBUG_PRINTK_VERBOSE(fmt,args...) printk(KERN_DEBUG fmt,##args) |
---|
.. | .. |
---|
429 | 415 | |
---|
430 | 416 | MODULE_DEVICE_TABLE(pci, snd_korg1212_ids); |
---|
431 | 417 | |
---|
432 | | -static char *stateName[] = { |
---|
| 418 | +static const char * const stateName[] = { |
---|
433 | 419 | "Non-existent", |
---|
434 | 420 | "Uninitialized", |
---|
435 | 421 | "DSP download in process", |
---|
.. | .. |
---|
469 | 455 | "SPDIF-R", |
---|
470 | 456 | }; |
---|
471 | 457 | |
---|
472 | | -static u16 ClockSourceSelector[] = { |
---|
| 458 | +static const u16 ClockSourceSelector[] = { |
---|
473 | 459 | 0x8000, // selects source as ADAT at 44.1 kHz |
---|
474 | 460 | 0x0000, // selects source as ADAT at 48 kHz |
---|
475 | 461 | 0x8001, // selects source as S/PDIF at 44.1 kHz |
---|
.. | .. |
---|
827 | 813 | |
---|
828 | 814 | static int snd_korg1212_SetRate(struct snd_korg1212 *korg1212, int rate) |
---|
829 | 815 | { |
---|
830 | | - static enum ClockSourceIndex s44[] = { |
---|
| 816 | + static const enum ClockSourceIndex s44[] = { |
---|
831 | 817 | K1212_CLKIDX_AdatAt44_1K, |
---|
832 | 818 | K1212_CLKIDX_WordAt44_1K, |
---|
833 | 819 | K1212_CLKIDX_LocalAt44_1K |
---|
834 | 820 | }; |
---|
835 | | - static enum ClockSourceIndex s48[] = { |
---|
| 821 | + static const enum ClockSourceIndex s48[] = { |
---|
836 | 822 | K1212_CLKIDX_AdatAt48K, |
---|
837 | 823 | K1212_CLKIDX_WordAt48K, |
---|
838 | 824 | K1212_CLKIDX_LocalAt48K |
---|
.. | .. |
---|
2033 | 2019 | .private_value = ord, \ |
---|
2034 | 2020 | } |
---|
2035 | 2021 | |
---|
2036 | | -static struct snd_kcontrol_new snd_korg1212_controls[] = { |
---|
| 2022 | +static const struct snd_kcontrol_new snd_korg1212_controls[] = { |
---|
2037 | 2023 | MON_MIXER(8, "Analog"), |
---|
2038 | 2024 | MON_MIXER(10, "SPDIF"), |
---|
2039 | 2025 | MON_MIXER(0, "ADAT-1"), MON_MIXER(1, "ADAT-2"), MON_MIXER(2, "ADAT-3"), MON_MIXER(3, "ADAT-4"), |
---|
.. | .. |
---|
2090 | 2076 | |
---|
2091 | 2077 | static void snd_korg1212_proc_init(struct snd_korg1212 *korg1212) |
---|
2092 | 2078 | { |
---|
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); |
---|
2097 | 2081 | } |
---|
2098 | 2082 | |
---|
2099 | 2083 | static int |
---|
.. | .. |
---|
2165 | 2149 | { |
---|
2166 | 2150 | int err, rc; |
---|
2167 | 2151 | 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; |
---|
2169 | 2155 | struct snd_korg1212 * korg1212; |
---|
2170 | 2156 | const struct firmware *dsp_code; |
---|
2171 | 2157 | |
---|
2172 | | - static struct snd_device_ops ops = { |
---|
| 2158 | + static const struct snd_device_ops ops = { |
---|
2173 | 2159 | .dev_free = snd_korg1212_dev_free, |
---|
2174 | 2160 | }; |
---|
2175 | 2161 | |
---|
.. | .. |
---|
2253 | 2239 | } |
---|
2254 | 2240 | |
---|
2255 | 2241 | korg1212->irq = pci->irq; |
---|
| 2242 | + card->sync_irq = korg1212->irq; |
---|
2256 | 2243 | |
---|
2257 | 2244 | pci_set_master(korg1212->pci); |
---|
2258 | 2245 | |
---|
.. | .. |
---|
2291 | 2278 | korg1212->idRegPtr, |
---|
2292 | 2279 | stateName[korg1212->cardState]); |
---|
2293 | 2280 | |
---|
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, |
---|
2295 | 2282 | sizeof(struct KorgSharedBuffer), &korg1212->dma_shared) < 0) { |
---|
2296 | 2283 | snd_printk(KERN_ERR "korg1212: can not allocate shared buffer memory (%zd bytes)\n", sizeof(struct KorgSharedBuffer)); |
---|
2297 | 2284 | snd_korg1212_free(korg1212); |
---|
.. | .. |
---|
2306 | 2293 | |
---|
2307 | 2294 | korg1212->DataBufsSize = sizeof(struct KorgAudioBuffer) * kNumBuffers; |
---|
2308 | 2295 | |
---|
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, |
---|
2310 | 2297 | korg1212->DataBufsSize, &korg1212->dma_play) < 0) { |
---|
2311 | 2298 | snd_printk(KERN_ERR "korg1212: can not allocate play data buffer memory (%d bytes)\n", korg1212->DataBufsSize); |
---|
2312 | 2299 | snd_korg1212_free(korg1212); |
---|
.. | .. |
---|
2318 | 2305 | K1212_DEBUG_PRINTK("K1212_DEBUG: Play Data Area = 0x%p (0x%08x), %d bytes\n", |
---|
2319 | 2306 | korg1212->playDataBufsPtr, korg1212->PlayDataPhy, korg1212->DataBufsSize); |
---|
2320 | 2307 | |
---|
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, |
---|
2322 | 2309 | korg1212->DataBufsSize, &korg1212->dma_rec) < 0) { |
---|
2323 | 2310 | snd_printk(KERN_ERR "korg1212: can not allocate record data buffer memory (%d bytes)\n", korg1212->DataBufsSize); |
---|
2324 | 2311 | snd_korg1212_free(korg1212); |
---|
.. | .. |
---|
2353 | 2340 | return err; |
---|
2354 | 2341 | } |
---|
2355 | 2342 | |
---|
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, |
---|
2357 | 2344 | dsp_code->size, &korg1212->dma_dsp) < 0) { |
---|
2358 | 2345 | snd_printk(KERN_ERR "korg1212: cannot allocate dsp code memory (%zd bytes)\n", dsp_code->size); |
---|
2359 | 2346 | snd_korg1212_free(korg1212); |
---|