Commit 7e2629dc authored by Ping-Ke Shih's avatar Ping-Ke Shih Committed by Kalle Valo

wifi: rtw89: 8922a: add chip_ops::rfk_init_late to do initial RF calibrations later

The RF calibrations are moved into firmware, so we trigger calibrations by
H2C commands and wait for C2H completion events. However, these events
can be received only after HCI (i.e. PCI for now) starts, so we should
do initial RF calibrations after that.
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-11-pkshih@realtek.com
parent ff146ec2
...@@ -4101,6 +4101,7 @@ int rtw89_core_start(struct rtw89_dev *rtwdev) ...@@ -4101,6 +4101,7 @@ int rtw89_core_start(struct rtw89_dev *rtwdev)
set_bit(RTW89_FLAG_RUNNING, rtwdev->flags); set_bit(RTW89_FLAG_RUNNING, rtwdev->flags);
rtw89_chip_rfk_init_late(rtwdev);
rtw89_btc_ntfy_radio_state(rtwdev, BTC_RFCTRL_WL_ON); rtw89_btc_ntfy_radio_state(rtwdev, BTC_RFCTRL_WL_ON);
rtw89_fw_h2c_fw_log(rtwdev, rtwdev->fw.log.enable); rtw89_fw_h2c_fw_log(rtwdev, rtwdev->fw.log.enable);
rtw89_fw_h2c_init_ba_cam(rtwdev); rtw89_fw_h2c_init_ba_cam(rtwdev);
......
...@@ -3157,6 +3157,7 @@ struct rtw89_chip_ops { ...@@ -3157,6 +3157,7 @@ struct rtw89_chip_ops {
void (*fem_setup)(struct rtw89_dev *rtwdev); void (*fem_setup)(struct rtw89_dev *rtwdev);
void (*rfe_gpio)(struct rtw89_dev *rtwdev); void (*rfe_gpio)(struct rtw89_dev *rtwdev);
void (*rfk_init)(struct rtw89_dev *rtwdev); void (*rfk_init)(struct rtw89_dev *rtwdev);
void (*rfk_init_late)(struct rtw89_dev *rtwdev);
void (*rfk_channel)(struct rtw89_dev *rtwdev); void (*rfk_channel)(struct rtw89_dev *rtwdev);
void (*rfk_band_changed)(struct rtw89_dev *rtwdev, void (*rfk_band_changed)(struct rtw89_dev *rtwdev,
enum rtw89_phy_idx phy_idx); enum rtw89_phy_idx phy_idx);
...@@ -5642,6 +5643,14 @@ static inline void rtw89_chip_rfk_init(struct rtw89_dev *rtwdev) ...@@ -5642,6 +5643,14 @@ static inline void rtw89_chip_rfk_init(struct rtw89_dev *rtwdev)
chip->ops->rfk_init(rtwdev); chip->ops->rfk_init(rtwdev);
} }
static inline void rtw89_chip_rfk_init_late(struct rtw89_dev *rtwdev)
{
const struct rtw89_chip_info *chip = rtwdev->chip;
if (chip->ops->rfk_init_late)
chip->ops->rfk_init_late(rtwdev);
}
static inline void rtw89_chip_rfk_channel(struct rtw89_dev *rtwdev) static inline void rtw89_chip_rfk_channel(struct rtw89_dev *rtwdev)
{ {
const struct rtw89_chip_info *chip = rtwdev->chip; const struct rtw89_chip_info *chip = rtwdev->chip;
......
...@@ -2311,6 +2311,7 @@ static const struct rtw89_chip_ops rtw8851b_chip_ops = { ...@@ -2311,6 +2311,7 @@ static const struct rtw89_chip_ops rtw8851b_chip_ops = {
.fem_setup = NULL, .fem_setup = NULL,
.rfe_gpio = rtw8851b_rfe_gpio, .rfe_gpio = rtw8851b_rfe_gpio,
.rfk_init = rtw8851b_rfk_init, .rfk_init = rtw8851b_rfk_init,
.rfk_init_late = NULL,
.rfk_channel = rtw8851b_rfk_channel, .rfk_channel = rtw8851b_rfk_channel,
.rfk_band_changed = rtw8851b_rfk_band_changed, .rfk_band_changed = rtw8851b_rfk_band_changed,
.rfk_scan = rtw8851b_rfk_scan, .rfk_scan = rtw8851b_rfk_scan,
......
...@@ -2055,6 +2055,7 @@ static const struct rtw89_chip_ops rtw8852a_chip_ops = { ...@@ -2055,6 +2055,7 @@ static const struct rtw89_chip_ops rtw8852a_chip_ops = {
.fem_setup = rtw8852a_fem_setup, .fem_setup = rtw8852a_fem_setup,
.rfe_gpio = NULL, .rfe_gpio = NULL,
.rfk_init = rtw8852a_rfk_init, .rfk_init = rtw8852a_rfk_init,
.rfk_init_late = NULL,
.rfk_channel = rtw8852a_rfk_channel, .rfk_channel = rtw8852a_rfk_channel,
.rfk_band_changed = rtw8852a_rfk_band_changed, .rfk_band_changed = rtw8852a_rfk_band_changed,
.rfk_scan = rtw8852a_rfk_scan, .rfk_scan = rtw8852a_rfk_scan,
......
...@@ -2480,6 +2480,7 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = { ...@@ -2480,6 +2480,7 @@ static const struct rtw89_chip_ops rtw8852b_chip_ops = {
.fem_setup = NULL, .fem_setup = NULL,
.rfe_gpio = NULL, .rfe_gpio = NULL,
.rfk_init = rtw8852b_rfk_init, .rfk_init = rtw8852b_rfk_init,
.rfk_init_late = NULL,
.rfk_channel = rtw8852b_rfk_channel, .rfk_channel = rtw8852b_rfk_channel,
.rfk_band_changed = rtw8852b_rfk_band_changed, .rfk_band_changed = rtw8852b_rfk_band_changed,
.rfk_scan = rtw8852b_rfk_scan, .rfk_scan = rtw8852b_rfk_scan,
......
...@@ -2825,6 +2825,7 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = { ...@@ -2825,6 +2825,7 @@ static const struct rtw89_chip_ops rtw8852c_chip_ops = {
.fem_setup = NULL, .fem_setup = NULL,
.rfe_gpio = NULL, .rfe_gpio = NULL,
.rfk_init = rtw8852c_rfk_init, .rfk_init = rtw8852c_rfk_init,
.rfk_init_late = NULL,
.rfk_channel = rtw8852c_rfk_channel, .rfk_channel = rtw8852c_rfk_channel,
.rfk_band_changed = rtw8852c_rfk_band_changed, .rfk_band_changed = rtw8852c_rfk_band_changed,
.rfk_scan = rtw8852c_rfk_scan, .rfk_scan = rtw8852c_rfk_scan,
......
...@@ -1379,6 +1379,14 @@ static void rtw8922a_rfk_init(struct rtw89_dev *rtwdev) ...@@ -1379,6 +1379,14 @@ static void rtw8922a_rfk_init(struct rtw89_dev *rtwdev)
memset(rfk_mcc, 0, sizeof(*rfk_mcc)); memset(rfk_mcc, 0, sizeof(*rfk_mcc));
} }
static void rtw8922a_rfk_init_late(struct rtw89_dev *rtwdev)
{
rtw89_phy_rfk_pre_ntfy_and_wait(rtwdev, RTW89_PHY_0, 5);
rtw89_phy_rfk_dack_and_wait(rtwdev, RTW89_PHY_0, 58);
rtw89_phy_rfk_rxdck_and_wait(rtwdev, RTW89_PHY_0, 32);
}
static void _wait_rx_mode(struct rtw89_dev *rtwdev, u8 kpath) static void _wait_rx_mode(struct rtw89_dev *rtwdev, u8 kpath)
{ {
u32 rf_mode; u32 rf_mode;
...@@ -1687,6 +1695,7 @@ static const struct rtw89_chip_ops rtw8922a_chip_ops = { ...@@ -1687,6 +1695,7 @@ static const struct rtw89_chip_ops rtw8922a_chip_ops = {
.fem_setup = NULL, .fem_setup = NULL,
.rfe_gpio = NULL, .rfe_gpio = NULL,
.rfk_init = rtw8922a_rfk_init, .rfk_init = rtw8922a_rfk_init,
.rfk_init_late = rtw8922a_rfk_init_late,
.rfk_channel = rtw8922a_rfk_channel, .rfk_channel = rtw8922a_rfk_channel,
.rfk_band_changed = rtw8922a_rfk_band_changed, .rfk_band_changed = rtw8922a_rfk_band_changed,
.rfk_scan = rtw8922a_rfk_scan, .rfk_scan = rtw8922a_rfk_scan,
......
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