ALSA: hda - Make add_stereo_mix_input flag tristate
authorTakashi Iwai <tiwai@suse.de>
Mon, 15 Dec 2014 12:43:59 +0000 (13:43 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 15 Dec 2014 12:46:08 +0000 (13:46 +0100)
... 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>
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_generic.h
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_via.c

index 293af6b5ba3d37afd1cd587fa0bfc89728dfacd0..b680b4ec63313c8b1152390dbbf602018a212952 100644 (file)
@@ -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)
@@ -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);
index 61dd5153f512b99a26d44305dc2e17b723322077..3d852660443aafedf7450b39692b70aa1d59921a 100644 (file)
@@ -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 */
@@ -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);
index c81b715d6c985f2002daaa3da4567ac100257f8a..eb54da757407667be3acfefd45595c4043395c6c 100644 (file)
@@ -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)
index e9ebc7bd752cae1afdf95c0b2d2e0e8a15d2393b..fd3ed18670e9c4005d115a26f6410c7efd4faff8 100644 (file)
@@ -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;
index 6c206b6c8d65d389119e5f7c630f45e52767bd61..3de6d3d779c994d18fb54a09e7bbf33be98eee26 100644 (file)
@@ -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;
 }