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: 9960481 X-Patchwork-Delegate: kvalo@adurom.com 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 17C4A601E9 for ; Tue, 19 Sep 2017 23:25:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B42C28A38 for ; Tue, 19 Sep 2017 23:25:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F374D28E8C; Tue, 19 Sep 2017 23:25:09 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A25728A38 for ; Tue, 19 Sep 2017 23:25:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751455AbdISXYt (ORCPT ); Tue, 19 Sep 2017 19:24:49 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:43588 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394AbdISXYs (ORCPT ); Tue, 19 Sep 2017 19:24:48 -0400 Received: by mail-pf0-f170.google.com with SMTP id y29so608253pff.0 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=qijvD3af/5833QeLwh6PZedrheG+kRfywxp4nZf/s/tcF9Gy1P2TRWi414vLeuqOyN 2RQRgcEq7htH2RyyAM3kdZXQPd5HEb08xFZy8R0vsYdfLb/pawYLs1QINcUGeZEbPiBB bS/YbnlG2P8R2jQqy8H13Fkfh3VmqyFwwXuhtp4coenJXQtLfHCExPeIWDQLmPy7Uvwg EgEXPD6qy2AFByq/oevofHUdQr4PCr6emxk9b9js1wsbyuIqhaXlmXT4HQSeG4eVGHPF YsAL4VMtppJgMVBDUISM+xlTSR9Jn9ZBQEKKLjO1OsqX2guS0WZ53VaMJvd1zCqLcMWx C4Iw== X-Gm-Message-State: AHPjjUhy9czk9OH/LxccCyvwLHut4T3fpq/R3GALKx7KK7Mqa2yDVAeb 8FgGI/6kiCnlnXqJ6OI/urmwCls+VaM= 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 Cc: ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, Grant Grundler , , Brian Norris , Ryan Hsu , Michal Kazior 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 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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);