forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/sound/pci/emu10k1/emuproc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
34 * Creative Labs, Inc.
....@@ -11,21 +12,6 @@
1112 *
1213 * TODO:
1314 * --
14
- *
15
- * This program is free software; you can redistribute it and/or modify
16
- * it under the terms of the GNU General Public License as published by
17
- * the Free Software Foundation; either version 2 of the License, or
18
- * (at your option) any later version.
19
- *
20
- * This program is distributed in the hope that it will be useful,
21
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- * GNU General Public License for more details.
24
- *
25
- * You should have received a copy of the GNU General Public License
26
- * along with this program; if not, write to the Free Software
27
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
- *
2915 */
3016
3117 #include <linux/slab.h>
....@@ -40,10 +26,10 @@
4026 int status_reg,
4127 int rate_reg)
4228 {
43
- static char *clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" };
44
- static int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
45
- static char *channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
46
- static char *emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" };
29
+ static const char * const clkaccy[4] = { "1000ppm", "50ppm", "variable", "unknown" };
30
+ static const int samplerate[16] = { 44100, 1, 48000, 32000, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
31
+ static const char * const channel[16] = { "unspec", "left", "right", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" };
32
+ static const char * const emphasis[8] = { "none", "50/15 usec 2 channel", "2", "3", "4", "5", "6", "7" };
4733 unsigned int status, rate = 0;
4834
4935 status = snd_emu10k1_ptr_read(emu, status_reg, 0);
....@@ -81,7 +67,7 @@
8167 struct snd_info_buffer *buffer)
8268 {
8369 /* FIXME - output names are in emufx.c too */
84
- static char *creative_outs[32] = {
70
+ static const char * const creative_outs[32] = {
8571 /* 00 */ "AC97 Left",
8672 /* 01 */ "AC97 Right",
8773 /* 02 */ "Optical IEC958 Left",
....@@ -116,7 +102,7 @@
116102 /* 31 */ "???"
117103 };
118104
119
- static char *audigy_outs[64] = {
105
+ static const char * const audigy_outs[64] = {
120106 /* 00 */ "Digital Front Left",
121107 /* 01 */ "Digital Front Right",
122108 /* 02 */ "Digital Center",
....@@ -186,7 +172,7 @@
186172 struct snd_emu10k1 *emu = entry->private_data;
187173 unsigned int val, val1;
188174 int nefx = emu->audigy ? 64 : 32;
189
- char **outputs = emu->audigy ? audigy_outs : creative_outs;
175
+ const char * const *outputs = emu->audigy ? audigy_outs : creative_outs;
190176 int idx;
191177
192178 snd_iprintf(buffer, "EMU10K1\n\n");
....@@ -276,7 +262,7 @@
276262 static void snd_emu10k1_proc_rates_read(struct snd_info_entry *entry,
277263 struct snd_info_buffer *buffer)
278264 {
279
- static int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 };
265
+ static const int samplerate[8] = { 44100, 48000, 96000, 192000, 4, 5, 6, 7 };
280266 struct snd_emu10k1 *emu = entry->private_data;
281267 unsigned int val, tmp, n;
282268 val = snd_emu10k1_ptr20_read(emu, CAPTURE_RATE_STATUS, 0);
....@@ -559,7 +545,7 @@
559545 }
560546 #endif
561547
562
-static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
548
+static const struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
563549 .read = snd_emu10k1_fx8010_read,
564550 };
565551
....@@ -568,55 +554,40 @@
568554 struct snd_info_entry *entry;
569555 #ifdef CONFIG_SND_DEBUG
570556 if (emu->card_capabilities->emu_model) {
571
- if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry))
572
- snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read);
557
+ snd_card_ro_proc_new(emu->card, "emu1010_regs",
558
+ emu, snd_emu_proc_emu1010_reg_read);
573559 }
574
- if (! snd_card_proc_new(emu->card, "io_regs", &entry)) {
575
- snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read);
576
- entry->c.text.write = snd_emu_proc_io_reg_write;
577
- entry->mode |= 0200;
578
- }
579
- if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) {
580
- snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00a);
581
- entry->c.text.write = snd_emu_proc_ptr_reg_write00;
582
- entry->mode |= 0200;
583
- }
584
- if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) {
585
- snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00b);
586
- entry->c.text.write = snd_emu_proc_ptr_reg_write00;
587
- entry->mode |= 0200;
588
- }
589
- if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) {
590
- snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20a);
591
- entry->c.text.write = snd_emu_proc_ptr_reg_write20;
592
- entry->mode |= 0200;
593
- }
594
- if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) {
595
- snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20b);
596
- entry->c.text.write = snd_emu_proc_ptr_reg_write20;
597
- entry->mode |= 0200;
598
- }
599
- if (! snd_card_proc_new(emu->card, "ptr_regs20c", &entry)) {
600
- snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20c);
601
- entry->c.text.write = snd_emu_proc_ptr_reg_write20;
602
- entry->mode |= 0200;
603
- }
560
+ snd_card_rw_proc_new(emu->card, "io_regs", emu,
561
+ snd_emu_proc_io_reg_read,
562
+ snd_emu_proc_io_reg_write);
563
+ snd_card_rw_proc_new(emu->card, "ptr_regs00a", emu,
564
+ snd_emu_proc_ptr_reg_read00a,
565
+ snd_emu_proc_ptr_reg_write00);
566
+ snd_card_rw_proc_new(emu->card, "ptr_regs00b", emu,
567
+ snd_emu_proc_ptr_reg_read00b,
568
+ snd_emu_proc_ptr_reg_write00);
569
+ snd_card_rw_proc_new(emu->card, "ptr_regs20a", emu,
570
+ snd_emu_proc_ptr_reg_read20a,
571
+ snd_emu_proc_ptr_reg_write20);
572
+ snd_card_rw_proc_new(emu->card, "ptr_regs20b", emu,
573
+ snd_emu_proc_ptr_reg_read20b,
574
+ snd_emu_proc_ptr_reg_write20);
575
+ snd_card_rw_proc_new(emu->card, "ptr_regs20c", emu,
576
+ snd_emu_proc_ptr_reg_read20c,
577
+ snd_emu_proc_ptr_reg_write20);
604578 #endif
605579
606
- if (! snd_card_proc_new(emu->card, "emu10k1", &entry))
607
- snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_read);
580
+ snd_card_ro_proc_new(emu->card, "emu10k1", emu, snd_emu10k1_proc_read);
608581
609
- if (emu->card_capabilities->emu10k2_chip) {
610
- if (! snd_card_proc_new(emu->card, "spdif-in", &entry))
611
- snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_spdif_read);
612
- }
613
- if (emu->card_capabilities->ca0151_chip) {
614
- if (! snd_card_proc_new(emu->card, "capture-rates", &entry))
615
- snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_rates_read);
616
- }
582
+ if (emu->card_capabilities->emu10k2_chip)
583
+ snd_card_ro_proc_new(emu->card, "spdif-in", emu,
584
+ snd_emu10k1_proc_spdif_read);
585
+ if (emu->card_capabilities->ca0151_chip)
586
+ snd_card_ro_proc_new(emu->card, "capture-rates", emu,
587
+ snd_emu10k1_proc_rates_read);
617588
618
- if (! snd_card_proc_new(emu->card, "voices", &entry))
619
- snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_voices_read);
589
+ snd_card_ro_proc_new(emu->card, "voices", emu,
590
+ snd_emu10k1_proc_voices_read);
620591
621592 if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) {
622593 entry->content = SNDRV_INFO_CONTENT_DATA;
....@@ -646,11 +617,7 @@
646617 entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE;
647618 entry->c.ops = &snd_emu10k1_proc_ops_fx8010;
648619 }
649
- if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) {
650
- entry->content = SNDRV_INFO_CONTENT_TEXT;
651
- entry->private_data = emu;
652
- entry->mode = S_IFREG | 0444 /*| S_IWUSR*/;
653
- entry->c.text.read = snd_emu10k1_proc_acode_read;
654
- }
620
+ snd_card_ro_proc_new(emu->card, "fx8010_acode", emu,
621
+ snd_emu10k1_proc_acode_read);
655622 return 0;
656623 }