ALSA: hda - Make add_stereo_mix_input flag tristate

... for distinguishing whether it's explicitly enabled via a user hint
or enabled by a driver as a fallback.  Now the former case corresponds
to HDA_HINT_STEREO_MIX_ENABLE while the latter to
HDA_HINT_STEREO_MIX_AUTO.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2014-12-15 13:43:59 +01:00
parent 82d04e1088
commit 74f14b3683
5 changed files with 16 additions and 10 deletions

View File

@ -3218,8 +3218,7 @@ static int create_input_ctls(struct hda_codec *codec)
} }
/* add stereo mix when explicitly enabled via hint */ /* add stereo mix when explicitly enabled via hint */
if (mixer && spec->add_stereo_mix_input && if (mixer && spec->add_stereo_mix_input == HDA_HINT_STEREO_MIX_ENABLE) {
snd_hda_get_bool_hint(codec, "add_stereo_mix_input") > 0) {
err = parse_capture_source(codec, mixer, CFG_IDX_MIX, num_adcs, err = parse_capture_source(codec, mixer, CFG_IDX_MIX, num_adcs,
"Stereo Mix", 0); "Stereo Mix", 0);
if (err < 0) if (err < 0)
@ -4544,9 +4543,8 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
/* add stereo mix if available and not enabled yet */ /* add stereo mix if available and not enabled yet */
if (!spec->auto_mic && spec->mixer_nid && if (!spec->auto_mic && spec->mixer_nid &&
spec->add_stereo_mix_input && spec->add_stereo_mix_input == HDA_HINT_STEREO_MIX_AUTO &&
spec->input_mux.num_items > 1 && spec->input_mux.num_items > 1) {
snd_hda_get_bool_hint(codec, "add_stereo_mix_input") < 0) {
err = parse_capture_source(codec, spec->mixer_nid, err = parse_capture_source(codec, spec->mixer_nid,
CFG_IDX_MIX, spec->num_all_adcs, CFG_IDX_MIX, spec->num_all_adcs,
"Stereo Mix", 0); "Stereo Mix", 0);

View File

@ -222,7 +222,7 @@ struct hda_gen_spec {
unsigned int vmaster_mute_enum:1; /* add vmaster mute mode enum */ unsigned int vmaster_mute_enum:1; /* add vmaster mute mode enum */
unsigned int indep_hp:1; /* independent HP supported */ unsigned int indep_hp:1; /* independent HP supported */
unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */ unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */
unsigned int add_stereo_mix_input:1; /* add aamix as a capture src */ unsigned int add_stereo_mix_input:2; /* add aamix as a capture src */
unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */ unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */
unsigned int power_down_unused:1; /* power down unused widgets */ unsigned int power_down_unused:1; /* power down unused widgets */
unsigned int dac_min_mute:1; /* minimal = mute for DACs */ unsigned int dac_min_mute:1; /* minimal = mute for DACs */
@ -291,6 +291,13 @@ struct hda_gen_spec {
struct hda_jack_callback *cb); struct hda_jack_callback *cb);
}; };
/* values for add_stereo_mix_input flag */
enum {
HDA_HINT_STEREO_MIX_DISABLE, /* No stereo mix input */
HDA_HINT_STEREO_MIX_ENABLE, /* Add stereo mix input */
HDA_HINT_STEREO_MIX_AUTO, /* Add only if auto-mic is disabled */
};
int snd_hda_gen_spec_init(struct hda_gen_spec *spec); int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
int snd_hda_gen_init(struct hda_codec *codec); int snd_hda_gen_init(struct hda_codec *codec);

View File

@ -195,7 +195,8 @@ static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp)
codec->no_sticky_stream = 1; codec->no_sticky_stream = 1;
spec->gen.indep_hp = indep_hp; spec->gen.indep_hp = indep_hp;
spec->gen.add_stereo_mix_input = 1; if (!spec->gen.add_stereo_mix_input)
spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0); err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0);
if (err < 0) if (err < 0)

View File

@ -855,14 +855,14 @@ static int patch_conexant_auto(struct hda_codec *codec)
case 0x14f15045: case 0x14f15045:
codec->single_adc_amp = 1; codec->single_adc_amp = 1;
spec->gen.mixer_nid = 0x17; spec->gen.mixer_nid = 0x17;
spec->gen.add_stereo_mix_input = 1; spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
snd_hda_pick_fixup(codec, cxt5045_fixup_models, snd_hda_pick_fixup(codec, cxt5045_fixup_models,
cxt5045_fixups, cxt_fixups); cxt5045_fixups, cxt_fixups);
break; break;
case 0x14f15047: case 0x14f15047:
codec->pin_amp_workaround = 1; codec->pin_amp_workaround = 1;
spec->gen.mixer_nid = 0x19; spec->gen.mixer_nid = 0x19;
spec->gen.add_stereo_mix_input = 1; spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
snd_hda_pick_fixup(codec, cxt5047_fixup_models, snd_hda_pick_fixup(codec, cxt5047_fixup_models,
cxt5047_fixups, cxt_fixups); cxt5047_fixups, cxt_fixups);
break; break;

View File

@ -137,7 +137,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec)
spec->gen.indep_hp = 1; spec->gen.indep_hp = 1;
spec->gen.keep_eapd_on = 1; spec->gen.keep_eapd_on = 1;
spec->gen.pcm_playback_hook = via_playback_pcm_hook; spec->gen.pcm_playback_hook = via_playback_pcm_hook;
spec->gen.add_stereo_mix_input = 1; spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
return spec; return spec;
} }