Commit cd896c33 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Allow multiple imux for matrix-type mixers of ALC codecs

Allow the multiple imux instances for matrix-type mixers like ALC882.
So far, only ALC260 used this feature, but other codecs may need a
similar stuff.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a581780a
...@@ -382,11 +382,15 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, ...@@ -382,11 +382,15 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
{ {
struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
const struct hda_input_mux *imux = spec->input_mux; const struct hda_input_mux *imux;
unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
unsigned int mux_idx;
hda_nid_t nid = spec->capsrc_nids ? hda_nid_t nid = spec->capsrc_nids ?
spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
imux = &spec->input_mux[mux_idx];
if (spec->is_mix_capture) { if (spec->is_mix_capture) {
/* Matrix-mixer style (e.g. ALC882) */ /* Matrix-mixer style (e.g. ALC882) */
unsigned int *cur_val = &spec->cur_mux[adc_idx]; unsigned int *cur_val = &spec->cur_mux[adc_idx];
...@@ -407,10 +411,7 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, ...@@ -407,10 +411,7 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
return 1; return 1;
} else { } else {
/* MUX style (e.g. ALC880) */ /* MUX style (e.g. ALC880) */
unsigned int mux_idx; return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx],
ucontrol, nid,
&spec->cur_mux[adc_idx]); &spec->cur_mux[adc_idx]);
} }
} }
......
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