Commit bd32f782 authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent c2fd19c2
...@@ -2672,6 +2672,10 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin, ...@@ -2672,6 +2672,10 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin,
struct nid_path *path; struct nid_path *path;
int err, idx; 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); path = snd_array_new(&spec->loopback_path);
if (!path) if (!path)
return -ENOMEM; return -ENOMEM;
...@@ -2680,14 +2684,20 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin, ...@@ -2680,14 +2684,20 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin,
return -EINVAL; return -EINVAL;
idx = path->idx[path->depth - 1]; idx = path->idx[path->depth - 1];
if (nid_has_volume(codec, mix_nid, HDA_INPUT)) {
err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx, err = __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, ctlname, ctlidx,
HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
if (err < 0) if (err < 0)
return err; return err;
}
if (nid_has_mute(codec, mix_nid, HDA_INPUT)) {
err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx, err = __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, ctlname, ctlidx,
HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT));
if (err < 0) if (err < 0)
return err; return err;
}
add_loopback_list(spec, mix_nid, idx); add_loopback_list(spec, mix_nid, idx);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment