From patchwork Tue Aug 22 21:47:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ryanhsu@qti.qualcomm.com X-Patchwork-Id: 9916219 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 0E12D600C5 for ; Tue, 22 Aug 2017 21:47:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01504288AA for ; Tue, 22 Aug 2017 21:47:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA3E6288FA; Tue, 22 Aug 2017 21:47:38 +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=-2.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW 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 AF808288AA for ; Tue, 22 Aug 2017 21:47:38 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=44kkJ2J9diZhNITP1zoDHRJHJe1rv3d1jS2Upz1gVGY=; b=ievDoO+dVN3Jdv +O4eqxhRIGfkBe4TUZ2UHuAckb9sWl37dGyOWF/9a9KBCsZw10+5b47qJAM8ECqG7Fz3adRnVxdZh a8pj0wWniHXIA+an73+pfReuV0N2jQkupp9Df7yHb5MWMD4QpxzvFdUa9B+1cEMuauAAL13QD+LLc E3sXlUbaG0YfO13kcC4jYJXP1EY6bI5cGfGDMyWViVHZB7+SHISa92tKBA4gvZBjiTunMf0nbqCLy 9iom9OGc0UKQGFY9Br5F0fWDBoXki3JFtFgm2KsPmPMJ3FkHskfhNU4yk9s/2WZ5Nv9E457WihnMq eglzeV9hI1exHiODxEBQ==; 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 1dkH1K-0001th-AF; Tue, 22 Aug 2017 21:47:34 +0000 Received: from sabertooth01.qualcomm.com ([65.197.215.72]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dkH1E-0001p5-07 for ath10k@lists.infradead.org; Tue, 22 Aug 2017 21:47:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1503438447; x=1534974447; h=from:to:cc:subject:date:message-id:mime-version; bh=LkpZcAKT6jOOplY0ZDwOSznr8v6iCa+dA7sHOLYi0mM=; b=bV8fCzYe3UC+3N1nVBEpSCgBOJq79SqTT9Wmj4iXw+ksNomG0zlTzo/Y PpbLDxnUpe0nLBOLHbsP1KTem59aC7KAv2VHlQXTRQfH/bORrqrnpixa8 POSzLhZx3LFBXpDZFepLbfItk2UXdKfdkEE0kddeyJx4UeIG1R33nbcre o=; X-IronPort-AV: E=Sophos;i="5.41,414,1498546800"; d="scan'208";a="113184718" Received: from unknown (HELO ironmsg11-lv.qualcomm.com) ([10.47.202.155]) by sabertooth01.qualcomm.com with ESMTP; 22 Aug 2017 14:47:06 -0700 X-IronPort-AV: E=McAfee;i="5900,7806,8631"; a="7419674" X-MGA-submission: =?us-ascii?q?MDGrMY0agA9nQLNfRe/7cUjATw5vvQDh5ujFhl?= =?us-ascii?q?UKwgSXJfW8MtqSV796cOvq0GFE+sgt2dIK8u5F4Nknc1H6WX01WtRxqD?= =?us-ascii?q?rkQxiV5uayOZF8MRGW90+oVI6UIzcJ5uDFvxnQmNlKEWeRRGLrW4a0TZ?= =?us-ascii?q?95?= Received: from nalasexr01g.na.qualcomm.com ([10.49.56.53]) by ironmsg11-lv.qualcomm.com with ESMTP/TLS/RC4-SHA; 22 Aug 2017 14:47:07 -0700 Received: from ryanhsu-linux2.qualcomm.com (10.80.80.8) by NALASEXR01G.na.qualcomm.com (10.49.56.53) with Microsoft SMTP Server (TLS) id 15.0.1178.4; Tue, 22 Aug 2017 14:47:06 -0700 From: To: , Subject: [PATCH v3 1/2] ath10k: add the PCI PM core suspend/resume ops Date: Tue, 22 Aug 2017 14:47:34 -0700 Message-ID: <1503438455-6133-1-git-send-email-ryanhsu@qti.qualcomm.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01B.na.qualcomm.com (10.85.0.82) To NALASEXR01G.na.qualcomm.com (10.49.56.53) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170822_144728_120399_502A2EE6 X-CRM114-Status: UNSURE ( 9.89 ) X-CRM114-Notice: Please train this message. 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: ryanhsu@qti.qualcomm.com Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ryan Hsu The actual PCI suspend/resume in ath10k has been handled in wow.c, but in the case of the device doesn't support remote wakeup, the .hif_suspend() and .hif_resume() will never be handled. ath10k_wow_op_suspend() { if (WARN_ON(!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, ar->running_fw->fw_file.fw_features))) { ret = 1; goto exit; } .... ret = ath10k_hif_suspend(ar); } So register the PCI PM core to support the suspend/resume if the device doesn't support remote wakeup. Signed-off-by: Ryan Hsu --- drivers/net/wireless/ath/ath10k/pci.c | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 0457e31..4aac0de 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -3358,11 +3358,53 @@ static void ath10k_pci_remove(struct pci_dev *pdev) MODULE_DEVICE_TABLE(pci, ath10k_pci_id_table); +#ifdef CONFIG_PM + +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); + if (ret) + ath10k_warn(ar, "failed to suspend hif: %d\n", ret); + + return ret; +} + +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); + if (ret) + ath10k_warn(ar, "failed to resume hif: %d\n", ret); + + return ret; +} + +SIMPLE_DEV_PM_OPS(ath10k_pci_pm_ops, + ath10k_pci_pm_suspend, + ath10k_pci_pm_resume); +#endif + static struct pci_driver ath10k_pci_driver = { .name = "ath10k_pci", .id_table = ath10k_pci_id_table, .probe = ath10k_pci_probe, .remove = ath10k_pci_remove, +#ifdef CONFIG_PM + .driver.pm = &ath10k_pci_pm_ops, +#endif }; static int __init ath10k_pci_init(void)