On Tue, Oct 22, 2019 at 6:04 PM <yhchuang@xxxxxxxxxxx> wrote: > > From: Tzu-En Huang <tehuang@xxxxxxxxxxx> > > The temperature of the chip can affect the output power > of the RF components. Hence driver requires to compensate > the power by adjusting the power index recorded in the > power swing table. > > And if the difference of current thermal value to the > default thermal value exceeds a threshold, the RF IQK > should be triggered to re-calibrate the characteristics > of the RF components, to keep the output IQ vectors of > the RF components orthogonal enough. > > Signed-off-by: Tzu-En Huang <tehuang@xxxxxxxxxxx> > Signed-off-by: Yan-Hsuan Chuang <yhchuang@xxxxxxxxxxx> > --- > > v1 -> v2 > * Use macros to check current band > * Some coding style refinement > * Not casting "const" pointers > > v2 -> v3 > * Use RF_PATH_* for thermal values > > drivers/net/wireless/realtek/rtw88/fw.c | 1 + > drivers/net/wireless/realtek/rtw88/main.h | 49 ++- > drivers/net/wireless/realtek/rtw88/phy.c | 126 +++++++ > drivers/net/wireless/realtek/rtw88/phy.h | 12 + > drivers/net/wireless/realtek/rtw88/rtw8822b.c | 330 ++++++++++++++++++ > drivers/net/wireless/realtek/rtw88/rtw8822c.c | 228 ++++++++++++ > 6 files changed, 745 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h > index 492a2bfc0d5a..757b0ce2bbee 100644 > --- a/drivers/net/wireless/realtek/rtw88/main.h > +++ b/drivers/net/wireless/realtek/rtw88/main.h > +/* This table stores the values of TX power that will be adjusted by power > + * tracking. > + * > + * For 5G bands, there are 3 different settings. > + * For 2G there are cck rate and ofdm rate with different settings. > + */ > +struct rtw_pwr_track_tbl { > + const u8 *pwrtrk_5gb_n[RTW_PWR_TRK_5G_NUM]; > + const u8 *pwrtrk_5gb_p[RTW_PWR_TRK_5G_NUM]; > + const u8 *pwrtrk_5ga_n[RTW_PWR_TRK_5G_NUM]; > + const u8 *pwrtrk_5ga_p[RTW_PWR_TRK_5G_NUM]; > + const u8 *pwrtrk_2gb_n; > + const u8 *pwrtrk_2gb_p; > + const u8 *pwrtrk_2ga_n; > + const u8 *pwrtrk_2ga_p; > + const u8 *pwrtrk_2g_cckb_n; > + const u8 *pwrtrk_2g_cckb_p; > + const u8 *pwrtrk_2g_ccka_n; > + const u8 *pwrtrk_2g_ccka_p; > +}; > + > /* hardware configuration for each IC */ > struct rtw_chip_info { > struct rtw_chip_ops *ops; > @@ -1171,6 +1202,11 @@ struct rtw_phy_cck_pd_reg { > #define DACK_MSBK_BACKUP_NUM 0xf > #define DACK_DCK_BACKUP_NUM 0x2 > > +struct rtw_swing_table { > + const u8 *p[RTW_RF_PATH_MAX]; > + const u8 *n[RTW_RF_PATH_MAX]; > +}; > + > struct rtw_dm_info { > u32 cck_fa_cnt; > u32 ofdm_fa_cnt; > @@ -1197,6 +1233,15 @@ struct rtw_dm_info { > u8 cck_gi_u_bnd; > u8 cck_gi_l_bnd; > > + u8 tx_rate; > + u8 thermal_avg[RTW_RF_PATH_MAX]; > + u8 thermal_meter_k; > + s8 delta_power_index[RTW_RF_PATH_MAX]; I don't see any chance that delta_power_index[] will be < 0. Either from rtw_phy_pwrtrack_get_pwridx() or swing_table. Maybe just use u8 instead of s8? > +s8 rtw_phy_pwrtrack_get_pwridx(struct rtw_dev *rtwdev, > + struct rtw_swing_table *swing_table, > + u8 tbl_path, u8 therm_path, u8 delta) > +{ Same as above. > -- > 2.17.1 > Then I think I have no problem other than above. Chris