diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-03-30 12:00:42 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-03-30 12:00:42 -0400 |
commit | c35c9d5d3f03c203168e816f6f735d23f92fd6f1 (patch) | |
tree | 4ff805dce30f00e1c3d73c8faa7808d3d3a01903 /sound/pci | |
parent | 467126460818e287aa92c73232c38453ec2ab013 (diff) | |
parent | 1f85d72d2c9c9a1d6d32cf325936bc224ad5d591 (diff) |
Merge branch 'fix/hda' into topic/hda
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 96 |
1 files changed, 81 insertions, 15 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index edd5071cf011..1694f60631a1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -5064,6 +5064,70 @@ static void set_capture_mixer(struct hda_codec *codec) | |||
5064 | } | 5064 | } |
5065 | } | 5065 | } |
5066 | 5066 | ||
5067 | /* fill adc_nids (and capsrc_nids) containing all active input pins */ | ||
5068 | static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids, | ||
5069 | int num_nids) | ||
5070 | { | ||
5071 | struct alc_spec *spec = codec->spec; | ||
5072 | int n; | ||
5073 | hda_nid_t fallback_adc = 0, fallback_cap = 0; | ||
5074 | |||
5075 | for (n = 0; n < num_nids; n++) { | ||
5076 | hda_nid_t adc, cap; | ||
5077 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; | ||
5078 | int nconns, i, j; | ||
5079 | |||
5080 | adc = nids[n]; | ||
5081 | if (get_wcaps_type(get_wcaps(codec, adc)) != AC_WID_AUD_IN) | ||
5082 | continue; | ||
5083 | cap = adc; | ||
5084 | nconns = snd_hda_get_connections(codec, cap, conn, | ||
5085 | ARRAY_SIZE(conn)); | ||
5086 | if (nconns == 1) { | ||
5087 | cap = conn[0]; | ||
5088 | nconns = snd_hda_get_connections(codec, cap, conn, | ||
5089 | ARRAY_SIZE(conn)); | ||
5090 | } | ||
5091 | if (nconns <= 0) | ||
5092 | continue; | ||
5093 | if (!fallback_adc) { | ||
5094 | fallback_adc = adc; | ||
5095 | fallback_cap = cap; | ||
5096 | } | ||
5097 | for (i = 0; i < AUTO_PIN_LAST; i++) { | ||
5098 | hda_nid_t nid = spec->autocfg.input_pins[i]; | ||
5099 | if (!nid) | ||
5100 | continue; | ||
5101 | for (j = 0; j < nconns; j++) { | ||
5102 | if (conn[j] == nid) | ||
5103 | break; | ||
5104 | } | ||
5105 | if (j >= nconns) | ||
5106 | break; | ||
5107 | } | ||
5108 | if (i >= AUTO_PIN_LAST) { | ||
5109 | int num_adcs = spec->num_adc_nids; | ||
5110 | spec->private_adc_nids[num_adcs] = adc; | ||
5111 | spec->private_capsrc_nids[num_adcs] = cap; | ||
5112 | spec->num_adc_nids++; | ||
5113 | spec->adc_nids = spec->private_adc_nids; | ||
5114 | if (adc != cap) | ||
5115 | spec->capsrc_nids = spec->private_capsrc_nids; | ||
5116 | } | ||
5117 | } | ||
5118 | if (!spec->num_adc_nids) { | ||
5119 | printk(KERN_WARNING "hda_codec: %s: no valid ADC found;" | ||
5120 | " using fallback 0x%x\n", | ||
5121 | codec->chip_name, fallback_adc); | ||
5122 | spec->private_adc_nids[0] = fallback_adc; | ||
5123 | spec->adc_nids = spec->private_adc_nids; | ||
5124 | if (fallback_adc != fallback_cap) { | ||
5125 | spec->private_capsrc_nids[0] = fallback_cap; | ||
5126 | spec->capsrc_nids = spec->private_adc_nids; | ||
5127 | } | ||
5128 | } | ||
5129 | } | ||
5130 | |||
5067 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | 5131 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
5068 | #define set_beep_amp(spec, nid, idx, dir) \ | 5132 | #define set_beep_amp(spec, nid, idx, dir) \ |
5069 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | 5133 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
@@ -13418,9 +13482,9 @@ static hda_nid_t alc269vb_capsrc_nids[1] = { | |||
13418 | 0x22, | 13482 | 0x22, |
13419 | }; | 13483 | }; |
13420 | 13484 | ||
13421 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), | 13485 | static hda_nid_t alc269_adc_candidates[] = { |
13422 | * not a mux! | 13486 | 0x08, 0x09, 0x07, |
13423 | */ | 13487 | }; |
13424 | 13488 | ||
13425 | #define alc269_modes alc260_modes | 13489 | #define alc269_modes alc260_modes |
13426 | #define alc269_capture_source alc880_lg_lw_capture_source | 13490 | #define alc269_capture_source alc880_lg_lw_capture_source |
@@ -13927,7 +13991,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
13927 | struct alc_spec *spec = codec->spec; | 13991 | struct alc_spec *spec = codec->spec; |
13928 | int err; | 13992 | int err; |
13929 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | 13993 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
13930 | hda_nid_t real_capsrc_nids; | ||
13931 | 13994 | ||
13932 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | 13995 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
13933 | alc269_ignore); | 13996 | alc269_ignore); |
@@ -13951,18 +14014,19 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
13951 | 14014 | ||
13952 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { | 14015 | if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { |
13953 | add_verb(spec, alc269vb_init_verbs); | 14016 | add_verb(spec, alc269vb_init_verbs); |
13954 | real_capsrc_nids = alc269vb_capsrc_nids[0]; | ||
13955 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); | 14017 | alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); |
13956 | } else { | 14018 | } else { |
13957 | add_verb(spec, alc269_init_verbs); | 14019 | add_verb(spec, alc269_init_verbs); |
13958 | real_capsrc_nids = alc269_capsrc_nids[0]; | ||
13959 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); | 14020 | alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); |
13960 | } | 14021 | } |
13961 | 14022 | ||
13962 | spec->num_mux_defs = 1; | 14023 | spec->num_mux_defs = 1; |
13963 | spec->input_mux = &spec->private_imux[0]; | 14024 | spec->input_mux = &spec->private_imux[0]; |
14025 | fillup_priv_adc_nids(codec, alc269_adc_candidates, | ||
14026 | sizeof(alc269_adc_candidates)); | ||
14027 | |||
13964 | /* set default input source */ | 14028 | /* set default input source */ |
13965 | snd_hda_codec_write_cache(codec, real_capsrc_nids, | 14029 | snd_hda_codec_write_cache(codec, spec->capsrc_nids[0], |
13966 | 0, AC_VERB_SET_CONNECT_SEL, | 14030 | 0, AC_VERB_SET_CONNECT_SEL, |
13967 | spec->input_mux->items[0].index); | 14031 | spec->input_mux->items[0].index); |
13968 | 14032 | ||
@@ -14241,14 +14305,16 @@ static int patch_alc269(struct hda_codec *codec) | |||
14241 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | 14305 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
14242 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | 14306 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
14243 | 14307 | ||
14244 | if (!is_alc269vb) { | 14308 | if (!spec->adc_nids) { /* wasn't filled automatically? use default */ |
14245 | spec->adc_nids = alc269_adc_nids; | 14309 | if (!is_alc269vb) { |
14246 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | 14310 | spec->adc_nids = alc269_adc_nids; |
14247 | spec->capsrc_nids = alc269_capsrc_nids; | 14311 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
14248 | } else { | 14312 | spec->capsrc_nids = alc269_capsrc_nids; |
14249 | spec->adc_nids = alc269vb_adc_nids; | 14313 | } else { |
14250 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); | 14314 | spec->adc_nids = alc269vb_adc_nids; |
14251 | spec->capsrc_nids = alc269vb_capsrc_nids; | 14315 | spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); |
14316 | spec->capsrc_nids = alc269vb_capsrc_nids; | ||
14317 | } | ||
14252 | } | 14318 | } |
14253 | 14319 | ||
14254 | if (!spec->cap_mixer) | 14320 | if (!spec->cap_mixer) |