From patchwork Mon Dec 15 12:56:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 5492851 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A81ACBEEA8 for ; Mon, 15 Dec 2014 12:57:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B626420A0D for ; Mon, 15 Dec 2014 12:57:36 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 1D38F20A0C for ; Mon, 15 Dec 2014 12:57:35 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8CB8926067C; Mon, 15 Dec 2014 13:57:33 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 330EA2604D2; Mon, 15 Dec 2014 13:57:00 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id EC02826049F; Mon, 15 Dec 2014 13:56:57 +0100 (CET) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id E2B44260490 for ; Mon, 15 Dec 2014 13:56:49 +0100 (CET) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B0C8FAC8B for ; Mon, 15 Dec 2014 12:56:49 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Mon, 15 Dec 2014 13:56:42 +0100 Message-Id: <1418648202-2509-2-git-send-email-tiwai@suse.de> X-Mailer: git-send-email 2.2.0 In-Reply-To: <1418648202-2509-1-git-send-email-tiwai@suse.de> References: <1418648202-2509-1-git-send-email-tiwai@suse.de> Subject: [alsa-devel] [PATCH 2/2] ALSA: hda - Make add_stereo_mix_input flag tristate X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP ... 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 --- sound/pci/hda/hda_generic.c | 8 +++----- sound/pci/hda/hda_generic.h | 9 ++++++++- sound/pci/hda/patch_analog.c | 3 ++- sound/pci/hda/patch_conexant.c | 4 ++-- sound/pci/hda/patch_via.c | 2 +- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 293af6b5ba3d..b680b4ec6331 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -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); diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h index 61dd5153f512..3d852660443a 100644 --- a/sound/pci/hda/hda_generic.h +++ b/sound/pci/hda/hda_generic.h @@ -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); diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index c81b715d6c98..eb54da757407 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c @@ -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) diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index e9ebc7bd752c..fd3ed18670e9 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -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; diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 6c206b6c8d65..3de6d3d779c9 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c @@ -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; }