From patchwork Tue Sep 19 23:24:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9960483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C48F601E9 for ; Tue, 19 Sep 2017 23:25:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EEF128A38 for ; Tue, 19 Sep 2017 23:25:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0393328E8C; Tue, 19 Sep 2017 23:25:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8810928A38 for ; Tue, 19 Sep 2017 23:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=Ns+p5c7OsIStJ/1sKDFEKtRdCkVbdt8wDWhz6fWZrSE=; b=dn7 idobkIeb8ltIvh+pMgirZwl2zsk7+7PoA7EU4X8A0MMpAKyFOTJI6tsQnq4M3avI2xBBlh37a/aeo FGHEPzwlc4/CAqBr6M+WgxPDZrKjzKDRPMEAMHE0NxXH8QiekwqABFXh1srw2pJX3KkMsFYQnTuLZ oA2pkd6zDaxwfC9piOIzhG+uiMYQzUnwZv7ovBocbUoRaeZsaXnqYrNmKFU0gosGQ3v1hm5qyhg9D d7BFaE0noHuYdMUvi1bNI/RVfRbC2+eaVUO4doHF9AMmqJ8EyoRFZo82GjUpV9rFBbdH4DOMetu0/ l/VPkYKnINPXxwddb0/jazVyoFEVoCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1duRtG-0006IG-EV; Tue, 19 Sep 2017 23:25:18 +0000 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1duRt7-0005XO-QY for ath10k@lists.infradead.org; Tue, 19 Sep 2017 23:25:16 +0000 Received: by mail-pf0-x22d.google.com with SMTP id n24so600111pfk.5 for ; Tue, 19 Sep 2017 16:24:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=sRXF8su8rgBqnHIGAEXSp6RqKi3EMNQMwvRFefaj9lg=; b=AowNWBu34pg1Y6AAT3awsw32/oniLGVGN8mw7kq8JAJ4YNjGwG3OlhLCHFqN/vn86T u6nU7JnPmMQKwlkEW1GLnA/zJtEZ5yZdY8QQlXdKmDUBJrPSa/Cwj6Gxq47amsQ3K30j yTl9lWASIbq3Cq1NnBQjjlzCbKqhAUX0O7Cag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sRXF8su8rgBqnHIGAEXSp6RqKi3EMNQMwvRFefaj9lg=; b=OyA14dJXdz7OevFLGmlN0YVMHOMRZOqyYNYawVlx3K1UfXRPJlyVY2viU6aPab8AxX +sfQ5q6864OXK+Xq0JwQe5oRV1HCR7cQZFxcchHC/+rQ1lJhWmYqGZ3F6FxfrcIAXqyG vWNAYpUcR1DUR7pi91FsMEZoX1apPNQv0TMw4XSpT70Vy3sQf9q/0aLhjKjBqUOzWMaM e++A4HVvCDyZBV4v8M3cIzl2/ybBu+HzwJqTmZFsn3gc8uUJVTh1MNC+P4uRe8UC31dP Z2LuUKUE2qwJKQXSjcYHl0qLTGjuZlT8FBIHBBmjvXaSPvHsR4vdcuzaYUsWS+MWufTC 1cKg== X-Gm-Message-State: AHPjjUgziXByBwdbFyrDIIVsuKUFq/MxIXGut1MTPzAhqwvSyb4h54pk SSVu9qIjZRMkrI3Q0Y+JTawTGw== X-Google-Smtp-Source: AOwi7QCOI1MCp3qCsb6p/3fWgIJWRvKJZUs1j5HDzDac79ce/gu/V4S5MdM5QUHlCKbcLePQBBj9AA== X-Received: by 10.99.127.27 with SMTP id a27mr221928pgd.269.1505863488080; Tue, 19 Sep 2017 16:24:48 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.113.17]) by smtp.gmail.com with ESMTPSA id c30sm4922056pgn.33.2017.09.19.16.24.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Sep 2017 16:24:47 -0700 (PDT) From: Brian Norris To: Kalle Valo Subject: [PATCH] ath10k: fix core PCI suspend when WoWLAN is supported but disabled Date: Tue, 19 Sep 2017 16:24:16 -0700 Message-Id: <20170919232416.108247-1-briannorris@chromium.org> X-Mailer: git-send-email 2.14.1.690.gbb1197296e-goog X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170919_162510_782353_AEA54CBC X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryan Hsu , Grant Grundler , Brian Norris , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, ath10k@lists.infradead.org, Michal Kazior MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP For devices where the FW supports WoWLAN but user-space has not configured it, we don't do any PCI-specific suspend/resume operations, because mac80211 doesn't call drv_suspend() when !wowlan. This has particularly bad effects for some platforms, because we don't stop the power-save timer, and if this timer goes off after the PCI controller has suspended the link, Bad Things will happen. Commit 32faa3f0ee50 ("ath10k: add the PCI PM core suspend/resume ops") got some of this right, in that it understood there was a problem on non-WoWLAN firmware. But it forgot the $subject case. Fix this by moving all the PCI driver suspend/resume logic exclusively into the driver PM hooks. This shouldn't affect WoWLAN support much (this just gets executed later on). I would just as well kill the entirety of ath10k_hif_suspend(), as it's not even implemented on the USB or SDIO drivers. I expect that we don't need the callback, except to return "supported" (i.e., 0) or "not supported" (i.e., -EOPNOTSUPP). Fixes: 32faa3f0ee50 ("ath10k: add the PCI PM core suspend/resume ops") Fixes: 77258d409ce4 ("ath10k: enable pci soc powersaving") Signed-off-by: Brian Norris Cc: Ryan Hsu Cc: Kalle Valo Cc: Michal Kazior --- drivers/net/wireless/ath/ath10k/pci.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index bc1633945a56..4655c944e3fd 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -2580,6 +2580,12 @@ void ath10k_pci_hif_power_down(struct ath10k *ar) #ifdef CONFIG_PM static int ath10k_pci_hif_suspend(struct ath10k *ar) +{ + /* Nothing to do; the important stuff is in the driver suspend. */ + return 0; +} + +static int ath10k_pci_suspend(struct ath10k *ar) { /* The grace timer can still be counting down and ar->ps_awake be true. * It is known that the device may be asleep after resuming regardless @@ -2592,6 +2598,12 @@ static int ath10k_pci_hif_suspend(struct ath10k *ar) } static int ath10k_pci_hif_resume(struct ath10k *ar) +{ + /* Nothing to do; the important stuff is in the driver resume. */ + return 0; +} + +static int ath10k_pci_resume(struct ath10k *ar) { struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); struct pci_dev *pdev = ar_pci->pdev; @@ -3403,11 +3415,7 @@ static int ath10k_pci_pm_suspend(struct device *dev) struct ath10k *ar = dev_get_drvdata(dev); int ret; - if (test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, - ar->running_fw->fw_file.fw_features)) - return 0; - - ret = ath10k_hif_suspend(ar); + ret = ath10k_pci_suspend(ar); if (ret) ath10k_warn(ar, "failed to suspend hif: %d\n", ret); @@ -3419,11 +3427,7 @@ static int ath10k_pci_pm_resume(struct device *dev) struct ath10k *ar = dev_get_drvdata(dev); int ret; - if (test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, - ar->running_fw->fw_file.fw_features)) - return 0; - - ret = ath10k_hif_resume(ar); + ret = ath10k_pci_resume(ar); if (ret) ath10k_warn(ar, "failed to resume hif: %d\n", ret);