From: Ping-Ke Shih <pkshih@realtek.com>
To: <kvalo@kernel.org>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH 03/11] wifi: rtw89: rfk: add H2C command to trigger IQK
Date: Fri, 2 Feb 2024 11:06:34 +0800 [thread overview]
Message-ID: <20240202030642.108385-4-pkshih@realtek.com> (raw)
In-Reply-To: <20240202030642.108385-1-pkshih@realtek.com>
IQ signal calibration is a basic and important calibration to yield good RF
performance. Do this calibration on AP channel if we are going to connect.
During scanning phase, it transmits with low data rate, so without IQK
RF performance is still acceptable.
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
drivers/net/wireless/realtek/rtw89/fw.c | 35 +++++++++++++++++++++++++
drivers/net/wireless/realtek/rtw89/fw.h | 7 +++++
2 files changed, 42 insertions(+)
diff --git a/drivers/net/wireless/realtek/rtw89/fw.c b/drivers/net/wireless/realtek/rtw89/fw.c
index 5bd3d08a5d25..d2c166ee5c89 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.c
+++ b/drivers/net/wireless/realtek/rtw89/fw.c
@@ -4593,6 +4593,41 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
return ret;
}
+int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
+{
+ struct rtw89_h2c_rf_iqk *h2c;
+ u32 len = sizeof(*h2c);
+ struct sk_buff *skb;
+ int ret;
+
+ skb = rtw89_fw_h2c_alloc_skb_with_hdr(rtwdev, len);
+ if (!skb) {
+ rtw89_err(rtwdev, "failed to alloc skb for h2c RF IQK\n");
+ return -ENOMEM;
+ }
+ skb_put(skb, len);
+ h2c = (struct rtw89_h2c_rf_iqk *)skb->data;
+
+ h2c->phy_idx = cpu_to_le32(phy_idx);
+ h2c->dbcc = cpu_to_le32(rtwdev->dbcc_en);
+
+ rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
+ H2C_CAT_OUTSRC, H2C_CL_OUTSRC_RF_FW_RFK,
+ H2C_FUNC_RFK_IQK_OFFLOAD, 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;
+}
+
int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev,
u8 h2c_class, u8 h2c_func, u8 *buf, u16 len,
bool rack, bool dack)
diff --git a/drivers/net/wireless/realtek/rtw89/fw.h b/drivers/net/wireless/realtek/rtw89/fw.h
index d9316b66ab76..e9c7f9532b0b 100644
--- a/drivers/net/wireless/realtek/rtw89/fw.h
+++ b/drivers/net/wireless/realtek/rtw89/fw.h
@@ -3935,6 +3935,7 @@ enum rtw89_mcc_h2c_func {
#define H2C_CL_OUTSRC_RF_FW_RFK 0xb
enum rtw89_rfk_offload_h2c_func {
+ H2C_FUNC_RFK_IQK_OFFLOAD = 0x1,
H2C_FUNC_RFK_PRE_NOTIFY = 0x8,
};
@@ -3982,6 +3983,11 @@ struct rtw89_fw_h2c_rfk_pre_info {
} __packed mlo;
} __packed;
+struct rtw89_h2c_rf_iqk {
+ __le32 phy_idx;
+ __le32 dbcc;
+} __packed;
+
enum rtw89_rf_log_type {
RTW89_RF_RUN_LOG = 0,
RTW89_RF_RPT_LOG = 1,
@@ -4169,6 +4175,7 @@ int rtw89_fw_h2c_rf_reg(struct rtw89_dev *rtwdev,
int rtw89_fw_h2c_rf_ntfy_mcc(struct rtw89_dev *rtwdev);
int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
enum rtw89_phy_idx phy_idx);
+int rtw89_fw_h2c_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev,
u8 h2c_class, u8 h2c_func, u8 *buf, u16 len,
bool rack, bool dack);
--
2.25.1
next prev parent reply other threads:[~2024-02-02 3:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-02 3:06 [PATCH 00/11] wifi: rtw89: 8922a: add firmware RF calibrations Ping-Ke Shih
2024-02-02 3:06 ` [PATCH 01/11] wifi: rtw89: rfk: add a completion to wait RF calibration report from C2H event Ping-Ke Shih
2024-02-06 18:05 ` Kalle Valo
2024-02-02 3:06 ` [PATCH 02/11] wifi: rtw89: rfk: send channel information to firmware for RF calibrations Ping-Ke Shih
2024-02-02 3:06 ` Ping-Ke Shih [this message]
2024-02-02 3:06 ` [PATCH 04/11] wifi: rtw89: rfk: add H2C command to trigger RX DCK Ping-Ke Shih
2024-02-02 3:06 ` [PATCH 05/11] wifi: rtw89: rfk: add H2C command to trigger DPK Ping-Ke Shih
2024-02-02 3:06 ` [PATCH 06/11] wifi: rtw89: rfk: add H2C command to trigger DACK Ping-Ke Shih
2024-02-02 3:06 ` [PATCH 07/11] wifi: rtw89: rfk: add H2C command to trigger TXGAPK Ping-Ke Shih
2024-02-02 3:06 ` [PATCH 08/11] wifi: rtw89: rfk: add H2C command to trigger TSSI Ping-Ke Shih
2024-02-02 3:06 ` [PATCH 09/11] wifi: rtw89: 8922a: rfk: implement chip_ops to call RF calibrations Ping-Ke Shih
2024-02-02 3:06 ` [PATCH 10/11] wifi: rtw89: 8922a: add chip_ops::rfk_init_late to do initial RF calibrations later Ping-Ke Shih
2024-02-02 3:06 ` [PATCH 11/11] wifi: rtw89: 8922a: add chip_ops::rfk_hw_init 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=20240202030642.108385-4-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).