aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc/awacs.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/ppc/awacs.c')
-rw-r--r--sound/ppc/awacs.c88
1 files changed, 78 insertions, 10 deletions
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 7bd33e6552ab..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};
@@ -766,12 +780,16 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip)
766} 780}
767#endif /* CONFIG_PM */ 781#endif /* CONFIG_PM */
768 782
769#define IS_PM7500 (machine_is_compatible("AAPL,7500")) 783#define IS_PM7500 (machine_is_compatible("AAPL,7500") \
784 || machine_is_compatible("AAPL,8500") \
785 || machine_is_compatible("AAPL,9500"))
786#define IS_PM5500 (machine_is_compatible("AAPL,e411"))
770#define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) 787#define IS_BEIGE (machine_is_compatible("AAPL,Gossamer"))
771#define IS_IMAC1 (machine_is_compatible("PowerMac2,1")) 788#define IS_IMAC1 (machine_is_compatible("PowerMac2,1"))
772#define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \ 789#define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \
773 || machine_is_compatible("PowerMac4,1")) 790 || machine_is_compatible("PowerMac4,1"))
774#define IS_G4AGP (machine_is_compatible("PowerMac3,1")) 791#define IS_G4AGP (machine_is_compatible("PowerMac3,1"))
792#define IS_LOMBARD (machine_is_compatible("PowerBook1,1"))
775 793
776static int imac1, imac2; 794static int imac1, imac2;
777 795
@@ -858,10 +876,14 @@ int __init
858snd_pmac_awacs_init(struct snd_pmac *chip) 876snd_pmac_awacs_init(struct snd_pmac *chip)
859{ 877{
860 int pm7500 = IS_PM7500; 878 int pm7500 = IS_PM7500;
879 int pm5500 = IS_PM5500;
861 int beige = IS_BEIGE; 880 int beige = IS_BEIGE;
862 int g4agp = IS_G4AGP; 881 int g4agp = IS_G4AGP;
882 int lombard = IS_LOMBARD;
863 int imac; 883 int imac;
864 int err, vol; 884 int err, vol;
885 struct snd_kcontrol *vmaster_sw, *vmaster_vol;
886 struct snd_kcontrol *master_vol, *speaker_vol;
865 887
866 imac1 = IS_IMAC1; 888 imac1 = IS_IMAC1;
867 imac2 = IS_IMAC2; 889 imac2 = IS_IMAC2;
@@ -915,7 +937,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
915 /* set headphone-jack detection bit */ 937 /* set headphone-jack detection bit */
916 switch (chip->model) { 938 switch (chip->model) {
917 case PMAC_AWACS: 939 case PMAC_AWACS:
918 chip->hp_stat_mask = pm7500 ? MASK_HDPCONN 940 chip->hp_stat_mask = pm7500 || pm5500 ? MASK_HDPCONN
919 : MASK_LOCONN; 941 : MASK_LOCONN;
920 break; 942 break;
921 case PMAC_SCREAMER: 943 case PMAC_SCREAMER:
@@ -954,7 +976,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
954 return err; 976 return err;
955 if (beige || g4agp) 977 if (beige || g4agp)
956 ; 978 ;
957 else if (chip->model == PMAC_SCREAMER) 979 else if (chip->model == PMAC_SCREAMER || pm5500)
958 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2), 980 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_screamer_mixers2),
959 snd_pmac_screamer_mixers2); 981 snd_pmac_screamer_mixers2);
960 else if (!pm7500) 982 else if (!pm7500)
@@ -962,19 +984,35 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
962 snd_pmac_awacs_mixers2); 984 snd_pmac_awacs_mixers2);
963 if (err < 0) 985 if (err < 0)
964 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 }
965 if (pm7500) 994 if (pm7500)
966 err = build_mixers(chip, 995 err = build_mixers(chip,
967 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500), 996 ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500),
968 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)));
969 else if (beige) 1002 else if (beige)
970 err = build_mixers(chip, 1003 err = build_mixers(chip,
971 ARRAY_SIZE(snd_pmac_screamer_mixers_beige), 1004 ARRAY_SIZE(snd_pmac_screamer_mixers_beige),
972 snd_pmac_screamer_mixers_beige); 1005 snd_pmac_screamer_mixers_beige);
973 else if (imac) 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;
974 err = build_mixers(chip, 1012 err = build_mixers(chip,
975 ARRAY_SIZE(snd_pmac_screamer_mixers_imac), 1013 ARRAY_SIZE(snd_pmac_screamer_mixers_imac),
976 snd_pmac_screamer_mixers_imac); 1014 snd_pmac_screamer_mixers_imac);
977 else if (g4agp) 1015 } else if (g4agp)
978 err = build_mixers(chip, 1016 err = build_mixers(chip,
979 ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp), 1017 ARRAY_SIZE(snd_pmac_screamer_mixers_g4agp),
980 snd_pmac_screamer_mixers_g4agp); 1018 snd_pmac_screamer_mixers_g4agp);
@@ -984,8 +1022,10 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
984 snd_pmac_awacs_mixers_pmac); 1022 snd_pmac_awacs_mixers_pmac);
985 if (err < 0) 1023 if (err < 0)
986 return err; 1024 return err;
987 chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp) 1025 chip->master_sw_ctl = snd_ctl_new1((pm7500 || imac || g4agp || lombard)
988 ? &snd_pmac_awacs_master_sw_imac 1026 ? &snd_pmac_awacs_master_sw_imac
1027 : pm5500
1028 ? &snd_pmac_awacs_master_sw_pmac5500
989 : &snd_pmac_awacs_master_sw, chip); 1029 : &snd_pmac_awacs_master_sw, chip);
990 err = snd_ctl_add(chip->card, chip->master_sw_ctl); 1030 err = snd_ctl_add(chip->card, chip->master_sw_ctl);
991 if (err < 0) 1031 if (err < 0)
@@ -1017,8 +1057,9 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
1017#endif /* PMAC_AMP_AVAIL */ 1057#endif /* PMAC_AMP_AVAIL */
1018 { 1058 {
1019 /* route A = headphone, route C = speaker */ 1059 /* route A = headphone, route C = speaker */
1020 err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_speaker_vol), 1060 err = snd_ctl_add(chip->card,
1021 snd_pmac_awacs_speaker_vol); 1061 (speaker_vol = snd_ctl_new1(snd_pmac_awacs_speaker_vol,
1062 chip)));
1022 if (err < 0) 1063 if (err < 0)
1023 return err; 1064 return err;
1024 chip->speaker_sw_ctl = snd_ctl_new1(imac1 1065 chip->speaker_sw_ctl = snd_ctl_new1(imac1
@@ -1031,6 +1072,33 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
1031 return err; 1072 return err;
1032 } 1073 }
1033 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
1034 if (beige || g4agp) 1102 if (beige || g4agp)
1035 err = build_mixers(chip, 1103 err = build_mixers(chip,
1036 ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige), 1104 ARRAY_SIZE(snd_pmac_screamer_mic_boost_beige),