diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-12-12 18:08:52 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-01-10 10:34:29 +0100 |
commit | bd32f782b956e6a3040696899a818387ecbe17bc (patch) | |
tree | 601efb9607464368cd2c8aeeee7caa9f5cf76e1e | |
parent | c2fd19c2fc3cc5e609c573f3c66711fd809f9d3c (diff) | |
download | linux-bd32f782b956e6a3040696899a818387ecbe17bc.tar.bz2 |
ALSA: hda/realtek - Check amp capabilities of aa-mixer widget
For handling the analog-loopback paths more generically, check the amp
capabilities of the aa-mixer widget, and create only the appropriate
mixer elements.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8ce0a0d4f083..7a22ab0b047b 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2672,6 +2672,10 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin, struct nid_path *path; int err, idx; + if (!nid_has_volume(codec, mix_nid, HDA_INPUT) && + !nid_has_mute(codec, mix_nid, HDA_INPUT)) + return 0; /* no need for analog loopback */ + path = snd_array_new(&spec->loopback_path); if (!path) return -ENOMEM; @@ -2680,14 +2684,20 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin, return -EINVAL; idx = path->idx[path->depth - 1]; - err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, + if (nid_has_volume(codec, mix_nid, HDA_INPUT)) { + err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); - if (err < 0) - return err; - err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, + if (err < 0) + return err; + } + + if (nid_has_mute(codec, mix_nid, HDA_INPUT)) { + err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); - if (err < 0) - return err; + if (err < 0) + return err; + } + add_loopback_list(spec, mix_nid, idx); return 0; } |