From patchwork Tue Aug 19 04:07:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 4740441 X-Patchwork-Delegate: tiwai@suse.de 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 B49BCC0338 for ; Tue, 19 Aug 2014 04:08:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E3BF72013A for ; Tue, 19 Aug 2014 04:08:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id AFBB220131 for ; Tue, 19 Aug 2014 04:08:05 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8F0432655A2; Tue, 19 Aug 2014 06:07:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org 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 0CC7B26558D; Tue, 19 Aug 2014 06:07:49 +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 3D98A265594; Tue, 19 Aug 2014 06:07:47 +0200 (CEST) Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com [209.85.220.44]) by alsa0.perex.cz (Postfix) with ESMTP id AA5B026558D for ; Tue, 19 Aug 2014 06:07:34 +0200 (CEST) Received: by mail-pa0-f44.google.com with SMTP id eu11so9133205pac.31 for ; Mon, 18 Aug 2014 21:07:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=biu1eQaB5o3/ToH7pbKYNqbG9mnsffZLvA0ekZ4AhiY=; b=DtxOr2xX2HYKOC1Lbqn/sBVk7so75q72K4Hv1SO+n5NppqFx4xoGwU7DEFyJwrW4wv HHwXio0vXmeRCMZx8hjq9+UvLwiew1dCK7YUGHwIHTP8KEDS4h56wlPv+MHDThfDEWvB 8jA+gojgzvdfDv0kpCaEV9BJYu7Mt1hzUObvwuv4+tnkTX28yjqAOj72X7ftRcGI/ml7 BReYgH9HOKxR+Y7HZ0+Tsl8Nw3l2Ad0mXL8YoZ1OijCsNj/lGrNKDT+hHBXVrCYnV2Yy 7o6mMz//8uMnF9tftW0jaGe9VGWd9c1RzeAla0IAlTSHf0ApPp+Ns1i7X2h5wcO+VhEx hIGw== X-Gm-Message-State: ALoCoQk4pKgZUqV4Hyo2tx23jycpEDnAmizO9JwQXRo7Yi4ddz+s+lo/bR9TC6g6g3Ea+d70HsiA X-Received: by 10.68.134.130 with SMTP id pk2mr40552686pbb.133.1408421252345; Mon, 18 Aug 2014 21:07:32 -0700 (PDT) Received: from localhost.localdomain ([125.39.112.2]) by mx.google.com with ESMTPSA id fq4sm27241385pdb.71.2014.08.18.21.07.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Aug 2014 21:07:31 -0700 (PDT) From: Hui Wang To: tiwai@suse.de, alsa-devel@alsa-project.org Date: Tue, 19 Aug 2014 12:07:03 +0800 Message-Id: <1408421223-10913-1-git-send-email-hui.wang@canonical.com> X-Mailer: git-send-email 1.9.1 Cc: hui.wang@canonical.com, franz.hsieh@canonical.com, stable@vger.kernel.org Subject: [alsa-devel] [PATCH v2] ALSA: hda - restore the gpio led after resume 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 On some HP laptops, the mute led is controlled by codec gpio. When some machine resume from s3/s4, the codec gpio data will be cleared to 0 by BIOS: Before suspend: IO[3]: enable=1, dir=1, wake=0, sticky=0, data=1, unsol=0 After resume: IO[3]: enable=1, dir=1, wake=0, sticky=0, data=0, unsol=0 To skip the AFG node to enter D3 can't fix this problem. A workaround is to restore the gpio data when the system resume back from s3/s4. It is safe even on the machines without this problem. BugLink: https://bugs.launchpad.net/bugs/1358116 Tested-by: Franz Hsieh Cc: stable@vger.kernel.org Signed-off-by: Hui Wang --- V2: move the verb write from led_power_filter to alc269_resume sound/pci/hda/patch_realtek.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b32ce08..d71270a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3268,6 +3268,15 @@ static int alc269_resume(struct hda_codec *codec) snd_hda_codec_resume_cache(codec); alc_inv_dmic_sync(codec, true); hda_call_check_power_status(codec, 0x01); + + /* on some machine, the BIOS will clear the codec gpio data when enter + * suspend, and won't restore the data after resume, so we restore it + * in the driver. + */ + if (spec->gpio_led) + snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA, + spec->gpio_led); + if (spec->has_alc5505_dsp) alc5505_dsp_resume(codec);