From patchwork Thu Dec 17 06:58:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Xiong Y" X-Patchwork-Id: 7869771 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 51C10BEEE5 for ; Thu, 17 Dec 2015 06:53:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8618C203F7 for ; Thu, 17 Dec 2015 06:53:00 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id E0919203F1 for ; Thu, 17 Dec 2015 06:52:57 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5244B265556; Thu, 17 Dec 2015 07:52:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6A08E2654BF; Thu, 17 Dec 2015 07:52:49 +0100 (CET) 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 952232654EA; Thu, 17 Dec 2015 07:52:47 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 5F84D2654B7 for ; Thu, 17 Dec 2015 07:52:39 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 16 Dec 2015 22:52:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,440,1444719600"; d="scan'208";a="709443197" Received: from panda-dev.bj.intel.com ([10.238.154.68]) by orsmga003.jf.intel.com with ESMTP; 16 Dec 2015 22:52:37 -0800 From: Xiong Zhang To: alsa-devel@alsa-project.org Date: Thu, 17 Dec 2015 14:58:44 +0800 Message-Id: <1450335524-22848-1-git-send-email-xiong.y.zhang@intel.com> X-Mailer: git-send-email 1.9.1 Cc: libin.yang@intel.com, han.lu@intel.com, Xiong Zhang Subject: [alsa-devel] [PATCH] ALSA: hda - Set intel hda controller power at freeze() and thaw() 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 It takes three minutes to enter into hibernation on some OEM SKL machines and we see many codec spurious response after thaw() opertion. This is because HDA is still in D0 state after freeze() call and pci_pm_freeze/pci_pm_freeze_noirq() don't set D3 hot in pci_bus driver. It seems bios still access HDA when system enter into freeze state, HDA will receive codec response interrupt immediately after thaw() call. Because of this unexpected interrupt, HDA enter into a abnormal state and slow down the system enter into hibernation. In this patch, we put HDA into D3 hot state in azx_freeze_noirq() and put HDA into D0 state in azx_thaw_noirq(). Signed-off-by: Xiong Zhang --- sound/pci/hda/hda_intel.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index c38c68f..3ba7cbc 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -890,6 +890,16 @@ static int azx_suspend(struct device *dev) return 0; } +static int azx_freeze_noirq(struct device *dev) +{ + struct pci_dev *pci = to_pci_dev(dev); + + if (pci->vendor == PCI_VENDOR_ID_INTEL) + pci_set_power_state(pci, PCI_D3hot); + + return 0; +} + static int azx_resume(struct device *dev) { struct pci_dev *pci = to_pci_dev(dev); @@ -924,6 +934,14 @@ static int azx_resume(struct device *dev) trace_azx_resume(chip); return 0; } + +static int azx_thaw_noirq(struct device *dev) +{ + struct pci_dev *pci = to_pci_dev(dev); + + if (pci->vendor == PCI_VENDOR_ID_INTEL) + pci_set_power_state(pci, PCI_D0); +} #endif /* CONFIG_PM_SLEEP || SUPPORT_VGA_SWITCHEROO */ #ifdef CONFIG_PM @@ -1035,6 +1053,8 @@ static int azx_runtime_idle(struct device *dev) static const struct dev_pm_ops azx_pm = { SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) + .freeze_noirq = azx_freeze_noirq, + .thaw_noirq = azx_thaw_noirq, SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle) };