From patchwork Fri Dec 4 15:20:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1411091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cnbym05vrz9sWw; Sat, 5 Dec 2020 02:21:36 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1klCtn-0006aL-R1; Fri, 04 Dec 2020 15:21:31 +0000 Received: from mail-pl1-f194.google.com ([209.85.214.194]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1klCtk-0006TB-Co for kernel-team@lists.ubuntu.com; Fri, 04 Dec 2020 15:21:28 +0000 Received: by mail-pl1-f194.google.com with SMTP id 4so3264923plk.5 for ; Fri, 04 Dec 2020 07:21:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rjZfe0cG6krhABJF5ZTnBSn5gIkvVlbqaITbD4mQK6A=; b=lGLGvoz+ruMD5/tGdDj15TL5Cc2OfT1UBT3CD1auE+VjsAPOX7vY0ouC0JUciLFgyF 7ord8BNecFrp4BSLYSHVqUsU4h4kk10bwjfVYOXpKB+s9UkyED/rFCCYjAgcBqDl2a5Z eIi+ClwZl97TdOrsXaXR5Rh4xtaGrxDE7eOSJT2FBLy7gpHiVYN5s7jBekFp8pYF3gp6 10aK9OPfcUTtv7m3w3UXMvlw6rmvnfu2kQcYqNBAskNxiDfKdUXd8+V5WZzC2Y25ZDlD R0cc38q4SlKNA7yN+HtuPraTYlJ61uUcFesG0G2oFpMXQyN1sIYLFl637caqq3/SrqGy 8qGQ== X-Gm-Message-State: AOAM532tDgCjg+OuXnpYxadz33OP08hnvbX0WPKkURg6ezj8m1YVNDSE pdRI+Q8Nwl67/YTaJIoQ7Z2FesFIQpurOw== X-Google-Smtp-Source: ABdhPJxSfgHHl15mYwfJKs6+Gmxd0RhA1CypreBkIA+6Cr7ub0vLdCtI1jEEu1VbjuPSCEC2dbyUPQ== X-Received: by 2002:a17:90a:8c18:: with SMTP id a24mr1694315pjo.215.1607095282221; Fri, 04 Dec 2020 07:21:22 -0800 (PST) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id v186sm5095352pfb.152.2020.12.04.07.21.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2020 07:21:21 -0800 (PST) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 22/26][SRU][U/OEM-5.10] UBUNTU: SAUCE: ath11k: put target to wow state when suspend happens Date: Fri, 4 Dec 2020 23:20:08 +0800 Message-Id: <20201204152013.195139-23-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201204152013.195139-1-vicamo.yang@canonical.com> References: <20201204152013.195139-1-vicamo.yang@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.214.194; envelope-from=vicamo@gmail.com; helo=mail-pl1-f194.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Carl Huang BugLink: https://bugs.launchpad.net/bugs/1879633 This change is to put QCA6390 to wow state instead of suspend state when system suspend happens. It also disables CE irq and DP irq, and then put MHI to suspend state. When system resumes, driver resumes MHI firstly, then enables CE irq and dp IRQ, and sends wow wakeup command to firmware. Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1 Signed-off-by: Carl Huang Signed-off-by: Kalle Valo (cherry picked from commit 0c214f7ebce5eadb589554611bb927517c7aa7ea https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git) Signed-off-by: You-Sheng Yang --- drivers/net/wireless/ath/ath11k/core.c | 26 +++++++++++++------------- drivers/net/wireless/ath/ath11k/pci.c | 8 -------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index af1d1b1e097c..04bc4390b5cd 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -12,6 +12,7 @@ #include "dp_rx.h" #include "debug.h" #include "hif.h" +#include "wow.h" unsigned int ath11k_debug_mask; EXPORT_SYMBOL(ath11k_debug_mask); @@ -952,21 +953,18 @@ int ath11k_core_suspend(struct ath11k_base *ab) int ret = 0; if (ab->hw_params.support_suspend) { + msleep(500); ath11k_purge_rx_pktlog(ar, true); + ret = ath11k_wow_enable(ar); + if (ret) + return ret; + + ath11k_purge_rx_pktlog(ar, false); ath11k_ce_stop_shadow_timers(ab); ath11k_dp_stop_shadow_timers(ab); - reinit_completion(&ar->target_suspend); - ath11k_wmi_pdev_suspend(ar, 1, 0); - ret = wait_for_completion_timeout(&ar->target_suspend, 3 * HZ); - if (ret == 0) { - ath11k_warn(ab, - "timed out while waiting for suspend completion\n"); - return -ETIMEDOUT; - } else if (!ar->target_suspend_ack) { - ath11k_warn(ab, "suspend failed\n"); - return -EAGAIN; - } - ath11k_purge_rx_pktlog(ar, false); + + ath11k_hif_irq_disable(ab); + ath11k_hif_ce_irq_disable(ab); return ath11k_hif_suspend(ab); } return 0; @@ -979,8 +977,10 @@ int ath11k_core_resume(struct ath11k_base *ab) if (ab->hw_params.support_suspend) { ath11k_hif_resume(ab); + ath11k_hif_ce_irq_enable(ab); + ath11k_hif_irq_enable(ab); ath11k_enable_rx_pktlog(ar); - ath11k_wmi_pdev_resume(ab->pdevs[0].ar, 0); + ath11k_wow_wakeup(ar); } return 0; diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c index 7fcba8e02f92..18432c360249 100644 --- a/drivers/net/wireless/ath/ath11k/pci.c +++ b/drivers/net/wireless/ath/ath11k/pci.c @@ -1345,14 +1345,10 @@ static __maybe_unused int ath11k_pci_pm_suspend(struct device *dev) struct ath11k_base *ab = dev_get_drvdata(dev); int ret; - msleep(3000); - ret = ath11k_core_suspend(ab); if (ret) ath11k_warn(ab, "failed to suspend hif: %d\n", ret); - msleep(3000); - return ret; } @@ -1361,14 +1357,10 @@ static __maybe_unused int ath11k_pci_pm_resume(struct device *dev) struct ath11k_base *ab = dev_get_drvdata(dev); int ret; - msleep(3000); - ret = ath11k_core_resume(ab); if (ret) ath11k_warn(ab, "failed to resume hif: %d\n", ret); - msleep(3000); - return ret; }