diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 216 |
1 files changed, 42 insertions, 174 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 3a735870a071..f1fa1d249369 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -238,6 +238,7 @@ struct alc_spec { | |||
238 | /* capture */ | 238 | /* capture */ |
239 | unsigned int num_adc_nids; | 239 | unsigned int num_adc_nids; |
240 | hda_nid_t *adc_nids; | 240 | hda_nid_t *adc_nids; |
241 | hda_nid_t *capsrc_nids; | ||
241 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | 242 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
242 | 243 | ||
243 | /* capture source */ | 244 | /* capture source */ |
@@ -291,6 +292,7 @@ struct alc_config_preset { | |||
291 | hda_nid_t hp_nid; /* optional */ | 292 | hda_nid_t hp_nid; /* optional */ |
292 | unsigned int num_adc_nids; | 293 | unsigned int num_adc_nids; |
293 | hda_nid_t *adc_nids; | 294 | hda_nid_t *adc_nids; |
295 | hda_nid_t *capsrc_nids; | ||
294 | hda_nid_t dig_in_nid; | 296 | hda_nid_t dig_in_nid; |
295 | unsigned int num_channel_mode; | 297 | unsigned int num_channel_mode; |
296 | const struct hda_channel_mode *channel_mode; | 298 | const struct hda_channel_mode *channel_mode; |
@@ -337,9 +339,10 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
337 | struct alc_spec *spec = codec->spec; | 339 | struct alc_spec *spec = codec->spec; |
338 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 340 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
339 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | 341 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
342 | hda_nid_t nid = spec->capsrc_nids ? | ||
343 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; | ||
340 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, | 344 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
341 | spec->adc_nids[adc_idx], | 345 | nid, &spec->cur_mux[adc_idx]); |
342 | &spec->cur_mux[adc_idx]); | ||
343 | } | 346 | } |
344 | 347 | ||
345 | 348 | ||
@@ -708,6 +711,7 @@ static void setup_preset(struct alc_spec *spec, | |||
708 | 711 | ||
709 | spec->num_adc_nids = preset->num_adc_nids; | 712 | spec->num_adc_nids = preset->num_adc_nids; |
710 | spec->adc_nids = preset->adc_nids; | 713 | spec->adc_nids = preset->adc_nids; |
714 | spec->capsrc_nids = preset->capsrc_nids; | ||
711 | spec->dig_in_nid = preset->dig_in_nid; | 715 | spec->dig_in_nid = preset->dig_in_nid; |
712 | 716 | ||
713 | spec->unsol_event = preset->unsol_event; | 717 | spec->unsol_event = preset->unsol_event; |
@@ -5219,6 +5223,9 @@ static hda_nid_t alc882_dac_nids[4] = { | |||
5219 | #define alc882_adc_nids alc880_adc_nids | 5223 | #define alc882_adc_nids alc880_adc_nids |
5220 | #define alc882_adc_nids_alt alc880_adc_nids_alt | 5224 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
5221 | 5225 | ||
5226 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; | ||
5227 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; | ||
5228 | |||
5222 | /* input MUX */ | 5229 | /* input MUX */ |
5223 | /* FIXME: should be a matrix-type input source selection */ | 5230 | /* FIXME: should be a matrix-type input source selection */ |
5224 | 5231 | ||
@@ -5241,15 +5248,10 @@ static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
5241 | struct alc_spec *spec = codec->spec; | 5248 | struct alc_spec *spec = codec->spec; |
5242 | const struct hda_input_mux *imux = spec->input_mux; | 5249 | const struct hda_input_mux *imux = spec->input_mux; |
5243 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 5250 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
5244 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; | 5251 | hda_nid_t nid = spec->capsrc_nids[adc_idx]; |
5245 | hda_nid_t nid; | ||
5246 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | 5252 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
5247 | unsigned int i, idx; | 5253 | unsigned int i, idx; |
5248 | 5254 | ||
5249 | if (spec->num_adc_nids < 3) | ||
5250 | nid = capture_mixers[adc_idx + 1]; | ||
5251 | else | ||
5252 | nid = capture_mixers[adc_idx]; | ||
5253 | idx = ucontrol->value.enumerated.item[0]; | 5255 | idx = ucontrol->value.enumerated.item[0]; |
5254 | if (idx >= imux->num_items) | 5256 | if (idx >= imux->num_items) |
5255 | idx = imux->num_items - 1; | 5257 | idx = imux->num_items - 1; |
@@ -6126,6 +6128,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
6126 | .dig_out_nid = ALC882_DIGOUT_NID, | 6128 | .dig_out_nid = ALC882_DIGOUT_NID, |
6127 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | 6129 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
6128 | .adc_nids = alc882_adc_nids, | 6130 | .adc_nids = alc882_adc_nids, |
6131 | .capsrc_nids = alc882_capsrc_nids, | ||
6129 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | 6132 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6130 | .channel_mode = alc882_3ST_6ch_modes, | 6133 | .channel_mode = alc882_3ST_6ch_modes, |
6131 | .need_dac_fix = 1, | 6134 | .need_dac_fix = 1, |
@@ -6142,6 +6145,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
6142 | .dig_out_nid = ALC882_DIGOUT_NID, | 6145 | .dig_out_nid = ALC882_DIGOUT_NID, |
6143 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), | 6146 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
6144 | .adc_nids = alc882_adc_nids, | 6147 | .adc_nids = alc882_adc_nids, |
6148 | .capsrc_nids = alc882_capsrc_nids, | ||
6145 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), | 6149 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
6146 | .channel_mode = alc882_3ST_6ch_modes, | 6150 | .channel_mode = alc882_3ST_6ch_modes, |
6147 | .need_dac_fix = 1, | 6151 | .need_dac_fix = 1, |
@@ -6387,12 +6391,14 @@ static int patch_alc882(struct hda_codec *codec) | |||
6387 | if (wcap != AC_WID_AUD_IN) { | 6391 | if (wcap != AC_WID_AUD_IN) { |
6388 | spec->adc_nids = alc882_adc_nids_alt; | 6392 | spec->adc_nids = alc882_adc_nids_alt; |
6389 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); | 6393 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
6394 | spec->capsrc_nids = alc882_capsrc_nids_alt; | ||
6390 | spec->mixers[spec->num_mixers] = | 6395 | spec->mixers[spec->num_mixers] = |
6391 | alc882_capture_alt_mixer; | 6396 | alc882_capture_alt_mixer; |
6392 | spec->num_mixers++; | 6397 | spec->num_mixers++; |
6393 | } else { | 6398 | } else { |
6394 | spec->adc_nids = alc882_adc_nids; | 6399 | spec->adc_nids = alc882_adc_nids; |
6395 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); | 6400 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
6401 | spec->capsrc_nids = alc882_capsrc_nids; | ||
6396 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; | 6402 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
6397 | spec->num_mixers++; | 6403 | spec->num_mixers++; |
6398 | } | 6404 | } |
@@ -6435,6 +6441,8 @@ static hda_nid_t alc883_adc_nids[2] = { | |||
6435 | 0x08, 0x09, | 6441 | 0x08, 0x09, |
6436 | }; | 6442 | }; |
6437 | 6443 | ||
6444 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; | ||
6445 | |||
6438 | /* input MUX */ | 6446 | /* input MUX */ |
6439 | /* FIXME: should be a matrix-type input source selection */ | 6447 | /* FIXME: should be a matrix-type input source selection */ |
6440 | 6448 | ||
@@ -6468,33 +6476,8 @@ static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { | |||
6468 | 6476 | ||
6469 | #define alc883_mux_enum_info alc_mux_enum_info | 6477 | #define alc883_mux_enum_info alc_mux_enum_info |
6470 | #define alc883_mux_enum_get alc_mux_enum_get | 6478 | #define alc883_mux_enum_get alc_mux_enum_get |
6471 | 6479 | /* ALC883 has the ALC882-type input selection */ | |
6472 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, | 6480 | #define alc883_mux_enum_put alc882_mux_enum_put |
6473 | struct snd_ctl_elem_value *ucontrol) | ||
6474 | { | ||
6475 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
6476 | struct alc_spec *spec = codec->spec; | ||
6477 | const struct hda_input_mux *imux = spec->input_mux; | ||
6478 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
6479 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; | ||
6480 | hda_nid_t nid = capture_mixers[adc_idx]; | ||
6481 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | ||
6482 | unsigned int i, idx; | ||
6483 | |||
6484 | idx = ucontrol->value.enumerated.item[0]; | ||
6485 | if (idx >= imux->num_items) | ||
6486 | idx = imux->num_items - 1; | ||
6487 | if (*cur_val == idx) | ||
6488 | return 0; | ||
6489 | for (i = 0; i < imux->num_items; i++) { | ||
6490 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | ||
6491 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | ||
6492 | imux->items[i].index, | ||
6493 | HDA_AMP_MUTE, v); | ||
6494 | } | ||
6495 | *cur_val = idx; | ||
6496 | return 1; | ||
6497 | } | ||
6498 | 6481 | ||
6499 | /* | 6482 | /* |
6500 | * 2ch mode | 6483 | * 2ch mode |
@@ -7667,8 +7650,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7667 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7650 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7668 | .dac_nids = alc883_dac_nids, | 7651 | .dac_nids = alc883_dac_nids, |
7669 | .dig_out_nid = ALC883_DIGOUT_NID, | 7652 | .dig_out_nid = ALC883_DIGOUT_NID, |
7670 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7671 | .adc_nids = alc883_adc_nids, | ||
7672 | .dig_in_nid = ALC883_DIGIN_NID, | 7653 | .dig_in_nid = ALC883_DIGIN_NID, |
7673 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7654 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7674 | .channel_mode = alc883_3ST_2ch_modes, | 7655 | .channel_mode = alc883_3ST_2ch_modes, |
@@ -7680,8 +7661,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7680 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7661 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7681 | .dac_nids = alc883_dac_nids, | 7662 | .dac_nids = alc883_dac_nids, |
7682 | .dig_out_nid = ALC883_DIGOUT_NID, | 7663 | .dig_out_nid = ALC883_DIGOUT_NID, |
7683 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7684 | .adc_nids = alc883_adc_nids, | ||
7685 | .dig_in_nid = ALC883_DIGIN_NID, | 7664 | .dig_in_nid = ALC883_DIGIN_NID, |
7686 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 7665 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7687 | .channel_mode = alc883_3ST_6ch_modes, | 7666 | .channel_mode = alc883_3ST_6ch_modes, |
@@ -7693,8 +7672,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7693 | .init_verbs = { alc883_init_verbs }, | 7672 | .init_verbs = { alc883_init_verbs }, |
7694 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7673 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7695 | .dac_nids = alc883_dac_nids, | 7674 | .dac_nids = alc883_dac_nids, |
7696 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7697 | .adc_nids = alc883_adc_nids, | ||
7698 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 7675 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7699 | .channel_mode = alc883_3ST_6ch_modes, | 7676 | .channel_mode = alc883_3ST_6ch_modes, |
7700 | .need_dac_fix = 1, | 7677 | .need_dac_fix = 1, |
@@ -7706,8 +7683,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7706 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7683 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7707 | .dac_nids = alc883_dac_nids, | 7684 | .dac_nids = alc883_dac_nids, |
7708 | .dig_out_nid = ALC883_DIGOUT_NID, | 7685 | .dig_out_nid = ALC883_DIGOUT_NID, |
7709 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7710 | .adc_nids = alc883_adc_nids, | ||
7711 | .dig_in_nid = ALC883_DIGIN_NID, | 7686 | .dig_in_nid = ALC883_DIGIN_NID, |
7712 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 7687 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
7713 | .channel_mode = alc883_sixstack_modes, | 7688 | .channel_mode = alc883_sixstack_modes, |
@@ -7719,8 +7694,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7719 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7694 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7720 | .dac_nids = alc883_dac_nids, | 7695 | .dac_nids = alc883_dac_nids, |
7721 | .dig_out_nid = ALC883_DIGOUT_NID, | 7696 | .dig_out_nid = ALC883_DIGOUT_NID, |
7722 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7723 | .adc_nids = alc883_adc_nids, | ||
7724 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 7697 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7725 | .channel_mode = alc883_3ST_6ch_modes, | 7698 | .channel_mode = alc883_3ST_6ch_modes, |
7726 | .need_dac_fix = 1, | 7699 | .need_dac_fix = 1, |
@@ -7734,8 +7707,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7734 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7707 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7735 | .dac_nids = alc883_dac_nids, | 7708 | .dac_nids = alc883_dac_nids, |
7736 | .dig_out_nid = ALC883_DIGOUT_NID, | 7709 | .dig_out_nid = ALC883_DIGOUT_NID, |
7737 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7738 | .adc_nids = alc883_adc_nids, | ||
7739 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7710 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7740 | .channel_mode = alc883_3ST_2ch_modes, | 7711 | .channel_mode = alc883_3ST_2ch_modes, |
7741 | .input_mux = &alc883_capture_source, | 7712 | .input_mux = &alc883_capture_source, |
@@ -7752,8 +7723,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7752 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, | 7723 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
7753 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7724 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7754 | .dac_nids = alc883_dac_nids, | 7725 | .dac_nids = alc883_dac_nids, |
7755 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7756 | .adc_nids = alc883_adc_nids, | ||
7757 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7726 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7758 | .channel_mode = alc883_3ST_2ch_modes, | 7727 | .channel_mode = alc883_3ST_2ch_modes, |
7759 | .input_mux = &alc883_capture_source, | 7728 | .input_mux = &alc883_capture_source, |
@@ -7764,8 +7733,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7764 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7733 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7765 | .dac_nids = alc883_dac_nids, | 7734 | .dac_nids = alc883_dac_nids, |
7766 | .dig_out_nid = ALC883_DIGOUT_NID, | 7735 | .dig_out_nid = ALC883_DIGOUT_NID, |
7767 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7768 | .adc_nids = alc883_adc_nids, | ||
7769 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7736 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7770 | .channel_mode = alc883_3ST_2ch_modes, | 7737 | .channel_mode = alc883_3ST_2ch_modes, |
7771 | .input_mux = &alc883_capture_source, | 7738 | .input_mux = &alc883_capture_source, |
@@ -7779,8 +7746,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7779 | alc883_medion_eapd_verbs }, | 7746 | alc883_medion_eapd_verbs }, |
7780 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7747 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7781 | .dac_nids = alc883_dac_nids, | 7748 | .dac_nids = alc883_dac_nids, |
7782 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7783 | .adc_nids = alc883_adc_nids, | ||
7784 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 7749 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
7785 | .channel_mode = alc883_sixstack_modes, | 7750 | .channel_mode = alc883_sixstack_modes, |
7786 | .input_mux = &alc883_capture_source, | 7751 | .input_mux = &alc883_capture_source, |
@@ -7791,8 +7756,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7791 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7756 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7792 | .dac_nids = alc883_dac_nids, | 7757 | .dac_nids = alc883_dac_nids, |
7793 | .dig_out_nid = ALC883_DIGOUT_NID, | 7758 | .dig_out_nid = ALC883_DIGOUT_NID, |
7794 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7795 | .adc_nids = alc883_adc_nids, | ||
7796 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7759 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7797 | .channel_mode = alc883_3ST_2ch_modes, | 7760 | .channel_mode = alc883_3ST_2ch_modes, |
7798 | .input_mux = &alc883_capture_source, | 7761 | .input_mux = &alc883_capture_source, |
@@ -7804,8 +7767,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7804 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | 7767 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
7805 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7768 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7806 | .dac_nids = alc883_dac_nids, | 7769 | .dac_nids = alc883_dac_nids, |
7807 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7808 | .adc_nids = alc883_adc_nids, | ||
7809 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7770 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7810 | .channel_mode = alc883_3ST_2ch_modes, | 7771 | .channel_mode = alc883_3ST_2ch_modes, |
7811 | .input_mux = &alc883_capture_source, | 7772 | .input_mux = &alc883_capture_source, |
@@ -7815,8 +7776,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7815 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, | 7776 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
7816 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7777 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7817 | .dac_nids = alc883_dac_nids, | 7778 | .dac_nids = alc883_dac_nids, |
7818 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7819 | .adc_nids = alc883_adc_nids, | ||
7820 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7779 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7821 | .channel_mode = alc883_3ST_2ch_modes, | 7780 | .channel_mode = alc883_3ST_2ch_modes, |
7822 | .input_mux = &alc883_lenovo_101e_capture_source, | 7781 | .input_mux = &alc883_lenovo_101e_capture_source, |
@@ -7828,8 +7787,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7828 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, | 7787 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
7829 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7788 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7830 | .dac_nids = alc883_dac_nids, | 7789 | .dac_nids = alc883_dac_nids, |
7831 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7832 | .adc_nids = alc883_adc_nids, | ||
7833 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7790 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7834 | .channel_mode = alc883_3ST_2ch_modes, | 7791 | .channel_mode = alc883_3ST_2ch_modes, |
7835 | .need_dac_fix = 1, | 7792 | .need_dac_fix = 1, |
@@ -7843,8 +7800,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7843 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7800 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7844 | .dac_nids = alc883_dac_nids, | 7801 | .dac_nids = alc883_dac_nids, |
7845 | .dig_out_nid = ALC883_DIGOUT_NID, | 7802 | .dig_out_nid = ALC883_DIGOUT_NID, |
7846 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7847 | .adc_nids = alc883_adc_nids, | ||
7848 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | 7803 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
7849 | .channel_mode = alc883_3ST_6ch_modes, | 7804 | .channel_mode = alc883_3ST_6ch_modes, |
7850 | .need_dac_fix = 1, | 7805 | .need_dac_fix = 1, |
@@ -7858,8 +7813,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7858 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7813 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7859 | .dac_nids = alc883_dac_nids, | 7814 | .dac_nids = alc883_dac_nids, |
7860 | .dig_out_nid = ALC883_DIGOUT_NID, | 7815 | .dig_out_nid = ALC883_DIGOUT_NID, |
7861 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7862 | .adc_nids = alc883_adc_nids, | ||
7863 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7816 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7864 | .channel_mode = alc883_3ST_2ch_modes, | 7817 | .channel_mode = alc883_3ST_2ch_modes, |
7865 | .input_mux = &alc883_capture_source, | 7818 | .input_mux = &alc883_capture_source, |
@@ -7872,8 +7825,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7872 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7825 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7873 | .dac_nids = alc883_dac_nids, | 7826 | .dac_nids = alc883_dac_nids, |
7874 | .dig_out_nid = ALC883_DIGOUT_NID, | 7827 | .dig_out_nid = ALC883_DIGOUT_NID, |
7875 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7876 | .adc_nids = alc883_adc_nids, | ||
7877 | .dig_in_nid = ALC883_DIGIN_NID, | 7828 | .dig_in_nid = ALC883_DIGIN_NID, |
7878 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 7829 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
7879 | .channel_mode = alc883_sixstack_modes, | 7830 | .channel_mode = alc883_sixstack_modes, |
@@ -7884,8 +7835,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7884 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, | 7835 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
7885 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7836 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7886 | .dac_nids = alc883_dac_nids, | 7837 | .dac_nids = alc883_dac_nids, |
7887 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7888 | .adc_nids = alc883_adc_nids, | ||
7889 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), | 7838 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
7890 | .channel_mode = alc888_3st_hp_modes, | 7839 | .channel_mode = alc888_3st_hp_modes, |
7891 | .need_dac_fix = 1, | 7840 | .need_dac_fix = 1, |
@@ -7897,8 +7846,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7897 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7846 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7898 | .dac_nids = alc883_dac_nids, | 7847 | .dac_nids = alc883_dac_nids, |
7899 | .dig_out_nid = ALC883_DIGOUT_NID, | 7848 | .dig_out_nid = ALC883_DIGOUT_NID, |
7900 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7901 | .adc_nids = alc883_adc_nids, | ||
7902 | .dig_in_nid = ALC883_DIGIN_NID, | 7849 | .dig_in_nid = ALC883_DIGIN_NID, |
7903 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 7850 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
7904 | .channel_mode = alc883_sixstack_modes, | 7851 | .channel_mode = alc883_sixstack_modes, |
@@ -7911,8 +7858,6 @@ static struct alc_config_preset alc883_presets[] = { | |||
7911 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, | 7858 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
7912 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 7859 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
7913 | .dac_nids = alc883_dac_nids, | 7860 | .dac_nids = alc883_dac_nids, |
7914 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
7915 | .adc_nids = alc883_adc_nids, | ||
7916 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 7861 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
7917 | .channel_mode = alc883_3ST_2ch_modes, | 7862 | .channel_mode = alc883_3ST_2ch_modes, |
7918 | .input_mux = &alc883_capture_source, | 7863 | .input_mux = &alc883_capture_source, |
@@ -8072,10 +8017,9 @@ static int patch_alc883(struct hda_codec *codec) | |||
8072 | spec->stream_digital_playback = &alc883_pcm_digital_playback; | 8017 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
8073 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | 8018 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
8074 | 8019 | ||
8075 | if (!spec->adc_nids && spec->input_mux) { | 8020 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
8076 | spec->adc_nids = alc883_adc_nids; | 8021 | spec->adc_nids = alc883_adc_nids; |
8077 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | 8022 | spec->capsrc_nids = alc883_capsrc_nids; |
8078 | } | ||
8079 | 8023 | ||
8080 | spec->vmaster_nid = 0x0c; | 8024 | spec->vmaster_nid = 0x0c; |
8081 | 8025 | ||
@@ -9532,6 +9476,8 @@ static hda_nid_t alc268_adc_nids_alt[1] = { | |||
9532 | 0x08 | 9476 | 0x08 |
9533 | }; | 9477 | }; |
9534 | 9478 | ||
9479 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; | ||
9480 | |||
9535 | static struct snd_kcontrol_new alc268_base_mixer[] = { | 9481 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
9536 | /* output mixer control */ | 9482 | /* output mixer control */ |
9537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), | 9483 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
@@ -9787,21 +9733,7 @@ static struct hda_verb alc268_volume_init_verbs[] = { | |||
9787 | 9733 | ||
9788 | #define alc268_mux_enum_info alc_mux_enum_info | 9734 | #define alc268_mux_enum_info alc_mux_enum_info |
9789 | #define alc268_mux_enum_get alc_mux_enum_get | 9735 | #define alc268_mux_enum_get alc_mux_enum_get |
9790 | 9736 | #define alc268_mux_enum_put alc_mux_enum_put | |
9791 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
9792 | struct snd_ctl_elem_value *ucontrol) | ||
9793 | { | ||
9794 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
9795 | struct alc_spec *spec = codec->spec; | ||
9796 | |||
9797 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
9798 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; | ||
9799 | hda_nid_t nid = capture_mixers[adc_idx]; | ||
9800 | |||
9801 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
9802 | nid, | ||
9803 | &spec->cur_mux[adc_idx]); | ||
9804 | } | ||
9805 | 9737 | ||
9806 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | 9738 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
9807 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | 9739 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
@@ -10145,6 +10077,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
10145 | .dac_nids = alc268_dac_nids, | 10077 | .dac_nids = alc268_dac_nids, |
10146 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10078 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10147 | .adc_nids = alc268_adc_nids_alt, | 10079 | .adc_nids = alc268_adc_nids_alt, |
10080 | .capsrc_nids = alc268_capsrc_nids, | ||
10148 | .hp_nid = 0x03, | 10081 | .hp_nid = 0x03, |
10149 | .dig_out_nid = ALC268_DIGOUT_NID, | 10082 | .dig_out_nid = ALC268_DIGOUT_NID, |
10150 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10083 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
@@ -10159,6 +10092,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
10159 | .dac_nids = alc268_dac_nids, | 10092 | .dac_nids = alc268_dac_nids, |
10160 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10093 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10161 | .adc_nids = alc268_adc_nids_alt, | 10094 | .adc_nids = alc268_adc_nids_alt, |
10095 | .capsrc_nids = alc268_capsrc_nids, | ||
10162 | .hp_nid = 0x03, | 10096 | .hp_nid = 0x03, |
10163 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10097 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
10164 | .channel_mode = alc268_modes, | 10098 | .channel_mode = alc268_modes, |
@@ -10174,6 +10108,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
10174 | .dac_nids = alc268_dac_nids, | 10108 | .dac_nids = alc268_dac_nids, |
10175 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10109 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10176 | .adc_nids = alc268_adc_nids_alt, | 10110 | .adc_nids = alc268_adc_nids_alt, |
10111 | .capsrc_nids = alc268_capsrc_nids, | ||
10177 | .hp_nid = 0x02, | 10112 | .hp_nid = 0x02, |
10178 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10113 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
10179 | .channel_mode = alc268_modes, | 10114 | .channel_mode = alc268_modes, |
@@ -10202,6 +10137,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
10202 | .dac_nids = alc268_dac_nids, | 10137 | .dac_nids = alc268_dac_nids, |
10203 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10138 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10204 | .adc_nids = alc268_adc_nids_alt, | 10139 | .adc_nids = alc268_adc_nids_alt, |
10140 | .capsrc_nids = alc268_capsrc_nids, | ||
10205 | .hp_nid = 0x03, | 10141 | .hp_nid = 0x03, |
10206 | .dig_out_nid = ALC268_DIGOUT_NID, | 10142 | .dig_out_nid = ALC268_DIGOUT_NID, |
10207 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10143 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
@@ -10219,6 +10155,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
10219 | .dac_nids = alc268_dac_nids, | 10155 | .dac_nids = alc268_dac_nids, |
10220 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | 10156 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
10221 | .adc_nids = alc268_adc_nids_alt, | 10157 | .adc_nids = alc268_adc_nids_alt, |
10158 | .capsrc_nids = alc268_capsrc_nids, | ||
10222 | .hp_nid = 0x03, | 10159 | .hp_nid = 0x03, |
10223 | .dig_out_nid = ALC268_DIGOUT_NID, | 10160 | .dig_out_nid = ALC268_DIGOUT_NID, |
10224 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 10161 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
@@ -10294,6 +10231,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
10294 | alc268_capture_mixer; | 10231 | alc268_capture_mixer; |
10295 | spec->num_mixers++; | 10232 | spec->num_mixers++; |
10296 | } | 10233 | } |
10234 | spec->capsrc_nids = alc268_capsrc_nids; | ||
10297 | } | 10235 | } |
10298 | 10236 | ||
10299 | spec->vmaster_nid = 0x02; | 10237 | spec->vmaster_nid = 0x02; |
@@ -11850,6 +11788,8 @@ static hda_nid_t alc861vd_adc_nids[1] = { | |||
11850 | 0x09, | 11788 | 0x09, |
11851 | }; | 11789 | }; |
11852 | 11790 | ||
11791 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; | ||
11792 | |||
11853 | /* input MUX */ | 11793 | /* input MUX */ |
11854 | /* FIXME: should be a matrix-type input source selection */ | 11794 | /* FIXME: should be a matrix-type input source selection */ |
11855 | static struct hda_input_mux alc861vd_capture_source = { | 11795 | static struct hda_input_mux alc861vd_capture_source = { |
@@ -11881,33 +11821,8 @@ static struct hda_input_mux alc861vd_hp_capture_source = { | |||
11881 | 11821 | ||
11882 | #define alc861vd_mux_enum_info alc_mux_enum_info | 11822 | #define alc861vd_mux_enum_info alc_mux_enum_info |
11883 | #define alc861vd_mux_enum_get alc_mux_enum_get | 11823 | #define alc861vd_mux_enum_get alc_mux_enum_get |
11884 | 11824 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ | |
11885 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, | 11825 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
11886 | struct snd_ctl_elem_value *ucontrol) | ||
11887 | { | ||
11888 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
11889 | struct alc_spec *spec = codec->spec; | ||
11890 | const struct hda_input_mux *imux = spec->input_mux; | ||
11891 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
11892 | static hda_nid_t capture_mixers[1] = { 0x22 }; | ||
11893 | hda_nid_t nid = capture_mixers[adc_idx]; | ||
11894 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | ||
11895 | unsigned int i, idx; | ||
11896 | |||
11897 | idx = ucontrol->value.enumerated.item[0]; | ||
11898 | if (idx >= imux->num_items) | ||
11899 | idx = imux->num_items - 1; | ||
11900 | if (*cur_val == idx) | ||
11901 | return 0; | ||
11902 | for (i = 0; i < imux->num_items; i++) { | ||
11903 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | ||
11904 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | ||
11905 | imux->items[i].index, | ||
11906 | HDA_AMP_MUTE, v); | ||
11907 | } | ||
11908 | *cur_val = idx; | ||
11909 | return 1; | ||
11910 | } | ||
11911 | 11826 | ||
11912 | /* | 11827 | /* |
11913 | * 2ch mode | 11828 | * 2ch mode |
@@ -12390,8 +12305,6 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12390 | alc861vd_3stack_init_verbs }, | 12305 | alc861vd_3stack_init_verbs }, |
12391 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | 12306 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
12392 | .dac_nids = alc660vd_dac_nids, | 12307 | .dac_nids = alc660vd_dac_nids, |
12393 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12394 | .adc_nids = alc861vd_adc_nids, | ||
12395 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12308 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12396 | .channel_mode = alc861vd_3stack_2ch_modes, | 12309 | .channel_mode = alc861vd_3stack_2ch_modes, |
12397 | .input_mux = &alc861vd_capture_source, | 12310 | .input_mux = &alc861vd_capture_source, |
@@ -12403,8 +12316,6 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12403 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | 12316 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
12404 | .dac_nids = alc660vd_dac_nids, | 12317 | .dac_nids = alc660vd_dac_nids, |
12405 | .dig_out_nid = ALC861VD_DIGOUT_NID, | 12318 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
12406 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12407 | .adc_nids = alc861vd_adc_nids, | ||
12408 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12319 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12409 | .channel_mode = alc861vd_3stack_2ch_modes, | 12320 | .channel_mode = alc861vd_3stack_2ch_modes, |
12410 | .input_mux = &alc861vd_capture_source, | 12321 | .input_mux = &alc861vd_capture_source, |
@@ -12449,8 +12360,6 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12449 | alc861vd_lenovo_unsol_verbs }, | 12360 | alc861vd_lenovo_unsol_verbs }, |
12450 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), | 12361 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
12451 | .dac_nids = alc660vd_dac_nids, | 12362 | .dac_nids = alc660vd_dac_nids, |
12452 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12453 | .adc_nids = alc861vd_adc_nids, | ||
12454 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12363 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12455 | .channel_mode = alc861vd_3stack_2ch_modes, | 12364 | .channel_mode = alc861vd_3stack_2ch_modes, |
12456 | .input_mux = &alc861vd_capture_source, | 12365 | .input_mux = &alc861vd_capture_source, |
@@ -12462,8 +12371,6 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12462 | .init_verbs = { alc861vd_dallas_verbs }, | 12371 | .init_verbs = { alc861vd_dallas_verbs }, |
12463 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | 12372 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
12464 | .dac_nids = alc861vd_dac_nids, | 12373 | .dac_nids = alc861vd_dac_nids, |
12465 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12466 | .adc_nids = alc861vd_adc_nids, | ||
12467 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12374 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12468 | .channel_mode = alc861vd_3stack_2ch_modes, | 12375 | .channel_mode = alc861vd_3stack_2ch_modes, |
12469 | .input_mux = &alc861vd_dallas_capture_source, | 12376 | .input_mux = &alc861vd_dallas_capture_source, |
@@ -12475,9 +12382,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
12475 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, | 12382 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
12476 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), | 12383 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
12477 | .dac_nids = alc861vd_dac_nids, | 12384 | .dac_nids = alc861vd_dac_nids, |
12478 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
12479 | .dig_out_nid = ALC861VD_DIGOUT_NID, | 12385 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
12480 | .adc_nids = alc861vd_adc_nids, | ||
12481 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), | 12386 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
12482 | .channel_mode = alc861vd_3stack_2ch_modes, | 12387 | .channel_mode = alc861vd_3stack_2ch_modes, |
12483 | .input_mux = &alc861vd_hp_capture_source, | 12388 | .input_mux = &alc861vd_hp_capture_source, |
@@ -12779,6 +12684,7 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
12779 | 12684 | ||
12780 | spec->adc_nids = alc861vd_adc_nids; | 12685 | spec->adc_nids = alc861vd_adc_nids; |
12781 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | 12686 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
12687 | spec->capsrc_nids = alc861vd_capsrc_nids; | ||
12782 | 12688 | ||
12783 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; | 12689 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
12784 | spec->num_mixers++; | 12690 | spec->num_mixers++; |
@@ -12820,9 +12726,11 @@ static hda_nid_t alc662_adc_nids[1] = { | |||
12820 | /* ADC1-2 */ | 12726 | /* ADC1-2 */ |
12821 | 0x09, | 12727 | 0x09, |
12822 | }; | 12728 | }; |
12729 | |||
12730 | static hda_nid_t alc662_capsrc_nids[1] = { 0x23 }; | ||
12731 | |||
12823 | /* input MUX */ | 12732 | /* input MUX */ |
12824 | /* FIXME: should be a matrix-type input source selection */ | 12733 | /* FIXME: should be a matrix-type input source selection */ |
12825 | |||
12826 | static struct hda_input_mux alc662_capture_source = { | 12734 | static struct hda_input_mux alc662_capture_source = { |
12827 | .num_items = 4, | 12735 | .num_items = 4, |
12828 | .items = { | 12736 | .items = { |
@@ -12851,33 +12759,8 @@ static struct hda_input_mux alc662_eeepc_capture_source = { | |||
12851 | 12759 | ||
12852 | #define alc662_mux_enum_info alc_mux_enum_info | 12760 | #define alc662_mux_enum_info alc_mux_enum_info |
12853 | #define alc662_mux_enum_get alc_mux_enum_get | 12761 | #define alc662_mux_enum_get alc_mux_enum_get |
12762 | #define alc662_mux_enum_put alc882_mux_enum_put | ||
12854 | 12763 | ||
12855 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, | ||
12856 | struct snd_ctl_elem_value *ucontrol) | ||
12857 | { | ||
12858 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
12859 | struct alc_spec *spec = codec->spec; | ||
12860 | const struct hda_input_mux *imux = spec->input_mux; | ||
12861 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | ||
12862 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; | ||
12863 | hda_nid_t nid = capture_mixers[adc_idx]; | ||
12864 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | ||
12865 | unsigned int i, idx; | ||
12866 | |||
12867 | idx = ucontrol->value.enumerated.item[0]; | ||
12868 | if (idx >= imux->num_items) | ||
12869 | idx = imux->num_items - 1; | ||
12870 | if (*cur_val == idx) | ||
12871 | return 0; | ||
12872 | for (i = 0; i < imux->num_items; i++) { | ||
12873 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; | ||
12874 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, | ||
12875 | imux->items[i].index, | ||
12876 | HDA_AMP_MUTE, v); | ||
12877 | } | ||
12878 | *cur_val = idx; | ||
12879 | return 1; | ||
12880 | } | ||
12881 | /* | 12764 | /* |
12882 | * 2ch mode | 12765 | * 2ch mode |
12883 | */ | 12766 | */ |
@@ -13354,8 +13237,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13354 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13237 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13355 | .dac_nids = alc662_dac_nids, | 13238 | .dac_nids = alc662_dac_nids, |
13356 | .dig_out_nid = ALC662_DIGOUT_NID, | 13239 | .dig_out_nid = ALC662_DIGOUT_NID, |
13357 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13358 | .adc_nids = alc662_adc_nids, | ||
13359 | .dig_in_nid = ALC662_DIGIN_NID, | 13240 | .dig_in_nid = ALC662_DIGIN_NID, |
13360 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 13241 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
13361 | .channel_mode = alc662_3ST_2ch_modes, | 13242 | .channel_mode = alc662_3ST_2ch_modes, |
@@ -13368,8 +13249,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13368 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13249 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13369 | .dac_nids = alc662_dac_nids, | 13250 | .dac_nids = alc662_dac_nids, |
13370 | .dig_out_nid = ALC662_DIGOUT_NID, | 13251 | .dig_out_nid = ALC662_DIGOUT_NID, |
13371 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13372 | .adc_nids = alc662_adc_nids, | ||
13373 | .dig_in_nid = ALC662_DIGIN_NID, | 13252 | .dig_in_nid = ALC662_DIGIN_NID, |
13374 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | 13253 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
13375 | .channel_mode = alc662_3ST_6ch_modes, | 13254 | .channel_mode = alc662_3ST_6ch_modes, |
@@ -13382,8 +13261,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13382 | .init_verbs = { alc662_init_verbs }, | 13261 | .init_verbs = { alc662_init_verbs }, |
13383 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13262 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13384 | .dac_nids = alc662_dac_nids, | 13263 | .dac_nids = alc662_dac_nids, |
13385 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13386 | .adc_nids = alc662_adc_nids, | ||
13387 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | 13264 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
13388 | .channel_mode = alc662_3ST_6ch_modes, | 13265 | .channel_mode = alc662_3ST_6ch_modes, |
13389 | .need_dac_fix = 1, | 13266 | .need_dac_fix = 1, |
@@ -13396,8 +13273,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13396 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13273 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13397 | .dac_nids = alc662_dac_nids, | 13274 | .dac_nids = alc662_dac_nids, |
13398 | .dig_out_nid = ALC662_DIGOUT_NID, | 13275 | .dig_out_nid = ALC662_DIGOUT_NID, |
13399 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13400 | .adc_nids = alc662_adc_nids, | ||
13401 | .dig_in_nid = ALC662_DIGIN_NID, | 13276 | .dig_in_nid = ALC662_DIGIN_NID, |
13402 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), | 13277 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
13403 | .channel_mode = alc662_5stack_modes, | 13278 | .channel_mode = alc662_5stack_modes, |
@@ -13408,8 +13283,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13408 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, | 13283 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
13409 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13284 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13410 | .dac_nids = alc662_dac_nids, | 13285 | .dac_nids = alc662_dac_nids, |
13411 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13412 | .adc_nids = alc662_adc_nids, | ||
13413 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 13286 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
13414 | .channel_mode = alc662_3ST_2ch_modes, | 13287 | .channel_mode = alc662_3ST_2ch_modes, |
13415 | .input_mux = &alc662_lenovo_101e_capture_source, | 13288 | .input_mux = &alc662_lenovo_101e_capture_source, |
@@ -13422,8 +13295,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13422 | alc662_eeepc_sue_init_verbs }, | 13295 | alc662_eeepc_sue_init_verbs }, |
13423 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13296 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13424 | .dac_nids = alc662_dac_nids, | 13297 | .dac_nids = alc662_dac_nids, |
13425 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), | ||
13426 | .adc_nids = alc662_adc_nids, | ||
13427 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | 13298 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
13428 | .channel_mode = alc662_3ST_2ch_modes, | 13299 | .channel_mode = alc662_3ST_2ch_modes, |
13429 | .input_mux = &alc662_eeepc_capture_source, | 13300 | .input_mux = &alc662_eeepc_capture_source, |
@@ -13437,8 +13308,6 @@ static struct alc_config_preset alc662_presets[] = { | |||
13437 | alc662_eeepc_ep20_sue_init_verbs }, | 13308 | alc662_eeepc_ep20_sue_init_verbs }, |
13438 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | 13309 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
13439 | .dac_nids = alc662_dac_nids, | 13310 | .dac_nids = alc662_dac_nids, |
13440 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), | ||
13441 | .adc_nids = alc662_adc_nids, | ||
13442 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), | 13311 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
13443 | .channel_mode = alc662_3ST_6ch_modes, | 13312 | .channel_mode = alc662_3ST_6ch_modes, |
13444 | .input_mux = &alc662_lenovo_101e_capture_source, | 13313 | .input_mux = &alc662_lenovo_101e_capture_source, |
@@ -13750,10 +13619,9 @@ static int patch_alc662(struct hda_codec *codec) | |||
13750 | spec->stream_digital_playback = &alc662_pcm_digital_playback; | 13619 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
13751 | spec->stream_digital_capture = &alc662_pcm_digital_capture; | 13620 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
13752 | 13621 | ||
13753 | if (!spec->adc_nids && spec->input_mux) { | 13622 | spec->adc_nids = alc662_adc_nids; |
13754 | spec->adc_nids = alc662_adc_nids; | 13623 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
13755 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | 13624 | spec->capsrc_nids = alc662_capsrc_nids; |
13756 | } | ||
13757 | 13625 | ||
13758 | spec->vmaster_nid = 0x02; | 13626 | spec->vmaster_nid = 0x02; |
13759 | 13627 | ||