From: Ping-Ke Shih <pkshih@realtek.com>
To: <linux-wireless@vger.kernel.org>
Cc: <owen.hsiao@realtek.com>, <echuang@realtek.com>,
<henchy.chen@realtek.com>, <phhuang@realtek.com>,
<kevin_yang@realtek.com>
Subject: [PATCH rtw-next v2 08/14] wifi: rtw89: 8922d: send RFE type to firmware
Date: Wed, 2 Sep 2026 13:29:52 +0800 [thread overview]
Message-ID: <20260902052958.50371-9-pkshih@realtek.com> (raw)
In-Reply-To: <20260902052958.50371-1-pkshih@realtek.com>
To configure BT in firmware according to RFE type, send it via H2C command.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/fw.c | 40 +++++++++++++++++++
drivers/net/wireless/realtek/rtw89/fw.h | 7 ++++
drivers/net/wireless/realtek/rtw89/rtw8922d.c | 2 +
3 files changed, 49 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index b2991bc93f85..fb5757b84494 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -3567,6 +3567,46 @@ int rtw89_fw_h2c_lps_ml_cmn_info_v1(struct rtw89_dev *rtwdev,
return ret;
}
+int rtw89_fw_h2c_phy_rfe_type(struct rtw89_dev *rtwdev)
+{
+ const struct rtw89_chip_info *chip = rtwdev->chip;
+ struct rtw89_efuse *efuse = &rtwdev->efuse;
+ struct rtw89_h2c_phy_rfe_type *h2c;
+ u32 len = sizeof(*h2c);
+ struct sk_buff *skb;
+ int ret;
+
+ if (chip->chip_id != RTL8922D)
+ return 0;
+
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
+ if (!skb) {
+ rtw89_err(rtwdev, "failed to alloc skb for h2c phy_rfe_type\n");
+ return -ENOMEM;
+ }
+ skb_put(skb, len);
+ h2c = (struct rtw89_h2c_phy_rfe_type *)skb->data;
+
+ h2c->rfe_type = efuse->rfe_type;
+
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
+ H2C_CAT_OUTSRC, H2C_CL_OUTSRC_DM,
+ H2C_FUNC_FW_RFE_TYPE, 0, 0, len);
+
+ ret = rtw89_h2c_tx(rtwdev, skb, false);
+ if (ret) {
+ rtw89_err(rtwdev, "failed to send h2c\n");
+ goto fail;
+ }
+
+ return 0;
+fail:
+ dev_kfree_skb_any(skb);
+
+ return ret;
+}
+EXPORT_SYMBOL(rtw89_fw_h2c_phy_rfe_type);
+
#define H2C_P2P_ACT_LEN 20
int rtw89_fw_h2c_p2p_act(struct rtw89_dev *rtwdev,
struct rtw89_vif_link *rtwvif_link,
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
index 375ca0a243a6..f7d017d3ced0 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.h
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
@@ -2101,6 +2101,11 @@ struct rtw89_h2c_lps_ml_cmn_info_v1 {
struct rtw89_bb_link_info_rx_gain rx_gain[RTW89_BB_PS_LINK_BUF_MAX];
} __packed;
+struct rtw89_h2c_phy_rfe_type {
+ u8 rfe_type;
+ u8 rsvd[3];
+} __packed;
+
struct rtw89_h2c_trig_cpu_except {
__le32 w0;
} __packed;
@@ -4886,6 +4891,7 @@ enum rtw89_mrc_h2c_func {
#define H2C_FUNC_FW_MCC_DIG 0x6
#define H2C_FUNC_FW_LPS_CH_INFO 0xb
#define H2C_FUNC_FW_LPS_ML_CMN_INFO 0xe
+#define H2C_FUNC_FW_RFE_TYPE 0x1b
#define H2C_CL_OUTSRC_RF_REG_A 0x8
#define H2C_CL_OUTSRC_RF_REG_B 0x9
@@ -5568,6 +5574,7 @@ int rtw89_fw_h2c_lps_ml_cmn_info_v1(struct rtw89_dev *rtwdev,
struct rtw89_vif *rtwvif);
int rtw89_fw_h2c_fwips(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link,
bool enable);
+int rtw89_fw_h2c_phy_rfe_type(struct rtw89_dev *rtwdev);
struct sk_buff *rtw89_fw_h2c_alloc_skb_with_hdr(struct rtw89_dev *rtwdev, u32 len);
struct sk_buff *rtw89_fw_h2c_alloc_skb_no_hdr(struct rtw89_dev *rtwdev, u32 len);
int rtw89_fw_msg_reg(struct rtw89_dev *rtwdev,
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8922d.c b/drivers/net/wireless/realtek/rtw89/rtw8922d.c
index 5f910163163f..4d003b303ae7 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8922d.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8922d.c
@@ -2504,6 +2504,8 @@ static void rtw8922d_bb_sethw(struct rtw89_dev *rtwdev)
enum rtw89_phy_idx phy_idx;
u32 reg;
+ rtw89_fw_h2c_phy_rfe_type(rtwdev);
+
reg = rtw89_mac_reg_by_idx(rtwdev, R_BE_PWR_BOOST, RTW89_PHY_0);
rtw89_write32_clr(rtwdev, reg, B_BE_PWR_CTRL_SEL);
reg = rtw89_mac_reg_by_idx(rtwdev, R_BE_PWR_BOOST, RTW89_PHY_1);
--
2.25.1
next prev parent reply other threads:[~2026-09-02 5:31 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 5:29 [PATCH rtw-next v2 00/14] wifi: rtw89: update RTL8922D capabilities and settings, and enable P2P device Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 01/14] wifi: rtw89: 8922de: add low latency quirk for Valve device Ping-Ke Shih
2026-09-08 3:15 ` Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 02/14] wifi: rtw89: 8922d: disable VCORE for thermal protection by default Ping-Ke Shih
2026-09-08 6:03 ` Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 03/14] wifi: rtw89: allow two station interfaces in SCC Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 04/14] wifi: rtw89: 8922d: update BB wrapper RFSI ctrl to v4 Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 05/14] wifi: rtw89: 8922d: set BB wrapper settings according to operating channel Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 06/14] wifi: rtw89: 8922d: move conditionally disabled TX shape to common flow Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 07/14] wifi: rtw89: 8922d: update BB wrapper RFSI ctrl to v5 Ping-Ke Shih
2026-09-02 5:29 ` Ping-Ke Shih [this message]
2026-09-02 5:29 ` [PATCH rtw-next v2 09/14] wifi: rtw89: 8922d: bypass RX IQK when scan Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 10/14] wifi: rtw89: 8922d: correct selection of CCK rate circuit Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 11/14] wifi: rtw89: chan: introduce helper and refine active list iteration Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 12/14] wifi: rtw89: regd: check only active vifs when recalculating 6 GHz power type Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 13/14] wifi: rtw89: skip tracking things when entity is paused Ping-Ke Shih
2026-09-02 5:29 ` [PATCH rtw-next v2 14/14] wifi: rtw89: add p2p device declaration Ping-Ke Shih
2026-09-06 0:20 ` [PATCH rtw-next v2 00/14] wifi: rtw89: update RTL8922D capabilities and settings, and enable P2P device Maxim Skokov
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=20260902052958.50371-9-pkshih@realtek.com \
--to=pkshih@realtek.com \
--cc=echuang@realtek.com \
--cc=henchy.chen@realtek.com \
--cc=kevin_yang@realtek.com \
--cc=linux-wireless@vger.kernel.org \
--cc=owen.hsiao@realtek.com \
--cc=phhuang@realtek.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox