diff options
-rw-r--r-- | sound/pci/hda/patch_analog.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 55ce897ef0b3..05ca027fcc01 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -2621,7 +2621,7 @@ static int ad1988_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
2621 | { | 2621 | { |
2622 | struct ad198x_spec *spec = codec->spec; | 2622 | struct ad198x_spec *spec = codec->spec; |
2623 | hda_nid_t nid; | 2623 | hda_nid_t nid; |
2624 | int idx, err; | 2624 | int i, idx, err; |
2625 | char name[32]; | 2625 | char name[32]; |
2626 | 2626 | ||
2627 | if (! pin) | 2627 | if (! pin) |
@@ -2629,16 +2629,26 @@ static int ad1988_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, | |||
2629 | 2629 | ||
2630 | idx = ad1988_pin_idx(pin); | 2630 | idx = ad1988_pin_idx(pin); |
2631 | nid = ad1988_idx_to_dac(codec, idx); | 2631 | nid = ad1988_idx_to_dac(codec, idx); |
2632 | /* specify the DAC as the extra output */ | 2632 | /* check whether the corresponding DAC was already taken */ |
2633 | if (! spec->multiout.hp_nid) | 2633 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
2634 | spec->multiout.hp_nid = nid; | 2634 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
2635 | else | 2635 | hda_nid_t dac = ad1988_idx_to_dac(codec, ad1988_pin_idx(pin)); |
2636 | spec->multiout.extra_out_nid[0] = nid; | 2636 | if (dac == nid) |
2637 | /* control HP volume/switch on the output mixer amp */ | 2637 | break; |
2638 | sprintf(name, "%s Playback Volume", pfx); | 2638 | } |
2639 | if ((err = add_control(spec, AD_CTL_WIDGET_VOL, name, | 2639 | if (i >= spec->autocfg.line_outs) { |
2640 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) | 2640 | /* specify the DAC as the extra output */ |
2641 | return err; | 2641 | if (!spec->multiout.hp_nid) |
2642 | spec->multiout.hp_nid = nid; | ||
2643 | else | ||
2644 | spec->multiout.extra_out_nid[0] = nid; | ||
2645 | /* control HP volume/switch on the output mixer amp */ | ||
2646 | sprintf(name, "%s Playback Volume", pfx); | ||
2647 | err = add_control(spec, AD_CTL_WIDGET_VOL, name, | ||
2648 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | ||
2649 | if (err < 0) | ||
2650 | return err; | ||
2651 | } | ||
2642 | nid = ad1988_mixer_nids[idx]; | 2652 | nid = ad1988_mixer_nids[idx]; |
2643 | sprintf(name, "%s Playback Switch", pfx); | 2653 | sprintf(name, "%s Playback Switch", pfx); |
2644 | if ((err = add_control(spec, AD_CTL_BIND_MUTE, name, | 2654 | if ((err = add_control(spec, AD_CTL_BIND_MUTE, name, |