aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc
diff options
context:
space:
mode:
authorRisto Suominen <Risto.Suominen@gmail.com>2008-08-25 02:04:23 -0400
committerTakashi Iwai <tiwai@suse.de>2008-10-02 06:50:37 -0400
commit030b655b062fe5190fc490e0091ea50307d7a86f (patch)
tree85eaf04aa553ab4ae3b3ffabc1b7905fca35dafc /sound/ppc
parent4dbf95ba6c344186ec6d38ff514dc675da464bec (diff)
ALSA: snd-powermac: HP detection for 1st iMac G3 SL
Correct headphone detection for 1st generation iMac G3 Slot-loading (Screamer). This patch fixes the regression in the recent snd-powermac which doesn't support some G3/G4 PowerMacs: http://lkml.org/lkml/2008/10/1/220 Signed-off-by: Risto Suominen <Risto.Suominen@gmail.com> Tested-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Cc: stable@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/ppc')
-rw-r--r--sound/ppc/awacs.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index 543d4f1784a5..106c48225bba 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -695,7 +695,10 @@ static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __initdata = {
695static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata = 695static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata =
696AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); 696AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1);
697 697
698static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac __initdata = 698static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __initdata =
699AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1);
700
701static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __initdata =
699AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); 702AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
700 703
701 704
@@ -772,12 +775,12 @@ static void snd_pmac_awacs_resume(struct snd_pmac *chip)
772 775
773#define IS_PM7500 (machine_is_compatible("AAPL,7500")) 776#define IS_PM7500 (machine_is_compatible("AAPL,7500"))
774#define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) 777#define IS_BEIGE (machine_is_compatible("AAPL,Gossamer"))
775#define IS_IMAC (machine_is_compatible("PowerMac2,1") \ 778#define IS_IMAC1 (machine_is_compatible("PowerMac2,1"))
776 || machine_is_compatible("PowerMac2,2") \ 779#define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \
777 || machine_is_compatible("PowerMac4,1")) 780 || machine_is_compatible("PowerMac4,1"))
778#define IS_G4AGP (machine_is_compatible("PowerMac3,1")) 781#define IS_G4AGP (machine_is_compatible("PowerMac3,1"))
779 782
780static int imac; 783static int imac1, imac2;
781 784
782#ifdef PMAC_SUPPORT_AUTOMUTE 785#ifdef PMAC_SUPPORT_AUTOMUTE
783/* 786/*
@@ -823,13 +826,18 @@ static void snd_pmac_awacs_update_automute(struct snd_pmac *chip, int do_notify)
823 { 826 {
824 int reg = chip->awacs_reg[1] 827 int reg = chip->awacs_reg[1]
825 | (MASK_HDMUTE | MASK_SPKMUTE); 828 | (MASK_HDMUTE | MASK_SPKMUTE);
826 if (imac) { 829 if (imac1) {
830 reg &= ~MASK_SPKMUTE;
831 reg |= MASK_PAROUT1;
832 } else if (imac2) {
827 reg &= ~MASK_SPKMUTE; 833 reg &= ~MASK_SPKMUTE;
828 reg &= ~MASK_PAROUT1; 834 reg &= ~MASK_PAROUT1;
829 } 835 }
830 if (snd_pmac_awacs_detect_headphone(chip)) 836 if (snd_pmac_awacs_detect_headphone(chip))
831 reg &= ~MASK_HDMUTE; 837 reg &= ~MASK_HDMUTE;
832 else if (imac) 838 else if (imac1)
839 reg &= ~MASK_PAROUT1;
840 else if (imac2)
833 reg |= MASK_PAROUT1; 841 reg |= MASK_PAROUT1;
834 else 842 else
835 reg &= ~MASK_SPKMUTE; 843 reg &= ~MASK_SPKMUTE;
@@ -859,9 +867,12 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
859 int pm7500 = IS_PM7500; 867 int pm7500 = IS_PM7500;
860 int beige = IS_BEIGE; 868 int beige = IS_BEIGE;
861 int g4agp = IS_G4AGP; 869 int g4agp = IS_G4AGP;
870 int imac;
862 int err, vol; 871 int err, vol;
863 872
864 imac = IS_IMAC; 873 imac1 = IS_IMAC1;
874 imac2 = IS_IMAC2;
875 imac = imac1 || imac2;
865 /* looks like MASK_GAINLINE triggers something, so we set here 876 /* looks like MASK_GAINLINE triggers something, so we set here
866 * as start-up 877 * as start-up
867 */ 878 */
@@ -1017,8 +1028,10 @@ snd_pmac_awacs_init(struct snd_pmac *chip)
1017 snd_pmac_awacs_speaker_vol); 1028 snd_pmac_awacs_speaker_vol);
1018 if (err < 0) 1029 if (err < 0)
1019 return err; 1030 return err;
1020 chip->speaker_sw_ctl = snd_ctl_new1(imac 1031 chip->speaker_sw_ctl = snd_ctl_new1(imac1
1021 ? &snd_pmac_awacs_speaker_sw_imac 1032 ? &snd_pmac_awacs_speaker_sw_imac1
1033 : imac2
1034 ? &snd_pmac_awacs_speaker_sw_imac2
1022 : &snd_pmac_awacs_speaker_sw, chip); 1035 : &snd_pmac_awacs_speaker_sw, chip);
1023 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); 1036 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl);
1024 if (err < 0) 1037 if (err < 0)