All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Cc: Raymond Yau <superquad.vortex2@gmail.com>,
	ALSA Development Mailing List <alsa-devel@alsa-project.org>
Subject: Re: Pop noise on startup when headphones are plugged in (Dell XPS13 9333)
Date: Mon, 27 Apr 2015 10:49:53 +0200	[thread overview]
Message-ID: <s5hmw1ulzv2.wl-tiwai@suse.de> (raw)
In-Reply-To: <2856179.MdfUFTz22r@xps13>

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 <tiwai@suse.de>
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 <gabriele.mzt@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 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;
 	}
 }
 
-- 
2.3.5

      reply	other threads:[~2015-04-27  8:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-19 17:26 Pop noise on startup when headphones are plugged in (Dell XPS13 9333) Gabriele Mazzotta
2015-04-20  5:58 ` Takashi Iwai
2015-04-20  7:18   ` Takashi Iwai
2015-04-20 19:51     ` Gabriele Mazzotta
2015-04-20 19:49   ` Gabriele Mazzotta
2015-04-21  2:13     ` Raymond Yau
2015-04-21  9:50       ` Gabriele Mazzotta
2015-04-21  9:58 ` Gabriele Mazzotta
2015-04-21 10:04   ` Takashi Iwai
2015-04-23 19:12 ` Gabriele Mazzotta
2015-04-24  6:13   ` Takashi Iwai
2015-04-24 15:14     ` Gabriele Mazzotta
2015-04-24 15:34       ` Takashi Iwai
2015-04-25 11:51         ` Gabriele Mazzotta
2015-04-25 13:57           ` Gabriele Mazzotta
2015-04-26 16:26             ` Takashi Iwai
2015-04-26 17:05               ` Gabriele Mazzotta
2015-04-27  8:49                 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hmw1ulzv2.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=gabriele.mzt@gmail.com \
    --cc=superquad.vortex2@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.