.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * PMac AWACS lowlevel functions |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) by Takashi Iwai <tiwai@suse.de> |
---|
5 | 6 | * 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 |
---|
20 | 7 | */ |
---|
21 | 8 | |
---|
22 | 9 | |
---|
.. | .. |
---|
477 | 464 | #define AMP_CH_SPK 0 |
---|
478 | 465 | #define AMP_CH_HD 1 |
---|
479 | 466 | |
---|
480 | | -static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = { |
---|
| 467 | +static const struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = { |
---|
481 | 468 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
---|
482 | 469 | .name = "Speaker Playback Volume", |
---|
483 | 470 | .info = snd_pmac_awacs_info_volume_amp, |
---|
.. | .. |
---|
595 | 582 | /* |
---|
596 | 583 | * lists of mixer elements |
---|
597 | 584 | */ |
---|
598 | | -static struct snd_kcontrol_new snd_pmac_awacs_mixers[] = { |
---|
| 585 | +static const struct snd_kcontrol_new snd_pmac_awacs_mixers[] = { |
---|
599 | 586 | AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0), |
---|
600 | 587 | AWACS_VOLUME("Master Capture Volume", 0, 4, 0), |
---|
601 | 588 | /* AWACS_SWITCH("Unknown Playback Switch", 6, SHIFT_PAROUT0, 0), */ |
---|
602 | 589 | }; |
---|
603 | 590 | |
---|
604 | | -static struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = { |
---|
| 591 | +static const struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = { |
---|
605 | 592 | AWACS_VOLUME("Master Playback Volume", 2, 6, 1), |
---|
606 | 593 | AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1), |
---|
607 | 594 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), |
---|
608 | 595 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0), |
---|
609 | 596 | }; |
---|
610 | 597 | |
---|
611 | | -static struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = { |
---|
| 598 | +static const struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = { |
---|
612 | 599 | AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), |
---|
613 | 600 | }; |
---|
614 | 601 | |
---|
615 | | -static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = { |
---|
| 602 | +static const struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = { |
---|
616 | 603 | AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1), |
---|
617 | 604 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), |
---|
618 | 605 | }; |
---|
619 | 606 | |
---|
620 | | -static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = { |
---|
| 607 | +static const struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = { |
---|
621 | 608 | AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), |
---|
622 | 609 | AWACS_VOLUME("Master Playback Volume", 5, 6, 1), |
---|
623 | 610 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), |
---|
624 | 611 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), |
---|
625 | 612 | }; |
---|
626 | 613 | |
---|
627 | | -static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = { |
---|
| 614 | +static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = { |
---|
628 | 615 | AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), |
---|
629 | 616 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), |
---|
630 | 617 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), |
---|
631 | 618 | }; |
---|
632 | 619 | |
---|
633 | | -static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = { |
---|
| 620 | +static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = { |
---|
634 | 621 | AWACS_VOLUME("Headphone Playback Volume", 2, 6, 1), |
---|
635 | 622 | }; |
---|
636 | 623 | |
---|
637 | | -static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = { |
---|
| 624 | +static const struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = { |
---|
638 | 625 | AWACS_VOLUME("Master Playback Volume", 2, 6, 1), |
---|
639 | 626 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), |
---|
640 | 627 | }; |
---|
.. | .. |
---|
642 | 629 | /* FIXME: is this correct order? |
---|
643 | 630 | * screamer (powerbook G3 pismo) seems to have different bits... |
---|
644 | 631 | */ |
---|
645 | | -static struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = { |
---|
| 632 | +static const struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = { |
---|
646 | 633 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0), |
---|
647 | 634 | AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0), |
---|
648 | 635 | }; |
---|
649 | 636 | |
---|
650 | | -static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = { |
---|
| 637 | +static const struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = { |
---|
651 | 638 | AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), |
---|
652 | 639 | AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0), |
---|
653 | 640 | }; |
---|
654 | 641 | |
---|
655 | | -static struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = { |
---|
| 642 | +static const struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = { |
---|
656 | 643 | AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), |
---|
657 | 644 | }; |
---|
658 | 645 | |
---|
659 | | -static struct snd_kcontrol_new snd_pmac_awacs_master_sw = |
---|
| 646 | +static const struct snd_kcontrol_new snd_pmac_awacs_master_sw = |
---|
660 | 647 | AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1); |
---|
661 | 648 | |
---|
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 = |
---|
663 | 650 | AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1); |
---|
664 | 651 | |
---|
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 = |
---|
666 | 653 | AWACS_SWITCH("Headphone Playback Switch", 1, SHIFT_HDMUTE, 1); |
---|
667 | 654 | |
---|
668 | | -static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = { |
---|
| 655 | +static const struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = { |
---|
669 | 656 | AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0), |
---|
670 | 657 | }; |
---|
671 | 658 | |
---|
672 | | -static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = { |
---|
| 659 | +static const struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = { |
---|
673 | 660 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
---|
674 | 661 | .name = "Mic Boost Capture Volume", |
---|
675 | 662 | .info = snd_pmac_screamer_mic_boost_info, |
---|
.. | .. |
---|
678 | 665 | }, |
---|
679 | 666 | }; |
---|
680 | 667 | |
---|
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[] = |
---|
682 | 669 | { |
---|
683 | 670 | AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), |
---|
684 | 671 | }; |
---|
685 | 672 | |
---|
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[] = |
---|
687 | 674 | { |
---|
688 | 675 | AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), |
---|
689 | 676 | AWACS_SWITCH("CD Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0), |
---|
690 | 677 | }; |
---|
691 | 678 | |
---|
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[] = |
---|
693 | 680 | { |
---|
694 | 681 | AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), |
---|
695 | 682 | AWACS_SWITCH("Mic Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0), |
---|
696 | 683 | }; |
---|
697 | 684 | |
---|
698 | | -static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = { |
---|
| 685 | +static const struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = { |
---|
699 | 686 | AWACS_VOLUME("Speaker Playback Volume", 4, 6, 1), |
---|
700 | 687 | }; |
---|
701 | 688 | |
---|
702 | | -static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw = |
---|
| 689 | +static const struct snd_kcontrol_new snd_pmac_awacs_speaker_sw = |
---|
703 | 690 | AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); |
---|
704 | 691 | |
---|
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 = |
---|
706 | 693 | AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); |
---|
707 | 694 | |
---|
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 = |
---|
709 | 696 | AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); |
---|
710 | 697 | |
---|
711 | 698 | |
---|
.. | .. |
---|
713 | 700 | * add new mixer elements to the card |
---|
714 | 701 | */ |
---|
715 | 702 | static int build_mixers(struct snd_pmac *chip, int nums, |
---|
716 | | - struct snd_kcontrol_new *mixers) |
---|
| 703 | + const struct snd_kcontrol_new *mixers) |
---|
717 | 704 | { |
---|
718 | 705 | int i, err; |
---|
719 | 706 | |
---|
.. | .. |
---|
1076 | 1063 | if (pm5500 || imac || lombard) { |
---|
1077 | 1064 | vmaster_sw = snd_ctl_make_virtual_master( |
---|
1078 | 1065 | "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); |
---|
1081 | 1068 | if (err < 0) |
---|
1082 | 1069 | 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); |
---|
1085 | 1072 | if (err < 0) |
---|
1086 | 1073 | return err; |
---|
1087 | 1074 | err = snd_ctl_add(chip->card, vmaster_sw); |
---|
.. | .. |
---|
1089 | 1076 | return err; |
---|
1090 | 1077 | vmaster_vol = snd_ctl_make_virtual_master( |
---|
1091 | 1078 | "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); |
---|
1093 | 1080 | if (err < 0) |
---|
1094 | 1081 | return err; |
---|
1095 | | - err = snd_ctl_add_slave(vmaster_vol, speaker_vol); |
---|
| 1082 | + err = snd_ctl_add_follower(vmaster_vol, speaker_vol); |
---|
1096 | 1083 | if (err < 0) |
---|
1097 | 1084 | return err; |
---|
1098 | 1085 | err = snd_ctl_add(chip->card, vmaster_vol); |
---|