hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/sound/sparc/dbri.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Driver for DBRI sound chip found on Sparcs.
34 * Copyright (C) 2004, 2005 Martin Habets (mhabets@users.sourceforge.net)
....@@ -21,7 +22,7 @@
2122 * - Data sheet of the T7903, a newer but very similar ISA bus equivalent
2223 * available from the Lucent (formerly AT&T microelectronics) home
2324 * page.
24
- * - http://www.freesoft.org/Linux/DBRI/
25
+ * - https://www.freesoft.org/Linux/DBRI/
2526 * - MMCODEC: Crystal Semiconductor CS4215 16 bit Multimedia Audio Codec
2627 * Interfaces: CHI, Audio In & Out, 2 bits parallel
2728 * Documentation: from the Crystal Semiconductor home page.
....@@ -103,7 +104,7 @@
103104 MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard.");
104105
105106 #ifdef DBRI_DEBUG
106
-static char *cmds[] = {
107
+static const char * const cmds[] = {
107108 "WAIT", "PAUSE", "JUMP", "IIQ", "REX", "SDP", "CDP", "DTS",
108109 "SSP", "CHI", "NT", "TE", "CDEC", "TEST", "CDM", "RESRV"
109110 };
....@@ -579,12 +580,16 @@
579580 switch (len) {
580581 case 32:
581582 b = ((b & 0xffff0000) >> 16) | ((b & 0x0000ffff) << 16);
583
+ fallthrough;
582584 case 16:
583585 b = ((b & 0xff00ff00) >> 8) | ((b & 0x00ff00ff) << 8);
586
+ fallthrough;
584587 case 8:
585588 b = ((b & 0xf0f0f0f0) >> 4) | ((b & 0x0f0f0f0f) << 4);
589
+ fallthrough;
586590 case 4:
587591 b = ((b & 0xcccccccc) >> 2) | ((b & 0x33333333) << 2);
592
+ fallthrough;
588593 case 2:
589594 b = ((b & 0xaaaaaaaa) >> 1) | ((b & 0x55555555) << 1);
590595 case 1:
....@@ -615,7 +620,7 @@
615620 while another can be executed. The scheme works by adding two WAIT commands
616621 after each sent batch of commands. When the next batch is prepared it is
617622 added after the WAIT commands then the WAITs are replaced with single JUMP
618
-command to the new batch. The the DBRI is forced to reread the last WAIT
623
+command to the new batch. Then the DBRI is forced to reread the last WAIT
619624 command (replaced by the JUMP by then). If the DBRI is still executing
620625 previous commands the request to reread the WAIT command is ignored.
621626
....@@ -2094,12 +2099,6 @@
20942099 if (ret != 0)
20952100 return ret;
20962101
2097
- if ((ret = snd_pcm_lib_malloc_pages(substream,
2098
- params_buffer_bytes(hw_params))) < 0) {
2099
- printk(KERN_ERR "malloc_pages failed with %d\n", ret);
2100
- return ret;
2101
- }
2102
-
21032102 /* hw_params can get called multiple times. Only map the DMA once.
21042103 */
21052104 if (info->dvma_buffer == 0) {
....@@ -2146,7 +2145,7 @@
21462145 info->pipe = -1;
21472146 }
21482147
2149
- return snd_pcm_lib_free_pages(substream);
2148
+ return 0;
21502149 }
21512150
21522151 static int snd_dbri_prepare(struct snd_pcm_substream *substream)
....@@ -2216,7 +2215,6 @@
22162215 static const struct snd_pcm_ops snd_dbri_ops = {
22172216 .open = snd_dbri_open,
22182217 .close = snd_dbri_close,
2219
- .ioctl = snd_pcm_lib_ioctl,
22202218 .hw_params = snd_dbri_hw_params,
22212219 .hw_free = snd_dbri_hw_free,
22222220 .prepare = snd_dbri_prepare,
....@@ -2243,12 +2241,8 @@
22432241 pcm->info_flags = 0;
22442242 strcpy(pcm->name, card->shortname);
22452243
2246
- if ((err = snd_pcm_lib_preallocate_pages_for_all(pcm,
2247
- SNDRV_DMA_TYPE_CONTINUOUS,
2248
- snd_dma_continuous_data(GFP_KERNEL),
2249
- 64 * 1024, 64 * 1024)) < 0)
2250
- return err;
2251
-
2244
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
2245
+ NULL, 64 * 1024, 64 * 1024);
22522246 return 0;
22532247 }
22542248
....@@ -2416,7 +2410,7 @@
24162410 .private_value = (entry) | ((shift) << 8) | ((mask) << 16) | \
24172411 ((invert) << 24) },
24182412
2419
-static struct snd_kcontrol_new dbri_controls[] = {
2413
+static const struct snd_kcontrol_new dbri_controls[] = {
24202414 {
24212415 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
24222416 .name = "Playback Volume",
....@@ -2510,16 +2504,10 @@
25102504 static void snd_dbri_proc(struct snd_card *card)
25112505 {
25122506 struct snd_dbri *dbri = card->private_data;
2513
- struct snd_info_entry *entry;
25142507
2515
- if (!snd_card_proc_new(card, "regs", &entry))
2516
- snd_info_set_text_ops(entry, dbri, dbri_regs_read);
2517
-
2508
+ snd_card_ro_proc_new(card, "regs", dbri, dbri_regs_read);
25182509 #ifdef DBRI_DEBUG
2519
- if (!snd_card_proc_new(card, "debug", &entry)) {
2520
- snd_info_set_text_ops(entry, dbri, dbri_debug_read);
2521
- entry->mode = S_IFREG | 0444; /* Readable only. */
2522
- }
2510
+ snd_card_ro_proc_new(card, "debug", dbri, dbri_debug_read);
25232511 #endif
25242512 }
25252513
....@@ -2541,8 +2529,8 @@
25412529 dbri->op = op;
25422530 dbri->irq = irq;
25432531
2544
- dbri->dma = dma_zalloc_coherent(&op->dev, sizeof(struct dbri_dma),
2545
- &dbri->dma_dvma, GFP_KERNEL);
2532
+ dbri->dma = dma_alloc_coherent(&op->dev, sizeof(struct dbri_dma),
2533
+ &dbri->dma_dvma, GFP_KERNEL);
25462534 if (!dbri->dma)
25472535 return -ENOMEM;
25482536