diff options
| -rw-r--r-- | sound/pci/hda/patch_realtek.c | 105 |
1 files changed, 97 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 836103081925..98cc465992f2 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -230,6 +230,7 @@ enum { | |||
| 230 | ALC888_ACER_ASPIRE_7730G, | 230 | ALC888_ACER_ASPIRE_7730G, |
| 231 | ALC883_MEDION, | 231 | ALC883_MEDION, |
| 232 | ALC883_MEDION_MD2, | 232 | ALC883_MEDION_MD2, |
| 233 | ALC883_MEDION_WIM2160, | ||
| 233 | ALC883_LAPTOP_EAPD, | 234 | ALC883_LAPTOP_EAPD, |
| 234 | ALC883_LENOVO_101E_2ch, | 235 | ALC883_LENOVO_101E_2ch, |
| 235 | ALC883_LENOVO_NB0763, | 236 | ALC883_LENOVO_NB0763, |
| @@ -4896,6 +4897,25 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) | |||
| 4896 | } | 4897 | } |
| 4897 | } | 4898 | } |
| 4898 | 4899 | ||
| 4900 | static void alc880_auto_init_input_src(struct hda_codec *codec) | ||
| 4901 | { | ||
| 4902 | struct alc_spec *spec = codec->spec; | ||
| 4903 | int c; | ||
| 4904 | |||
| 4905 | for (c = 0; c < spec->num_adc_nids; c++) { | ||
| 4906 | unsigned int mux_idx; | ||
| 4907 | const struct hda_input_mux *imux; | ||
| 4908 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
| 4909 | imux = &spec->input_mux[mux_idx]; | ||
| 4910 | if (!imux->num_items && mux_idx > 0) | ||
| 4911 | imux = &spec->input_mux[0]; | ||
| 4912 | if (imux) | ||
| 4913 | snd_hda_codec_write(codec, spec->adc_nids[c], 0, | ||
| 4914 | AC_VERB_SET_CONNECT_SEL, | ||
| 4915 | imux->items[0].index); | ||
| 4916 | } | ||
| 4917 | } | ||
| 4918 | |||
| 4899 | /* parse the BIOS configuration and set up the alc_spec */ | 4919 | /* parse the BIOS configuration and set up the alc_spec */ |
| 4900 | /* return 1 if successful, 0 if the proper config is not found, | 4920 | /* return 1 if successful, 0 if the proper config is not found, |
| 4901 | * or a negative error code | 4921 | * or a negative error code |
| @@ -4974,6 +4994,7 @@ static void alc880_auto_init(struct hda_codec *codec) | |||
| 4974 | alc880_auto_init_multi_out(codec); | 4994 | alc880_auto_init_multi_out(codec); |
| 4975 | alc880_auto_init_extra_out(codec); | 4995 | alc880_auto_init_extra_out(codec); |
| 4976 | alc880_auto_init_analog_input(codec); | 4996 | alc880_auto_init_analog_input(codec); |
| 4997 | alc880_auto_init_input_src(codec); | ||
| 4977 | if (spec->unsol_event) | 4998 | if (spec->unsol_event) |
| 4978 | alc_inithook(codec); | 4999 | alc_inithook(codec); |
| 4979 | } | 5000 | } |
| @@ -6485,6 +6506,8 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec) | |||
| 6485 | } | 6506 | } |
| 6486 | } | 6507 | } |
| 6487 | 6508 | ||
| 6509 | #define alc260_auto_init_input_src alc880_auto_init_input_src | ||
| 6510 | |||
| 6488 | /* | 6511 | /* |
| 6489 | * generic initialization of ADC, input mixers and output mixers | 6512 | * generic initialization of ADC, input mixers and output mixers |
| 6490 | */ | 6513 | */ |
| @@ -6571,6 +6594,7 @@ static void alc260_auto_init(struct hda_codec *codec) | |||
| 6571 | struct alc_spec *spec = codec->spec; | 6594 | struct alc_spec *spec = codec->spec; |
| 6572 | alc260_auto_init_multi_out(codec); | 6595 | alc260_auto_init_multi_out(codec); |
| 6573 | alc260_auto_init_analog_input(codec); | 6596 | alc260_auto_init_analog_input(codec); |
| 6597 | alc260_auto_init_input_src(codec); | ||
| 6574 | if (spec->unsol_event) | 6598 | if (spec->unsol_event) |
| 6575 | alc_inithook(codec); | 6599 | alc_inithook(codec); |
| 6576 | } | 6600 | } |
| @@ -8543,6 +8567,42 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |||
| 8543 | { } /* end */ | 8567 | { } /* end */ |
| 8544 | }; | 8568 | }; |
| 8545 | 8569 | ||
| 8570 | static struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = { | ||
| 8571 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
| 8572 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
| 8573 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
| 8574 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | ||
| 8575 | HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT), | ||
| 8576 | HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT), | ||
| 8577 | { } /* end */ | ||
| 8578 | }; | ||
| 8579 | |||
| 8580 | static struct hda_verb alc883_medion_wim2160_verbs[] = { | ||
| 8581 | /* Unmute front mixer */ | ||
| 8582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
| 8583 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
| 8584 | |||
| 8585 | /* Set speaker pin to front mixer */ | ||
| 8586 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8587 | |||
| 8588 | /* Init headphone pin */ | ||
| 8589 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
| 8590 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
| 8591 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
| 8592 | {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
| 8593 | |||
| 8594 | { } /* end */ | ||
| 8595 | }; | ||
| 8596 | |||
| 8597 | /* toggle speaker-output according to the hp-jack state */ | ||
| 8598 | static void alc883_medion_wim2160_setup(struct hda_codec *codec) | ||
| 8599 | { | ||
| 8600 | struct alc_spec *spec = codec->spec; | ||
| 8601 | |||
| 8602 | spec->autocfg.hp_pins[0] = 0x1a; | ||
| 8603 | spec->autocfg.speaker_pins[0] = 0x15; | ||
| 8604 | } | ||
| 8605 | |||
| 8546 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | 8606 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
| 8547 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 8607 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8548 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 8608 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| @@ -9252,6 +9312,7 @@ static const char *alc882_models[ALC882_MODEL_LAST] = { | |||
| 9252 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", | 9312 | [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g", |
| 9253 | [ALC883_MEDION] = "medion", | 9313 | [ALC883_MEDION] = "medion", |
| 9254 | [ALC883_MEDION_MD2] = "medion-md2", | 9314 | [ALC883_MEDION_MD2] = "medion-md2", |
| 9315 | [ALC883_MEDION_WIM2160] = "medion-wim2160", | ||
| 9255 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", | 9316 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
| 9256 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | 9317 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
| 9257 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | 9318 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| @@ -9906,6 +9967,21 @@ static struct alc_config_preset alc882_presets[] = { | |||
| 9906 | .setup = alc883_medion_md2_setup, | 9967 | .setup = alc883_medion_md2_setup, |
| 9907 | .init_hook = alc_automute_amp, | 9968 | .init_hook = alc_automute_amp, |
| 9908 | }, | 9969 | }, |
| 9970 | [ALC883_MEDION_WIM2160] = { | ||
| 9971 | .mixers = { alc883_medion_wim2160_mixer }, | ||
| 9972 | .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs }, | ||
| 9973 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
| 9974 | .dac_nids = alc883_dac_nids, | ||
| 9975 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
| 9976 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
| 9977 | .adc_nids = alc883_adc_nids, | ||
| 9978 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
| 9979 | .channel_mode = alc883_3ST_2ch_modes, | ||
| 9980 | .input_mux = &alc883_capture_source, | ||
| 9981 | .unsol_event = alc_automute_amp_unsol_event, | ||
| 9982 | .setup = alc883_medion_wim2160_setup, | ||
| 9983 | .init_hook = alc_automute_amp, | ||
| 9984 | }, | ||
| 9909 | [ALC883_LAPTOP_EAPD] = { | 9985 | [ALC883_LAPTOP_EAPD] = { |
| 9910 | .mixers = { alc883_base_mixer }, | 9986 | .mixers = { alc883_base_mixer }, |
| 9911 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | 9987 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| @@ -12915,6 +12991,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, | |||
| 12915 | dac = 0x02; | 12991 | dac = 0x02; |
| 12916 | break; | 12992 | break; |
| 12917 | case 0x15: | 12993 | case 0x15: |
| 12994 | case 0x21: /* ALC269vb has this pin, too */ | ||
| 12918 | dac = 0x03; | 12995 | dac = 0x03; |
| 12919 | break; | 12996 | break; |
| 12920 | default: | 12997 | default: |
| @@ -13834,19 +13911,19 @@ static void alc269_laptop_unsol_event(struct hda_codec *codec, | |||
| 13834 | } | 13911 | } |
| 13835 | } | 13912 | } |
| 13836 | 13913 | ||
| 13837 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) | 13914 | static void alc269_laptop_amic_setup(struct hda_codec *codec) |
| 13838 | { | 13915 | { |
| 13839 | struct alc_spec *spec = codec->spec; | 13916 | struct alc_spec *spec = codec->spec; |
| 13840 | spec->autocfg.hp_pins[0] = 0x15; | 13917 | spec->autocfg.hp_pins[0] = 0x15; |
| 13841 | spec->autocfg.speaker_pins[0] = 0x14; | 13918 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13842 | spec->ext_mic.pin = 0x18; | 13919 | spec->ext_mic.pin = 0x18; |
| 13843 | spec->ext_mic.mux_idx = 0; | 13920 | spec->ext_mic.mux_idx = 0; |
| 13844 | spec->int_mic.pin = 0x12; | 13921 | spec->int_mic.pin = 0x19; |
| 13845 | spec->int_mic.mux_idx = 5; | 13922 | spec->int_mic.mux_idx = 1; |
| 13846 | spec->auto_mic = 1; | 13923 | spec->auto_mic = 1; |
| 13847 | } | 13924 | } |
| 13848 | 13925 | ||
| 13849 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | 13926 | static void alc269_laptop_dmic_setup(struct hda_codec *codec) |
| 13850 | { | 13927 | { |
| 13851 | struct alc_spec *spec = codec->spec; | 13928 | struct alc_spec *spec = codec->spec; |
| 13852 | spec->autocfg.hp_pins[0] = 0x15; | 13929 | spec->autocfg.hp_pins[0] = 0x15; |
| @@ -13854,14 +13931,14 @@ static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | |||
| 13854 | spec->ext_mic.pin = 0x18; | 13931 | spec->ext_mic.pin = 0x18; |
| 13855 | spec->ext_mic.mux_idx = 0; | 13932 | spec->ext_mic.mux_idx = 0; |
| 13856 | spec->int_mic.pin = 0x12; | 13933 | spec->int_mic.pin = 0x12; |
| 13857 | spec->int_mic.mux_idx = 6; | 13934 | spec->int_mic.mux_idx = 5; |
| 13858 | spec->auto_mic = 1; | 13935 | spec->auto_mic = 1; |
| 13859 | } | 13936 | } |
| 13860 | 13937 | ||
| 13861 | static void alc269_laptop_amic_setup(struct hda_codec *codec) | 13938 | static void alc269vb_laptop_amic_setup(struct hda_codec *codec) |
| 13862 | { | 13939 | { |
| 13863 | struct alc_spec *spec = codec->spec; | 13940 | struct alc_spec *spec = codec->spec; |
| 13864 | spec->autocfg.hp_pins[0] = 0x15; | 13941 | spec->autocfg.hp_pins[0] = 0x21; |
| 13865 | spec->autocfg.speaker_pins[0] = 0x14; | 13942 | spec->autocfg.speaker_pins[0] = 0x14; |
| 13866 | spec->ext_mic.pin = 0x18; | 13943 | spec->ext_mic.pin = 0x18; |
| 13867 | spec->ext_mic.mux_idx = 0; | 13944 | spec->ext_mic.mux_idx = 0; |
| @@ -13870,6 +13947,18 @@ static void alc269_laptop_amic_setup(struct hda_codec *codec) | |||
| 13870 | spec->auto_mic = 1; | 13947 | spec->auto_mic = 1; |
| 13871 | } | 13948 | } |
| 13872 | 13949 | ||
| 13950 | static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) | ||
| 13951 | { | ||
| 13952 | struct alc_spec *spec = codec->spec; | ||
| 13953 | spec->autocfg.hp_pins[0] = 0x21; | ||
| 13954 | spec->autocfg.speaker_pins[0] = 0x14; | ||
| 13955 | spec->ext_mic.pin = 0x18; | ||
| 13956 | spec->ext_mic.mux_idx = 0; | ||
| 13957 | spec->int_mic.pin = 0x12; | ||
| 13958 | spec->int_mic.mux_idx = 6; | ||
| 13959 | spec->auto_mic = 1; | ||
| 13960 | } | ||
| 13961 | |||
| 13873 | static void alc269_laptop_inithook(struct hda_codec *codec) | 13962 | static void alc269_laptop_inithook(struct hda_codec *codec) |
| 13874 | { | 13963 | { |
| 13875 | alc269_speaker_automute(codec); | 13964 | alc269_speaker_automute(codec); |
| @@ -14236,7 +14325,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
| 14236 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | 14325 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 14237 | .channel_mode = alc269_modes, | 14326 | .channel_mode = alc269_modes, |
| 14238 | .unsol_event = alc269_laptop_unsol_event, | 14327 | .unsol_event = alc269_laptop_unsol_event, |
| 14239 | .setup = alc269_laptop_amic_setup, | 14328 | .setup = alc269vb_laptop_amic_setup, |
| 14240 | .init_hook = alc269_laptop_inithook, | 14329 | .init_hook = alc269_laptop_inithook, |
| 14241 | }, | 14330 | }, |
| 14242 | [ALC269VB_DMIC] = { | 14331 | [ALC269VB_DMIC] = { |
