You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
4.8 KiB
125 lines
4.8 KiB
1 year ago
|
From ebf2cfc3ca05dfc0e9b0497f6412271efe4b87d1 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?=C3=8D=C3=B1igo=20Huguet?= <ihuguet@redhat.com>
|
||
|
Date: Wed, 24 May 2023 15:00:27 +0200
|
||
|
Subject: [PATCH 047/142] wifi: rtw89: collect and send RF parameters to
|
||
|
firmware for WoWLAN
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
Bugzilla: https://bugzilla.redhat.com/2207499
|
||
|
|
||
|
commit d9112042d9942648825d3ebe837dd33dbd7c6ddb
|
||
|
Author: Chih-Kang Chang <gary.chang@realtek.com>
|
||
|
Date: Thu Oct 27 13:27:01 2022 +0800
|
||
|
|
||
|
wifi: rtw89: collect and send RF parameters to firmware for WoWLAN
|
||
|
|
||
|
For WoWLAN mode, we only collect and send RF parameters to Firmware
|
||
|
without writing RF registers. So we add one function to practice it.
|
||
|
|
||
|
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
|
||
|
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
|
||
|
Signed-off-by: Kalle Valo <kvalo@kernel.org>
|
||
|
Link: https://lore.kernel.org/r/20221027052707.14605-2-pkshih@realtek.com
|
||
|
|
||
|
Signed-off-by: Íñigo Huguet <ihuguet@redhat.com>
|
||
|
---
|
||
|
drivers/net/wireless/realtek/rtw89/core.c | 2 +-
|
||
|
drivers/net/wireless/realtek/rtw89/phy.c | 31 +++++++++++++++++++++++++++++--
|
||
|
drivers/net/wireless/realtek/rtw89/phy.h | 2 +-
|
||
|
3 files changed, 31 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c
|
||
|
index 45babf1a857d1..c285707b21bb1 100644
|
||
|
--- a/drivers/net/wireless/realtek/rtw89/core.c
|
||
|
+++ b/drivers/net/wireless/realtek/rtw89/core.c
|
||
|
@@ -2962,7 +2962,7 @@ int rtw89_core_start(struct rtw89_dev *rtwdev)
|
||
|
return ret;
|
||
|
|
||
|
rtw89_phy_init_bb_reg(rtwdev);
|
||
|
- rtw89_phy_init_rf_reg(rtwdev);
|
||
|
+ rtw89_phy_init_rf_reg(rtwdev, false);
|
||
|
|
||
|
rtw89_btc_ntfy_init(rtwdev, BTC_MODE_NORMAL);
|
||
|
|
||
|
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
|
||
|
index 0bd2a0cea7ff1..944bb0f2ee633 100644
|
||
|
--- a/drivers/net/wireless/realtek/rtw89/phy.c
|
||
|
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
|
||
|
@@ -801,6 +801,11 @@ bool rtw89_phy_write_rf_v1(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||
|
}
|
||
|
EXPORT_SYMBOL(rtw89_phy_write_rf_v1);
|
||
|
|
||
|
+static bool rtw89_chip_rf_v1(struct rtw89_dev *rtwdev)
|
||
|
+{
|
||
|
+ return rtwdev->chip->ops->write_rf == rtw89_phy_write_rf_v1;
|
||
|
+}
|
||
|
+
|
||
|
static void rtw89_phy_bb_reset(struct rtw89_dev *rtwdev,
|
||
|
enum rtw89_phy_idx phy_idx)
|
||
|
{
|
||
|
@@ -1123,6 +1128,24 @@ static int rtw89_phy_config_rf_reg_fw(struct rtw89_dev *rtwdev,
|
||
|
return ret;
|
||
|
}
|
||
|
|
||
|
+static void rtw89_phy_config_rf_reg_noio(struct rtw89_dev *rtwdev,
|
||
|
+ const struct rtw89_reg2_def *reg,
|
||
|
+ enum rtw89_rf_path rf_path,
|
||
|
+ void *extra_data)
|
||
|
+{
|
||
|
+ u32 addr = reg->addr;
|
||
|
+
|
||
|
+ if (addr == 0xfe || addr == 0xfd || addr == 0xfc || addr == 0xfb ||
|
||
|
+ addr == 0xfa || addr == 0xf9)
|
||
|
+ return;
|
||
|
+
|
||
|
+ if (rtw89_chip_rf_v1(rtwdev) && addr < 0x100)
|
||
|
+ return;
|
||
|
+
|
||
|
+ rtw89_phy_cofig_rf_reg_store(rtwdev, reg, rf_path,
|
||
|
+ (struct rtw89_fw_h2c_rf_reg_info *)extra_data);
|
||
|
+}
|
||
|
+
|
||
|
static void rtw89_phy_config_rf_reg(struct rtw89_dev *rtwdev,
|
||
|
const struct rtw89_reg2_def *reg,
|
||
|
enum rtw89_rf_path rf_path,
|
||
|
@@ -1335,7 +1358,7 @@ static u32 rtw89_phy_nctl_poll(struct rtw89_dev *rtwdev)
|
||
|
return rtw89_phy_read32(rtwdev, 0x8080);
|
||
|
}
|
||
|
|
||
|
-void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev)
|
||
|
+void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev, bool noio)
|
||
|
{
|
||
|
void (*config)(struct rtw89_dev *rtwdev, const struct rtw89_reg2_def *reg,
|
||
|
enum rtw89_rf_path rf_path, void *data);
|
||
|
@@ -1351,7 +1374,11 @@ void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev)
|
||
|
for (path = RF_PATH_A; path < chip->rf_path_num; path++) {
|
||
|
rf_table = chip->rf_table[path];
|
||
|
rf_reg_info->rf_path = rf_table->rf_path;
|
||
|
- config = rf_table->config ? rf_table->config : rtw89_phy_config_rf_reg;
|
||
|
+ if (noio)
|
||
|
+ config = rtw89_phy_config_rf_reg_noio;
|
||
|
+ else
|
||
|
+ config = rf_table->config ? rf_table->config :
|
||
|
+ rtw89_phy_config_rf_reg;
|
||
|
rtw89_phy_init_reg(rtwdev, rf_table, config, (void *)rf_reg_info);
|
||
|
if (rtw89_phy_config_rf_reg_fw(rtwdev, rf_reg_info))
|
||
|
rtw89_warn(rtwdev, "rf path %d reg h2c config failed\n",
|
||
|
diff --git a/drivers/net/wireless/realtek/rtw89/phy.h b/drivers/net/wireless/realtek/rtw89/phy.h
|
||
|
index 995c13f6f906c..dac69a02e8687 100644
|
||
|
--- a/drivers/net/wireless/realtek/rtw89/phy.h
|
||
|
+++ b/drivers/net/wireless/realtek/rtw89/phy.h
|
||
|
@@ -500,7 +500,7 @@ bool rtw89_phy_write_rf(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||
|
bool rtw89_phy_write_rf_v1(struct rtw89_dev *rtwdev, enum rtw89_rf_path rf_path,
|
||
|
u32 addr, u32 mask, u32 data);
|
||
|
void rtw89_phy_init_bb_reg(struct rtw89_dev *rtwdev);
|
||
|
-void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev);
|
||
|
+void rtw89_phy_init_rf_reg(struct rtw89_dev *rtwdev, bool noio);
|
||
|
void rtw89_phy_config_rf_reg_v1(struct rtw89_dev *rtwdev,
|
||
|
const struct rtw89_reg2_def *reg,
|
||
|
enum rtw89_rf_path rf_path,
|
||
|
--
|
||
|
2.13.6
|
||
|
|