From patchwork Sun Apr 19 17:00:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriele Mazzotta X-Patchwork-Id: 6238691 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 C71A8BF4A6 for ; Sun, 19 Apr 2015 17:01:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0509820306 for ; Sun, 19 Apr 2015 17:01:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id D618720340 for ; Sun, 19 Apr 2015 17:01:24 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id AB47A2651DC; Sun, 19 Apr 2015 19:01:18 +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, 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 328562651B8; Sun, 19 Apr 2015 19:01:11 +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 64E472651C9; Sun, 19 Apr 2015 19:01:09 +0200 (CEST) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by alsa0.perex.cz (Postfix) with ESMTP id 4A6F1265090 for ; Sun, 19 Apr 2015 19:01:02 +0200 (CEST) Received: by wiun10 with SMTP id n10so67564462wiu.1 for ; Sun, 19 Apr 2015 10:01:02 -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; bh=v66fHfa0cpVaIRG3QGV9TKy7nTY65ymsR8Csv91q7xU=; b=RJRgGUmi8ugEiajmTMCQesdD8hGfu8upIkuW+Y511/rZlFaT1TSg3P0aAKU+TOkZqZ Gd7VEeDYusQPhaMs1PoXr5aDn3rLja4NzwuQmutcUFYIAK6ujPXiE+ujV/wF6zOjUkqB nhgffPLZb7ekjkWbvdkxCz0R9Q0Buju8ii1hkReN2JbIub7lIyhFo1FUDh3EnbvvVnUA cC1yqKJXyfIb8Ym7iRkXx/47FFmDJDl63m7teq5Z4nJYxZQV6caVwTnfnqPQrUsQoEv8 Jj0Z+QHKrzeqkvf136z8TTnZK22cfXra3YOn/i/NtpRcrg5xHUWLJEp2CQ4BHxoH4Tzf Q+Gg== X-Received: by 10.181.28.165 with SMTP id jp5mr7424151wid.55.1429462861975; Sun, 19 Apr 2015 10:01:01 -0700 (PDT) Received: from xps13.8.8.4.4 (2-235-140-64.ip228.fastwebnet.it. [2.235.140.64]) by mx.google.com with ESMTPSA id gy8sm11687255wib.13.2015.04.19.10.01.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Apr 2015 10:01:01 -0700 (PDT) From: Gabriele Mazzotta To: perex@perex.cz, tiwai@suse.de Date: Sun, 19 Apr 2015 19:00:40 +0200 Message-Id: <1429462840-24143-1-git-send-email-gabriele.mzt@gmail.com> X-Mailer: git-send-email 2.1.4 Cc: alsa-devel@alsa-project.org, Gabriele Mazzotta , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ALSA: hda - Mute headphone pin on suspend on 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: , 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 Muting the headphone output pin right before the codec suspension prevents pop noises when headphones are plugged in (except for a barely audible click noise). This solution allows to truly save some power when headphones are plugged in unlike the previous solution (033b0a7ca9c: "ALSA: hda - Pop noises fix for XPS13 9333") Signed-off-by: Gabriele Mazzotta --- sound/pci/hda/patch_realtek.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b18b9c6..231d0e4 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4176,17 +4176,15 @@ static void alc_fixup_disable_aamix(struct hda_codec *codec, } } -static unsigned int alc_power_filter_xps13(struct hda_codec *codec, - hda_nid_t nid, - unsigned int power_state) +static void alc_shutup_dell_xps13(struct hda_codec *codec) { struct alc_spec *spec = codec->spec; + int hp_pin = spec->gen.autocfg.hp_pins[0]; - /* Avoid pop noises when headphones are plugged in */ - if (spec->gen.hp_jack_present) - if (nid == codec->core.afg || nid == 0x02 || nid == 0x15) - return AC_PWRST_D0; - return snd_hda_gen_path_power_filter(codec, nid, power_state); + /* Prevent pop noises when headphones are plugged in */ + snd_hda_codec_write(codec, hp_pin, 0, + AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); + msleep(20); } static void alc_fixup_dell_xps13(struct hda_codec *codec, @@ -4197,8 +4195,7 @@ static void alc_fixup_dell_xps13(struct hda_codec *codec, struct hda_input_mux *imux = &spec->gen.input_mux; int i; - spec->shutup = alc_no_shutup; - codec->power_filter = alc_power_filter_xps13; + spec->shutup = alc_shutup_dell_xps13; /* Make the internal mic the default input source. */ for (i = 0; i < imux->num_items; i++) {