aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-10-31 10:24:04 -0400
committerTakashi Iwai <tiwai@suse.de>2008-10-31 12:24:30 -0400
commit54cbc9abe57cf0a36619f394802448c62402599a (patch)
tree677a78158887de56ea8d312b435ed3b4338faa01 /sound/pci/hda
parentd88897eaea53f0fae62d528a24e76b8643082db3 (diff)
ALSA: hda - Unify capture callbacks in realtek codes
Unify the capture callbacks in patch_realtek.c. The difference of matrix or mux style is checked via spec->is_mix_capture flag. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/patch_realtek.c276
1 files changed, 100 insertions, 176 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 51479fba960e..8477d6d46880 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -268,6 +268,7 @@ struct alc_spec {
268 hda_nid_t *adc_nids; 268 hda_nid_t *adc_nids;
269 hda_nid_t *capsrc_nids; 269 hda_nid_t *capsrc_nids;
270 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 270 hda_nid_t dig_in_nid; /* digital-in NID; optional */
271 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */
271 272
272 /* capture source */ 273 /* capture source */
273 unsigned int num_mux_defs; 274 unsigned int num_mux_defs;
@@ -374,14 +375,38 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
374{ 375{
375 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 376 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
376 struct alc_spec *spec = codec->spec; 377 struct alc_spec *spec = codec->spec;
378 const struct hda_input_mux *imux = spec->input_mux;
377 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 379 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
378 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
379 hda_nid_t nid = spec->capsrc_nids ? 380 hda_nid_t nid = spec->capsrc_nids ?
380 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; 381 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
381 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol,
382 nid, &spec->cur_mux[adc_idx]);
383}
384 382
383 if (spec->is_mix_capture) {
384 /* Matrix-mixer style (e.g. ALC882) */
385 unsigned int *cur_val = &spec->cur_mux[adc_idx];
386 unsigned int i, idx;
387
388 idx = ucontrol->value.enumerated.item[0];
389 if (idx >= imux->num_items)
390 idx = imux->num_items - 1;
391 if (*cur_val == idx)
392 return 0;
393 for (i = 0; i < imux->num_items; i++) {
394 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
395 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
396 imux->items[i].index,
397 HDA_AMP_MUTE, v);
398 }
399 *cur_val = idx;
400 return 1;
401 } else {
402 /* MUX style (e.g. ALC880) */
403 unsigned int mux_idx;
404 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
405 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx],
406 ucontrol, nid,
407 &spec->cur_mux[adc_idx]);
408 }
409}
385 410
386/* 411/*
387 * channel mode setting 412 * channel mode setting
@@ -5629,36 +5654,6 @@ static struct hda_input_mux alc882_capture_source = {
5629 { "CD", 0x4 }, 5654 { "CD", 0x4 },
5630 }, 5655 },
5631}; 5656};
5632#define alc882_mux_enum_info alc_mux_enum_info
5633#define alc882_mux_enum_get alc_mux_enum_get
5634
5635static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
5636 struct snd_ctl_elem_value *ucontrol)
5637{
5638 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
5639 struct alc_spec *spec = codec->spec;
5640 const struct hda_input_mux *imux = spec->input_mux;
5641 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
5642 hda_nid_t nid = spec->capsrc_nids ?
5643 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
5644 unsigned int *cur_val = &spec->cur_mux[adc_idx];
5645 unsigned int i, idx;
5646
5647 idx = ucontrol->value.enumerated.item[0];
5648 if (idx >= imux->num_items)
5649 idx = imux->num_items - 1;
5650 if (*cur_val == idx)
5651 return 0;
5652 for (i = 0; i < imux->num_items; i++) {
5653 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5654 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5655 imux->items[i].index,
5656 HDA_AMP_MUTE, v);
5657 }
5658 *cur_val = idx;
5659 return 1;
5660}
5661
5662/* 5657/*
5663 * 2ch mode 5658 * 2ch mode
5664 */ 5659 */
@@ -6341,48 +6336,8 @@ static struct hda_verb alc882_auto_init_verbs[] = {
6341 { } 6336 { }
6342}; 6337};
6343 6338
6344/* capture mixer elements */ 6339#define alc882_capture_alt_mixer alc880_capture_alt_mixer
6345static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { 6340#define alc882_capture_mixer alc880_capture_mixer
6346 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
6347 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
6348 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
6349 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
6350 {
6351 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6352 /* The multiple "Capture Source" controls confuse alsamixer
6353 * So call somewhat different..
6354 */
6355 /* .name = "Capture Source", */
6356 .name = "Input Source",
6357 .count = 2,
6358 .info = alc882_mux_enum_info,
6359 .get = alc882_mux_enum_get,
6360 .put = alc882_mux_enum_put,
6361 },
6362 { } /* end */
6363};
6364
6365static struct snd_kcontrol_new alc882_capture_mixer[] = {
6366 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
6367 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
6368 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT),
6369 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT),
6370 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT),
6371 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT),
6372 {
6373 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
6374 /* The multiple "Capture Source" controls confuse alsamixer
6375 * So call somewhat different..
6376 */
6377 /* .name = "Capture Source", */
6378 .name = "Input Source",
6379 .count = 3,
6380 .info = alc882_mux_enum_info,
6381 .get = alc882_mux_enum_get,
6382 .put = alc882_mux_enum_put,
6383 },
6384 { } /* end */
6385};
6386 6341
6387#ifdef CONFIG_SND_HDA_POWER_SAVE 6342#ifdef CONFIG_SND_HDA_POWER_SAVE
6388#define alc882_loopbacks alc880_loopbacks 6343#define alc882_loopbacks alc880_loopbacks
@@ -6835,6 +6790,7 @@ static int patch_alc882(struct hda_codec *codec)
6835 spec->stream_digital_playback = &alc882_pcm_digital_playback; 6790 spec->stream_digital_playback = &alc882_pcm_digital_playback;
6836 spec->stream_digital_capture = &alc882_pcm_digital_capture; 6791 spec->stream_digital_capture = &alc882_pcm_digital_capture;
6837 6792
6793 spec->is_mix_capture = 1; /* matrix-style capture */
6838 if (!spec->adc_nids && spec->input_mux) { 6794 if (!spec->adc_nids && spec->input_mux) {
6839 /* check whether NID 0x07 is valid */ 6795 /* check whether NID 0x07 is valid */
6840 unsigned int wcap = get_wcaps(codec, 0x07); 6796 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -6958,11 +6914,6 @@ static struct hda_input_mux alc883_asus_eee1601_capture_source = {
6958 }, 6914 },
6959}; 6915};
6960 6916
6961#define alc883_mux_enum_info alc_mux_enum_info
6962#define alc883_mux_enum_get alc_mux_enum_get
6963/* ALC883 has the ALC882-type input selection */
6964#define alc883_mux_enum_put alc882_mux_enum_put
6965
6966/* 6917/*
6967 * 2ch mode 6918 * 2ch mode
6968 */ 6919 */
@@ -7125,9 +7076,9 @@ static struct snd_kcontrol_new alc883_base_mixer[] = {
7125 /* .name = "Capture Source", */ 7076 /* .name = "Capture Source", */
7126 .name = "Input Source", 7077 .name = "Input Source",
7127 .count = 2, 7078 .count = 2,
7128 .info = alc883_mux_enum_info, 7079 .info = alc_mux_enum_info,
7129 .get = alc883_mux_enum_get, 7080 .get = alc_mux_enum_get,
7130 .put = alc883_mux_enum_put, 7081 .put = alc_mux_enum_put,
7131 }, 7082 },
7132 { } /* end */ 7083 { } /* end */
7133}; 7084};
@@ -7155,9 +7106,9 @@ static struct snd_kcontrol_new alc883_mitac_mixer[] = {
7155 /* .name = "Capture Source", */ 7106 /* .name = "Capture Source", */
7156 .name = "Input Source", 7107 .name = "Input Source",
7157 .count = 2, 7108 .count = 2,
7158 .info = alc883_mux_enum_info, 7109 .info = alc_mux_enum_info,
7159 .get = alc883_mux_enum_get, 7110 .get = alc_mux_enum_get,
7160 .put = alc883_mux_enum_put, 7111 .put = alc_mux_enum_put,
7161 }, 7112 },
7162 { } /* end */ 7113 { } /* end */
7163}; 7114};
@@ -7182,9 +7133,9 @@ static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
7182 /* .name = "Capture Source", */ 7133 /* .name = "Capture Source", */
7183 .name = "Input Source", 7134 .name = "Input Source",
7184 .count = 2, 7135 .count = 2,
7185 .info = alc883_mux_enum_info, 7136 .info = alc_mux_enum_info,
7186 .get = alc883_mux_enum_get, 7137 .get = alc_mux_enum_get,
7187 .put = alc883_mux_enum_put, 7138 .put = alc_mux_enum_put,
7188 }, 7139 },
7189 { } /* end */ 7140 { } /* end */
7190}; 7141};
@@ -7209,9 +7160,9 @@ static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
7209 /* .name = "Capture Source", */ 7160 /* .name = "Capture Source", */
7210 .name = "Input Source", 7161 .name = "Input Source",
7211 .count = 2, 7162 .count = 2,
7212 .info = alc883_mux_enum_info, 7163 .info = alc_mux_enum_info,
7213 .get = alc883_mux_enum_get, 7164 .get = alc_mux_enum_get,
7214 .put = alc883_mux_enum_put, 7165 .put = alc_mux_enum_put,
7215 }, 7166 },
7216 { } /* end */ 7167 { } /* end */
7217}; 7168};
@@ -7241,9 +7192,9 @@ static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
7241 /* .name = "Capture Source", */ 7192 /* .name = "Capture Source", */
7242 .name = "Input Source", 7193 .name = "Input Source",
7243 .count = 2, 7194 .count = 2,
7244 .info = alc883_mux_enum_info, 7195 .info = alc_mux_enum_info,
7245 .get = alc883_mux_enum_get, 7196 .get = alc_mux_enum_get,
7246 .put = alc883_mux_enum_put, 7197 .put = alc_mux_enum_put,
7247 }, 7198 },
7248 { } /* end */ 7199 { } /* end */
7249}; 7200};
@@ -7277,9 +7228,9 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
7277 /* .name = "Capture Source", */ 7228 /* .name = "Capture Source", */
7278 .name = "Input Source", 7229 .name = "Input Source",
7279 .count = 1, 7230 .count = 1,
7280 .info = alc883_mux_enum_info, 7231 .info = alc_mux_enum_info,
7281 .get = alc883_mux_enum_get, 7232 .get = alc_mux_enum_get,
7282 .put = alc883_mux_enum_put, 7233 .put = alc_mux_enum_put,
7283 }, 7234 },
7284 { } /* end */ 7235 { } /* end */
7285}; 7236};
@@ -7316,9 +7267,9 @@ static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
7316 /* .name = "Capture Source", */ 7267 /* .name = "Capture Source", */
7317 .name = "Input Source", 7268 .name = "Input Source",
7318 .count = 2, 7269 .count = 2,
7319 .info = alc883_mux_enum_info, 7270 .info = alc_mux_enum_info,
7320 .get = alc883_mux_enum_get, 7271 .get = alc_mux_enum_get,
7321 .put = alc883_mux_enum_put, 7272 .put = alc_mux_enum_put,
7322 }, 7273 },
7323 { } /* end */ 7274 { } /* end */
7324}; 7275};
@@ -7353,9 +7304,9 @@ static struct snd_kcontrol_new alc883_fivestack_mixer[] = {
7353 /* .name = "Capture Source", */ 7304 /* .name = "Capture Source", */
7354 .name = "Input Source", 7305 .name = "Input Source",
7355 .count = 1, 7306 .count = 1,
7356 .info = alc883_mux_enum_info, 7307 .info = alc_mux_enum_info,
7357 .get = alc883_mux_enum_get, 7308 .get = alc_mux_enum_get,
7358 .put = alc883_mux_enum_put, 7309 .put = alc_mux_enum_put,
7359 }, 7310 },
7360 { } /* end */ 7311 { } /* end */
7361}; 7312};
@@ -7386,9 +7337,9 @@ static struct snd_kcontrol_new alc883_tagra_mixer[] = {
7386 /* .name = "Capture Source", */ 7337 /* .name = "Capture Source", */
7387 .name = "Input Source", 7338 .name = "Input Source",
7388 .count = 2, 7339 .count = 2,
7389 .info = alc883_mux_enum_info, 7340 .info = alc_mux_enum_info,
7390 .get = alc883_mux_enum_get, 7341 .get = alc_mux_enum_get,
7391 .put = alc883_mux_enum_put, 7342 .put = alc_mux_enum_put,
7392 }, 7343 },
7393 { } /* end */ 7344 { } /* end */
7394}; 7345};
@@ -7414,9 +7365,9 @@ static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = {
7414 /* .name = "Capture Source", */ 7365 /* .name = "Capture Source", */
7415 .name = "Input Source", 7366 .name = "Input Source",
7416 .count = 2, 7367 .count = 2,
7417 .info = alc883_mux_enum_info, 7368 .info = alc_mux_enum_info,
7418 .get = alc883_mux_enum_get, 7369 .get = alc_mux_enum_get,
7419 .put = alc883_mux_enum_put, 7370 .put = alc_mux_enum_put,
7420 }, 7371 },
7421 { } /* end */ 7372 { } /* end */
7422}; 7373};
@@ -7437,9 +7388,9 @@ static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
7437 /* .name = "Capture Source", */ 7388 /* .name = "Capture Source", */
7438 .name = "Input Source", 7389 .name = "Input Source",
7439 .count = 1, 7390 .count = 1,
7440 .info = alc883_mux_enum_info, 7391 .info = alc_mux_enum_info,
7441 .get = alc883_mux_enum_get, 7392 .get = alc_mux_enum_get,
7442 .put = alc883_mux_enum_put, 7393 .put = alc_mux_enum_put,
7443 }, 7394 },
7444 { } /* end */ 7395 { } /* end */
7445}; 7396};
@@ -7463,9 +7414,9 @@ static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
7463 /* .name = "Capture Source", */ 7414 /* .name = "Capture Source", */
7464 .name = "Input Source", 7415 .name = "Input Source",
7465 .count = 2, 7416 .count = 2,
7466 .info = alc883_mux_enum_info, 7417 .info = alc_mux_enum_info,
7467 .get = alc883_mux_enum_get, 7418 .get = alc_mux_enum_get,
7468 .put = alc883_mux_enum_put, 7419 .put = alc_mux_enum_put,
7469 }, 7420 },
7470 { } /* end */ 7421 { } /* end */
7471}; 7422};
@@ -7489,9 +7440,9 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = {
7489 /* .name = "Capture Source", */ 7440 /* .name = "Capture Source", */
7490 .name = "Input Source", 7441 .name = "Input Source",
7491 .count = 2, 7442 .count = 2,
7492 .info = alc883_mux_enum_info, 7443 .info = alc_mux_enum_info,
7493 .get = alc883_mux_enum_get, 7444 .get = alc_mux_enum_get,
7494 .put = alc883_mux_enum_put, 7445 .put = alc_mux_enum_put,
7495 }, 7446 },
7496 { } /* end */ 7447 { } /* end */
7497}; 7448};
@@ -7514,9 +7465,9 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
7514 /* .name = "Capture Source", */ 7465 /* .name = "Capture Source", */
7515 .name = "Input Source", 7466 .name = "Input Source",
7516 .count = 2, 7467 .count = 2,
7517 .info = alc883_mux_enum_info, 7468 .info = alc_mux_enum_info,
7518 .get = alc883_mux_enum_get, 7469 .get = alc_mux_enum_get,
7519 .put = alc883_mux_enum_put, 7470 .put = alc_mux_enum_put,
7520 }, 7471 },
7521 { } /* end */ 7472 { } /* end */
7522}; 7473};
@@ -7554,9 +7505,9 @@ static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
7554 /* .name = "Capture Source", */ 7505 /* .name = "Capture Source", */
7555 .name = "Input Source", 7506 .name = "Input Source",
7556 .count = 2, 7507 .count = 2,
7557 .info = alc883_mux_enum_info, 7508 .info = alc_mux_enum_info,
7558 .get = alc883_mux_enum_get, 7509 .get = alc_mux_enum_get,
7559 .put = alc883_mux_enum_put, 7510 .put = alc_mux_enum_put,
7560 }, 7511 },
7561 { } /* end */ 7512 { } /* end */
7562}; 7513};
@@ -7595,9 +7546,9 @@ static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
7595 /* .name = "Capture Source", */ 7546 /* .name = "Capture Source", */
7596 .name = "Input Source", 7547 .name = "Input Source",
7597 .count = 1, 7548 .count = 1,
7598 .info = alc883_mux_enum_info, 7549 .info = alc_mux_enum_info,
7599 .get = alc883_mux_enum_get, 7550 .get = alc_mux_enum_get,
7600 .put = alc883_mux_enum_put, 7551 .put = alc_mux_enum_put,
7601 }, 7552 },
7602 { } /* end */ 7553 { } /* end */
7603}; 7554};
@@ -8253,25 +8204,7 @@ static struct hda_verb alc883_auto_init_verbs[] = {
8253}; 8204};
8254 8205
8255/* capture mixer elements */ 8206/* capture mixer elements */
8256static struct snd_kcontrol_new alc883_capture_mixer[] = { 8207#define alc883_capture_mixer alc880_capture_alt_mixer /* 2 ADC ver */
8257 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
8258 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
8259 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
8260 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
8261 {
8262 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
8263 /* The multiple "Capture Source" controls confuse alsamixer
8264 * So call somewhat different..
8265 */
8266 /* .name = "Capture Source", */
8267 .name = "Input Source",
8268 .count = 2,
8269 .info = alc882_mux_enum_info,
8270 .get = alc882_mux_enum_get,
8271 .put = alc882_mux_enum_put,
8272 },
8273 { } /* end */
8274};
8275 8208
8276static struct hda_verb alc888_asus_m90v_verbs[] = { 8209static struct hda_verb alc888_asus_m90v_verbs[] = {
8277 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 8210 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
@@ -8947,6 +8880,7 @@ static int patch_alc883(struct hda_codec *codec)
8947 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 8880 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
8948 spec->adc_nids = alc883_adc_nids; 8881 spec->adc_nids = alc883_adc_nids;
8949 spec->capsrc_nids = alc883_capsrc_nids; 8882 spec->capsrc_nids = alc883_capsrc_nids;
8883 spec->is_mix_capture = 1; /* matrix-style capture */
8950 8884
8951 spec->vmaster_nid = 0x0c; 8885 spec->vmaster_nid = 0x0c;
8952 8886
@@ -9967,7 +9901,7 @@ static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
9967 struct alc_spec *spec = codec->spec; 9901 struct alc_spec *spec = codec->spec;
9968 int ret; 9902 int ret;
9969 9903
9970 ret = alc882_mux_enum_put(kcontrol, ucontrol); 9904 ret = alc_mux_enum_put(kcontrol, ucontrol);
9971 if (!ret) 9905 if (!ret)
9972 return 0; 9906 return 0;
9973 /* reprogram the HP pin as mic or HP according to the input source */ 9907 /* reprogram the HP pin as mic or HP according to the input source */
@@ -9984,8 +9918,8 @@ static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
9984 { 9918 {
9985 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 9919 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9986 .name = "Capture Source", 9920 .name = "Capture Source",
9987 .info = alc882_mux_enum_info, 9921 .info = alc_mux_enum_info,
9988 .get = alc882_mux_enum_get, 9922 .get = alc_mux_enum_get,
9989 .put = alc262_ultra_mux_enum_put, 9923 .put = alc262_ultra_mux_enum_put,
9990 }, 9924 },
9991 { } /* end */ 9925 { } /* end */
@@ -10748,6 +10682,7 @@ static int patch_alc262(struct hda_codec *codec)
10748 spec->stream_digital_playback = &alc262_pcm_digital_playback; 10682 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10749 spec->stream_digital_capture = &alc262_pcm_digital_capture; 10683 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10750 10684
10685 spec->is_mix_capture = 1;
10751 if (!spec->adc_nids && spec->input_mux) { 10686 if (!spec->adc_nids && spec->input_mux) {
10752 /* check whether NID 0x07 is valid */ 10687 /* check whether NID 0x07 is valid */
10753 unsigned int wcap = get_wcaps(codec, 0x07); 10688 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -11213,10 +11148,6 @@ static struct hda_verb alc268_volume_init_verbs[] = {
11213 { } 11148 { }
11214}; 11149};
11215 11150
11216#define alc268_mux_enum_info alc_mux_enum_info
11217#define alc268_mux_enum_get alc_mux_enum_get
11218#define alc268_mux_enum_put alc_mux_enum_put
11219
11220static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { 11151static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11221 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), 11152 HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT),
11222 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), 11153 HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT),
@@ -11228,9 +11159,9 @@ static struct snd_kcontrol_new alc268_capture_alt_mixer[] = {
11228 /* .name = "Capture Source", */ 11159 /* .name = "Capture Source", */
11229 .name = "Input Source", 11160 .name = "Input Source",
11230 .count = 1, 11161 .count = 1,
11231 .info = alc268_mux_enum_info, 11162 .info = alc_mux_enum_info,
11232 .get = alc268_mux_enum_get, 11163 .get = alc_mux_enum_get,
11233 .put = alc268_mux_enum_put, 11164 .put = alc_mux_enum_put,
11234 }, 11165 },
11235 { } /* end */ 11166 { } /* end */
11236}; 11167};
@@ -11248,9 +11179,9 @@ static struct snd_kcontrol_new alc268_capture_mixer[] = {
11248 /* .name = "Capture Source", */ 11179 /* .name = "Capture Source", */
11249 .name = "Input Source", 11180 .name = "Input Source",
11250 .count = 2, 11181 .count = 2,
11251 .info = alc268_mux_enum_info, 11182 .info = alc_mux_enum_info,
11252 .get = alc268_mux_enum_get, 11183 .get = alc_mux_enum_get,
11253 .put = alc268_mux_enum_put, 11184 .put = alc_mux_enum_put,
11254 }, 11185 },
11255 { } /* end */ 11186 { } /* end */
11256}; 11187};
@@ -13698,11 +13629,6 @@ static struct hda_input_mux alc861vd_hp_capture_source = {
13698 }, 13629 },
13699}; 13630};
13700 13631
13701#define alc861vd_mux_enum_info alc_mux_enum_info
13702#define alc861vd_mux_enum_get alc_mux_enum_get
13703/* ALC861VD has the ALC882-type input selection (but has only one ADC) */
13704#define alc861vd_mux_enum_put alc882_mux_enum_put
13705
13706/* 13632/*
13707 * 2ch mode 13633 * 2ch mode
13708 */ 13634 */
@@ -13760,9 +13686,9 @@ static struct snd_kcontrol_new alc861vd_capture_mixer[] = {
13760 /* .name = "Capture Source", */ 13686 /* .name = "Capture Source", */
13761 .name = "Input Source", 13687 .name = "Input Source",
13762 .count = 1, 13688 .count = 1,
13763 .info = alc861vd_mux_enum_info, 13689 .info = alc_mux_enum_info,
13764 .get = alc861vd_mux_enum_get, 13690 .get = alc_mux_enum_get,
13765 .put = alc861vd_mux_enum_put, 13691 .put = alc_mux_enum_put,
13766 }, 13692 },
13767 { } /* end */ 13693 { } /* end */
13768}; 13694};
@@ -14588,6 +14514,7 @@ static int patch_alc861vd(struct hda_codec *codec)
14588 spec->adc_nids = alc861vd_adc_nids; 14514 spec->adc_nids = alc861vd_adc_nids;
14589 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); 14515 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14590 spec->capsrc_nids = alc861vd_capsrc_nids; 14516 spec->capsrc_nids = alc861vd_capsrc_nids;
14517 spec->is_mix_capture = 1;
14591 14518
14592 add_mixer(spec, alc861vd_capture_mixer); 14519 add_mixer(spec, alc861vd_capture_mixer);
14593 14520
@@ -14676,10 +14603,6 @@ static struct hda_input_mux alc663_m51va_capture_source = {
14676 }, 14603 },
14677}; 14604};
14678 14605
14679#define alc662_mux_enum_info alc_mux_enum_info
14680#define alc662_mux_enum_get alc_mux_enum_get
14681#define alc662_mux_enum_put alc882_mux_enum_put
14682
14683/* 14606/*
14684 * 2ch mode 14607 * 2ch mode
14685 */ 14608 */
@@ -15277,9 +15200,9 @@ static struct snd_kcontrol_new alc662_capture_mixer[] = {
15277 /* .name = "Capture Source", */ 15200 /* .name = "Capture Source", */
15278 .name = "Input Source", 15201 .name = "Input Source",
15279 .count = 1, 15202 .count = 1,
15280 .info = alc662_mux_enum_info, 15203 .info = alc_mux_enum_info,
15281 .get = alc662_mux_enum_get, 15204 .get = alc_mux_enum_get,
15282 .put = alc662_mux_enum_put, 15205 .put = alc_mux_enum_put,
15283 }, 15206 },
15284 { } /* end */ 15207 { } /* end */
15285}; 15208};
@@ -16420,6 +16343,7 @@ static int patch_alc662(struct hda_codec *codec)
16420 spec->adc_nids = alc662_adc_nids; 16343 spec->adc_nids = alc662_adc_nids;
16421 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 16344 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16422 spec->capsrc_nids = alc662_capsrc_nids; 16345 spec->capsrc_nids = alc662_capsrc_nids;
16346 spec->is_mix_capture = 1;
16423 16347
16424 spec->vmaster_nid = 0x02; 16348 spec->vmaster_nid = 0x02;
16425 16349