2023-06-06 14:12:27

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH 2/2] wifi: rtw89: cleanup rtw89_iqk_info and related code

Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
just change 'thermal_rek_en' field which is set but unused
and so removed as well) functions, set but unused 'kcount'
field of 'struct rtw89_iqk_info', convert 'thermal' to local
variables where appropriate (it doesn't need to have longer
storage duration because it is actually used for debugging
purposes only), fix typos.

Signed-off-by: Dmitry Antipov <[email protected]>
---
drivers/net/wireless/realtek/rtw89/core.h | 3 --
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 -
.../net/wireless/realtek/rtw89/rtw8852a_rfk.c | 34 +------------------
.../net/wireless/realtek/rtw89/rtw8852a_rfk.h | 1 -
.../net/wireless/realtek/rtw89/rtw8852b_rfk.c | 8 +----
.../net/wireless/realtek/rtw89/rtw8852c_rfk.c | 9 ++---
6 files changed, 4 insertions(+), 52 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index bea2e7210b70..5e703d617e26 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -3540,7 +3540,6 @@ struct rtw89_iqk_info {
u8 iqk_band[RTW89_IQK_PATH_NR];
u8 iqk_ch[RTW89_IQK_PATH_NR];
u8 iqk_bw[RTW89_IQK_PATH_NR];
- u8 kcount;
u8 iqk_times;
u8 version;
u32 nb_txcfir[RTW89_IQK_PATH_NR];
@@ -3555,8 +3554,6 @@ struct rtw89_iqk_info {
bool iqk_xym_en;
bool iqk_sram_en;
bool iqk_cfir_en;
- u8 thermal[RTW89_IQK_PATH_NR];
- bool thermal_rek_en;
u32 syn1to2;
u8 iqk_mcc_ch[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
u8 iqk_table_idx[RTW89_IQK_PATH_NR];
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
index d7930efd89b7..e798f395b32d 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
@@ -1332,7 +1332,6 @@ static void rtw8852a_rfk_scan(struct rtw89_dev *rtwdev, bool start)
static void rtw8852a_rfk_track(struct rtw89_dev *rtwdev)
{
rtw8852a_dpk_track(rtwdev);
- rtw8852a_iqk_track(rtwdev);
rtw8852a_tssi_track(rtwdev);
}

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
index cd6c39b7f802..afb7eba3dc44 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
@@ -1284,11 +1284,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp = 0x0;
bool flag = 0x0;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ (u8)ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1536,28 +1533,6 @@ static void _iqk_dbcc(struct rtw89_dev *rtwdev, u8 path)
_iqk_afebb_restore(rtwdev, phy_idx, path);
}

-static void _iqk_track(struct rtw89_dev *rtwdev)
-{
- struct rtw89_iqk_info *iqk = &rtwdev->iqk;
- u8 path = 0x0;
- u8 cur_ther;
-
- if (iqk->iqk_band[0] == RTW89_BAND_2G)
- return;
- if (iqk->iqk_bw[0] < RTW89_CHANNEL_WIDTH_80)
- return;
-
- /* only check path 0 */
- for (path = 0; path < 1; path++) {
- cur_ther = ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
-
- if (abs(cur_ther - iqk->thermal[path]) > RTW8852A_IQK_THR_REK)
- iqk->thermal_rek_en = true;
- else
- iqk->thermal_rek_en = false;
- }
-}
-
static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
{
u32 rf_reg5, rck_val = 0;
@@ -1616,7 +1591,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1645,7 +1619,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852A_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
@@ -3655,11 +3628,6 @@ void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
}

-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev)
-{
- _iqk_track(rtwdev);
-}
-
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe)
{
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
index ea36553a76b7..fa058ccc8616 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
@@ -10,7 +10,6 @@
void rtw8852a_rck(struct rtw89_dev *rtwdev);
void rtw8852a_dack(struct rtw89_dev *rtwdev);
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev);
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe);
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
index 722ae34b09c1..fa018e1f499b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
@@ -1317,10 +1317,6 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
-
flag = iqk_info->lok_cor_fail[0][path];
rtw89_phy_write32_mask(rtwdev, R_IQKINF, B_IQKINF_FCOR << (path * 4), flag);
flag = iqk_info->lok_fin_fail[0][path];
@@ -1568,7 +1564,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) {
@@ -1622,9 +1617,8 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852B_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
index 2c0bc3a4ab3b..d8c8688faee4 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
@@ -1261,11 +1261,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ (u8)ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1502,7 +1499,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1529,9 +1525,8 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852C_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
--
2.40.1



2023-06-08 00:47:56

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 2/2] wifi: rtw89: cleanup rtw89_iqk_info and related code



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Tuesday, June 6, 2023 10:08 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: Kalle Valo <[email protected]>; [email protected]; Dmitry Antipov <[email protected]>
> Subject: [PATCH 2/2] wifi: rtw89: cleanup rtw89_iqk_info and related code
>
> Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
> just change 'thermal_rek_en' field which is set but unused
> and so removed as well) functions, set but unused 'kcount'
> field of 'struct rtw89_iqk_info', convert 'thermal' to local
> variables where appropriate (it doesn't need to have longer
> storage duration because it is actually used for debugging
> purposes only), fix typos.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> ---
> drivers/net/wireless/realtek/rtw89/core.h | 3 --
> drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 -
> .../net/wireless/realtek/rtw89/rtw8852a_rfk.c | 34 +------------------
> .../net/wireless/realtek/rtw89/rtw8852a_rfk.h | 1 -
> .../net/wireless/realtek/rtw89/rtw8852b_rfk.c | 8 +----
> .../net/wireless/realtek/rtw89/rtw8852c_rfk.c | 9 ++---
> 6 files changed, 4 insertions(+), 52 deletions(-)
>

[...]

> diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> index cd6c39b7f802..afb7eba3dc44 100644
> --- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> +++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
> @@ -1284,11 +1284,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
> u32 tmp = 0x0;
> bool flag = 0x0;
>
> - iqk_info->thermal[path] =
> - ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
> - iqk_info->thermal_rek_en = false;
> rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
> - iqk_info->thermal[path]);
> + (u8)ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));

nit: no need casting (u8)

> rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
> iqk_info->lok_cor_fail[0][path]);
> rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,

[...]

> diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
> b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
> index 2c0bc3a4ab3b..d8c8688faee4 100644
> --- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
> +++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
> @@ -1261,11 +1261,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
> u32 tmp;
> bool flag;
>
> - iqk_info->thermal[path] =
> - ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
> - iqk_info->thermal_rek_en = false;
> rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
> - iqk_info->thermal[path]);
> + (u8)ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));

nit: no need casting (u8)

> rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
> iqk_info->lok_cor_fail[0][path]);
> rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,

[...]


2023-06-08 08:00:17

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH] [v2] wifi: rtw89: cleanup rtw89_iqk_info and related code

Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
just change 'thermal_rek_en' field which is set but unused
and so removed as well) functions, set but unused 'kcount'
field of 'struct rtw89_iqk_info', convert 'thermal' to local
variables where appropriate (it doesn't need to have longer
storage duration because it is actually used for debugging
purposes only), fix typos.

Signed-off-by: Dmitry Antipov <[email protected]>
---
v2: integer format specifier quirks (Ping-Ke Shih)
---
drivers/net/wireless/realtek/rtw89/core.h | 3 --
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 -
.../net/wireless/realtek/rtw89/rtw8852a_rfk.c | 36 ++-----------------
.../net/wireless/realtek/rtw89/rtw8852a_rfk.h | 1 -
.../net/wireless/realtek/rtw89/rtw8852b_rfk.c | 8 +----
.../net/wireless/realtek/rtw89/rtw8852c_rfk.c | 11 ++----
6 files changed, 6 insertions(+), 54 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index bea2e7210b70..5e703d617e26 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -3540,7 +3540,6 @@ struct rtw89_iqk_info {
u8 iqk_band[RTW89_IQK_PATH_NR];
u8 iqk_ch[RTW89_IQK_PATH_NR];
u8 iqk_bw[RTW89_IQK_PATH_NR];
- u8 kcount;
u8 iqk_times;
u8 version;
u32 nb_txcfir[RTW89_IQK_PATH_NR];
@@ -3555,8 +3554,6 @@ struct rtw89_iqk_info {
bool iqk_xym_en;
bool iqk_sram_en;
bool iqk_cfir_en;
- u8 thermal[RTW89_IQK_PATH_NR];
- bool thermal_rek_en;
u32 syn1to2;
u8 iqk_mcc_ch[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
u8 iqk_table_idx[RTW89_IQK_PATH_NR];
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
index d7930efd89b7..e798f395b32d 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
@@ -1332,7 +1332,6 @@ static void rtw8852a_rfk_scan(struct rtw89_dev *rtwdev, bool start)
static void rtw8852a_rfk_track(struct rtw89_dev *rtwdev)
{
rtw8852a_dpk_track(rtwdev);
- rtw8852a_iqk_track(rtwdev);
rtw8852a_tssi_track(rtwdev);
}

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
index cd6c39b7f802..d86429e4a35f 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
@@ -1284,11 +1284,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp = 0x0;
bool flag = 0x0;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
- rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %lu\n", path,
+ ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1536,28 +1533,6 @@ static void _iqk_dbcc(struct rtw89_dev *rtwdev, u8 path)
_iqk_afebb_restore(rtwdev, phy_idx, path);
}

-static void _iqk_track(struct rtw89_dev *rtwdev)
-{
- struct rtw89_iqk_info *iqk = &rtwdev->iqk;
- u8 path = 0x0;
- u8 cur_ther;
-
- if (iqk->iqk_band[0] == RTW89_BAND_2G)
- return;
- if (iqk->iqk_bw[0] < RTW89_CHANNEL_WIDTH_80)
- return;
-
- /* only check path 0 */
- for (path = 0; path < 1; path++) {
- cur_ther = ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
-
- if (abs(cur_ther - iqk->thermal[path]) > RTW8852A_IQK_THR_REK)
- iqk->thermal_rek_en = true;
- else
- iqk->thermal_rek_en = false;
- }
-}
-
static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
{
u32 rf_reg5, rck_val = 0;
@@ -1616,7 +1591,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1645,7 +1619,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852A_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
@@ -3655,11 +3628,6 @@ void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
}

-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev)
-{
- _iqk_track(rtwdev);
-}
-
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe)
{
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
index ea36553a76b7..fa058ccc8616 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
@@ -10,7 +10,6 @@
void rtw8852a_rck(struct rtw89_dev *rtwdev);
void rtw8852a_dack(struct rtw89_dev *rtwdev);
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev);
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe);
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
index 722ae34b09c1..fa018e1f499b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
@@ -1317,10 +1317,6 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
-
flag = iqk_info->lok_cor_fail[0][path];
rtw89_phy_write32_mask(rtwdev, R_IQKINF, B_IQKINF_FCOR << (path * 4), flag);
flag = iqk_info->lok_fin_fail[0][path];
@@ -1568,7 +1564,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) {
@@ -1622,9 +1617,8 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852B_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
index 2c0bc3a4ab3b..de7714f871d5 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
@@ -1261,11 +1261,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
- rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %lu\n", path,
+ ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1502,7 +1499,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1529,9 +1525,8 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852C_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
--
2.40.1


2023-06-08 08:22:05

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH] [v2] wifi: rtw89: cleanup rtw89_iqk_info and related code



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Thursday, June 8, 2023 3:45 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: Kalle Valo <[email protected]>; [email protected]; Dmitry Antipov <[email protected]>
> Subject: [PATCH] [v2] wifi: rtw89: cleanup rtw89_iqk_info and related code
>
> Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
> just change 'thermal_rek_en' field which is set but unused
> and so removed as well) functions, set but unused 'kcount'
> field of 'struct rtw89_iqk_info', convert 'thermal' to local
> variables where appropriate (it doesn't need to have longer
> storage duration because it is actually used for debugging
> purposes only), fix typos.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> ---
> v2: integer format specifier quirks (Ping-Ke Shih)

Please resend whole patchset by v3. Only sending patch 1/2 like this would be
hard to maintainers to choose patches.



2023-06-08 08:34:21

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH 1/2] [v3] wifi: rtw89: cleanup private data structures

Remove a bunch of unused (and set but unused) fields
from 'struct rtw89_btc_wl_nhm', 'struct rtw89_dle_info',
'struct rtw89_hal' and 'struct rtw89_env_monitor_info'
driver-specific data structures, adjust related bits.

Signed-off-by: Dmitry Antipov <[email protected]>
---
v3: adjust to match series
---
drivers/net/wireless/realtek/rtw89/core.h | 39 -----------------------
drivers/net/wireless/realtek/rtw89/mac.c | 6 +---
drivers/net/wireless/realtek/rtw89/phy.c | 4 ---
3 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 6df386a38fb4..bea2e7210b70 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -1382,7 +1382,6 @@ struct rtw89_btc_wl_nhm {
u8 current_status;
u8 refresh;
bool start_flag;
- u8 last_ccx_rpt_stamp;
s8 pwr_max;
s8 pwr_min;
};
@@ -3237,7 +3236,6 @@ enum rtw89_hcifc_mode {

struct rtw89_dle_info {
enum rtw89_qta_mode qta_mode;
- u16 wde_pg_size;
u16 ple_pg_size;
u16 c0_rx_qta;
u16 c1_rx_qta;
@@ -3417,7 +3415,6 @@ struct rtw89_hal {
u32 rx_fltr;
u8 cv;
u8 acv;
- u32 sw_amsdu_max_size;
u32 antenna_tx;
u32 antenna_rx;
u8 tx_nss;
@@ -3815,35 +3812,16 @@ enum rtw89_ccx_edcca_opt_bw_idx {
#define RTW89_FAHM_RPT_NUM 12
#define RTW89_IFS_CLM_NUM 4
struct rtw89_env_monitor_info {
- u32 ccx_trigger_time;
- u64 start_time;
- u8 ccx_rpt_stamp;
u8 ccx_watchdog_result;
bool ccx_ongoing;
u8 ccx_rac_lv;
bool ccx_manual_ctrl;
- u8 ccx_pre_rssi;
- u16 clm_mntr_time;
- u16 nhm_mntr_time;
u16 ifs_clm_mntr_time;
enum rtw89_ifs_clm_application ifs_clm_app;
- u16 fahm_mntr_time;
- u16 edcca_clm_mntr_time;
u16 ccx_period;
u8 ccx_unit_idx;
- enum rtw89_ccx_edcca_opt_bw_idx ccx_edcca_opt_bw_idx;
- u8 nhm_th[RTW89_NHM_TH_NUM];
u16 ifs_clm_th_l[RTW89_IFS_CLM_NUM];
u16 ifs_clm_th_h[RTW89_IFS_CLM_NUM];
- u8 fahm_numer_opt;
- u8 fahm_denom_opt;
- u8 fahm_th[RTW89_FAHM_TH_NUM];
- u16 clm_result;
- u16 nhm_result[RTW89_NHM_RPT_NUM];
- u8 nhm_wgt[RTW89_NHM_RPT_NUM];
- u16 nhm_tx_cnt;
- u16 nhm_cca_cnt;
- u16 nhm_idle_cnt;
u16 ifs_clm_tx;
u16 ifs_clm_edcca_excl_cca;
u16 ifs_clm_ofdmfa;
@@ -3854,17 +3832,6 @@ struct rtw89_env_monitor_info {
u8 ifs_clm_his[RTW89_IFS_CLM_NUM];
u16 ifs_clm_avg[RTW89_IFS_CLM_NUM];
u16 ifs_clm_cca[RTW89_IFS_CLM_NUM];
- u16 fahm_result[RTW89_FAHM_RPT_NUM];
- u16 fahm_denom_result;
- u16 edcca_clm_result;
- u8 clm_ratio;
- u8 nhm_rpt[RTW89_NHM_RPT_NUM];
- u8 nhm_tx_ratio;
- u8 nhm_cca_ratio;
- u8 nhm_idle_ratio;
- u8 nhm_ratio;
- u16 nhm_result_sum;
- u8 nhm_pwr;
u8 ifs_clm_tx_ratio;
u8 ifs_clm_edcca_excl_cca_ratio;
u8 ifs_clm_cck_fa_ratio;
@@ -3875,12 +3842,6 @@ struct rtw89_env_monitor_info {
u16 ifs_clm_ofdm_fa_permil;
u32 ifs_clm_ifs_avg[RTW89_IFS_CLM_NUM];
u32 ifs_clm_cca_avg[RTW89_IFS_CLM_NUM];
- u8 fahm_rpt[RTW89_FAHM_RPT_NUM];
- u16 fahm_result_sum;
- u8 fahm_ratio;
- u8 fahm_denom_ratio;
- u8 fahm_pwr;
- u8 edcca_clm_ratio;
};

enum rtw89_ser_rcvy_step {
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index 512de491a064..8c9471ece05a 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -716,11 +716,8 @@ static int hfc_reset_param(struct rtw89_dev *rtwdev)
if (param_ini.pub_cfg)
param->pub_cfg = *param_ini.pub_cfg;

- if (param_ini.prec_cfg) {
+ if (param_ini.prec_cfg)
param->prec_cfg = *param_ini.prec_cfg;
- rtwdev->hal.sw_amsdu_max_size =
- param->prec_cfg.wp_ch07_prec * HFC_PAGE_UNIT;
- }

if (param_ini.ch_cfg)
param->ch_cfg = param_ini.ch_cfg;
@@ -1497,7 +1494,6 @@ static const struct rtw89_dle_mem *get_dle_mem_cfg(struct rtw89_dev *rtwdev,
return NULL;
}

- mac->dle_info.wde_pg_size = cfg->wde_size->pge_size;
mac->dle_info.ple_pg_size = cfg->ple_size->pge_size;
mac->dle_info.qta_mode = mode;
mac->dle_info.c0_rx_qta = cfg->ple_min_qt->cma0_dma;
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
index c7e906123416..9ebc6e2a467f 100644
--- a/drivers/net/wireless/realtek/rtw89/phy.c
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
@@ -3053,11 +3053,8 @@ static void rtw89_phy_ccx_top_setting_init(struct rtw89_dev *rtwdev)
env->ccx_manual_ctrl = false;
env->ccx_ongoing = false;
env->ccx_rac_lv = RTW89_RAC_RELEASE;
- env->ccx_rpt_stamp = 0;
env->ccx_period = 0;
env->ccx_unit_idx = RTW89_CCX_32_US;
- env->ccx_trigger_time = 0;
- env->ccx_edcca_opt_bw_idx = RTW89_CCX_EDCCA_BW20_0;

rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_EN_MSK, 1);
rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_TRIG_OPT_MSK, 1);
@@ -3265,7 +3262,6 @@ static void rtw89_phy_ccx_trigger(struct rtw89_dev *rtwdev)
rtw89_phy_set_phy_regs(rtwdev, R_IFS_COUNTER, B_IFS_COUNTER_CLR_MSK, 1);
rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_MEASUREMENT_TRIG_MSK, 1);

- env->ccx_rpt_stamp++;
env->ccx_ongoing = true;
}

--
2.40.1


2023-06-08 08:51:17

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH 2/2] [v3] wifi: rtw89: cleanup rtw89_iqk_info and related code

Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
just change 'thermal_rek_en' field which is set but unused
and so removed as well) functions, set but unused 'kcount'
field of 'struct rtw89_iqk_info', convert 'thermal' to local
variables where appropriate (it doesn't need to have longer
storage duration because it is actually used for debugging
purposes only), fix typos.

Signed-off-by: Dmitry Antipov <[email protected]>
---
v3: adjust to match series
v2: integer format specifier quirks (Ping-Ke Shih)
---
drivers/net/wireless/realtek/rtw89/core.h | 3 --
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 -
.../net/wireless/realtek/rtw89/rtw8852a_rfk.c | 36 ++-----------------
.../net/wireless/realtek/rtw89/rtw8852a_rfk.h | 1 -
.../net/wireless/realtek/rtw89/rtw8852b_rfk.c | 8 +----
.../net/wireless/realtek/rtw89/rtw8852c_rfk.c | 11 ++----
6 files changed, 6 insertions(+), 54 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index bea2e7210b70..5e703d617e26 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -3540,7 +3540,6 @@ struct rtw89_iqk_info {
u8 iqk_band[RTW89_IQK_PATH_NR];
u8 iqk_ch[RTW89_IQK_PATH_NR];
u8 iqk_bw[RTW89_IQK_PATH_NR];
- u8 kcount;
u8 iqk_times;
u8 version;
u32 nb_txcfir[RTW89_IQK_PATH_NR];
@@ -3555,8 +3554,6 @@ struct rtw89_iqk_info {
bool iqk_xym_en;
bool iqk_sram_en;
bool iqk_cfir_en;
- u8 thermal[RTW89_IQK_PATH_NR];
- bool thermal_rek_en;
u32 syn1to2;
u8 iqk_mcc_ch[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
u8 iqk_table_idx[RTW89_IQK_PATH_NR];
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
index d7930efd89b7..e798f395b32d 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
@@ -1332,7 +1332,6 @@ static void rtw8852a_rfk_scan(struct rtw89_dev *rtwdev, bool start)
static void rtw8852a_rfk_track(struct rtw89_dev *rtwdev)
{
rtw8852a_dpk_track(rtwdev);
- rtw8852a_iqk_track(rtwdev);
rtw8852a_tssi_track(rtwdev);
}

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
index cd6c39b7f802..d86429e4a35f 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
@@ -1284,11 +1284,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp = 0x0;
bool flag = 0x0;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
- rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %lu\n", path,
+ ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1536,28 +1533,6 @@ static void _iqk_dbcc(struct rtw89_dev *rtwdev, u8 path)
_iqk_afebb_restore(rtwdev, phy_idx, path);
}

-static void _iqk_track(struct rtw89_dev *rtwdev)
-{
- struct rtw89_iqk_info *iqk = &rtwdev->iqk;
- u8 path = 0x0;
- u8 cur_ther;
-
- if (iqk->iqk_band[0] == RTW89_BAND_2G)
- return;
- if (iqk->iqk_bw[0] < RTW89_CHANNEL_WIDTH_80)
- return;
-
- /* only check path 0 */
- for (path = 0; path < 1; path++) {
- cur_ther = ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
-
- if (abs(cur_ther - iqk->thermal[path]) > RTW8852A_IQK_THR_REK)
- iqk->thermal_rek_en = true;
- else
- iqk->thermal_rek_en = false;
- }
-}
-
static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
{
u32 rf_reg5, rck_val = 0;
@@ -1616,7 +1591,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1645,7 +1619,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852A_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
@@ -3655,11 +3628,6 @@ void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
}

-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev)
-{
- _iqk_track(rtwdev);
-}
-
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe)
{
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
index ea36553a76b7..fa058ccc8616 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
@@ -10,7 +10,6 @@
void rtw8852a_rck(struct rtw89_dev *rtwdev);
void rtw8852a_dack(struct rtw89_dev *rtwdev);
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev);
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe);
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
index 722ae34b09c1..fa018e1f499b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
@@ -1317,10 +1317,6 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
-
flag = iqk_info->lok_cor_fail[0][path];
rtw89_phy_write32_mask(rtwdev, R_IQKINF, B_IQKINF_FCOR << (path * 4), flag);
flag = iqk_info->lok_fin_fail[0][path];
@@ -1568,7 +1564,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) {
@@ -1622,9 +1617,8 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852B_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
index 2c0bc3a4ab3b..de7714f871d5 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
@@ -1261,11 +1261,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
- rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %lu\n", path,
+ ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1502,7 +1499,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1529,9 +1525,8 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852C_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
--
2.40.1


2023-06-08 08:53:54

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 1/2] [v3] wifi: rtw89: cleanup private data structures



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Thursday, June 8, 2023 4:25 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: Kalle Valo <[email protected]>; [email protected]; Dmitry Antipov <[email protected]>
> Subject: [PATCH 1/2] [v3] wifi: rtw89: cleanup private data structures
>
> Remove a bunch of unused (and set but unused) fields
> from 'struct rtw89_btc_wl_nhm', 'struct rtw89_dle_info',
> 'struct rtw89_hal' and 'struct rtw89_env_monitor_info'
> driver-specific data structures, adjust related bits.
>
> Signed-off-by: Dmitry Antipov <[email protected]>

Acked-by: Ping-Ke Shih <[email protected]>

> ---
> v3: adjust to match series

[...]


2023-06-08 08:53:55

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 2/2] [v3] wifi: rtw89: cleanup rtw89_iqk_info and related code



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Thursday, June 8, 2023 4:25 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: Kalle Valo <[email protected]>; [email protected]; Dmitry Antipov <[email protected]>
> Subject: [PATCH 2/2] [v3] wifi: rtw89: cleanup rtw89_iqk_info and related code
>
> Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
> just change 'thermal_rek_en' field which is set but unused
> and so removed as well) functions, set but unused 'kcount'
> field of 'struct rtw89_iqk_info', convert 'thermal' to local
> variables where appropriate (it doesn't need to have longer
> storage duration because it is actually used for debugging
> purposes only), fix typos.
>
> Signed-off-by: Dmitry Antipov <[email protected]>

Acked-by: Ping-Ke Shih <[email protected]>

> ---
> v3: adjust to match series
> v2: integer format specifier quirks (Ping-Ke Shih)
> ---

[...]


2023-06-13 08:36:58

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 2/2] [v3] wifi: rtw89: cleanup rtw89_iqk_info and related code

Dmitry Antipov <[email protected]> wrote:

> Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
> just change 'thermal_rek_en' field which is set but unused
> and so removed as well) functions, set but unused 'kcount'
> field of 'struct rtw89_iqk_info', convert 'thermal' to local
> variables where appropriate (it doesn't need to have longer
> storage duration because it is actually used for debugging
> purposes only), fix typos.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> Acked-by: Ping-Ke Shih <[email protected]>

In the future please fix typos in a separate patch. One logical change per patch, please.

No need to resend because of this.

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


2023-06-13 08:41:41

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] [v3] wifi: rtw89: cleanup private data structures

Dmitry Antipov <[email protected]> wrote:

> Remove a bunch of unused (and set but unused) fields
> from 'struct rtw89_btc_wl_nhm', 'struct rtw89_dle_info',
> 'struct rtw89_hal' and 'struct rtw89_env_monitor_info'
> driver-specific data structures, adjust related bits.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> Acked-by: Ping-Ke Shih <[email protected]>

Failed to build:

drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c: In function '_iqk_init':
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c:1563:17: error: 'struct rtw89_iqk_info' has no member named 'thermal_rek_en'
1563 | iqk_info->thermal_rek_en = false;
| ^~
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c: In function '_doiqk':
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c:1592:17: error: 'struct rtw89_iqk_info' has no member named 'kcount'
1592 | iqk_info->kcount = 0;
| ^~
make[6]: *** [scripts/Makefile.build:252: drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.o] Error 1
make[6]: *** Waiting for unfinished jobs....
make[5]: *** [scripts/Makefile.build:494: drivers/net/wireless/realtek/rtw89] Error 2
make[4]: *** [scripts/Makefile.build:494: drivers/net/wireless/realtek] Error 2
make[3]: *** [scripts/Makefile.build:494: drivers/net/wireless] Error 2
make[2]: *** [scripts/Makefile.build:494: drivers/net] Error 2
make[1]: *** [scripts/Makefile.build:494: drivers] Error 2
make: *** [Makefile:2026: .] Error 2

2 patches set to Changes Requested.

13271750 [1/2,v3] wifi: rtw89: cleanup private data structures
13271751 [2/2,v3] wifi: rtw89: cleanup rtw89_iqk_info and related code

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


2023-06-13 09:10:57

by Dmitry Antipov

[permalink] [raw]
Subject: Re: [PATCH 1/2] [v3] wifi: rtw89: cleanup private data structures

On 6/13/23 11:38, Kalle Valo wrote:

> Failed to build

Hmm... works for me against upstream at fb054096aea0 using following configuration:

CONFIG_RTW89=m
CONFIG_RTW89_CORE=m
CONFIG_RTW89_PCI=m
CONFIG_RTW89_8852A=m
CONFIG_RTW89_8852B=m
CONFIG_RTW89_8852C=m
CONFIG_RTW89_8852AE=m
CONFIG_RTW89_8852BE=m
CONFIG_RTW89_8852CE=m
CONFIG_RTW89_DEBUG=y
CONFIG_RTW89_DEBUGMSG=y
CONFIG_RTW89_DEBUGFS=y

Dmitry

2023-06-13 09:15:59

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 1/2] [v3] wifi: rtw89: cleanup private data structures



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Tuesday, June 13, 2023 4:56 PM
> To: Kalle Valo <[email protected]>
> Cc: Ping-Ke Shih <[email protected]>; [email protected]
> Subject: Re: [PATCH 1/2] [v3] wifi: rtw89: cleanup private data structures
>
> On 6/13/23 11:38, Kalle Valo wrote:
>
> > Failed to build
>
> Hmm... works for me against upstream at fb054096aea0 using following configuration:
>
> CONFIG_RTW89=m
> CONFIG_RTW89_CORE=m
> CONFIG_RTW89_PCI=m
> CONFIG_RTW89_8852A=m
> CONFIG_RTW89_8852B=m
> CONFIG_RTW89_8852C=m
> CONFIG_RTW89_8852AE=m
> CONFIG_RTW89_8852BE=m
> CONFIG_RTW89_8852CE=m
> CONFIG_RTW89_DEBUG=y
> CONFIG_RTW89_DEBUGMSG=y
> CONFIG_RTW89_DEBUGFS=y
>

Rebase your patch on top of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
Then, enable
CONFIG_RTW89_8851B=m
CONFIG_RTW89_8851BE=m

Ping-Ke

2023-06-13 09:16:24

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] [v3] wifi: rtw89: cleanup private data structures

Dmitry Antipov <[email protected]> writes:

> On 6/13/23 11:38, Kalle Valo wrote:
>
>> Failed to build
>
> Hmm... works for me against upstream at fb054096aea0 using following configuration:
>
> CONFIG_RTW89=m
> CONFIG_RTW89_CORE=m
> CONFIG_RTW89_PCI=m
> CONFIG_RTW89_8852A=m
> CONFIG_RTW89_8852B=m
> CONFIG_RTW89_8852C=m
> CONFIG_RTW89_8852AE=m
> CONFIG_RTW89_8852BE=m
> CONFIG_RTW89_8852CE=m
> CONFIG_RTW89_DEBUG=y
> CONFIG_RTW89_DEBUGMSG=y
> CONFIG_RTW89_DEBUGFS=y

You should use wireless-next as the baseline for wireless patches:

https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git/

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2023-06-13 10:11:19

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH 1/3] [v4] wifi: rtw89: cleanup private data structures

Remove a bunch of unused (and set but unused) fields
from 'struct rtw89_btc_wl_nhm', 'struct rtw89_dle_info',
'struct rtw89_hal' and 'struct rtw89_env_monitor_info'
driver-specific data structures, adjust related bits.

Signed-off-by: Dmitry Antipov <[email protected]>
---
v4: rebase against wireless-next tree
v3: adjust to match series
---
drivers/net/wireless/realtek/rtw89/core.h | 39 -----------------------
drivers/net/wireless/realtek/rtw89/mac.c | 6 +---
drivers/net/wireless/realtek/rtw89/phy.c | 4 ---
3 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 7e1e508956c8..a4958e280828 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -1405,7 +1405,6 @@ struct rtw89_btc_wl_nhm {
u8 current_status;
u8 refresh;
bool start_flag;
- u8 last_ccx_rpt_stamp;
s8 pwr_max;
s8 pwr_min;
};
@@ -3301,7 +3300,6 @@ enum rtw89_hcifc_mode {

struct rtw89_dle_info {
enum rtw89_qta_mode qta_mode;
- u16 wde_pg_size;
u16 ple_pg_size;
u16 c0_rx_qta;
u16 c1_rx_qta;
@@ -3484,7 +3482,6 @@ struct rtw89_hal {
u32 rx_fltr;
u8 cv;
u8 acv;
- u32 sw_amsdu_max_size;
u32 antenna_tx;
u32 antenna_rx;
u8 tx_nss;
@@ -3890,35 +3887,16 @@ enum rtw89_ccx_edcca_opt_bw_idx {
#define RTW89_FAHM_RPT_NUM 12
#define RTW89_IFS_CLM_NUM 4
struct rtw89_env_monitor_info {
- u32 ccx_trigger_time;
- u64 start_time;
- u8 ccx_rpt_stamp;
u8 ccx_watchdog_result;
bool ccx_ongoing;
u8 ccx_rac_lv;
bool ccx_manual_ctrl;
- u8 ccx_pre_rssi;
- u16 clm_mntr_time;
- u16 nhm_mntr_time;
u16 ifs_clm_mntr_time;
enum rtw89_ifs_clm_application ifs_clm_app;
- u16 fahm_mntr_time;
- u16 edcca_clm_mntr_time;
u16 ccx_period;
u8 ccx_unit_idx;
- enum rtw89_ccx_edcca_opt_bw_idx ccx_edcca_opt_bw_idx;
- u8 nhm_th[RTW89_NHM_TH_NUM];
u16 ifs_clm_th_l[RTW89_IFS_CLM_NUM];
u16 ifs_clm_th_h[RTW89_IFS_CLM_NUM];
- u8 fahm_numer_opt;
- u8 fahm_denom_opt;
- u8 fahm_th[RTW89_FAHM_TH_NUM];
- u16 clm_result;
- u16 nhm_result[RTW89_NHM_RPT_NUM];
- u8 nhm_wgt[RTW89_NHM_RPT_NUM];
- u16 nhm_tx_cnt;
- u16 nhm_cca_cnt;
- u16 nhm_idle_cnt;
u16 ifs_clm_tx;
u16 ifs_clm_edcca_excl_cca;
u16 ifs_clm_ofdmfa;
@@ -3929,17 +3907,6 @@ struct rtw89_env_monitor_info {
u8 ifs_clm_his[RTW89_IFS_CLM_NUM];
u16 ifs_clm_avg[RTW89_IFS_CLM_NUM];
u16 ifs_clm_cca[RTW89_IFS_CLM_NUM];
- u16 fahm_result[RTW89_FAHM_RPT_NUM];
- u16 fahm_denom_result;
- u16 edcca_clm_result;
- u8 clm_ratio;
- u8 nhm_rpt[RTW89_NHM_RPT_NUM];
- u8 nhm_tx_ratio;
- u8 nhm_cca_ratio;
- u8 nhm_idle_ratio;
- u8 nhm_ratio;
- u16 nhm_result_sum;
- u8 nhm_pwr;
u8 ifs_clm_tx_ratio;
u8 ifs_clm_edcca_excl_cca_ratio;
u8 ifs_clm_cck_fa_ratio;
@@ -3950,12 +3917,6 @@ struct rtw89_env_monitor_info {
u16 ifs_clm_ofdm_fa_permil;
u32 ifs_clm_ifs_avg[RTW89_IFS_CLM_NUM];
u32 ifs_clm_cca_avg[RTW89_IFS_CLM_NUM];
- u8 fahm_rpt[RTW89_FAHM_RPT_NUM];
- u16 fahm_result_sum;
- u8 fahm_ratio;
- u8 fahm_denom_ratio;
- u8 fahm_pwr;
- u8 edcca_clm_ratio;
};

enum rtw89_ser_rcvy_step {
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index 49d593468265..b114babec698 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -758,11 +758,8 @@ static int hfc_reset_param(struct rtw89_dev *rtwdev)
if (param_ini.pub_cfg)
param->pub_cfg = *param_ini.pub_cfg;

- if (param_ini.prec_cfg) {
+ if (param_ini.prec_cfg)
param->prec_cfg = *param_ini.prec_cfg;
- rtwdev->hal.sw_amsdu_max_size =
- param->prec_cfg.wp_ch07_prec * HFC_PAGE_UNIT;
- }

if (param_ini.ch_cfg)
param->ch_cfg = param_ini.ch_cfg;
@@ -1541,7 +1538,6 @@ static const struct rtw89_dle_mem *get_dle_mem_cfg(struct rtw89_dev *rtwdev,
return NULL;
}

- mac->dle_info.wde_pg_size = cfg->wde_size->pge_size;
mac->dle_info.ple_pg_size = cfg->ple_size->pge_size;
mac->dle_info.qta_mode = mode;
mac->dle_info.c0_rx_qta = cfg->ple_min_qt->cma0_dma;
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
index e2eb9422a6bb..e94390b24824 100644
--- a/drivers/net/wireless/realtek/rtw89/phy.c
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
@@ -3188,11 +3188,8 @@ static void rtw89_phy_ccx_top_setting_init(struct rtw89_dev *rtwdev)
env->ccx_manual_ctrl = false;
env->ccx_ongoing = false;
env->ccx_rac_lv = RTW89_RAC_RELEASE;
- env->ccx_rpt_stamp = 0;
env->ccx_period = 0;
env->ccx_unit_idx = RTW89_CCX_32_US;
- env->ccx_trigger_time = 0;
- env->ccx_edcca_opt_bw_idx = RTW89_CCX_EDCCA_BW20_0;

rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_EN_MSK, 1);
rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_TRIG_OPT_MSK, 1);
@@ -3400,7 +3397,6 @@ static void rtw89_phy_ccx_trigger(struct rtw89_dev *rtwdev)
rtw89_phy_set_phy_regs(rtwdev, R_IFS_COUNTER, B_IFS_COUNTER_CLR_MSK, 1);
rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_MEASUREMENT_TRIG_MSK, 1);

- env->ccx_rpt_stamp++;
env->ccx_ongoing = true;
}

--
2.40.1


2023-06-13 10:11:20

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH 3/3] wifi: rtw89: fix typo

Fix typo in '_doiqk()'.

Signed-off-by: Dmitry Antipov <[email protected]>
---
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
index 466fa8e406da..48f1bcc46eda 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
@@ -1586,7 +1586,7 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
iqk_info->version = RTW8851B_IQK_VER;

--
2.40.1


2023-06-13 10:11:19

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH 2/3] [v4] wifi: rtw89: cleanup rtw89_iqk_info and related code

Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
just change 'thermal_rek_en' field which is set but unused
and so removed as well) functions, set but unused 'kcount'
field of 'struct rtw89_iqk_info', convert 'thermal' to local
variables where appropriate (it doesn't need to have longer
storage duration because it is actually used for debugging
purposes only), fix typos.

Signed-off-by: Dmitry Antipov <[email protected]>
---
v4: rebase against wireless-next tree and fix compiling
with CONFIG_RTW89_8851B{E} (Ping-Ke Shih)
v3: adjust to match series
v2: integer format specifier quirks (Ping-Ke Shih)
---
drivers/net/wireless/realtek/rtw89/core.h | 3 --
.../net/wireless/realtek/rtw89/rtw8851b_rfk.c | 2 --
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 -
.../net/wireless/realtek/rtw89/rtw8852a_rfk.c | 36 ++-----------------
.../net/wireless/realtek/rtw89/rtw8852a_rfk.h | 1 -
.../net/wireless/realtek/rtw89/rtw8852b_rfk.c | 8 +----
.../net/wireless/realtek/rtw89/rtw8852c_rfk.c | 11 ++----
7 files changed, 6 insertions(+), 56 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index a4958e280828..0f7ca12e4b34 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -3610,7 +3610,6 @@ struct rtw89_iqk_info {
u8 iqk_band[RTW89_IQK_PATH_NR];
u8 iqk_ch[RTW89_IQK_PATH_NR];
u8 iqk_bw[RTW89_IQK_PATH_NR];
- u8 kcount;
u8 iqk_times;
u8 version;
u32 nb_txcfir[RTW89_IQK_PATH_NR];
@@ -3625,8 +3624,6 @@ struct rtw89_iqk_info {
bool iqk_xym_en;
bool iqk_sram_en;
bool iqk_cfir_en;
- u8 thermal[RTW89_IQK_PATH_NR];
- bool thermal_rek_en;
u32 syn1to2;
u8 iqk_mcc_ch[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
u8 iqk_table_idx[RTW89_IQK_PATH_NR];
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
index 1899a5d69a81..466fa8e406da 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
@@ -1560,7 +1560,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) {
@@ -1589,7 +1588,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK strat!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8851B_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
index 559835ce86bb..6257414a3b4b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
@@ -1338,7 +1338,6 @@ static void rtw8852a_rfk_scan(struct rtw89_dev *rtwdev, bool start)
static void rtw8852a_rfk_track(struct rtw89_dev *rtwdev)
{
rtw8852a_dpk_track(rtwdev);
- rtw8852a_iqk_track(rtwdev);
rtw8852a_tssi_track(rtwdev);
}

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
index cd6c39b7f802..d86429e4a35f 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
@@ -1284,11 +1284,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp = 0x0;
bool flag = 0x0;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
- rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %lu\n", path,
+ ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1536,28 +1533,6 @@ static void _iqk_dbcc(struct rtw89_dev *rtwdev, u8 path)
_iqk_afebb_restore(rtwdev, phy_idx, path);
}

-static void _iqk_track(struct rtw89_dev *rtwdev)
-{
- struct rtw89_iqk_info *iqk = &rtwdev->iqk;
- u8 path = 0x0;
- u8 cur_ther;
-
- if (iqk->iqk_band[0] == RTW89_BAND_2G)
- return;
- if (iqk->iqk_bw[0] < RTW89_CHANNEL_WIDTH_80)
- return;
-
- /* only check path 0 */
- for (path = 0; path < 1; path++) {
- cur_ther = ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
-
- if (abs(cur_ther - iqk->thermal[path]) > RTW8852A_IQK_THR_REK)
- iqk->thermal_rek_en = true;
- else
- iqk->thermal_rek_en = false;
- }
-}
-
static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
{
u32 rf_reg5, rck_val = 0;
@@ -1616,7 +1591,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1645,7 +1619,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852A_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
@@ -3655,11 +3628,6 @@ void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
}

-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev)
-{
- _iqk_track(rtwdev);
-}
-
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe)
{
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
index ea36553a76b7..fa058ccc8616 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
@@ -10,7 +10,6 @@
void rtw8852a_rck(struct rtw89_dev *rtwdev);
void rtw8852a_dack(struct rtw89_dev *rtwdev);
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev);
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe);
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
index 722ae34b09c1..fa018e1f499b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
@@ -1317,10 +1317,6 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
-
flag = iqk_info->lok_cor_fail[0][path];
rtw89_phy_write32_mask(rtwdev, R_IQKINF, B_IQKINF_FCOR << (path * 4), flag);
flag = iqk_info->lok_fin_fail[0][path];
@@ -1568,7 +1564,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) {
@@ -1622,9 +1617,8 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852B_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
index 2c0bc3a4ab3b..de7714f871d5 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
@@ -1261,11 +1261,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
- rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %lu\n", path,
+ ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1502,7 +1499,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1529,9 +1525,8 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_ONESHOT_START);

rtw89_debug(rtwdev, RTW89_DBG_RFK,
- "[IQK]==========IQK strat!!!!!==========\n");
+ "[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852C_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
--
2.40.1


2023-06-14 02:54:39

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 1/3] [v4] wifi: rtw89: cleanup private data structures



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Tuesday, June 13, 2023 6:02 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: [email protected]; Kalle Valo <[email protected]>; Dmitry Antipov <[email protected]>
> Subject: [PATCH 1/3] [v4] wifi: rtw89: cleanup private data structures
>
> Remove a bunch of unused (and set but unused) fields
> from 'struct rtw89_btc_wl_nhm', 'struct rtw89_dle_info',
> 'struct rtw89_hal' and 'struct rtw89_env_monitor_info'
> driver-specific data structures, adjust related bits.
>
> Signed-off-by: Dmitry Antipov <[email protected]>

Acked-by: Ping-Ke Shih <[email protected]>

[...]


2023-06-14 03:21:19

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 3/3] wifi: rtw89: fix typo



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Tuesday, June 13, 2023 6:02 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: [email protected]; Kalle Valo <[email protected]>; Dmitry Antipov <[email protected]>
> Subject: [PATCH 3/3] wifi: rtw89: fix typo

If you will send next version, please make subject more specific.
I means something like "wifi: rtw89: fix spelling typo of IQK debug messages".

>
> Fix typo in '_doiqk()'.
>
> Signed-off-by: Dmitry Antipov <[email protected]>
> ---
> drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
> b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
> index 466fa8e406da..48f1bcc46eda 100644
> --- a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
> +++ b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
> @@ -1586,7 +1586,7 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
> BTC_WRFK_ONESHOT_START);
>
> rtw89_debug(rtwdev, RTW89_DBG_RFK,
> - "[IQK]==========IQK strat!!!!!==========\n");
> + "[IQK]==========IQK start!!!!!==========\n");
> iqk_info->iqk_times++;
> iqk_info->version = RTW8851B_IQK_VER;
>
> --
> 2.40.1


2023-06-14 03:25:52

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 2/3] [v4] wifi: rtw89: cleanup rtw89_iqk_info and related code



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Tuesday, June 13, 2023 6:02 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: [email protected]; Kalle Valo <[email protected]>; Dmitry Antipov <[email protected]>
> Subject: [PATCH 2/3] [v4] wifi: rtw89: cleanup rtw89_iqk_info and related code
>
> Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
> just change 'thermal_rek_en' field which is set but unused
> and so removed as well) functions, set but unused 'kcount'
> field of 'struct rtw89_iqk_info', convert 'thermal' to local
> variables where appropriate (it doesn't need to have longer
> storage duration because it is actually used for debugging
> purposes only), fix typos.

Since you send v4 to fix compiler error of 8851b, I think you can move
all typos into patch 3/3.



2023-06-14 06:02:41

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH 1/3] [v5] wifi: rtw89: cleanup private data structures

Remove a bunch of unused (and set but unused) fields
from 'struct rtw89_btc_wl_nhm', 'struct rtw89_dle_info',
'struct rtw89_hal' and 'struct rtw89_env_monitor_info'
driver-specific data structures, adjust related bits.

Signed-off-by: Dmitry Antipov <[email protected]>
---
v5: adjust to match series
v4: rebase against wireless-next tree
v3: adjust to match series
---
drivers/net/wireless/realtek/rtw89/core.h | 39 -----------------------
drivers/net/wireless/realtek/rtw89/mac.c | 6 +---
drivers/net/wireless/realtek/rtw89/phy.c | 4 ---
3 files changed, 1 insertion(+), 48 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index 7e1e508956c8..a4958e280828 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -1405,7 +1405,6 @@ struct rtw89_btc_wl_nhm {
u8 current_status;
u8 refresh;
bool start_flag;
- u8 last_ccx_rpt_stamp;
s8 pwr_max;
s8 pwr_min;
};
@@ -3301,7 +3300,6 @@ enum rtw89_hcifc_mode {

struct rtw89_dle_info {
enum rtw89_qta_mode qta_mode;
- u16 wde_pg_size;
u16 ple_pg_size;
u16 c0_rx_qta;
u16 c1_rx_qta;
@@ -3484,7 +3482,6 @@ struct rtw89_hal {
u32 rx_fltr;
u8 cv;
u8 acv;
- u32 sw_amsdu_max_size;
u32 antenna_tx;
u32 antenna_rx;
u8 tx_nss;
@@ -3890,35 +3887,16 @@ enum rtw89_ccx_edcca_opt_bw_idx {
#define RTW89_FAHM_RPT_NUM 12
#define RTW89_IFS_CLM_NUM 4
struct rtw89_env_monitor_info {
- u32 ccx_trigger_time;
- u64 start_time;
- u8 ccx_rpt_stamp;
u8 ccx_watchdog_result;
bool ccx_ongoing;
u8 ccx_rac_lv;
bool ccx_manual_ctrl;
- u8 ccx_pre_rssi;
- u16 clm_mntr_time;
- u16 nhm_mntr_time;
u16 ifs_clm_mntr_time;
enum rtw89_ifs_clm_application ifs_clm_app;
- u16 fahm_mntr_time;
- u16 edcca_clm_mntr_time;
u16 ccx_period;
u8 ccx_unit_idx;
- enum rtw89_ccx_edcca_opt_bw_idx ccx_edcca_opt_bw_idx;
- u8 nhm_th[RTW89_NHM_TH_NUM];
u16 ifs_clm_th_l[RTW89_IFS_CLM_NUM];
u16 ifs_clm_th_h[RTW89_IFS_CLM_NUM];
- u8 fahm_numer_opt;
- u8 fahm_denom_opt;
- u8 fahm_th[RTW89_FAHM_TH_NUM];
- u16 clm_result;
- u16 nhm_result[RTW89_NHM_RPT_NUM];
- u8 nhm_wgt[RTW89_NHM_RPT_NUM];
- u16 nhm_tx_cnt;
- u16 nhm_cca_cnt;
- u16 nhm_idle_cnt;
u16 ifs_clm_tx;
u16 ifs_clm_edcca_excl_cca;
u16 ifs_clm_ofdmfa;
@@ -3929,17 +3907,6 @@ struct rtw89_env_monitor_info {
u8 ifs_clm_his[RTW89_IFS_CLM_NUM];
u16 ifs_clm_avg[RTW89_IFS_CLM_NUM];
u16 ifs_clm_cca[RTW89_IFS_CLM_NUM];
- u16 fahm_result[RTW89_FAHM_RPT_NUM];
- u16 fahm_denom_result;
- u16 edcca_clm_result;
- u8 clm_ratio;
- u8 nhm_rpt[RTW89_NHM_RPT_NUM];
- u8 nhm_tx_ratio;
- u8 nhm_cca_ratio;
- u8 nhm_idle_ratio;
- u8 nhm_ratio;
- u16 nhm_result_sum;
- u8 nhm_pwr;
u8 ifs_clm_tx_ratio;
u8 ifs_clm_edcca_excl_cca_ratio;
u8 ifs_clm_cck_fa_ratio;
@@ -3950,12 +3917,6 @@ struct rtw89_env_monitor_info {
u16 ifs_clm_ofdm_fa_permil;
u32 ifs_clm_ifs_avg[RTW89_IFS_CLM_NUM];
u32 ifs_clm_cca_avg[RTW89_IFS_CLM_NUM];
- u8 fahm_rpt[RTW89_FAHM_RPT_NUM];
- u16 fahm_result_sum;
- u8 fahm_ratio;
- u8 fahm_denom_ratio;
- u8 fahm_pwr;
- u8 edcca_clm_ratio;
};

enum rtw89_ser_rcvy_step {
diff --git a/drivers/net/wireless/realtek/rtw89/mac.c b/drivers/net/wireless/realtek/rtw89/mac.c
index 49d593468265..b114babec698 100644
--- a/drivers/net/wireless/realtek/rtw89/mac.c
+++ b/drivers/net/wireless/realtek/rtw89/mac.c
@@ -758,11 +758,8 @@ static int hfc_reset_param(struct rtw89_dev *rtwdev)
if (param_ini.pub_cfg)
param->pub_cfg = *param_ini.pub_cfg;

- if (param_ini.prec_cfg) {
+ if (param_ini.prec_cfg)
param->prec_cfg = *param_ini.prec_cfg;
- rtwdev->hal.sw_amsdu_max_size =
- param->prec_cfg.wp_ch07_prec * HFC_PAGE_UNIT;
- }

if (param_ini.ch_cfg)
param->ch_cfg = param_ini.ch_cfg;
@@ -1541,7 +1538,6 @@ static const struct rtw89_dle_mem *get_dle_mem_cfg(struct rtw89_dev *rtwdev,
return NULL;
}

- mac->dle_info.wde_pg_size = cfg->wde_size->pge_size;
mac->dle_info.ple_pg_size = cfg->ple_size->pge_size;
mac->dle_info.qta_mode = mode;
mac->dle_info.c0_rx_qta = cfg->ple_min_qt->cma0_dma;
diff --git a/drivers/net/wireless/realtek/rtw89/phy.c b/drivers/net/wireless/realtek/rtw89/phy.c
index e2eb9422a6bb..e94390b24824 100644
--- a/drivers/net/wireless/realtek/rtw89/phy.c
+++ b/drivers/net/wireless/realtek/rtw89/phy.c
@@ -3188,11 +3188,8 @@ static void rtw89_phy_ccx_top_setting_init(struct rtw89_dev *rtwdev)
env->ccx_manual_ctrl = false;
env->ccx_ongoing = false;
env->ccx_rac_lv = RTW89_RAC_RELEASE;
- env->ccx_rpt_stamp = 0;
env->ccx_period = 0;
env->ccx_unit_idx = RTW89_CCX_32_US;
- env->ccx_trigger_time = 0;
- env->ccx_edcca_opt_bw_idx = RTW89_CCX_EDCCA_BW20_0;

rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_EN_MSK, 1);
rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_CCX_TRIG_OPT_MSK, 1);
@@ -3400,7 +3397,6 @@ static void rtw89_phy_ccx_trigger(struct rtw89_dev *rtwdev)
rtw89_phy_set_phy_regs(rtwdev, R_IFS_COUNTER, B_IFS_COUNTER_CLR_MSK, 1);
rtw89_phy_set_phy_regs(rtwdev, R_CCX, B_MEASUREMENT_TRIG_MSK, 1);

- env->ccx_rpt_stamp++;
env->ccx_ongoing = true;
}

--
2.40.1


2023-06-14 06:15:40

by Dmitry Antipov

[permalink] [raw]
Subject: [PATCH 2/3] [v5] wifi: rtw89: cleanup rtw89_iqk_info and related code

Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
just change 'thermal_rek_en' field which is set but unused
and so removed as well) functions, set but unused 'kcount'
field of 'struct rtw89_iqk_info', and convert 'thermal' to
local variables where appropriate (it doesn't need to have
longer storage duration because it is actually used for the
debugging purposes only).

Signed-off-by: Dmitry Antipov <[email protected]>
---
v5: move typo fixes to the next patch (Ping-Ke Shih)
v4: rebase against wireless-next tree and fix compiling
with CONFIG_RTW89_8851B{E} (Ping-Ke Shih)
v3: adjust to match series
v2: integer format specifier quirks (Ping-Ke Shih)
---
drivers/net/wireless/realtek/rtw89/core.h | 3 --
.../net/wireless/realtek/rtw89/rtw8851b_rfk.c | 2 --
drivers/net/wireless/realtek/rtw89/rtw8852a.c | 1 -
.../net/wireless/realtek/rtw89/rtw8852a_rfk.c | 36 ++-----------------
.../net/wireless/realtek/rtw89/rtw8852a_rfk.h | 1 -
.../net/wireless/realtek/rtw89/rtw8852b_rfk.c | 6 ----
.../net/wireless/realtek/rtw89/rtw8852c_rfk.c | 9 ++---
7 files changed, 4 insertions(+), 54 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw89/core.h b/drivers/net/wireless/realtek/rtw89/core.h
index a4958e280828..0f7ca12e4b34 100644
--- a/drivers/net/wireless/realtek/rtw89/core.h
+++ b/drivers/net/wireless/realtek/rtw89/core.h
@@ -3610,7 +3610,6 @@ struct rtw89_iqk_info {
u8 iqk_band[RTW89_IQK_PATH_NR];
u8 iqk_ch[RTW89_IQK_PATH_NR];
u8 iqk_bw[RTW89_IQK_PATH_NR];
- u8 kcount;
u8 iqk_times;
u8 version;
u32 nb_txcfir[RTW89_IQK_PATH_NR];
@@ -3625,8 +3624,6 @@ struct rtw89_iqk_info {
bool iqk_xym_en;
bool iqk_sram_en;
bool iqk_cfir_en;
- u8 thermal[RTW89_IQK_PATH_NR];
- bool thermal_rek_en;
u32 syn1to2;
u8 iqk_mcc_ch[RTW89_IQK_CHS_NR][RTW89_IQK_PATH_NR];
u8 iqk_table_idx[RTW89_IQK_PATH_NR];
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
index 1899a5d69a81..466fa8e406da 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
@@ -1560,7 +1560,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) {
@@ -1589,7 +1588,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK strat!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8851B_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a.c b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
index 559835ce86bb..6257414a3b4b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a.c
@@ -1338,7 +1338,6 @@ static void rtw8852a_rfk_scan(struct rtw89_dev *rtwdev, bool start)
static void rtw8852a_rfk_track(struct rtw89_dev *rtwdev)
{
rtw8852a_dpk_track(rtwdev);
- rtw8852a_iqk_track(rtwdev);
rtw8852a_tssi_track(rtwdev);
}

diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
index cd6c39b7f802..d86429e4a35f 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
@@ -1284,11 +1284,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp = 0x0;
bool flag = 0x0;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
- rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %lu\n", path,
+ ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1536,28 +1533,6 @@ static void _iqk_dbcc(struct rtw89_dev *rtwdev, u8 path)
_iqk_afebb_restore(rtwdev, phy_idx, path);
}

-static void _iqk_track(struct rtw89_dev *rtwdev)
-{
- struct rtw89_iqk_info *iqk = &rtwdev->iqk;
- u8 path = 0x0;
- u8 cur_ther;
-
- if (iqk->iqk_band[0] == RTW89_BAND_2G)
- return;
- if (iqk->iqk_bw[0] < RTW89_CHANNEL_WIDTH_80)
- return;
-
- /* only check path 0 */
- for (path = 0; path < 1; path++) {
- cur_ther = ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
-
- if (abs(cur_ther - iqk->thermal[path]) > RTW8852A_IQK_THR_REK)
- iqk->thermal_rek_en = true;
- else
- iqk->thermal_rek_en = false;
- }
-}
-
static void _rck(struct rtw89_dev *rtwdev, enum rtw89_rf_path path)
{
u32 rf_reg5, rck_val = 0;
@@ -1616,7 +1591,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1645,7 +1619,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK start!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852A_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
@@ -3655,11 +3628,6 @@ void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx)
rtw89_btc_ntfy_wl_rfk(rtwdev, phy_map, BTC_WRFKT_IQK, BTC_WRFK_STOP);
}

-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev)
-{
- _iqk_track(rtwdev);
-}
-
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe)
{
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
index ea36553a76b7..fa058ccc8616 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.h
@@ -10,7 +10,6 @@
void rtw8852a_rck(struct rtw89_dev *rtwdev);
void rtw8852a_dack(struct rtw89_dev *rtwdev);
void rtw8852a_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx);
-void rtw8852a_iqk_track(struct rtw89_dev *rtwdev);
void rtw8852a_rx_dck(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
bool is_afe);
void rtw8852a_dpk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
index 722ae34b09c1..3107eed52f15 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
@@ -1317,10 +1317,6 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
-
flag = iqk_info->lok_cor_fail[0][path];
rtw89_phy_write32_mask(rtwdev, R_IQKINF, B_IQKINF_FCOR << (path * 4), flag);
flag = iqk_info->lok_fin_fail[0][path];
@@ -1568,7 +1564,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (idx = 0; idx < RTW89_IQK_CHS_NR; idx++) {
@@ -1624,7 +1619,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK strat!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852B_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
index 2c0bc3a4ab3b..3423bdacc23c 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
@@ -1261,11 +1261,8 @@ static void _iqk_info_iqk(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy_idx,
u32 tmp;
bool flag;

- iqk_info->thermal[path] =
- ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]);
- iqk_info->thermal_rek_en = false;
- rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %d\n", path,
- iqk_info->thermal[path]);
+ rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_thermal = %lu\n", path,
+ ewma_thermal_read(&rtwdev->phystat.avg_thermal[path]));
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_COR_fail= %d\n", path,
iqk_info->lok_cor_fail[0][path]);
rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d_LOK_FIN_fail= %d\n", path,
@@ -1502,7 +1499,6 @@ static void _iqk_init(struct rtw89_dev *rtwdev)
iqk_info->iqk_sram_en = false;
iqk_info->iqk_cfir_en = false;
iqk_info->iqk_xym_en = false;
- iqk_info->thermal_rek_en = false;
iqk_info->iqk_times = 0x0;

for (ch = 0; ch < RTW89_IQK_CHS_NR; ch++) {
@@ -1531,7 +1527,6 @@ static void _doiqk(struct rtw89_dev *rtwdev, bool force,
rtw89_debug(rtwdev, RTW89_DBG_RFK,
"[IQK]==========IQK strat!!!!!==========\n");
iqk_info->iqk_times++;
- iqk_info->kcount = 0;
iqk_info->version = RTW8852C_IQK_VER;

rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]Test Ver 0x%x\n", iqk_info->version);
--
2.40.1


2023-06-14 07:07:15

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 2/3] [v5] wifi: rtw89: cleanup rtw89_iqk_info and related code



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Wednesday, June 14, 2023 1:11 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: Kalle Valo <[email protected]>; [email protected]; Dmitry Antipov <[email protected]>
> Subject: [PATCH 2/3] [v5] wifi: rtw89: cleanup rtw89_iqk_info and related code
>
> Drop useless '_iqk_track()' and 'rtw8852a_iqk_track()' (they
> just change 'thermal_rek_en' field which is set but unused
> and so removed as well) functions, set but unused 'kcount'
> field of 'struct rtw89_iqk_info', and convert 'thermal' to
> local variables where appropriate (it doesn't need to have
> longer storage duration because it is actually used for the
> debugging purposes only).
>
> Signed-off-by: Dmitry Antipov <[email protected]>

Acked-by: Ping-Ke Shih <[email protected]>

[...]


2023-06-14 07:07:32

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 1/3] [v5] wifi: rtw89: cleanup private data structures



> -----Original Message-----
> From: Dmitry Antipov <[email protected]>
> Sent: Wednesday, June 14, 2023 1:11 PM
> To: Ping-Ke Shih <[email protected]>
> Cc: Kalle Valo <[email protected]>; [email protected]; Dmitry Antipov <[email protected]>
> Subject: [PATCH 1/3] [v5] wifi: rtw89: cleanup private data structures
>
> Remove a bunch of unused (and set but unused) fields
> from 'struct rtw89_btc_wl_nhm', 'struct rtw89_dle_info',
> 'struct rtw89_hal' and 'struct rtw89_env_monitor_info'
> driver-specific data structures, adjust related bits.
>
> Signed-off-by: Dmitry Antipov <[email protected]>

Acked-by: Ping-Ke Shih <[email protected]>

> ---
> v5: adjust to match series
> v4: rebase against wireless-next tree
> v3: adjust to match series

I have acked v3, so you can take my acked-by if a patch isn't changed, and
then I don't need to check if it changes or not.