All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: <kvalo@kernel.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH 08/14] rtw89: don't flush hci queues and send h2c if power is off
Date: Thu, 21 Apr 2022 20:08:57 +0800	[thread overview]
Message-ID: <20220421120903.73715-9-pkshih@realtek.com> (raw)
In-Reply-To: <20220421120903.73715-1-pkshih@realtek.com>

When disconnecting, it warns somethings after power is off, and we can't
do HCI IO. So, add this patch to avoid below messages:

  rtw89_8852ce 0000:03:00.0: timed out to flush pci txch: 11
  rtw89_8852ce 0000:03:00.0: failed to pre-release fwcmd

Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
 drivers/net/wireless/realtek/rtw89/core.c | 7 +++++++
 drivers/net/wireless/realtek/rtw89/core.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
index 796b205854ac6..e3317deafa1d0 100644
--- a/drivers/net/wireless/realtek/rtw89/core.c
+++ b/drivers/net/wireless/realtek/rtw89/core.c
@@ -856,6 +856,13 @@ int rtw89_h2c_tx(struct rtw89_dev *rtwdev,
 	u32 cnt;
 	int ret;
 
+	if (!test_bit(RTW89_FLAG_POWERON, rtwdev->flags)) {
+		rtw89_debug(rtwdev, RTW89_DBG_FW,
+			    "ignore h2c due to power is off with firmware state=%d\n",
+			    test_bit(RTW89_FLAG_FW_RDY, rtwdev->flags));
+		return 0;
+	}
+
 	tx_req.skb = skb;
 	tx_req.tx_type = RTW89_CORE_TX_TYPE_FWCMD;
 	if (fwdl)
diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 27a3ceda90b90..6ca915cb7a29f 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -3199,6 +3199,9 @@ static inline void rtw89_hci_tx_kick_off(struct rtw89_dev *rtwdev, u8 txch)
 static inline void rtw89_hci_flush_queues(struct rtw89_dev *rtwdev, u32 queues,
 					  bool drop)
 {
+	if (!test_bit(RTW89_FLAG_POWERON, rtwdev->flags))
+		return;
+
 	if (rtwdev->hci.ops->flush_queues)
 		return rtwdev->hci.ops->flush_queues(rtwdev, queues, drop);
 }
-- 
2.25.1


  parent reply	other threads:[~2022-04-21 12:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-21 12:08 [PATCH 00/14] rtw89: 8852c: extend PCI code to support 8852ce and add 8852c chip_ops Ping-Ke Shih
2022-04-21 12:08 ` [PATCH 01/14] rtw89: pci: add variant IMR/ISR and configure functions Ping-Ke Shih
2022-04-24 11:31   ` Kalle Valo
2022-04-21 12:08 ` [PATCH 02/14] rtw89: pci: add variant RPWM/CPWM to enter low power mode Ping-Ke Shih
2022-04-21 12:08 ` [PATCH 03/14] rtw89: pci: reclaim TX BD only if it really need Ping-Ke Shih
2022-04-21 12:08 ` [PATCH 04/14] rtw89: pci: does RX in interrupt threadfn if low power mode Ping-Ke Shih
2022-04-23 12:32   ` Kalle Valo
2022-04-23 12:37     ` Kalle Valo
2022-04-24  2:58       ` Pkshih
2022-04-24  4:15         ` Kalle Valo
2022-04-21 12:08 ` [PATCH 05/14] rtw89: ser: re-enable interrupt in threadfn if under_recovery Ping-Ke Shih
2022-04-21 12:08 ` [PATCH 06/14] rtw89: ps: access TX/RX rings via another registers in low power mode Ping-Ke Shih
2022-04-21 12:08 ` [PATCH 07/14] rtw89: pci: allow to process RPP prior to TX BD Ping-Ke Shih
2022-04-21 12:08 ` Ping-Ke Shih [this message]
2022-04-21 12:08 ` [PATCH 09/14] rtw89: add RF H2C to notify firmware Ping-Ke Shih
2022-04-21 12:08 ` [PATCH 10/14] rtw89: 8852c: configure default BB TX/RX path Ping-Ke Shih
2022-04-21 12:09 ` [PATCH 11/14] rtw89: 8852c: implement chip_ops related to TX power Ping-Ke Shih
2022-04-21 12:09 ` [PATCH 12/14] rtw89: 8852c: implement chip_ops::get_thermal Ping-Ke Shih
2022-04-21 12:09 ` [PATCH 13/14] rtw89: 8852c: fill freq and band of RX status by PPDU report Ping-Ke Shih
2022-04-21 12:09 ` [PATCH 14/14] rtw89: 8852c: add chip_ops related to BTC Ping-Ke Shih

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220421120903.73715-9-pkshih@realtek.com \
    --to=pkshih@realtek.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.