From patchwork Mon Sep 18 13:11:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 13389623 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 099ADCD37B0 for ; Mon, 18 Sep 2023 13:21:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ymM1AXsnxyVy+nHhwbbqql3ZChBBExID2AJ5a+k4jYw=; b=jfLIfOornmGn25 xfY01HEXB10+0B8Wq0E/pHiOxiZbzglFxPVpv6Y7ZYaYitUm6kuCI3vT2nQut8+X9b5Aj7hkeDL3f 80oEzRiivtDjo12CBugg44hGeaLLg6GvrSTSQvYYiA6YpnTN+7l0yDF9DrWQmsADnuGHwW4dfmND6 hQ5Vk788fYmSZNhYzcIk8AHbwsJ+IU4dN+AEy0ksixp6Ks/FGET9YVL1yBhT6K8d82McWwHL71cTc chbAd8laiAYOYxxdFmcrHtm6SSgW/T1il6FdOJf6J1UFq0Ox5ITmWPhXwbv1lrDV6LBbhYr2xhbZ5 Gj1+3j15LihUNbSqZqMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiEBr-00FYIU-0A; Mon, 18 Sep 2023 13:21:27 +0000 Received: from mgamail.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qiEBR-00FXun-2o; Mon, 18 Sep 2023 13:21:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695043261; x=1726579261; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s0vQPYCvTArOJ8UKcbPeJ71cltUHLof64ZzmndGbOp4=; b=NBFT1MkrQEanKVjP0fxhYT0KdhegP1egI+sRoHVJYQFwXZGPd9ExJ3De 4jvdvqW+x3ksfeZfdtkloKtWwIsVCt40Ow5a9649FAgLq2IWnUFJl+kMS pomO9+VocTr0y606u5xmG1sHcmNKHNp3zCZnJThxCb/YbQe5L5xW264ul MLiobXvZpQnTzFc2oI+IrLyaaK7Hz/cY2WYVsVBOKuCA61bs7KnBSRwci 0A+5m8SSbAa9t+mM5HYIorEyAYIOk7zyLuo3F/Ojpm68A1LLL0qWsFTmM 0uBX6dJpKL1v+5+SfpceV+VLMLzIQnJgzQNloE5a/pj0YYx0625S9FY9t A==; X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="446113602" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="446113602" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 06:13:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10837"; a="811343017" X-IronPort-AV: E=Sophos;i="6.02,156,1688454000"; d="scan'208";a="811343017" Received: from nprotaso-mobl1.ccr.corp.intel.com (HELO ijarvine-mobl2.ger.corp.intel.com) ([10.252.49.156]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2023 06:13:39 -0700 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi , Rob Herring , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Lukas Wunner , "Rafael J . Wysocki" , Heiner Kallweit , Emmanuel Grumbach , linux-kernel@vger.kernel.org, Kalle Valo , Jeff Johnson , ath12k@lists.infradead.org, linux-wireless@vger.kernel.org Cc: ath10k@lists.infradead.org, ath11k@lists.infradead.org, intel-wired-lan@lists.osuosl.org, linux-arm-kernel@lists.infradead.org, linux-bluetooth@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, =?utf-8?q?Ilpo_J=C3=A4r?= =?utf-8?q?vinen?= Subject: [PATCH v2 11/13] wifi: ath12k: Use pci_disable/enable_link_state() Date: Mon, 18 Sep 2023 16:11:01 +0300 Message-Id: <20230918131103.24119-12-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230918131103.24119-1-ilpo.jarvinen@linux.intel.com> References: <20230918131103.24119-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230918_062102_005070_0E4D703D X-CRM114-Status: UNSURE ( 9.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ath12k driver adjusts ASPM state itself which leaves ASPM service driver in PCI core unaware of the link state changes the driver implemented. Call pci_disable_link_state() and pci_enable_link_state() instead of adjusting ASPMC field in LNKCTL directly in the driver and let PCI core handle the ASPM state management. Signed-off-by: Ilpo Järvinen Acked-by: Kalle Valo --- drivers/net/wireless/ath/ath12k/pci.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/pci.c b/drivers/net/wireless/ath/ath12k/pci.c index fae5dfd6e9d7..9401f62476be 100644 --- a/drivers/net/wireless/ath/ath12k/pci.c +++ b/drivers/net/wireless/ath/ath12k/pci.c @@ -794,19 +794,15 @@ static void ath12k_pci_aspm_disable(struct ath12k_pci *ab_pci) u16_get_bits(ab_pci->link_ctl, PCI_EXP_LNKCTL_ASPM_L1)); /* disable L0s and L1 */ - pcie_capability_clear_word(ab_pci->pdev, PCI_EXP_LNKCTL, - PCI_EXP_LNKCTL_ASPMC); - + pci_disable_link_state(ab_pci->pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1); set_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags); } static void ath12k_pci_aspm_restore(struct ath12k_pci *ab_pci) { if (test_and_clear_bit(ATH12K_PCI_ASPM_RESTORE, &ab_pci->flags)) - pcie_capability_clear_and_set_word(ab_pci->pdev, PCI_EXP_LNKCTL, - PCI_EXP_LNKCTL_ASPMC, - ab_pci->link_ctl & - PCI_EXP_LNKCTL_ASPMC); + pci_enable_link_state(ab_pci->pdev, ab_pci->link_ctl & + (PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1)); } static void ath12k_pci_kill_tasklets(struct ath12k_base *ab)