diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8f93b97559a5..80d6add8a620 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1604,27 +1604,29 @@ static void alc_auto_init_digital(struct hda_codec *codec) | |||
1604 | static void alc_auto_parse_digital(struct hda_codec *codec) | 1604 | static void alc_auto_parse_digital(struct hda_codec *codec) |
1605 | { | 1605 | { |
1606 | struct alc_spec *spec = codec->spec; | 1606 | struct alc_spec *spec = codec->spec; |
1607 | int i, err; | 1607 | int i, err, nums; |
1608 | hda_nid_t dig_nid; | 1608 | hda_nid_t dig_nid; |
1609 | 1609 | ||
1610 | /* support multiple SPDIFs; the secondary is set up as a slave */ | 1610 | /* support multiple SPDIFs; the secondary is set up as a slave */ |
1611 | nums = 0; | ||
1611 | for (i = 0; i < spec->autocfg.dig_outs; i++) { | 1612 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
1612 | hda_nid_t conn[4]; | 1613 | hda_nid_t conn[4]; |
1613 | err = snd_hda_get_connections(codec, | 1614 | err = snd_hda_get_connections(codec, |
1614 | spec->autocfg.dig_out_pins[i], | 1615 | spec->autocfg.dig_out_pins[i], |
1615 | conn, ARRAY_SIZE(conn)); | 1616 | conn, ARRAY_SIZE(conn)); |
1616 | if (err < 0) | 1617 | if (err <= 0) |
1617 | continue; | 1618 | continue; |
1618 | dig_nid = conn[0]; /* assume the first element is audio-out */ | 1619 | dig_nid = conn[0]; /* assume the first element is audio-out */ |
1619 | if (!i) { | 1620 | if (!nums) { |
1620 | spec->multiout.dig_out_nid = dig_nid; | 1621 | spec->multiout.dig_out_nid = dig_nid; |
1621 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | 1622 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; |
1622 | } else { | 1623 | } else { |
1623 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | 1624 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
1624 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) | 1625 | if (nums >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
1625 | break; | 1626 | break; |
1626 | spec->slave_dig_outs[i - 1] = dig_nid; | 1627 | spec->slave_dig_outs[nums - 1] = dig_nid; |
1627 | } | 1628 | } |
1629 | nums++; | ||
1628 | } | 1630 | } |
1629 | 1631 | ||
1630 | if (spec->autocfg.dig_in_pin) { | 1632 | if (spec->autocfg.dig_in_pin) { |
@@ -2270,6 +2272,7 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2270 | struct alc_spec *spec = codec->spec; | 2272 | struct alc_spec *spec = codec->spec; |
2271 | struct hda_pcm *info = spec->pcm_rec; | 2273 | struct hda_pcm *info = spec->pcm_rec; |
2272 | const struct hda_pcm_stream *p; | 2274 | const struct hda_pcm_stream *p; |
2275 | bool have_multi_adcs; | ||
2273 | int i; | 2276 | int i; |
2274 | 2277 | ||
2275 | codec->num_pcms = 1; | 2278 | codec->num_pcms = 1; |
@@ -2348,8 +2351,11 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2348 | /* If the use of more than one ADC is requested for the current | 2351 | /* If the use of more than one ADC is requested for the current |
2349 | * model, configure a second analog capture-only PCM. | 2352 | * model, configure a second analog capture-only PCM. |
2350 | */ | 2353 | */ |
2354 | have_multi_adcs = (spec->num_adc_nids > 1) && | ||
2355 | !spec->dyn_adc_switch && !spec->auto_mic && | ||
2356 | (!spec->input_mux || spec->input_mux->num_items > 1); | ||
2351 | /* Additional Analaog capture for index #2 */ | 2357 | /* Additional Analaog capture for index #2 */ |
2352 | if (spec->alt_dac_nid || spec->num_adc_nids > 1) { | 2358 | if (spec->alt_dac_nid || have_multi_adcs) { |
2353 | codec->num_pcms = 3; | 2359 | codec->num_pcms = 3; |
2354 | info = spec->pcm_rec + 2; | 2360 | info = spec->pcm_rec + 2; |
2355 | info->name = spec->stream_name_analog; | 2361 | info->name = spec->stream_name_analog; |
@@ -2365,7 +2371,7 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2365 | alc_pcm_null_stream; | 2371 | alc_pcm_null_stream; |
2366 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; | 2372 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
2367 | } | 2373 | } |
2368 | if (spec->num_adc_nids > 1) { | 2374 | if (have_multi_adcs) { |
2369 | p = spec->stream_analog_alt_capture; | 2375 | p = spec->stream_analog_alt_capture; |
2370 | if (!p) | 2376 | if (!p) |
2371 | p = &alc_pcm_analog_alt_capture; | 2377 | p = &alc_pcm_analog_alt_capture; |
@@ -2657,7 +2663,6 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) | |||
2657 | hda_nid_t *adc_nids = spec->private_adc_nids; | 2663 | hda_nid_t *adc_nids = spec->private_adc_nids; |
2658 | hda_nid_t *cap_nids = spec->private_capsrc_nids; | 2664 | hda_nid_t *cap_nids = spec->private_capsrc_nids; |
2659 | int max_nums = ARRAY_SIZE(spec->private_adc_nids); | 2665 | int max_nums = ARRAY_SIZE(spec->private_adc_nids); |
2660 | bool indep_capsrc = false; | ||
2661 | int i, nums = 0; | 2666 | int i, nums = 0; |
2662 | 2667 | ||
2663 | nid = codec->start_nid; | 2668 | nid = codec->start_nid; |
@@ -2679,13 +2684,11 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec) | |||
2679 | break; | 2684 | break; |
2680 | if (type == AC_WID_AUD_SEL) { | 2685 | if (type == AC_WID_AUD_SEL) { |
2681 | cap_nids[nums] = src; | 2686 | cap_nids[nums] = src; |
2682 | indep_capsrc = true; | ||
2683 | break; | 2687 | break; |
2684 | } | 2688 | } |
2685 | n = snd_hda_get_conn_list(codec, src, &list); | 2689 | n = snd_hda_get_conn_list(codec, src, &list); |
2686 | if (n > 1) { | 2690 | if (n > 1) { |
2687 | cap_nids[nums] = src; | 2691 | cap_nids[nums] = src; |
2688 | indep_capsrc = true; | ||
2689 | break; | 2692 | break; |
2690 | } else if (n != 1) | 2693 | } else if (n != 1) |
2691 | break; | 2694 | break; |