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>

authored by Risto Suominen and committed by Takashi Iwai 030b655b 4dbf95ba

+22 -9
+22 -9
sound/ppc/awacs.c
··· 695 695 static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __initdata = 696 696 AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); 697 697 698 - static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac __initdata = 698 + static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __initdata = 699 + AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); 700 + 701 + static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __initdata = 699 702 AWACS_SWITCH("PC Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); 700 703 701 704 ··· 775 772 776 773 #define IS_PM7500 (machine_is_compatible("AAPL,7500")) 777 774 #define IS_BEIGE (machine_is_compatible("AAPL,Gossamer")) 778 - #define IS_IMAC (machine_is_compatible("PowerMac2,1") \ 779 - || machine_is_compatible("PowerMac2,2") \ 775 + #define IS_IMAC1 (machine_is_compatible("PowerMac2,1")) 776 + #define IS_IMAC2 (machine_is_compatible("PowerMac2,2") \ 780 777 || machine_is_compatible("PowerMac4,1")) 781 778 #define IS_G4AGP (machine_is_compatible("PowerMac3,1")) 782 779 783 - static int imac; 780 + static int imac1, imac2; 784 781 785 782 #ifdef PMAC_SUPPORT_AUTOMUTE 786 783 /* ··· 826 823 { 827 824 int reg = chip->awacs_reg[1] 828 825 | (MASK_HDMUTE | MASK_SPKMUTE); 829 - if (imac) { 826 + if (imac1) { 827 + reg &= ~MASK_SPKMUTE; 828 + reg |= MASK_PAROUT1; 829 + } else if (imac2) { 830 830 reg &= ~MASK_SPKMUTE; 831 831 reg &= ~MASK_PAROUT1; 832 832 } 833 833 if (snd_pmac_awacs_detect_headphone(chip)) 834 834 reg &= ~MASK_HDMUTE; 835 - else if (imac) 835 + else if (imac1) 836 + reg &= ~MASK_PAROUT1; 837 + else if (imac2) 836 838 reg |= MASK_PAROUT1; 837 839 else 838 840 reg &= ~MASK_SPKMUTE; ··· 867 859 int pm7500 = IS_PM7500; 868 860 int beige = IS_BEIGE; 869 861 int g4agp = IS_G4AGP; 862 + int imac; 870 863 int err, vol; 871 864 872 - imac = IS_IMAC; 865 + imac1 = IS_IMAC1; 866 + imac2 = IS_IMAC2; 867 + imac = imac1 || imac2; 873 868 /* looks like MASK_GAINLINE triggers something, so we set here 874 869 * as start-up 875 870 */ ··· 1028 1017 snd_pmac_awacs_speaker_vol); 1029 1018 if (err < 0) 1030 1019 return err; 1031 - chip->speaker_sw_ctl = snd_ctl_new1(imac 1032 - ? &snd_pmac_awacs_speaker_sw_imac 1020 + chip->speaker_sw_ctl = snd_ctl_new1(imac1 1021 + ? &snd_pmac_awacs_speaker_sw_imac1 1022 + : imac2 1023 + ? &snd_pmac_awacs_speaker_sw_imac2 1033 1024 : &snd_pmac_awacs_speaker_sw, chip); 1034 1025 err = snd_ctl_add(chip->card, chip->speaker_sw_ctl); 1035 1026 if (err < 0)