<yhchuang@xxxxxxxxxxx> writes: > 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> [...] > +/* 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_PWRTRACK_5G_BAND_SIZE]; > + const u8 *pwrtrk_5gb_p[RTW_PWRTRACK_5G_BAND_SIZE]; > + const u8 *pwrtrk_5ga_n[RTW_PWRTRACK_5G_BAND_SIZE]; > + const u8 *pwrtrk_5ga_p[RTW_PWRTRACK_5G_BAND_SIZE]; > + 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; > +}; [...] > +void rtw_phy_config_swing_table(struct rtw_dev *rtwdev, > + struct rtw_swing_table *swing_table) > +{ > + const struct rtw_pwr_track_tbl *tbl = rtwdev->chip->pwr_track_tbl; > + u8 channel = rtwdev->hal.current_channel; > + > + if (channel >= 1 && channel <= 14) { > + if (rtwdev->dm_info.tx_rate <= DESC_RATE11M) { > + swing_table->tup[0] = (u8 *)tbl->pwrtrk_2g_ccka_p; > + swing_table->tdown[0] = (u8 *)tbl->pwrtrk_2g_ccka_n; > + swing_table->tup[1] = (u8 *)tbl->pwrtrk_2g_cckb_p; > + swing_table->tdown[1] = (u8 *)tbl->pwrtrk_2g_cckb_n; > + } else { > + swing_table->tup[0] = (u8 *)tbl->pwrtrk_2ga_p; > + swing_table->tdown[0] = (u8 *)tbl->pwrtrk_2ga_n; > + swing_table->tup[1] = (u8 *)tbl->pwrtrk_2gb_p; > + swing_table->tdown[1] = (u8 *)tbl->pwrtrk_2gb_n; > + } This is ugly and immeadiately caught my attention, don't cast away the const. It's const for a reason and if you cast it away you most likely you create a bug somewhere. It's better to avoid casting as much as possible as they get abused so easily. I stopped reviewing here, will continue later. -- https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches