forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/pci/ca0106/ca0106_mixer.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) 2004 James Courtier-Dutton <James@superbug.demon.co.uk>
34 * Driver CA0106 chips. e.g. Sound Blaster Audigy LS and Live 24bit
....@@ -44,21 +45,6 @@
4445 *
4546 * This code was initially based on code from ALSA's emu10k1x.c which is:
4647 * Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com>
47
- *
48
- * This program is free software; you can redistribute it and/or modify
49
- * it under the terms of the GNU General Public License as published by
50
- * the Free Software Foundation; either version 2 of the License, or
51
- * (at your option) any later version.
52
- *
53
- * This program is distributed in the hope that it will be useful,
54
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
55
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56
- * GNU General Public License for more details.
57
- *
58
- * You should have received a copy of the GNU General Public License
59
- * along with this program; if not, write to the Free Software
60
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
61
- *
6248 */
6349 #include <linux/delay.h>
6450 #include <linux/init.h>
....@@ -564,7 +550,7 @@
564550 .private_value = ((chid) << 8) | (reg) \
565551 }
566552
567
-static struct snd_kcontrol_new snd_ca0106_volume_ctls[] = {
553
+static const struct snd_kcontrol_new snd_ca0106_volume_ctls[] = {
568554 CA_VOLUME("Analog Front Playback Volume",
569555 CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2),
570556 CA_VOLUME("Analog Rear Playback Volume",
....@@ -645,7 +631,7 @@
645631 .private_value = chid \
646632 }
647633
648
-static struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] = {
634
+static const struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] = {
649635 I2C_VOLUME("Phone Capture Volume", 0),
650636 I2C_VOLUME("Mic Capture Volume", 1),
651637 I2C_VOLUME("Line in Capture Volume", 2),
....@@ -668,7 +654,7 @@
668654 };
669655
670656 static struct snd_kcontrol_new
671
-snd_ca0106_volume_spi_dac_ctl(struct snd_ca0106_details *details,
657
+snd_ca0106_volume_spi_dac_ctl(const struct snd_ca0106_details *details,
672658 int channel_id)
673659 {
674660 struct snd_kcontrol_new spi_switch = {0};
....@@ -753,7 +739,7 @@
753739 static
754740 DECLARE_TLV_DB_SCALE(snd_ca0106_master_db_scale, -6375, 25, 1);
755741
756
-static char *slave_vols[] = {
742
+static const char * const follower_vols[] = {
757743 "Analog Front Playback Volume",
758744 "Analog Rear Playback Volume",
759745 "Analog Center/LFE Playback Volume",
....@@ -766,7 +752,7 @@
766752 NULL
767753 };
768754
769
-static char *slave_sws[] = {
755
+static const char * const follower_sws[] = {
770756 "Analog Front Playback Switch",
771757 "Analog Rear Playback Switch",
772758 "Analog Center/LFE Playback Switch",
....@@ -775,13 +761,13 @@
775761 NULL
776762 };
777763
778
-static void add_slaves(struct snd_card *card,
779
- struct snd_kcontrol *master, char **list)
764
+static void add_followers(struct snd_card *card,
765
+ struct snd_kcontrol *master, const char * const *list)
780766 {
781767 for (; *list; list++) {
782
- struct snd_kcontrol *slave = ctl_find(card, *list);
783
- if (slave)
784
- snd_ctl_add_slave(master, slave);
768
+ struct snd_kcontrol *follower = ctl_find(card, *list);
769
+ if (follower)
770
+ snd_ctl_add_follower(master, follower);
785771 }
786772 }
787773
....@@ -789,9 +775,9 @@
789775 {
790776 int err;
791777 struct snd_card *card = emu->card;
792
- char **c;
778
+ const char * const *c;
793779 struct snd_kcontrol *vmaster;
794
- static char *ca0106_remove_ctls[] = {
780
+ static const char * const ca0106_remove_ctls[] = {
795781 "Master Mono Playback Switch",
796782 "Master Mono Playback Volume",
797783 "3D Control - Switch",
....@@ -815,7 +801,7 @@
815801 "Surround Phase Inversion Playback Switch",
816802 NULL
817803 };
818
- static char *ca0106_rename_ctls[] = {
804
+ static const char * const ca0106_rename_ctls[] = {
819805 "Master Playback Switch", "Capture Switch",
820806 "Master Playback Volume", "Capture Volume",
821807 "Line Playback Switch", "AC97 Line Capture Switch",
....@@ -866,7 +852,7 @@
866852 err = snd_ctl_add(card, vmaster);
867853 if (err < 0)
868854 return err;
869
- add_slaves(card, vmaster, slave_vols);
855
+ add_followers(card, vmaster, follower_vols);
870856
871857 if (emu->details->spi_dac) {
872858 vmaster = snd_ctl_make_virtual_master("Master Playback Switch",
....@@ -876,7 +862,7 @@
876862 err = snd_ctl_add(card, vmaster);
877863 if (err < 0)
878864 return err;
879
- add_slaves(card, vmaster, slave_sws);
865
+ add_followers(card, vmaster, follower_sws);
880866 }
881867
882868 strcpy(card->mixername, "CA0106");
....@@ -889,7 +875,7 @@
889875 unsigned int reg;
890876 };
891877
892
-static struct ca0106_vol_tbl saved_volumes[NUM_SAVED_VOLUMES] = {
878
+static const struct ca0106_vol_tbl saved_volumes[NUM_SAVED_VOLUMES] = {
893879 { CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2 },
894880 { CONTROL_REAR_CHANNEL, PLAYBACK_VOLUME2 },
895881 { CONTROL_CENTER_LFE_CHANNEL, PLAYBACK_VOLUME2 },