aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc
diff options
context:
space:
mode:
authorRisto Suominen <Risto.Suominen@gmail.com>2009-01-20 15:01:17 -0500
committerTakashi Iwai <tiwai@suse.de>2009-03-09 09:58:26 -0400
commitdca7c74172fee0cf6ee1e303df093c31b5561039 (patch)
treeb2f776bfdd633d37e3867eacb5fad628cc72d5c6 /sound/ppc
parented336d3404a8fdeda1e3f1c189b5f83186675448 (diff)
ALSA: Add vmaster controls for Pmac 5500, iMac G3 SL, and PBook G3 Lombard
Add virtual master controls for PowerMac 5500 (AWACS) and iMac G3 Slot-loading and PowerBook G3 Lombard (Screamer). Signed-off-by: Risto Suominen <Risto.Suominen@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/ppc')
-rw-r--r--sound/ppc/Kconfig1
-rw-r--r--sound/ppc/awacs.c74
2 files changed, 69 insertions, 6 deletions
diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig
index 777de2b17178..bd2338ab2ced 100644
--- a/sound/ppc/Kconfig
+++ b/sound/ppc/Kconfig
@@ -13,6 +13,7 @@ config SND_POWERMAC
13 tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" 13 tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)"
14 depends on I2C && INPUT && PPC_PMAC 14 depends on I2C && INPUT && PPC_PMAC
15 select SND_PCM 15 select SND_PCM
16 select SND_VMASTER
16 help 17 help
17 Say Y here to include support for the integrated sound device. 18 Say Y here to include support for the integrated sound device.
18 19
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 9abbf645eb67..80df9b1f651e 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -608,9 +608,12 @@ static struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] __initdata = {
608 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0), 608 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0),
609}; 609};
610 610
611static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __initdata = { 611static struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] __initdata = {
612 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 612 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
613 AWACS_VOLUME("Master Playback Volume", 5, 6, 1), 613};
614
615static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __initdata = {
616 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1),
614 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 617 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
615}; 618};
616 619
@@ -627,6 +630,10 @@ static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __initdata = {
627 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 630 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
628}; 631};
629 632
633static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] __initdata = {
634 AWACS_VOLUME("Headphone Playback Volume", 2, 6, 1),
635};
636
630static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] __initdata = { 637static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] __initdata = {
631 AWACS_VOLUME("Master Playback Volume", 2, 6, 1), 638 AWACS_VOLUME("Master Playback Volume", 2, 6, 1),
632 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 639 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
@@ -645,12 +652,19 @@ static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] __initdata = {
645 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0), 652 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0),
646}; 653};
647 654
655static struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] __initdata = {
656 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
657};
658
648static struct snd_kcontrol_new snd_pmac_awacs_master_sw __initdata = 659static struct snd_kcontrol_new snd_pmac_awacs_master_sw __initdata =
649AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1); 660AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1);
650 661
651static struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac __initdata = 662static struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac __initdata =
652AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1); 663AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1);
653 664
665static struct snd_kcontrol_new snd_pmac_awacs_master_sw_pmac5500 __initdata =
666AWACS_SWITCH("Headphone Playback Switch", 1, SHIFT_HDMUTE, 1);
667
654static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] __initdata = { 668static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] __initdata = {
655 AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 669 AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
656}; 670};
@@ -868,6 +882,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
868 int lombard = IS_LOMBARD; 882 int lombard = IS_LOMBARD;
869 int imac; 883 int imac;
870 int err, vol; 884 int err, vol;
885 struct snd_kcontrol *vmaster_sw, *vmaster_vol;
886 struct snd_kcontrol *master_vol, *speaker_vol;
871 887
872 imac1 = IS_IMAC1; 888 imac1 = IS_IMAC1;
873 imac2 = IS_IMAC2; 889 imac2 = IS_IMAC2;
@@ -968,19 +984,35 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
968 snd_pmac_awacs_mixers2); 984 snd_pmac_awacs_mixers2);
969 if (err < 0) 985 if (err < 0)
970 return err; 986 return err;
987 if (pm5500) {
988 err = build_mixers(chip,
989 ARRAY_SIZE(snd_pmac_awacs_mixers2_pmac5500),
990 snd_pmac_awacs_mixers2_pmac5500);
991 if (err < 0)
992 return err;
993 }
971 if (pm7500) 994 if (pm7500)
972 err = build_mixers(chip, 995 err = build_mixers(chip,
973 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500), 996 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500),
974 snd_pmac_awacs_mixers_pmac7500); 997 snd_pmac_awacs_mixers_pmac7500);
998 else if (pm5500)
999 err = snd_ctl_add(chip->card,
1000 (master_vol = snd_ctl_new1(snd_pmac_awacs_mixers_pmac5500,
1001 chip)));
975 else if (beige) 1002 else if (beige)
976 err = build_mixers(chip, 1003 err = build_mixers(chip,
977 ARRAY_SIZE(snd_pmac_screamer_mixers_beige), 1004 ARRAY_SIZE(snd_pmac_screamer_mixers_beige),
978 snd_pmac_screamer_mixers_beige); 1005 snd_pmac_screamer_mixers_beige);
979 else if (imac || lombard) 1006 else if (imac || lombard) {
1007 err = snd_ctl_add(chip->card,
1008 (master_vol = snd_ctl_new1(snd_pmac_screamer_mixers_lo,
1009 chip)));
1010 if (err < 0)
1011 return err;
980 err = build_mixers(chip, 1012 err = build_mixers(chip,
981 ARRAY_SIZE(snd_pmac_screamer_mixers_imac), 1013 ARRAY_SIZE(snd_pmac_screamer_mixers_imac),
982 snd_pmac_screamer_mixers_imac); 1014 snd_pmac_screamer_mixers_imac);
983 else if (g4agp) 1015 } else if (g4agp)
984 err = build_mixers(chip, 1016 err = build_mixers(chip,
985 ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp), 1017 ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp),
986 snd_pmac_screamer_mixers_g4agp); 1018 snd_pmac_screamer_mixers_g4agp);
@@ -992,6 +1024,8 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
992 return err; 1024 return err;
993 chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp || lombard) 1025 chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp || lombard)
994 ? &snd_pmac_awacs_master_sw_imac 1026 ? &snd_pmac_awacs_master_sw_imac
1027 : pm5500
1028 ? &snd_pmac_awacs_master_sw_pmac5500
995 : &snd_pmac_awacs_master_sw, chip); 1029 : &snd_pmac_awacs_master_sw, chip);
996 err = snd_ctl_add(chip->card, chip->master_sw_ctl); 1030 err = snd_ctl_add(chip->card, chip->master_sw_ctl);
997 if (err < 0) 1031 if (err < 0)
@@ -1023,8 +1057,9 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
1023#endif /* PMAC_AMP_AVAIL */ 1057#endif /* PMAC_AMP_AVAIL */
1024 { 1058 {
1025 /* route A = headphone, route C = speaker */ 1059 /* route A = headphone, route C = speaker */
1026 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_speaker_vol), 1060 err = snd_ctl_add(chip->card,
1027 snd_pmac_awacs_speaker_vol); 1061 (speaker_vol = snd_ctl_new1(snd_pmac_awacs_speaker_vol,
1062 chip)));
1028 if (err < 0) 1063 if (err < 0)
1029 return err; 1064 return err;
1030 chip->speaker_sw_ctl = snd_ctl_new1(imac1 1065 chip->speaker_sw_ctl = snd_ctl_new1(imac1
@@ -1037,6 +1072,33 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
1037 return err; 1072 return err;
1038 } 1073 }
1039 1074
1075 if (pm5500 || imac || lombard) {
1076 vmaster_sw = snd_ctl_make_virtual_master(
1077 "Master Playback Switch", (unsigned int *) NULL);
1078 err = snd_ctl_add_slave_uncached(vmaster_sw,
1079 chip->master_sw_ctl);
1080 if (err < 0)
1081 return err;
1082 err = snd_ctl_add_slave_uncached(vmaster_sw,
1083 chip->speaker_sw_ctl);
1084 if (err < 0)
1085 return err;
1086 err = snd_ctl_add(chip->card, vmaster_sw);
1087 if (err < 0)
1088 return err;
1089 vmaster_vol = snd_ctl_make_virtual_master(
1090 "Master Playback Volume", (unsigned int *) NULL);
1091 err = snd_ctl_add_slave(vmaster_vol, master_vol);
1092 if (err < 0)
1093 return err;
1094 err = snd_ctl_add_slave(vmaster_vol, speaker_vol);
1095 if (err < 0)
1096 return err;
1097 err = snd_ctl_add(chip->card, vmaster_vol);
1098 if (err < 0)
1099 return err;
1100 }
1101
1040 if (beige || g4agp) 1102 if (beige || g4agp)
1041 err = build_mixers(chip, 1103 err = build_mixers(chip,
1042 ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige), 1104 ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige),