Commit 1a0cba5d authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: rfk: add H2C command to trigger DACK

DACK (digital-to-analog converters calibration) is used to calibrate DAC
to output signals with expected quality.
Signed-off-by: default avatarPing-Ke Shih <pkshih@realtek.com>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240202030642.108385-7-pkshih@realtek.com
parent b835141b
...@@ -4671,6 +4671,42 @@ int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx) ...@@ -4671,6 +4671,42 @@ int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
return ret; return ret;
} }
int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
{
struct rtw89_h2c_rf_dack *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 DACK\n");
return -ENOMEM;
}
skb_put(skb, len);
h2c = (struct rtw89_h2c_rf_dack *)skb->data;
h2c->len = cpu_to_le32(len);
h2c->phy = cpu_to_le32(phy_idx);
h2c->type = cpu_to_le32(0);
rtw89_h2c_pkt_set_hdr(rtwdev, skb, FWCMD_TYPE_H2C,
H2C_CAT_OUTSRC, H2C_CL_OUTSRC_RF_FW_RFK,
H2C_FUNC_RFK_DACK_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_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx) int rtw89_fw_h2c_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
{ {
const struct rtw89_chan *chan = rtw89_chan_get(rtwdev, const struct rtw89_chan *chan = rtw89_chan_get(rtwdev,
......
...@@ -3937,6 +3937,7 @@ enum rtw89_mcc_h2c_func { ...@@ -3937,6 +3937,7 @@ enum rtw89_mcc_h2c_func {
enum rtw89_rfk_offload_h2c_func { enum rtw89_rfk_offload_h2c_func {
H2C_FUNC_RFK_IQK_OFFLOAD = 0x1, H2C_FUNC_RFK_IQK_OFFLOAD = 0x1,
H2C_FUNC_RFK_DPK_OFFLOAD = 0x3, H2C_FUNC_RFK_DPK_OFFLOAD = 0x3,
H2C_FUNC_RFK_DACK_OFFLOAD = 0x5,
H2C_FUNC_RFK_RXDCK_OFFLOAD = 0x6, H2C_FUNC_RFK_RXDCK_OFFLOAD = 0x6,
H2C_FUNC_RFK_PRE_NOTIFY = 0x8, H2C_FUNC_RFK_PRE_NOTIFY = 0x8,
}; };
...@@ -4001,6 +4002,12 @@ struct rtw89_h2c_rf_dpk { ...@@ -4001,6 +4002,12 @@ struct rtw89_h2c_rf_dpk {
u8 dpk_dbg_en; u8 dpk_dbg_en;
} __packed; } __packed;
struct rtw89_h2c_rf_dack {
__le32 len;
__le32 phy;
__le32 type;
} __packed;
struct rtw89_h2c_rf_rxdck { struct rtw89_h2c_rf_rxdck {
u8 len; u8 len;
u8 phy; u8 phy;
...@@ -4201,6 +4208,7 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev, ...@@ -4201,6 +4208,7 @@ int rtw89_fw_h2c_rf_pre_ntfy(struct rtw89_dev *rtwdev,
enum rtw89_phy_idx phy_idx); 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_rf_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx); int rtw89_fw_h2c_rf_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
int rtw89_fw_h2c_rf_dack(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
int rtw89_fw_h2c_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx); int rtw89_fw_h2c_rf_rxdck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev, int rtw89_fw_h2c_raw_with_hdr(struct rtw89_dev *rtwdev,
u8 h2c_class, u8 h2c_func, u8 *buf, u16 len, u8 h2c_class, u8 h2c_func, u8 *buf, u16 len,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment