forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/ppc/awacs.c
....@@ -1,22 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * PMac AWACS lowlevel functions
34 *
45 * Copyright (c) by Takashi Iwai <tiwai@suse.de>
56 * code based on dmasound.c.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207 */
218
229
....@@ -477,7 +464,7 @@
477464 #define AMP_CH_SPK 0
478465 #define AMP_CH_HD 1
479466
480
-static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = {
467
+static const struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = {
481468 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
482469 .name = "Speaker Playback Volume",
483470 .info = snd_pmac_awacs_info_volume_amp,
....@@ -595,46 +582,46 @@
595582 /*
596583 * lists of mixer elements
597584 */
598
-static struct snd_kcontrol_new snd_pmac_awacs_mixers[] = {
585
+static const struct snd_kcontrol_new snd_pmac_awacs_mixers[] = {
599586 AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0),
600587 AWACS_VOLUME("Master Capture Volume", 0, 4, 0),
601588 /* AWACS_SWITCH("Unknown Playback Switch", 6, SHIFT_PAROUT0, 0), */
602589 };
603590
604
-static struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = {
591
+static const struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = {
605592 AWACS_VOLUME("Master Playback Volume", 2, 6, 1),
606593 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1),
607594 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
608595 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0),
609596 };
610597
611
-static struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = {
598
+static const struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = {
612599 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
613600 };
614601
615
-static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = {
602
+static const struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = {
616603 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1),
617604 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
618605 };
619606
620
-static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = {
607
+static const struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = {
621608 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
622609 AWACS_VOLUME("Master Playback Volume", 5, 6, 1),
623610 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
624611 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
625612 };
626613
627
-static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = {
614
+static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = {
628615 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
629616 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
630617 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
631618 };
632619
633
-static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = {
620
+static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = {
634621 AWACS_VOLUME("Headphone Playback Volume", 2, 6, 1),
635622 };
636623
637
-static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = {
624
+static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = {
638625 AWACS_VOLUME("Master Playback Volume", 2, 6, 1),
639626 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
640627 };
....@@ -642,34 +629,34 @@
642629 /* FIXME: is this correct order?
643630 * screamer (powerbook G3 pismo) seems to have different bits...
644631 */
645
-static struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = {
632
+static const struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = {
646633 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0),
647634 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0),
648635 };
649636
650
-static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = {
637
+static const struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = {
651638 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
652639 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0),
653640 };
654641
655
-static struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = {
642
+static const struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = {
656643 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
657644 };
658645
659
-static struct snd_kcontrol_new snd_pmac_awacs_master_sw =
646
+static const struct snd_kcontrol_new snd_pmac_awacs_master_sw =
660647 AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1);
661648
662
-static struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac =
649
+static const struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac =
663650 AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1);
664651
665
-static struct snd_kcontrol_new snd_pmac_awacs_master_sw_pmac5500 =
652
+static const struct snd_kcontrol_new snd_pmac_awacs_master_sw_pmac5500 =
666653 AWACS_SWITCH("Headphone Playback Switch", 1, SHIFT_HDMUTE, 1);
667654
668
-static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = {
655
+static const struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = {
669656 AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
670657 };
671658
672
-static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = {
659
+static const struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = {
673660 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
674661 .name = "Mic Boost Capture Volume",
675662 .info = snd_pmac_screamer_mic_boost_info,
....@@ -678,34 +665,34 @@
678665 },
679666 };
680667
681
-static struct snd_kcontrol_new snd_pmac_awacs_mic_boost_pmac7500[] =
668
+static const struct snd_kcontrol_new snd_pmac_awacs_mic_boost_pmac7500[] =
682669 {
683670 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
684671 };
685672
686
-static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_beige[] =
673
+static const struct snd_kcontrol_new snd_pmac_screamer_mic_boost_beige[] =
687674 {
688675 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
689676 AWACS_SWITCH("CD Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0),
690677 };
691678
692
-static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_imac[] =
679
+static const struct snd_kcontrol_new snd_pmac_screamer_mic_boost_imac[] =
693680 {
694681 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
695682 AWACS_SWITCH("Mic Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0),
696683 };
697684
698
-static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = {
685
+static const struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = {
699686 AWACS_VOLUME("Speaker Playback Volume", 4, 6, 1),
700687 };
701688
702
-static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw =
689
+static const struct snd_kcontrol_new snd_pmac_awacs_speaker_sw =
703690 AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1);
704691
705
-static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 =
692
+static const struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 =
706693 AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 1);
707694
708
-static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 =
695
+static const struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 =
709696 AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
710697
711698
....@@ -713,7 +700,7 @@
713700 * add new mixer elements to the card
714701 */
715702 static int build_mixers(struct snd_pmac *chip, int nums,
716
- struct snd_kcontrol_new *mixers)
703
+ const struct snd_kcontrol_new *mixers)
717704 {
718705 int i, err;
719706
....@@ -1076,12 +1063,12 @@
10761063 if (pm5500 || imac || lombard) {
10771064 vmaster_sw = snd_ctl_make_virtual_master(
10781065 "Master Playback Switch", (unsigned int *) NULL);
1079
- err = snd_ctl_add_slave_uncached(vmaster_sw,
1080
- chip->master_sw_ctl);
1066
+ err = snd_ctl_add_follower_uncached(vmaster_sw,
1067
+ chip->master_sw_ctl);
10811068 if (err < 0)
10821069 return err;
1083
- err = snd_ctl_add_slave_uncached(vmaster_sw,
1084
- chip->speaker_sw_ctl);
1070
+ err = snd_ctl_add_follower_uncached(vmaster_sw,
1071
+ chip->speaker_sw_ctl);
10851072 if (err < 0)
10861073 return err;
10871074 err = snd_ctl_add(chip->card, vmaster_sw);
....@@ -1089,10 +1076,10 @@
10891076 return err;
10901077 vmaster_vol = snd_ctl_make_virtual_master(
10911078 "Master Playback Volume", (unsigned int *) NULL);
1092
- err = snd_ctl_add_slave(vmaster_vol, master_vol);
1079
+ err = snd_ctl_add_follower(vmaster_vol, master_vol);
10931080 if (err < 0)
10941081 return err;
1095
- err = snd_ctl_add_slave(vmaster_vol, speaker_vol);
1082
+ err = snd_ctl_add_follower(vmaster_vol, speaker_vol);
10961083 if (err < 0)
10971084 return err;
10981085 err = snd_ctl_add(chip->card, vmaster_vol);