Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: rtw89: phy: set TX power according to RF path number by chip

Previously, all supported chips had two RF paths. Therefore, these
codes used static number for TX power setting. Now, we are planning
to support a new chip which has only one RF path. So, we refine the
setting codes to refer to chip's RF path number at runtime.

Signed-off-by: Zong-Zhe Yang <kevin_yang@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/20230203065157.8227-1-pkshih@realtek.com

authored by

Zong-Zhe Yang and committed by
Kalle Valo
ddf9a2ea 5466ee9a

+6 -3
+6 -3
drivers/net/wireless/realtek/rtw89/phy.c
··· 2042 2042 const struct rtw89_chan *chan, 2043 2043 enum rtw89_phy_idx phy_idx) 2044 2044 { 2045 + u8 max_nss_num = rtwdev->chip->rf_path_num; 2045 2046 static const u8 rs[] = { 2046 2047 RTW89_RS_CCK, 2047 2048 RTW89_RS_OFDM, ··· 2065 2064 BUILD_BUG_ON(rtw89_rs_idx_max[RTW89_RS_HEDCM] % 4); 2066 2065 2067 2066 addr = R_AX_PWR_BY_RATE; 2068 - for (cur.nss = 0; cur.nss <= RTW89_NSS_2; cur.nss++) { 2067 + for (cur.nss = 0; cur.nss < max_nss_num; cur.nss++) { 2069 2068 for (i = 0; i < ARRAY_SIZE(rs); i++) { 2070 2069 if (cur.nss >= rtw89_rs_nss_max[rs[i]]) 2071 2070 continue; ··· 2128 2127 const struct rtw89_chan *chan, 2129 2128 enum rtw89_phy_idx phy_idx) 2130 2129 { 2130 + u8 max_ntx_num = rtwdev->chip->rf_path_num; 2131 2131 struct rtw89_txpwr_limit lmt; 2132 2132 u8 ch = chan->channel; 2133 2133 u8 bw = chan->band_width; ··· 2143 2141 RTW89_TXPWR_LMT_PAGE_SIZE); 2144 2142 2145 2143 addr = R_AX_PWR_LMT; 2146 - for (i = 0; i < RTW89_NTX_NUM; i++) { 2144 + for (i = 0; i < max_ntx_num; i++) { 2147 2145 rtw89_phy_fill_txpwr_limit(rtwdev, chan, &lmt, i); 2148 2146 2149 2147 ptr = (s8 *)&lmt; ··· 2164 2162 const struct rtw89_chan *chan, 2165 2163 enum rtw89_phy_idx phy_idx) 2166 2164 { 2165 + u8 max_ntx_num = rtwdev->chip->rf_path_num; 2167 2166 struct rtw89_txpwr_limit_ru lmt_ru; 2168 2167 u8 ch = chan->channel; 2169 2168 u8 bw = chan->band_width; ··· 2179 2176 RTW89_TXPWR_LMT_RU_PAGE_SIZE); 2180 2177 2181 2178 addr = R_AX_PWR_RU_LMT; 2182 - for (i = 0; i < RTW89_NTX_NUM; i++) { 2179 + for (i = 0; i < max_ntx_num; i++) { 2183 2180 rtw89_phy_fill_txpwr_limit_ru(rtwdev, chan, &lmt_ru, i); 2184 2181 2185 2182 ptr = (s8 *)&lmt_ru;