diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-03-16 12:38:46 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-03-16 12:38:46 -0400 |
commit | 433e8327caf9f7c0432b2f2f6684a5b79cfe18e9 (patch) | |
tree | 515e7bb9b0169fc4f8c1422ef6c926d4bd63e808 /sound/pci/hda/patch_realtek.c | |
parent | 27b92d4ff2be2359a21ff4acde5b63563ff720e2 (diff) | |
parent | cc90fd725e14020607c5a6ba3ea02a0ddec5655f (diff) |
Merge branch 'topic/hda' into for-linus
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 204 |
1 files changed, 79 insertions, 125 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 4261bb8eec1d..639d2746713f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -282,12 +282,6 @@ struct alc_mic_route { | |||
282 | unsigned char amix_idx; | 282 | unsigned char amix_idx; |
283 | }; | 283 | }; |
284 | 284 | ||
285 | struct alc_jack { | ||
286 | hda_nid_t nid; | ||
287 | int type; | ||
288 | struct snd_jack *jack; | ||
289 | }; | ||
290 | |||
291 | #define MUX_IDX_UNDEF ((unsigned char)-1) | 285 | #define MUX_IDX_UNDEF ((unsigned char)-1) |
292 | 286 | ||
293 | struct alc_customize_define { | 287 | struct alc_customize_define { |
@@ -366,9 +360,6 @@ struct alc_spec { | |||
366 | /* PCM information */ | 360 | /* PCM information */ |
367 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ | 361 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
368 | 362 | ||
369 | /* jack detection */ | ||
370 | struct snd_array jacks; | ||
371 | |||
372 | /* dynamic controls, init_verbs and input_mux */ | 363 | /* dynamic controls, init_verbs and input_mux */ |
373 | struct auto_pin_cfg autocfg; | 364 | struct auto_pin_cfg autocfg; |
374 | struct alc_customize_define cdefine; | 365 | struct alc_customize_define cdefine; |
@@ -394,6 +385,7 @@ struct alc_spec { | |||
394 | /* other flags */ | 385 | /* other flags */ |
395 | unsigned int no_analog :1; /* digital I/O only */ | 386 | unsigned int no_analog :1; /* digital I/O only */ |
396 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ | 387 | unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */ |
388 | unsigned int single_input_src:1; | ||
397 | int init_amp; | 389 | int init_amp; |
398 | int codec_variant; /* flag for other variants */ | 390 | int codec_variant; /* flag for other variants */ |
399 | 391 | ||
@@ -1032,94 +1024,32 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |||
1032 | alc_fix_pll(codec); | 1024 | alc_fix_pll(codec); |
1033 | } | 1025 | } |
1034 | 1026 | ||
1035 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
1036 | static void alc_free_jack_priv(struct snd_jack *jack) | ||
1037 | { | ||
1038 | struct alc_jack *jacks = jack->private_data; | ||
1039 | jacks->nid = 0; | ||
1040 | jacks->jack = NULL; | ||
1041 | } | ||
1042 | |||
1043 | static int alc_add_jack(struct hda_codec *codec, | ||
1044 | hda_nid_t nid, int type) | ||
1045 | { | ||
1046 | struct alc_spec *spec; | ||
1047 | struct alc_jack *jack; | ||
1048 | const char *name; | ||
1049 | int err; | ||
1050 | |||
1051 | spec = codec->spec; | ||
1052 | snd_array_init(&spec->jacks, sizeof(*jack), 32); | ||
1053 | jack = snd_array_new(&spec->jacks); | ||
1054 | if (!jack) | ||
1055 | return -ENOMEM; | ||
1056 | |||
1057 | jack->nid = nid; | ||
1058 | jack->type = type; | ||
1059 | name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; | ||
1060 | |||
1061 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); | ||
1062 | if (err < 0) | ||
1063 | return err; | ||
1064 | jack->jack->private_data = jack; | ||
1065 | jack->jack->private_free = alc_free_jack_priv; | ||
1066 | return 0; | ||
1067 | } | ||
1068 | |||
1069 | static void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) | ||
1070 | { | ||
1071 | struct alc_spec *spec = codec->spec; | ||
1072 | struct alc_jack *jacks = spec->jacks.list; | ||
1073 | |||
1074 | if (jacks) { | ||
1075 | int i; | ||
1076 | for (i = 0; i < spec->jacks.used; i++) { | ||
1077 | if (jacks->nid == nid) { | ||
1078 | unsigned int present; | ||
1079 | present = snd_hda_jack_detect(codec, nid); | ||
1080 | |||
1081 | present = (present) ? jacks->type : 0; | ||
1082 | |||
1083 | snd_jack_report(jacks->jack, present); | ||
1084 | } | ||
1085 | jacks++; | ||
1086 | } | ||
1087 | } | ||
1088 | } | ||
1089 | |||
1090 | static int alc_init_jacks(struct hda_codec *codec) | 1027 | static int alc_init_jacks(struct hda_codec *codec) |
1091 | { | 1028 | { |
1029 | #ifdef CONFIG_SND_HDA_INPUT_JACK | ||
1092 | struct alc_spec *spec = codec->spec; | 1030 | struct alc_spec *spec = codec->spec; |
1093 | int err; | 1031 | int err; |
1094 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; | 1032 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
1095 | unsigned int mic_nid = spec->ext_mic.pin; | 1033 | unsigned int mic_nid = spec->ext_mic.pin; |
1096 | 1034 | ||
1097 | if (hp_nid) { | 1035 | if (hp_nid) { |
1098 | err = alc_add_jack(codec, hp_nid, SND_JACK_HEADPHONE); | 1036 | err = snd_hda_input_jack_add(codec, hp_nid, |
1037 | SND_JACK_HEADPHONE, NULL); | ||
1099 | if (err < 0) | 1038 | if (err < 0) |
1100 | return err; | 1039 | return err; |
1101 | alc_report_jack(codec, hp_nid); | 1040 | snd_hda_input_jack_report(codec, hp_nid); |
1102 | } | 1041 | } |
1103 | 1042 | ||
1104 | if (mic_nid) { | 1043 | if (mic_nid) { |
1105 | err = alc_add_jack(codec, mic_nid, SND_JACK_MICROPHONE); | 1044 | err = snd_hda_input_jack_add(codec, mic_nid, |
1045 | SND_JACK_MICROPHONE, NULL); | ||
1106 | if (err < 0) | 1046 | if (err < 0) |
1107 | return err; | 1047 | return err; |
1108 | alc_report_jack(codec, mic_nid); | 1048 | snd_hda_input_jack_report(codec, mic_nid); |
1109 | } | 1049 | } |
1110 | 1050 | #endif /* CONFIG_SND_HDA_INPUT_JACK */ | |
1111 | return 0; | ||
1112 | } | ||
1113 | #else | ||
1114 | static inline void alc_report_jack(struct hda_codec *codec, hda_nid_t nid) | ||
1115 | { | ||
1116 | } | ||
1117 | |||
1118 | static inline int alc_init_jacks(struct hda_codec *codec) | ||
1119 | { | ||
1120 | return 0; | 1051 | return 0; |
1121 | } | 1052 | } |
1122 | #endif | ||
1123 | 1053 | ||
1124 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) | 1054 | static void alc_automute_speaker(struct hda_codec *codec, int pinctl) |
1125 | { | 1055 | { |
@@ -1133,7 +1063,7 @@ static void alc_automute_speaker(struct hda_codec *codec, int pinctl) | |||
1133 | nid = spec->autocfg.hp_pins[i]; | 1063 | nid = spec->autocfg.hp_pins[i]; |
1134 | if (!nid) | 1064 | if (!nid) |
1135 | break; | 1065 | break; |
1136 | alc_report_jack(codec, nid); | 1066 | snd_hda_input_jack_report(codec, nid); |
1137 | spec->jack_present |= snd_hda_jack_detect(codec, nid); | 1067 | spec->jack_present |= snd_hda_jack_detect(codec, nid); |
1138 | } | 1068 | } |
1139 | 1069 | ||
@@ -1240,7 +1170,7 @@ static void alc_mic_automute(struct hda_codec *codec) | |||
1240 | AC_VERB_SET_CONNECT_SEL, | 1170 | AC_VERB_SET_CONNECT_SEL, |
1241 | alive->mux_idx); | 1171 | alive->mux_idx); |
1242 | } | 1172 | } |
1243 | alc_report_jack(codec, spec->ext_mic.pin); | 1173 | snd_hda_input_jack_report(codec, spec->ext_mic.pin); |
1244 | 1174 | ||
1245 | /* FIXME: analog mixer */ | 1175 | /* FIXME: analog mixer */ |
1246 | } | 1176 | } |
@@ -2292,13 +2222,13 @@ static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { | |||
2292 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 2222 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
2293 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | 2223 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
2294 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | 2224 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
2295 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0f, 2, 0x0, | 2225 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
2296 | HDA_OUTPUT), | 2226 | HDA_OUTPUT), |
2297 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0f, 2, 2, HDA_INPUT), | 2227 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
2298 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), | 2228 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
2299 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), | 2229 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
2300 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | 2230 | HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT), |
2301 | HDA_BIND_MUTE("Side Playback Switch", 0x0e, 2, HDA_INPUT), | 2231 | HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT), |
2302 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 2232 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
2303 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 2233 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
2304 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | 2234 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
@@ -2309,7 +2239,6 @@ static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = { | |||
2309 | { } /* end */ | 2239 | { } /* end */ |
2310 | }; | 2240 | }; |
2311 | 2241 | ||
2312 | |||
2313 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | 2242 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { |
2314 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 2243 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
2315 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | 2244 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
@@ -3919,6 +3848,8 @@ static struct hda_amp_list alc880_lg_loopbacks[] = { | |||
3919 | * Common callbacks | 3848 | * Common callbacks |
3920 | */ | 3849 | */ |
3921 | 3850 | ||
3851 | static void alc_init_special_input_src(struct hda_codec *codec); | ||
3852 | |||
3922 | static int alc_init(struct hda_codec *codec) | 3853 | static int alc_init(struct hda_codec *codec) |
3923 | { | 3854 | { |
3924 | struct alc_spec *spec = codec->spec; | 3855 | struct alc_spec *spec = codec->spec; |
@@ -3929,6 +3860,7 @@ static int alc_init(struct hda_codec *codec) | |||
3929 | 3860 | ||
3930 | for (i = 0; i < spec->num_init_verbs; i++) | 3861 | for (i = 0; i < spec->num_init_verbs; i++) |
3931 | snd_hda_sequence_write(codec, spec->init_verbs[i]); | 3862 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
3863 | alc_init_special_input_src(codec); | ||
3932 | 3864 | ||
3933 | if (spec->init_hook) | 3865 | if (spec->init_hook) |
3934 | spec->init_hook(codec); | 3866 | spec->init_hook(codec); |
@@ -4284,6 +4216,7 @@ static void alc_free(struct hda_codec *codec) | |||
4284 | return; | 4216 | return; |
4285 | 4217 | ||
4286 | alc_shutup(codec); | 4218 | alc_shutup(codec); |
4219 | snd_hda_input_jack_free(codec); | ||
4287 | alc_free_kctls(codec); | 4220 | alc_free_kctls(codec); |
4288 | kfree(spec); | 4221 | kfree(spec); |
4289 | snd_hda_detach_beep_device(codec); | 4222 | snd_hda_detach_beep_device(codec); |
@@ -5151,7 +5084,9 @@ static const char *alc_get_line_out_pfx(const struct auto_pin_cfg *cfg, | |||
5151 | 5084 | ||
5152 | switch (cfg->line_out_type) { | 5085 | switch (cfg->line_out_type) { |
5153 | case AUTO_PIN_SPEAKER_OUT: | 5086 | case AUTO_PIN_SPEAKER_OUT: |
5154 | return "Speaker"; | 5087 | if (cfg->line_outs == 1) |
5088 | return "Speaker"; | ||
5089 | break; | ||
5155 | case AUTO_PIN_HP_OUT: | 5090 | case AUTO_PIN_HP_OUT: |
5156 | return "Headphone"; | 5091 | return "Headphone"; |
5157 | default: | 5092 | default: |
@@ -5205,16 +5140,19 @@ static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5205 | return err; | 5140 | return err; |
5206 | } else { | 5141 | } else { |
5207 | const char *name = pfx; | 5142 | const char *name = pfx; |
5208 | if (!name) | 5143 | int index = i; |
5144 | if (!name) { | ||
5209 | name = chname[i]; | 5145 | name = chname[i]; |
5146 | index = 0; | ||
5147 | } | ||
5210 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, | 5148 | err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, |
5211 | name, i, | 5149 | name, index, |
5212 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, | 5150 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
5213 | HDA_OUTPUT)); | 5151 | HDA_OUTPUT)); |
5214 | if (err < 0) | 5152 | if (err < 0) |
5215 | return err; | 5153 | return err; |
5216 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, | 5154 | err = __add_pb_sw_ctrl(spec, ALC_CTL_BIND_MUTE, |
5217 | name, i, | 5155 | name, index, |
5218 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | 5156 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
5219 | HDA_INPUT)); | 5157 | HDA_INPUT)); |
5220 | if (err < 0) | 5158 | if (err < 0) |
@@ -5585,6 +5523,7 @@ static void fixup_single_adc(struct hda_codec *codec) | |||
5585 | spec->capsrc_nids += i; | 5523 | spec->capsrc_nids += i; |
5586 | spec->adc_nids += i; | 5524 | spec->adc_nids += i; |
5587 | spec->num_adc_nids = 1; | 5525 | spec->num_adc_nids = 1; |
5526 | spec->single_input_src = 1; | ||
5588 | } | 5527 | } |
5589 | } | 5528 | } |
5590 | 5529 | ||
@@ -5596,6 +5535,16 @@ static void fixup_dual_adc_switch(struct hda_codec *codec) | |||
5596 | init_capsrc_for_pin(codec, spec->int_mic.pin); | 5535 | init_capsrc_for_pin(codec, spec->int_mic.pin); |
5597 | } | 5536 | } |
5598 | 5537 | ||
5538 | /* initialize some special cases for input sources */ | ||
5539 | static void alc_init_special_input_src(struct hda_codec *codec) | ||
5540 | { | ||
5541 | struct alc_spec *spec = codec->spec; | ||
5542 | if (spec->dual_adc_switch) | ||
5543 | fixup_dual_adc_switch(codec); | ||
5544 | else if (spec->single_input_src) | ||
5545 | init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin); | ||
5546 | } | ||
5547 | |||
5599 | static void set_capture_mixer(struct hda_codec *codec) | 5548 | static void set_capture_mixer(struct hda_codec *codec) |
5600 | { | 5549 | { |
5601 | struct alc_spec *spec = codec->spec; | 5550 | struct alc_spec *spec = codec->spec; |
@@ -5611,7 +5560,7 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
5611 | int mux = 0; | 5560 | int mux = 0; |
5612 | int num_adcs = spec->num_adc_nids; | 5561 | int num_adcs = spec->num_adc_nids; |
5613 | if (spec->dual_adc_switch) | 5562 | if (spec->dual_adc_switch) |
5614 | fixup_dual_adc_switch(codec); | 5563 | num_adcs = 1; |
5615 | else if (spec->auto_mic) | 5564 | else if (spec->auto_mic) |
5616 | fixup_automic_adc(codec); | 5565 | fixup_automic_adc(codec); |
5617 | else if (spec->input_mux) { | 5566 | else if (spec->input_mux) { |
@@ -5620,8 +5569,6 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
5620 | else if (spec->input_mux->num_items == 1) | 5569 | else if (spec->input_mux->num_items == 1) |
5621 | fixup_single_adc(codec); | 5570 | fixup_single_adc(codec); |
5622 | } | 5571 | } |
5623 | if (spec->dual_adc_switch) | ||
5624 | num_adcs = 1; | ||
5625 | spec->cap_mixer = caps[mux][num_adcs - 1]; | 5572 | spec->cap_mixer = caps[mux][num_adcs - 1]; |
5626 | } | 5573 | } |
5627 | } | 5574 | } |
@@ -10748,6 +10695,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
10748 | */ | 10695 | */ |
10749 | enum { | 10696 | enum { |
10750 | PINFIX_ABIT_AW9D_MAX, | 10697 | PINFIX_ABIT_AW9D_MAX, |
10698 | PINFIX_LENOVO_Y530, | ||
10751 | PINFIX_PB_M5210, | 10699 | PINFIX_PB_M5210, |
10752 | PINFIX_ACER_ASPIRE_7736, | 10700 | PINFIX_ACER_ASPIRE_7736, |
10753 | }; | 10701 | }; |
@@ -10762,6 +10710,14 @@ static const struct alc_fixup alc882_fixups[] = { | |||
10762 | { } | 10710 | { } |
10763 | } | 10711 | } |
10764 | }, | 10712 | }, |
10713 | [PINFIX_LENOVO_Y530] = { | ||
10714 | .type = ALC_FIXUP_PINS, | ||
10715 | .v.pins = (const struct alc_pincfg[]) { | ||
10716 | { 0x15, 0x99130112 }, /* rear int speakers */ | ||
10717 | { 0x16, 0x99130111 }, /* subwoofer */ | ||
10718 | { } | ||
10719 | } | ||
10720 | }, | ||
10765 | [PINFIX_PB_M5210] = { | 10721 | [PINFIX_PB_M5210] = { |
10766 | .type = ALC_FIXUP_VERBS, | 10722 | .type = ALC_FIXUP_VERBS, |
10767 | .v.verbs = (const struct hda_verb[]) { | 10723 | .v.verbs = (const struct hda_verb[]) { |
@@ -10777,6 +10733,7 @@ static const struct alc_fixup alc882_fixups[] = { | |||
10777 | 10733 | ||
10778 | static struct snd_pci_quirk alc882_fixup_tbl[] = { | 10734 | static struct snd_pci_quirk alc882_fixup_tbl[] = { |
10779 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), | 10735 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), |
10736 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), | ||
10780 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), | 10737 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
10781 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), | 10738 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), |
10782 | {} | 10739 | {} |
@@ -10829,23 +10786,28 @@ static void alc882_auto_init_hp_out(struct hda_codec *codec) | |||
10829 | hda_nid_t pin, dac; | 10786 | hda_nid_t pin, dac; |
10830 | int i; | 10787 | int i; |
10831 | 10788 | ||
10832 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { | 10789 | if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) { |
10833 | pin = spec->autocfg.hp_pins[i]; | 10790 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) { |
10834 | if (!pin) | 10791 | pin = spec->autocfg.hp_pins[i]; |
10835 | break; | 10792 | if (!pin) |
10836 | dac = spec->multiout.hp_nid; | 10793 | break; |
10837 | if (!dac) | 10794 | dac = spec->multiout.hp_nid; |
10838 | dac = spec->multiout.dac_nids[0]; /* to front */ | 10795 | if (!dac) |
10839 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | 10796 | dac = spec->multiout.dac_nids[0]; /* to front */ |
10797 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac); | ||
10798 | } | ||
10840 | } | 10799 | } |
10841 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { | 10800 | |
10842 | pin = spec->autocfg.speaker_pins[i]; | 10801 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) { |
10843 | if (!pin) | 10802 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) { |
10844 | break; | 10803 | pin = spec->autocfg.speaker_pins[i]; |
10845 | dac = spec->multiout.extra_out_nid[0]; | 10804 | if (!pin) |
10846 | if (!dac) | 10805 | break; |
10847 | dac = spec->multiout.dac_nids[0]; /* to front */ | 10806 | dac = spec->multiout.extra_out_nid[0]; |
10848 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | 10807 | if (!dac) |
10808 | dac = spec->multiout.dac_nids[0]; /* to front */ | ||
10809 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac); | ||
10810 | } | ||
10849 | } | 10811 | } |
10850 | } | 10812 | } |
10851 | 10813 | ||
@@ -13796,6 +13758,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
13796 | } | 13758 | } |
13797 | 13759 | ||
13798 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input | 13760 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
13761 | #define alc268_auto_init_input_src alc882_auto_init_input_src | ||
13799 | 13762 | ||
13800 | /* init callback for auto-configuration model -- overriding the default init */ | 13763 | /* init callback for auto-configuration model -- overriding the default init */ |
13801 | static void alc268_auto_init(struct hda_codec *codec) | 13764 | static void alc268_auto_init(struct hda_codec *codec) |
@@ -13805,6 +13768,7 @@ static void alc268_auto_init(struct hda_codec *codec) | |||
13805 | alc268_auto_init_hp_out(codec); | 13768 | alc268_auto_init_hp_out(codec); |
13806 | alc268_auto_init_mono_speaker_out(codec); | 13769 | alc268_auto_init_mono_speaker_out(codec); |
13807 | alc268_auto_init_analog_input(codec); | 13770 | alc268_auto_init_analog_input(codec); |
13771 | alc268_auto_init_input_src(codec); | ||
13808 | alc_auto_init_digital(codec); | 13772 | alc_auto_init_digital(codec); |
13809 | if (spec->unsol_event) | 13773 | if (spec->unsol_event) |
13810 | alc_inithook(codec); | 13774 | alc_inithook(codec); |
@@ -14092,7 +14056,6 @@ static int patch_alc268(struct hda_codec *codec) | |||
14092 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { | 14056 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
14093 | /* check whether NID 0x07 is valid */ | 14057 | /* check whether NID 0x07 is valid */ |
14094 | unsigned int wcap = get_wcaps(codec, 0x07); | 14058 | unsigned int wcap = get_wcaps(codec, 0x07); |
14095 | int i; | ||
14096 | 14059 | ||
14097 | spec->capsrc_nids = alc268_capsrc_nids; | 14060 | spec->capsrc_nids = alc268_capsrc_nids; |
14098 | /* get type */ | 14061 | /* get type */ |
@@ -14112,13 +14075,6 @@ static int patch_alc268(struct hda_codec *codec) | |||
14112 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | 14075 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
14113 | add_mixer(spec, alc268_capture_mixer); | 14076 | add_mixer(spec, alc268_capture_mixer); |
14114 | } | 14077 | } |
14115 | /* set default input source */ | ||
14116 | for (i = 0; i < spec->num_adc_nids; i++) | ||
14117 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], | ||
14118 | 0, AC_VERB_SET_CONNECT_SEL, | ||
14119 | i < spec->num_mux_defs ? | ||
14120 | spec->input_mux[i].items[0].index : | ||
14121 | spec->input_mux->items[0].index); | ||
14122 | } | 14078 | } |
14123 | 14079 | ||
14124 | spec->vmaster_nid = 0x02; | 14080 | spec->vmaster_nid = 0x02; |
@@ -14495,7 +14451,7 @@ static void alc269_speaker_automute(struct hda_codec *codec) | |||
14495 | HDA_AMP_MUTE, bits); | 14451 | HDA_AMP_MUTE, bits); |
14496 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 14452 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
14497 | HDA_AMP_MUTE, bits); | 14453 | HDA_AMP_MUTE, bits); |
14498 | alc_report_jack(codec, nid); | 14454 | snd_hda_input_jack_report(codec, nid); |
14499 | } | 14455 | } |
14500 | 14456 | ||
14501 | /* unsolicited event for HP jack sensing */ | 14457 | /* unsolicited event for HP jack sensing */ |
@@ -14807,11 +14763,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
14807 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | 14763 | fillup_priv_adc_nids(codec, alc269_adc_candidates, |
14808 | sizeof(alc269_adc_candidates)); | 14764 | sizeof(alc269_adc_candidates)); |
14809 | 14765 | ||
14810 | /* set default input source */ | ||
14811 | if (!spec->dual_adc_switch) | ||
14812 | select_or_unmute_capsrc(codec, spec->capsrc_nids[0], | ||
14813 | spec->input_mux->items[0].index); | ||
14814 | |||
14815 | err = alc_auto_add_mic_boost(codec); | 14766 | err = alc_auto_add_mic_boost(codec); |
14816 | if (err < 0) | 14767 | if (err < 0) |
14817 | return err; | 14768 | return err; |
@@ -14825,6 +14776,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
14825 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out | 14776 | #define alc269_auto_init_multi_out alc268_auto_init_multi_out |
14826 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out | 14777 | #define alc269_auto_init_hp_out alc268_auto_init_hp_out |
14827 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input | 14778 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
14779 | #define alc269_auto_init_input_src alc882_auto_init_input_src | ||
14828 | 14780 | ||
14829 | 14781 | ||
14830 | /* init callback for auto-configuration model -- overriding the default init */ | 14782 | /* init callback for auto-configuration model -- overriding the default init */ |
@@ -14834,6 +14786,8 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
14834 | alc269_auto_init_multi_out(codec); | 14786 | alc269_auto_init_multi_out(codec); |
14835 | alc269_auto_init_hp_out(codec); | 14787 | alc269_auto_init_hp_out(codec); |
14836 | alc269_auto_init_analog_input(codec); | 14788 | alc269_auto_init_analog_input(codec); |
14789 | if (!spec->dual_adc_switch) | ||
14790 | alc269_auto_init_input_src(codec); | ||
14837 | alc_auto_init_digital(codec); | 14791 | alc_auto_init_digital(codec); |
14838 | if (spec->unsol_event) | 14792 | if (spec->unsol_event) |
14839 | alc_inithook(codec); | 14793 | alc_inithook(codec); |