From patchwork Mon Apr 27 08:49:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 6278731 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.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 956A9BF4A6 for ; Mon, 27 Apr 2015 08:50:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F7A32041D for ; Mon, 27 Apr 2015 08:50:10 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 36377203B1 for ; Mon, 27 Apr 2015 08:50:09 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9817A265114; Mon, 27 Apr 2015 10:50:07 +0200 (CEST) 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, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 05C162650C0; Mon, 27 Apr 2015 10:50:06 +0200 (CEST) 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 66E052650E7; Mon, 27 Apr 2015 10:50:04 +0200 (CEST) Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 96924260564 for ; Mon, 27 Apr 2015 10:49:53 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 23F83AB1C; Mon, 27 Apr 2015 08:49:53 +0000 (UTC) Date: Mon, 27 Apr 2015 10:49:53 +0200 Message-ID: From: Takashi Iwai To: Gabriele Mazzotta In-Reply-To: <2856179.MdfUFTz22r@xps13> References: <23057263.IjMh4t6SYF@xps13> <1993280.RJlmSdruKz@xps13> <2856179.MdfUFTz22r@xps13> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.4 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: Raymond Yau , ALSA Development Mailing List Subject: Re: [alsa-devel] Pop noise on startup when headphones are plugged in (Dell XPS13 9333) 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP At Sun, 26 Apr 2015 19:05:18 +0200, Gabriele Mazzotta wrote: > > On Sunday 26 April 2015 18:26:59 Takashi Iwai wrote: > > At Sat, 25 Apr 2015 15:57:15 +0200, > > Gabriele Mazzotta wrote: > > > > > > On Saturday 25 April 2015 13:51:33 Gabriele Mazzotta wrote: > > > > Hi, > > > > > > > > I think this the patch here below is simpler than the other I sent. > > > > snd_hda_get_default_vref() guesses the vref input pins. We know that > > > > some of these are for headphones/headset mics, so we could set the > > > > vref to HIZ for these. > > > > > > > > Are there systems that would misbehave with this change? > > > > > > > > Gabriele > > > > > > > > --- > > > > diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c > > > > index 3d2597b..081db8b 100644 > > > > --- a/sound/pci/hda/hda_generic.c > > > > +++ b/sound/pci/hda/hda_generic.c > > > > @@ -3257,7 +3257,9 @@ static int create_input_ctls(struct hda_codec *codec) > > > > continue; > > > > > > > > val = PIN_IN; > > > > - if (cfg->inputs[i].type == AUTO_PIN_MIC) > > > > + if (cfg->inputs[i].type == AUTO_PIN_MIC && > > > > + !cfg->inputs[i].is_headset_mic && > > > > + !cfg->inputs[i].is_headphone_mic) > > > > val |= snd_hda_get_default_vref(codec, pin); > > > > if (pin != spec->hp_mic_pin) > > > > set_pin_target(codec, pin, val, false); > > > > > > Sorry, I think I misunderstood the meaning of the two flags and they > > > can't be used like that. > > > > Yeah, it's a slight abuse. > > > > How about a patch like below? This doesn't add any flag but it sets > > the default pin target value explicitly by the driver beforehand, and > > let the generic parser setting up only when uninitialized. > > It's working perfectly, thanks. > > Gabriele Good to hear. I queued the patch below now. thanks, Takashi -- 8< -- From: Takashi Iwai Subject: [PATCH] ALSA: hda - Fix click noise at start on Dell XPS13 Dell XPS13 produces a click noise at boot up, and Gabriele spotted out that it's triggered by the initial pin control of the mic (NID 0x19). This has to be set to Hi-Z Vref while the driver initializes to Vref 80% as a normal mic. This patch fixes the generic parser code not to override the target vref if it has been already set by the driver, and adds a proper initialization of the target vref for this pin in the Realtek driver side. Reported-and-tested-by: Gabriele Mazzotta Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_generic.c | 3 ++- sound/pci/hda/patch_realtek.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 3d2597b7037b..788f969b1a68 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -3259,7 +3259,8 @@ static int create_input_ctls(struct hda_codec *codec) val = PIN_IN; if (cfg->inputs[i].type == AUTO_PIN_MIC) val |= snd_hda_get_default_vref(codec, pin); - if (pin != spec->hp_mic_pin) + if (pin != spec->hp_mic_pin && + !snd_hda_codec_get_pin_target(codec, pin)) set_pin_target(codec, pin, val, false); if (mixer) { diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 06199e4e930f..e2afd53cc14c 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4190,11 +4190,18 @@ static void alc_shutup_dell_xps13(struct hda_codec *codec) static void alc_fixup_dell_xps13(struct hda_codec *codec, const struct hda_fixup *fix, int action) { - if (action == HDA_FIXUP_ACT_PROBE) { - struct alc_spec *spec = codec->spec; - struct hda_input_mux *imux = &spec->gen.input_mux; - int i; + struct alc_spec *spec = codec->spec; + struct hda_input_mux *imux = &spec->gen.input_mux; + int i; + switch (action) { + case HDA_FIXUP_ACT_PRE_PROBE: + /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise + * it causes a click noise at start up + */ + snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); + break; + case HDA_FIXUP_ACT_PROBE: spec->shutup = alc_shutup_dell_xps13; /* Make the internal mic the default input source. */ @@ -4204,6 +4211,7 @@ static void alc_fixup_dell_xps13(struct hda_codec *codec, break; } } + break; } }