hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/isa/sb/sb_mixer.c
....@@ -1,22 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
34 * Routines for Sound Blaster mixer control
4
- *
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
- *
205 */
216
227 #include <linux/io.h>
....@@ -453,7 +438,7 @@
453438 */
454439 int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value)
455440 {
456
- static struct snd_kcontrol_new newctls[] = {
441
+ static const struct snd_kcontrol_new newctls[] = {
457442 [SB_MIX_SINGLE] = {
458443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
459444 .info = snd_sbmixer_info_single,
....@@ -509,14 +494,14 @@
509494 * SB 2.0 specific mixer elements
510495 */
511496
512
-static struct sbmix_elem snd_sb20_controls[] = {
497
+static const struct sbmix_elem snd_sb20_controls[] = {
513498 SB_SINGLE("Master Playback Volume", SB_DSP20_MASTER_DEV, 1, 7),
514499 SB_SINGLE("PCM Playback Volume", SB_DSP20_PCM_DEV, 1, 3),
515500 SB_SINGLE("Synth Playback Volume", SB_DSP20_FM_DEV, 1, 7),
516501 SB_SINGLE("CD Playback Volume", SB_DSP20_CD_DEV, 1, 7)
517502 };
518503
519
-static unsigned char snd_sb20_init_values[][2] = {
504
+static const unsigned char snd_sb20_init_values[][2] = {
520505 { SB_DSP20_MASTER_DEV, 0 },
521506 { SB_DSP20_FM_DEV, 0 },
522507 };
....@@ -524,7 +509,7 @@
524509 /*
525510 * SB Pro specific mixer elements
526511 */
527
-static struct sbmix_elem snd_sbpro_controls[] = {
512
+static const struct sbmix_elem snd_sbpro_controls[] = {
528513 SB_DOUBLE("Master Playback Volume",
529514 SB_DSP_MASTER_DEV, SB_DSP_MASTER_DEV, 5, 1, 7),
530515 SB_DOUBLE("PCM Playback Volume",
....@@ -544,7 +529,7 @@
544529 SB_SINGLE("Capture Low-Pass Filter", SB_DSP_CAPTURE_FILT, 3, 1)
545530 };
546531
547
-static unsigned char snd_sbpro_init_values[][2] = {
532
+static const unsigned char snd_sbpro_init_values[][2] = {
548533 { SB_DSP_MASTER_DEV, 0 },
549534 { SB_DSP_PCM_DEV, 0 },
550535 { SB_DSP_FM_DEV, 0 },
....@@ -553,7 +538,7 @@
553538 /*
554539 * SB16 specific mixer elements
555540 */
556
-static struct sbmix_elem snd_sb16_controls[] = {
541
+static const struct sbmix_elem snd_sb16_controls[] = {
557542 SB_DOUBLE("Master Playback Volume",
558543 SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31),
559544 SB_DOUBLE("PCM Playback Volume",
....@@ -591,7 +576,7 @@
591576 SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15)
592577 };
593578
594
-static unsigned char snd_sb16_init_values[][2] = {
579
+static const unsigned char snd_sb16_init_values[][2] = {
595580 { SB_DSP4_MASTER_DEV + 0, 0 },
596581 { SB_DSP4_MASTER_DEV + 1, 0 },
597582 { SB_DSP4_PCM_DEV + 0, 0 },
....@@ -607,7 +592,7 @@
607592 /*
608593 * DT019x specific mixer elements
609594 */
610
-static struct sbmix_elem snd_dt019x_controls[] = {
595
+static const struct sbmix_elem snd_dt019x_controls[] = {
611596 /* ALS4000 below has some parts which we might be lacking,
612597 * e.g. snd_als4000_ctl_mono_playback_switch - check it! */
613598 SB_DOUBLE("Master Playback Volume",
....@@ -637,7 +622,7 @@
637622 }
638623 };
639624
640
-static unsigned char snd_dt019x_init_values[][2] = {
625
+static const unsigned char snd_dt019x_init_values[][2] = {
641626 { SB_DT019X_MASTER_DEV, 0 },
642627 { SB_DT019X_PCM_DEV, 0 },
643628 { SB_DT019X_SYNTH_DEV, 0 },
....@@ -652,7 +637,7 @@
652637 /*
653638 * ALS4000 specific mixer elements
654639 */
655
-static struct sbmix_elem snd_als4000_controls[] = {
640
+static const struct sbmix_elem snd_als4000_controls[] = {
656641 SB_DOUBLE("PCM Playback Switch",
657642 SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2, 1, 1),
658643 SB_DOUBLE("Synth Playback Switch",
....@@ -686,7 +671,7 @@
686671 #endif
687672 };
688673
689
-static unsigned char snd_als4000_init_values[][2] = {
674
+static const unsigned char snd_als4000_init_values[][2] = {
690675 { SB_DSP4_MASTER_DEV + 0, 0 },
691676 { SB_DSP4_MASTER_DEV + 1, 0 },
692677 { SB_DSP4_PCM_DEV + 0, 0 },
....@@ -704,9 +689,9 @@
704689 /*
705690 */
706691 static int snd_sbmixer_init(struct snd_sb *chip,
707
- struct sbmix_elem *controls,
692
+ const struct sbmix_elem *controls,
708693 int controls_count,
709
- unsigned char map[][2],
694
+ const unsigned char map[][2],
710695 int map_count,
711696 char *name)
712697 {
....@@ -815,14 +800,14 @@
815800 }
816801
817802 #ifdef CONFIG_PM
818
-static unsigned char sb20_saved_regs[] = {
803
+static const unsigned char sb20_saved_regs[] = {
819804 SB_DSP20_MASTER_DEV,
820805 SB_DSP20_PCM_DEV,
821806 SB_DSP20_FM_DEV,
822807 SB_DSP20_CD_DEV,
823808 };
824809
825
-static unsigned char sbpro_saved_regs[] = {
810
+static const unsigned char sbpro_saved_regs[] = {
826811 SB_DSP_MASTER_DEV,
827812 SB_DSP_PCM_DEV,
828813 SB_DSP_PLAYBACK_FILT,
....@@ -834,7 +819,7 @@
834819 SB_DSP_CAPTURE_FILT,
835820 };
836821
837
-static unsigned char sb16_saved_regs[] = {
822
+static const unsigned char sb16_saved_regs[] = {
838823 SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1,
839824 SB_DSP4_3DSE,
840825 SB_DSP4_BASS_DEV, SB_DSP4_BASS_DEV + 1,
....@@ -852,7 +837,7 @@
852837 SB_DSP4_MIC_AGC
853838 };
854839
855
-static unsigned char dt019x_saved_regs[] = {
840
+static const unsigned char dt019x_saved_regs[] = {
856841 SB_DT019X_MASTER_DEV,
857842 SB_DT019X_PCM_DEV,
858843 SB_DT019X_SYNTH_DEV,
....@@ -865,7 +850,7 @@
865850 SB_DT019X_CAPTURE_SW,
866851 };
867852
868
-static unsigned char als4000_saved_regs[] = {
853
+static const unsigned char als4000_saved_regs[] = {
869854 /* please verify in dsheet whether regs to be added
870855 are actually real H/W or just dummy */
871856 SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1,
....@@ -887,7 +872,7 @@
887872 SB_ALS4000_CR3_CONFIGURATION,
888873 };
889874
890
-static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
875
+static void save_mixer(struct snd_sb *chip, const unsigned char *regs, int num_regs)
891876 {
892877 unsigned char *val = chip->saved_regs;
893878 if (snd_BUG_ON(num_regs > ARRAY_SIZE(chip->saved_regs)))
....@@ -896,7 +881,7 @@
896881 *val++ = snd_sbmixer_read(chip, *regs++);
897882 }
898883
899
-static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)
884
+static void restore_mixer(struct snd_sb *chip, const unsigned char *regs, int num_regs)
900885 {
901886 unsigned char *val = chip->saved_regs;
902887 if (snd_BUG_ON(num_regs > ARRAY_SIZE(chip->saved_regs)))