Skip to content

Commit

Permalink
ALSA: hda - Make add_stereo_mix_input flag tristate
Browse files Browse the repository at this point in the history
... 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>
  • Loading branch information
Takashi Iwai committed Dec 15, 2014
1 parent 82d04e1 commit 74f14b3
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
8 changes: 3 additions & 5 deletions sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -3218,8 +3218,7 @@ static int create_input_ctls(struct hda_codec *codec)
}

/* add stereo mix when explicitly enabled via hint */
if (mixer && spec->add_stereo_mix_input &&
snd_hda_get_bool_hint(codec, "add_stereo_mix_input") > 0) {
if (mixer && spec->add_stereo_mix_input == HDA_HINT_STEREO_MIX_ENABLE) {
err = parse_capture_source(codec, mixer, CFG_IDX_MIX, num_adcs,
"Stereo Mix", 0);
if (err < 0)
Expand Down Expand Up @@ -4544,9 +4543,8 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,

/* add stereo mix if available and not enabled yet */
if (!spec->auto_mic && spec->mixer_nid &&
spec->add_stereo_mix_input &&
spec->input_mux.num_items > 1 &&
snd_hda_get_bool_hint(codec, "add_stereo_mix_input") < 0) {
spec->add_stereo_mix_input == HDA_HINT_STEREO_MIX_AUTO &&
spec->input_mux.num_items > 1) {
err = parse_capture_source(codec, spec->mixer_nid,
CFG_IDX_MIX, spec->num_all_adcs,
"Stereo Mix", 0);
Expand Down
9 changes: 8 additions & 1 deletion sound/pci/hda/hda_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct hda_gen_spec {
unsigned int vmaster_mute_enum:1; /* add vmaster mute mode enum */
unsigned int indep_hp:1; /* independent HP supported */
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 power_down_unused:1; /* power down unused widgets */
unsigned int dac_min_mute:1; /* minimal = mute for DACs */
Expand Down Expand Up @@ -291,6 +291,13 @@ struct hda_gen_spec {
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_init(struct hda_codec *codec);
Expand Down
3 changes: 2 additions & 1 deletion sound/pci/hda/patch_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp)
codec->no_sticky_stream = 1;

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);
if (err < 0)
Expand Down
4 changes: 2 additions & 2 deletions sound/pci/hda/patch_conexant.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,14 +855,14 @@ static int patch_conexant_auto(struct hda_codec *codec)
case 0x14f15045:
codec->single_adc_amp = 1;
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,
cxt5045_fixups, cxt_fixups);
break;
case 0x14f15047:
codec->pin_amp_workaround = 1;
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,
cxt5047_fixups, cxt_fixups);
break;
Expand Down
2 changes: 1 addition & 1 deletion sound/pci/hda/patch_via.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static struct via_spec *via_new_spec(struct hda_codec *codec)
spec->gen.indep_hp = 1;
spec->gen.keep_eapd_on = 1;
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;
}

Expand Down

0 comments on commit 74f14b3

Please sign in to comment.