Merge branch 'fix/hda' into for-linus

+128 -27
+83 -11
sound/pci/hda/patch_realtek.c
··· 1230 return; /* invalid entry */ 1231 } 1232 } 1233 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 1234 return; /* no unsol support */ 1235 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", ··· 4814 spec->auto_mic = 0; /* disable auto-mic to be sure */ 4815 } 4816 4817 static void set_capture_mixer(struct hda_codec *codec) 4818 { 4819 struct alc_spec *spec = codec->spec; ··· 4869 alc_capture_mixer3 }, 4870 }; 4871 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { 4872 - int mux; 4873 - if (spec->auto_mic) { 4874 - mux = 0; 4875 fixup_automic_adc(codec); 4876 - } else if (spec->input_mux && spec->input_mux->num_items > 1) 4877 - mux = 1; 4878 - else 4879 - mux = 0; 4880 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; 4881 } 4882 } ··· 7140 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), 7141 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), 7142 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7143 - HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7144 - HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), 7145 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7146 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7147 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), ··· 7542 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7543 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7544 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, 7545 /* Front Mic pin: input vref at 80% */ 7546 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 7547 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, ··· 7725 7726 spec->autocfg.hp_pins[0] = 0x15; 7727 spec->autocfg.speaker_pins[0] = 0x14; 7728 } 7729 7730 static void alc885_imac91_automute(struct hda_codec *codec) ··· 9194 .input_mux = &mb5_capture_source, 9195 .dig_out_nid = ALC882_DIGOUT_NID, 9196 .dig_in_nid = ALC882_DIGIN_NID, 9197 }, 9198 [ALC885_MACPRO] = { 9199 .mixers = { alc882_macpro_mixer }, ··· 11249 } 11250 11251 #define alc262_auto_create_input_ctls \ 11252 - alc880_auto_create_input_ctls 11253 11254 /* 11255 * generic initialization of ADC, input mixers and output mixers ··· 14925 spec->stream_digital_playback = &alc861_pcm_digital_playback; 14926 spec->stream_digital_capture = &alc861_pcm_digital_capture; 14927 14928 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 14929 14930 spec->vmaster_nid = 0x03; ··· 17323 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 17324 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 17325 ALC662_3ST_6ch_DIG), 17326 - SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), 17327 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 17328 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 17329 ALC662_3ST_6ch_DIG),
··· 1230 return; /* invalid entry */ 1231 } 1232 } 1233 + if (!ext || !fixed) 1234 + return; 1235 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 1236 return; /* no unsol support */ 1237 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", ··· 4812 spec->auto_mic = 0; /* disable auto-mic to be sure */ 4813 } 4814 4815 + /* choose the ADC/MUX containing the input pin and initialize the setup */ 4816 + static void fixup_single_adc(struct hda_codec *codec) 4817 + { 4818 + struct alc_spec *spec = codec->spec; 4819 + hda_nid_t pin; 4820 + int i; 4821 + 4822 + /* search for the input pin; there must be only one */ 4823 + for (i = 0; i < AUTO_PIN_LAST; i++) { 4824 + if (spec->autocfg.input_pins[i]) { 4825 + pin = spec->autocfg.input_pins[i]; 4826 + break; 4827 + } 4828 + } 4829 + if (!pin) 4830 + return; 4831 + 4832 + /* set the default connection to that pin */ 4833 + for (i = 0; i < spec->num_adc_nids; i++) { 4834 + hda_nid_t cap = spec->capsrc_nids ? 4835 + spec->capsrc_nids[i] : spec->adc_nids[i]; 4836 + int idx; 4837 + 4838 + idx = get_connection_index(codec, cap, pin); 4839 + if (idx < 0) 4840 + continue; 4841 + /* use only this ADC */ 4842 + if (spec->capsrc_nids) 4843 + spec->capsrc_nids += i; 4844 + spec->adc_nids += i; 4845 + spec->num_adc_nids = 1; 4846 + /* select or unmute this route */ 4847 + if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) { 4848 + snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx, 4849 + HDA_AMP_MUTE, 0); 4850 + } else { 4851 + snd_hda_codec_write_cache(codec, cap, 0, 4852 + AC_VERB_SET_CONNECT_SEL, idx); 4853 + } 4854 + return; 4855 + } 4856 + } 4857 + 4858 static void set_capture_mixer(struct hda_codec *codec) 4859 { 4860 struct alc_spec *spec = codec->spec; ··· 4824 alc_capture_mixer3 }, 4825 }; 4826 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { 4827 + int mux = 0; 4828 + if (spec->auto_mic) 4829 fixup_automic_adc(codec); 4830 + else if (spec->input_mux) { 4831 + if (spec->input_mux->num_items > 1) 4832 + mux = 1; 4833 + else if (spec->input_mux->num_items == 1) 4834 + fixup_single_adc(codec); 4835 + } 4836 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; 4837 } 4838 } ··· 7094 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), 7095 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), 7096 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7097 + HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7098 + HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), 7099 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7100 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7101 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), ··· 7496 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7497 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7498 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, 7499 + {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 7500 /* Front Mic pin: input vref at 80% */ 7501 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 7502 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, ··· 7678 7679 spec->autocfg.hp_pins[0] = 0x15; 7680 spec->autocfg.speaker_pins[0] = 0x14; 7681 + } 7682 + 7683 + static void alc885_mb5_automute(struct hda_codec *codec) 7684 + { 7685 + unsigned int present; 7686 + 7687 + present = snd_hda_codec_read(codec, 0x14, 0, 7688 + AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7689 + snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, 7690 + HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 7691 + snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, 7692 + HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); 7693 + 7694 + } 7695 + 7696 + static void alc885_mb5_unsol_event(struct hda_codec *codec, 7697 + unsigned int res) 7698 + { 7699 + /* Headphone insertion or removal. */ 7700 + if ((res >> 26) == ALC880_HP_EVENT) 7701 + alc885_mb5_automute(codec); 7702 } 7703 7704 static void alc885_imac91_automute(struct hda_codec *codec) ··· 9126 .input_mux = &mb5_capture_source, 9127 .dig_out_nid = ALC882_DIGOUT_NID, 9128 .dig_in_nid = ALC882_DIGIN_NID, 9129 + .unsol_event = alc885_mb5_unsol_event, 9130 + .init_hook = alc885_mb5_automute, 9131 }, 9132 [ALC885_MACPRO] = { 9133 .mixers = { alc882_macpro_mixer }, ··· 11179 } 11180 11181 #define alc262_auto_create_input_ctls \ 11182 + alc882_auto_create_input_ctls 11183 11184 /* 11185 * generic initialization of ADC, input mixers and output mixers ··· 14855 spec->stream_digital_playback = &alc861_pcm_digital_playback; 14856 spec->stream_digital_capture = &alc861_pcm_digital_capture; 14857 14858 + if (!spec->cap_mixer) 14859 + set_capture_mixer(codec); 14860 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 14861 14862 spec->vmaster_nid = 0x03; ··· 17251 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 17252 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 17253 ALC662_3ST_6ch_DIG), 17254 + SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO), 17255 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 17256 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 17257 ALC662_3ST_6ch_DIG),
+45 -16
sound/pci/hda/patch_sigmatel.c
··· 4730 } 4731 } 4732 4733 /* 4734 * This method searches for the mute LED GPIO configuration 4735 * provided as OEM string in SMBIOS. The format of that string ··· 4761 * 4762 * So, HP B-series like systems may have HP_Mute_LED_0 (current models) 4763 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings 4764 */ 4765 static int find_mute_led_gpio(struct hda_codec *codec) 4766 { ··· 4779 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, 4780 NULL, dev))) { 4781 if (sscanf(dev->name, "HP_Mute_LED_%d_%d", 4782 - &spec->gpio_led_polarity, 4783 - &spec->gpio_led) == 2) { 4784 spec->gpio_led = 1 << spec->gpio_led; 4785 return 1; 4786 } 4787 if (sscanf(dev->name, "HP_Mute_LED_%d", 4788 - &spec->gpio_led_polarity) == 1) { 4789 - switch (codec->vendor_id) { 4790 - case 0x111d7608: 4791 - /* GPIO 0 */ 4792 - spec->gpio_led = 0x01; 4793 - return 1; 4794 - case 0x111d7600: 4795 - case 0x111d7601: 4796 - case 0x111d7602: 4797 - case 0x111d7603: 4798 - /* GPIO 3 */ 4799 - spec->gpio_led = 0x08; 4800 - return 1; 4801 - } 4802 } 4803 } 4804 } 4805 return 0; ··· 5574 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); 5575 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5576 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); 5577 5578 switch (spec->board_config) { 5579 case STAC_HP_M4:
··· 4730 } 4731 } 4732 4733 + static int hp_blike_system(u32 subsystem_id); 4734 + 4735 + static void set_hp_led_gpio(struct hda_codec *codec) 4736 + { 4737 + struct sigmatel_spec *spec = codec->spec; 4738 + switch (codec->vendor_id) { 4739 + case 0x111d7608: 4740 + /* GPIO 0 */ 4741 + spec->gpio_led = 0x01; 4742 + break; 4743 + case 0x111d7600: 4744 + case 0x111d7601: 4745 + case 0x111d7602: 4746 + case 0x111d7603: 4747 + /* GPIO 3 */ 4748 + spec->gpio_led = 0x08; 4749 + break; 4750 + } 4751 + } 4752 + 4753 /* 4754 * This method searches for the mute LED GPIO configuration 4755 * provided as OEM string in SMBIOS. The format of that string ··· 4741 * 4742 * So, HP B-series like systems may have HP_Mute_LED_0 (current models) 4743 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings 4744 + * 4745 + * 4746 + * The dv-series laptops don't seem to have the HP_Mute_LED* strings in 4747 + * SMBIOS - at least the ones I have seen do not have them - which include 4748 + * my own system (HP Pavilion dv6-1110ax) and my cousin's 4749 + * HP Pavilion dv9500t CTO. 4750 + * Need more information on whether it is true across the entire series. 4751 + * -- kunal 4752 */ 4753 static int find_mute_led_gpio(struct hda_codec *codec) 4754 { ··· 4751 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, 4752 NULL, dev))) { 4753 if (sscanf(dev->name, "HP_Mute_LED_%d_%d", 4754 + &spec->gpio_led_polarity, 4755 + &spec->gpio_led) == 2) { 4756 spec->gpio_led = 1 << spec->gpio_led; 4757 return 1; 4758 } 4759 if (sscanf(dev->name, "HP_Mute_LED_%d", 4760 + &spec->gpio_led_polarity) == 1) { 4761 + set_hp_led_gpio(codec); 4762 + return 1; 4763 } 4764 + } 4765 + 4766 + /* 4767 + * Fallback case - if we don't find the DMI strings, 4768 + * we statically set the GPIO - if not a B-series system. 4769 + */ 4770 + if (!hp_blike_system(codec->subsystem_id)) { 4771 + set_hp_led_gpio(codec); 4772 + spec->gpio_led_polarity = 1; 4773 + return 1; 4774 } 4775 } 4776 return 0; ··· 5547 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); 5548 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5549 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); 5550 + 5551 + snd_printdd("Found board config: %d\n", spec->board_config); 5552 5553 switch (spec->board_config) { 5554 case STAC_HP_M4: