From patchwork Sat Apr 25 11:51:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriele Mazzotta X-Patchwork-Id: 6274261 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8BABA9F1C4 for ; Sat, 25 Apr 2015 11:51:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD0F5201ED for ; Sat, 25 Apr 2015 11:51:55 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 7E289201CD for ; Sat, 25 Apr 2015 11:51:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C6BBF2617B6; Sat, 25 Apr 2015 13:51:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A1878261546; Sat, 25 Apr 2015 13:51:42 +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 685D3261551; Sat, 25 Apr 2015 13:51:42 +0200 (CEST) Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by alsa0.perex.cz (Postfix) with ESMTP id 568142614FF for ; Sat, 25 Apr 2015 13:51:35 +0200 (CEST) Received: by wgen6 with SMTP id n6so74139514wge.3 for ; Sat, 25 Apr 2015 04:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; bh=xmNBOZHEuKh5lO7+bNHRBsPt0CE9PwzrDxWjJmOgNUU=; b=lIZ1ctsyKLDfRrp61QKBci9oBnRsLyJvDx4LWKzJvXYSIXyRhwSK5qd21sgYGgpXOw yrcuI5wGhkDUYDcFStvKtXLataj5EQ1TSfSpxMrEOsQGp6NUijFC+ghocF2aFIOb4d3R jqvqMC5E4VD+1azooCkpYtGM/Fwe6I/ZncCIxmsSqqpyISyOKZOkpBIU4JDiidaiaUSj P/nH5O2zMYhAOZn7UCmjmiiKizLlxebt/Vg5CDEL8J/jY/eOtFnlwR94QsW93fMatk0L bCERNM4vAOEsMVDwA1pQtxNxX164FLdIo86dkI7itTjIhVJZVd3ZT5W7aryqgf2qLzJQ EG3A== X-Received: by 10.180.87.199 with SMTP id ba7mr4905847wib.81.1429962695066; Sat, 25 Apr 2015 04:51:35 -0700 (PDT) Received: from hostprova (2-235-140-64.ip228.fastwebnet.it. [2.235.140.64]) by mx.google.com with ESMTPSA id e10sm2984757wij.11.2015.04.25.04.51.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Apr 2015 04:51:34 -0700 (PDT) From: Gabriele Mazzotta To: Takashi Iwai Date: Sat, 25 Apr 2015 13:51:33 +0200 Message-ID: <2264204.W7vnUSq2WO@xps13> In-Reply-To: References: <23057263.IjMh4t6SYF@xps13> MIME-Version: 1.0 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 On Friday 24 April 2015 17:34:57 Takashi Iwai wrote: > At Fri, 24 Apr 2015 17:14:24 +0200, > Gabriele Mazzotta wrote: > > > > 2015-04-24 8:13 GMT+02:00 Takashi Iwai : > > > At Thu, 23 Apr 2015 21:12:50 +0200, > > > Gabriele Mazzotta wrote: > > >> > > >> On Sunday 19 April 2015 19:26:58 Gabriele Mazzotta wrote: > > >> > Hi, > > >> > > > >> > I've recently found that commit a551d91473 ("ALSA: hda - Use regmap for > > >> > command verb caches, too") is somehow causing a pop noise on startup > > >> > when headphones are plugged in, but I couldn't figure out the exact > > >> > cause. Was this observed on other systems (mine is a Dell XPS13 9333, > > >> > Realtek ALC3661)? Does anyone have any idea of what the cause might be? > > >> > > >> Hi, > > >> > > >> I don't know why a551d91473 caused the issue, but I found the real > > >> cause of problem. > > >> > > >> On init, create_input_ctls() sets the vref of nid 0x19 to 80 (as > > >> returned by snd_hda_get_default_vref()), but it should be set to HIZ. > > >> This is not so different from the issue addressed by f38663ab5c > > >> ("ALSA: hda - Set internal mic as default input source on Dell XPS 13 9333"). > > >> > > >> I made a patch to prevent this from happening. > > >> > > >> Setting the vref is not necessary since alc_update_headset_mode() will > > >> take care of it. > > >> > > >> Should I maybe add a new flag instead of using suppress_hp_mic_detect? > > > > > > Yeah, that's better. Although the flag is currently unused, it's > > > provided for a different purpose (to skip the headphone mic detection; > > > which is different from "headset" mic). > > > > > > I wonder, though, whether the patch below improves anything. > > > A similar patch was in the development series in the past, but I had > > > to drop it because it caused behavior error. But now I tried again, > > > and it seems working. > > > > > > > > > Takashi > > > > The patch did no harm, but didn't solve the problem. > > OK, so the problem doesn't seem relevant with the runtime PM, which > was the usual suspect. > > My patch should reduce the actual verb writes, so it would be nice to > have even if it doesn't fix your problem. But maybe I'll postpone it > as a 4.2 material. > > > thanks, > > Takashi 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);