aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerton Ronaldo Krzesinski <herton@mandriva.com.br>2009-01-28 06:16:33 -0500
committerTakashi Iwai <tiwai@suse.de>2009-01-28 10:25:39 -0500
commit61b9b9b109217b2bfb128c3ca24d8f8c839a425f (patch)
tree4b162b626e76e122ca3681a77b5759bef1a0f2b6
parentca8d33fc9fafe373362d35107f01fba1e73fb966 (diff)
ALSA: hda - Consider additional capture source/selector in ALC889
Currently code for capture source support in ALC889 only considers capture mixers. This change adds additional support for ADC+selector present in ALC889, taking into account also the presence of an additional DMIC connection item in the selector. Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_realtek.c105
1 files changed, 77 insertions, 28 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 863ab957204..d81cb5eb8c5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -238,6 +238,13 @@ enum {
238 ALC883_MODEL_LAST, 238 ALC883_MODEL_LAST,
239}; 239};
240 240
241/* styles of capture selection */
242enum {
243 CAPT_MUX = 0, /* only mux based */
244 CAPT_MIX, /* only mixer based */
245 CAPT_1MUX_MIX, /* first mux and other mixers */
246};
247
241/* for GPIO Poll */ 248/* for GPIO Poll */
242#define GPIO_MASK 0x03 249#define GPIO_MASK 0x03
243 250
@@ -276,7 +283,7 @@ struct alc_spec {
276 hda_nid_t *adc_nids; 283 hda_nid_t *adc_nids;
277 hda_nid_t *capsrc_nids; 284 hda_nid_t *capsrc_nids;
278 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 285 hda_nid_t dig_in_nid; /* digital-in NID; optional */
279 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */ 286 int capture_style; /* capture style (CAPT_*) */
280 287
281 /* capture source */ 288 /* capture source */
282 unsigned int num_mux_defs; 289 unsigned int num_mux_defs;
@@ -294,7 +301,7 @@ struct alc_spec {
294 /* dynamic controls, init_verbs and input_mux */ 301 /* dynamic controls, init_verbs and input_mux */
295 struct auto_pin_cfg autocfg; 302 struct auto_pin_cfg autocfg;
296 struct snd_array kctls; 303 struct snd_array kctls;
297 struct hda_input_mux private_imux; 304 struct hda_input_mux private_imux[3];
298 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; 305 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS];
299 306
300 /* hooks */ 307 /* hooks */
@@ -396,7 +403,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
396 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 403 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
397 imux = &spec->input_mux[mux_idx]; 404 imux = &spec->input_mux[mux_idx];
398 405
399 if (spec->is_mix_capture) { 406 if (spec->capture_style &&
407 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) {
400 /* Matrix-mixer style (e.g. ALC882) */ 408 /* Matrix-mixer style (e.g. ALC882) */
401 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 409 unsigned int *cur_val = &spec->cur_mux[adc_idx];
402 unsigned int i, idx; 410 unsigned int i, idx;
@@ -4130,7 +4138,7 @@ static int new_analog_input(struct alc_spec *spec, hda_nid_t pin,
4130static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, 4138static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec,
4131 const struct auto_pin_cfg *cfg) 4139 const struct auto_pin_cfg *cfg)
4132{ 4140{
4133 struct hda_input_mux *imux = &spec->private_imux; 4141 struct hda_input_mux *imux = &spec->private_imux[0];
4134 int i, err, idx; 4142 int i, err, idx;
4135 4143
4136 for (i = 0; i < AUTO_PIN_LAST; i++) { 4144 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -4279,7 +4287,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
4279 add_verb(spec, alc880_volume_init_verbs); 4287 add_verb(spec, alc880_volume_init_verbs);
4280 4288
4281 spec->num_mux_defs = 1; 4289 spec->num_mux_defs = 1;
4282 spec->input_mux = &spec->private_imux; 4290 spec->input_mux = &spec->private_imux[0];
4283 4291
4284 store_pin_configs(codec); 4292 store_pin_configs(codec);
4285 return 1; 4293 return 1;
@@ -5487,7 +5495,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec,
5487static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, 5495static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec,
5488 const struct auto_pin_cfg *cfg) 5496 const struct auto_pin_cfg *cfg)
5489{ 5497{
5490 struct hda_input_mux *imux = &spec->private_imux; 5498 struct hda_input_mux *imux = &spec->private_imux[0];
5491 int i, err, idx; 5499 int i, err, idx;
5492 5500
5493 for (i = 0; i < AUTO_PIN_LAST; i++) { 5501 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -5647,7 +5655,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
5647 add_verb(spec, alc260_volume_init_verbs); 5655 add_verb(spec, alc260_volume_init_verbs);
5648 5656
5649 spec->num_mux_defs = 1; 5657 spec->num_mux_defs = 1;
5650 spec->input_mux = &spec->private_imux; 5658 spec->input_mux = &spec->private_imux[0];
5651 5659
5652 store_pin_configs(codec); 5660 store_pin_configs(codec);
5653 return 1; 5661 return 1;
@@ -7087,7 +7095,7 @@ static int patch_alc882(struct hda_codec *codec)
7087 spec->stream_digital_playback = &alc882_pcm_digital_playback; 7095 spec->stream_digital_playback = &alc882_pcm_digital_playback;
7088 spec->stream_digital_capture = &alc882_pcm_digital_capture; 7096 spec->stream_digital_capture = &alc882_pcm_digital_capture;
7089 7097
7090 spec->is_mix_capture = 1; /* matrix-style capture */ 7098 spec->capture_style = CAPT_MIX; /* matrix-style capture */
7091 if (!spec->adc_nids && spec->input_mux) { 7099 if (!spec->adc_nids && spec->input_mux) {
7092 /* check whether NID 0x07 is valid */ 7100 /* check whether NID 0x07 is valid */
7093 unsigned int wcap = get_wcaps(codec, 0x07); 7101 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -7155,10 +7163,14 @@ static hda_nid_t alc883_adc_nids_rev[2] = {
7155 0x09, 0x08 7163 0x09, 0x08
7156}; 7164};
7157 7165
7166#define alc889_adc_nids alc880_adc_nids
7167
7158static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; 7168static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
7159 7169
7160static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; 7170static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
7161 7171
7172#define alc889_capsrc_nids alc882_capsrc_nids
7173
7162/* input MUX */ 7174/* input MUX */
7163/* FIXME: should be a matrix-type input source selection */ 7175/* FIXME: should be a matrix-type input source selection */
7164 7176
@@ -8977,6 +8989,8 @@ static int alc883_parse_auto_config(struct hda_codec *codec)
8977{ 8989{
8978 struct alc_spec *spec = codec->spec; 8990 struct alc_spec *spec = codec->spec;
8979 int err = alc880_parse_auto_config(codec); 8991 int err = alc880_parse_auto_config(codec);
8992 struct auto_pin_cfg *cfg = &spec->autocfg;
8993 int i;
8980 8994
8981 if (err < 0) 8995 if (err < 0)
8982 return err; 8996 return err;
@@ -8990,6 +9004,26 @@ static int alc883_parse_auto_config(struct hda_codec *codec)
8990 /* hack - override the init verbs */ 9004 /* hack - override the init verbs */
8991 spec->init_verbs[0] = alc883_auto_init_verbs; 9005 spec->init_verbs[0] = alc883_auto_init_verbs;
8992 9006
9007 /* setup input_mux for ALC889 */
9008 if (codec->vendor_id == 0x10ec0889) {
9009 /* digital-mic input pin is excluded in alc880_auto_create..()
9010 * because it's under 0x18
9011 */
9012 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
9013 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
9014 struct hda_input_mux *imux = &spec->private_imux[0];
9015 for (i = 1; i < 3; i++)
9016 memcpy(&spec->private_imux[i],
9017 &spec->private_imux[0],
9018 sizeof(spec->private_imux[0]));
9019 imux->items[imux->num_items].label = "Int DMic";
9020 imux->items[imux->num_items].index = 0x0b;
9021 imux->num_items++;
9022 spec->num_mux_defs = 3;
9023 spec->input_mux = spec->private_imux;
9024 }
9025 }
9026
8993 return 1; /* config found */ 9027 return 1; /* config found */
8994} 9028}
8995 9029
@@ -9053,14 +9087,36 @@ static int patch_alc883(struct hda_codec *codec)
9053 spec->stream_name_analog = "ALC888 Analog"; 9087 spec->stream_name_analog = "ALC888 Analog";
9054 spec->stream_name_digital = "ALC888 Digital"; 9088 spec->stream_name_digital = "ALC888 Digital";
9055 } 9089 }
9090 if (!spec->num_adc_nids) {
9091 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9092 spec->adc_nids = alc883_adc_nids;
9093 }
9094 if (!spec->capsrc_nids)
9095 spec->capsrc_nids = alc883_capsrc_nids;
9096 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9056 break; 9097 break;
9057 case 0x10ec0889: 9098 case 0x10ec0889:
9058 spec->stream_name_analog = "ALC889 Analog"; 9099 spec->stream_name_analog = "ALC889 Analog";
9059 spec->stream_name_digital = "ALC889 Digital"; 9100 spec->stream_name_digital = "ALC889 Digital";
9101 if (!spec->num_adc_nids) {
9102 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids);
9103 spec->adc_nids = alc889_adc_nids;
9104 }
9105 if (!spec->capsrc_nids)
9106 spec->capsrc_nids = alc889_capsrc_nids;
9107 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style
9108 capture */
9060 break; 9109 break;
9061 default: 9110 default:
9062 spec->stream_name_analog = "ALC883 Analog"; 9111 spec->stream_name_analog = "ALC883 Analog";
9063 spec->stream_name_digital = "ALC883 Digital"; 9112 spec->stream_name_digital = "ALC883 Digital";
9113 if (!spec->num_adc_nids) {
9114 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9115 spec->adc_nids = alc883_adc_nids;
9116 }
9117 if (!spec->capsrc_nids)
9118 spec->capsrc_nids = alc883_capsrc_nids;
9119 spec->capture_style = CAPT_MIX; /* matrix-style capture */
9064 break; 9120 break;
9065 } 9121 }
9066 9122
@@ -9071,13 +9127,6 @@ static int patch_alc883(struct hda_codec *codec)
9071 spec->stream_digital_playback = &alc883_pcm_digital_playback; 9127 spec->stream_digital_playback = &alc883_pcm_digital_playback;
9072 spec->stream_digital_capture = &alc883_pcm_digital_capture; 9128 spec->stream_digital_capture = &alc883_pcm_digital_capture;
9073 9129
9074 if (!spec->num_adc_nids) {
9075 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);
9076 spec->adc_nids = alc883_adc_nids;
9077 }
9078 if (!spec->capsrc_nids)
9079 spec->capsrc_nids = alc883_capsrc_nids;
9080 spec->is_mix_capture = 1; /* matrix-style capture */
9081 if (!spec->cap_mixer) 9130 if (!spec->cap_mixer)
9082 set_capture_mixer(spec); 9131 set_capture_mixer(spec);
9083 9132
@@ -10512,7 +10561,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
10512 10561
10513 add_verb(spec, alc262_volume_init_verbs); 10562 add_verb(spec, alc262_volume_init_verbs);
10514 spec->num_mux_defs = 1; 10563 spec->num_mux_defs = 1;
10515 spec->input_mux = &spec->private_imux; 10564 spec->input_mux = &spec->private_imux[0];
10516 10565
10517 err = alc_auto_add_mic_boost(codec); 10566 err = alc_auto_add_mic_boost(codec);
10518 if (err < 0) 10567 if (err < 0)
@@ -10881,7 +10930,7 @@ static int patch_alc262(struct hda_codec *codec)
10881 spec->stream_digital_playback = &alc262_pcm_digital_playback; 10930 spec->stream_digital_playback = &alc262_pcm_digital_playback;
10882 spec->stream_digital_capture = &alc262_pcm_digital_capture; 10931 spec->stream_digital_capture = &alc262_pcm_digital_capture;
10883 10932
10884 spec->is_mix_capture = 1; 10933 spec->capture_style = CAPT_MIX;
10885 if (!spec->adc_nids && spec->input_mux) { 10934 if (!spec->adc_nids && spec->input_mux) {
10886 /* check whether NID 0x07 is valid */ 10935 /* check whether NID 0x07 is valid */
10887 unsigned int wcap = get_wcaps(codec, 0x07); 10936 unsigned int wcap = get_wcaps(codec, 0x07);
@@ -11539,7 +11588,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec,
11539static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, 11588static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
11540 const struct auto_pin_cfg *cfg) 11589 const struct auto_pin_cfg *cfg)
11541{ 11590{
11542 struct hda_input_mux *imux = &spec->private_imux; 11591 struct hda_input_mux *imux = &spec->private_imux[0];
11543 int i, idx1; 11592 int i, idx1;
11544 11593
11545 for (i = 0; i < AUTO_PIN_LAST; i++) { 11594 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -11657,7 +11706,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
11657 11706
11658 add_verb(spec, alc268_volume_init_verbs); 11707 add_verb(spec, alc268_volume_init_verbs);
11659 spec->num_mux_defs = 1; 11708 spec->num_mux_defs = 1;
11660 spec->input_mux = &spec->private_imux; 11709 spec->input_mux = &spec->private_imux[0];
11661 11710
11662 err = alc_auto_add_mic_boost(codec); 11711 err = alc_auto_add_mic_boost(codec);
11663 if (err < 0) 11712 if (err < 0)
@@ -12511,7 +12560,7 @@ static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec,
12511 */ 12560 */
12512 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || 12561 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 ||
12513 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { 12562 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) {
12514 struct hda_input_mux *imux = &spec->private_imux; 12563 struct hda_input_mux *imux = &spec->private_imux[0];
12515 imux->items[imux->num_items].label = "Int Mic"; 12564 imux->items[imux->num_items].label = "Int Mic";
12516 imux->items[imux->num_items].index = 0x05; 12565 imux->items[imux->num_items].index = 0x05;
12517 imux->num_items++; 12566 imux->num_items++;
@@ -12567,7 +12616,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
12567 12616
12568 add_verb(spec, alc269_init_verbs); 12617 add_verb(spec, alc269_init_verbs);
12569 spec->num_mux_defs = 1; 12618 spec->num_mux_defs = 1;
12570 spec->input_mux = &spec->private_imux; 12619 spec->input_mux = &spec->private_imux[0];
12571 /* set default input source */ 12620 /* set default input source */
12572 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], 12621 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0],
12573 0, AC_VERB_SET_CONNECT_SEL, 12622 0, AC_VERB_SET_CONNECT_SEL,
@@ -13483,7 +13532,7 @@ static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin)
13483static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, 13532static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec,
13484 const struct auto_pin_cfg *cfg) 13533 const struct auto_pin_cfg *cfg)
13485{ 13534{
13486 struct hda_input_mux *imux = &spec->private_imux; 13535 struct hda_input_mux *imux = &spec->private_imux[0];
13487 int i, err, idx, idx1; 13536 int i, err, idx, idx1;
13488 13537
13489 for (i = 0; i < AUTO_PIN_LAST; i++) { 13538 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -13620,7 +13669,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
13620 add_verb(spec, alc861_auto_init_verbs); 13669 add_verb(spec, alc861_auto_init_verbs);
13621 13670
13622 spec->num_mux_defs = 1; 13671 spec->num_mux_defs = 1;
13623 spec->input_mux = &spec->private_imux; 13672 spec->input_mux = &spec->private_imux[0];
13624 13673
13625 spec->adc_nids = alc861_adc_nids; 13674 spec->adc_nids = alc861_adc_nids;
13626 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); 13675 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);
@@ -14724,7 +14773,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
14724 add_verb(spec, alc861vd_volume_init_verbs); 14773 add_verb(spec, alc861vd_volume_init_verbs);
14725 14774
14726 spec->num_mux_defs = 1; 14775 spec->num_mux_defs = 1;
14727 spec->input_mux = &spec->private_imux; 14776 spec->input_mux = &spec->private_imux[0];
14728 14777
14729 err = alc_auto_add_mic_boost(codec); 14778 err = alc_auto_add_mic_boost(codec);
14730 if (err < 0) 14779 if (err < 0)
@@ -14803,7 +14852,7 @@ static int patch_alc861vd(struct hda_codec *codec)
14803 spec->adc_nids = alc861vd_adc_nids; 14852 spec->adc_nids = alc861vd_adc_nids;
14804 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); 14853 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids);
14805 spec->capsrc_nids = alc861vd_capsrc_nids; 14854 spec->capsrc_nids = alc861vd_capsrc_nids;
14806 spec->is_mix_capture = 1; 14855 spec->capture_style = CAPT_MIX;
14807 14856
14808 set_capture_mixer(spec); 14857 set_capture_mixer(spec);
14809 14858
@@ -16397,7 +16446,7 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin,
16397static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, 16446static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,
16398 const struct auto_pin_cfg *cfg) 16447 const struct auto_pin_cfg *cfg)
16399{ 16448{
16400 struct hda_input_mux *imux = &spec->private_imux; 16449 struct hda_input_mux *imux = &spec->private_imux[0];
16401 int i, err, idx; 16450 int i, err, idx;
16402 16451
16403 for (i = 0; i < AUTO_PIN_LAST; i++) { 16452 for (i = 0; i < AUTO_PIN_LAST; i++) {
@@ -16528,7 +16577,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
16528 add_mixer(spec, spec->kctls.list); 16577 add_mixer(spec, spec->kctls.list);
16529 16578
16530 spec->num_mux_defs = 1; 16579 spec->num_mux_defs = 1;
16531 spec->input_mux = &spec->private_imux; 16580 spec->input_mux = &spec->private_imux[0];
16532 16581
16533 add_verb(spec, alc662_auto_init_verbs); 16582 add_verb(spec, alc662_auto_init_verbs);
16534 if (codec->vendor_id == 0x10ec0663) 16583 if (codec->vendor_id == 0x10ec0663)
@@ -16613,7 +16662,7 @@ static int patch_alc662(struct hda_codec *codec)
16613 spec->adc_nids = alc662_adc_nids; 16662 spec->adc_nids = alc662_adc_nids;
16614 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 16663 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids);
16615 spec->capsrc_nids = alc662_capsrc_nids; 16664 spec->capsrc_nids = alc662_capsrc_nids;
16616 spec->is_mix_capture = 1; 16665 spec->capture_style = CAPT_MIX;
16617 16666
16618 if (!spec->cap_mixer) 16667 if (!spec->cap_mixer)
16619 set_capture_mixer(spec); 16668 set_capture_mixer(spec);