summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/realtek
diff options
context:
space:
mode:
authorYan-Hsuan Chuang <yhchuang@realtek.com>2019-05-29 10:54:42 +0300
committerKalle Valo <kvalo@codeaurora.org>2019-06-27 20:24:25 +0300
commitadf3c676d1d2f7e9b09e0153c7f58b7f87ca1a6f (patch)
tree26e4d5748faabfd083628460f45b5e0d650f4196 /drivers/net/wireless/realtek
parent764038160aea385bdab06c24c52c047dc4d13e11 (diff)
downloadlinux-adf3c676d1d2f7e9b09e0153c7f58b7f87ca1a6f.tar.xz
rtw88: choose the lowest as world-wide power limit
When we are loading tx power limit from the power limit table, compare the world-wide limit with the current limit and choose the lowest power limit for the world-wide power settings. Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Diffstat (limited to 'drivers/net/wireless/realtek')
-rw-r--r--drivers/net/wireless/realtek/rtw88/phy.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index 95f2b87ad0cc..ce26b1506e77 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -1170,6 +1170,7 @@ static void rtw_phy_set_tx_power_limit(struct rtw_dev *rtwdev, u8 regd, u8 band,
u8 bw, u8 rs, u8 ch, s8 pwr_limit)
{
struct rtw_hal *hal = &rtwdev->hal;
+ s8 ww;
int ch_idx;
pwr_limit = clamp_t(s8, pwr_limit,
@@ -1184,10 +1185,17 @@ static void rtw_phy_set_tx_power_limit(struct rtw_dev *rtwdev, u8 regd, u8 band,
return;
}
- if (band == PHY_BAND_2G)
+ if (band == PHY_BAND_2G) {
hal->tx_pwr_limit_2g[regd][bw][rs][ch_idx] = pwr_limit;
- else if (band == PHY_BAND_5G)
+ ww = hal->tx_pwr_limit_2g[RTW_REGD_WW][bw][rs][ch_idx];
+ ww = min_t(s8, ww, pwr_limit);
+ hal->tx_pwr_limit_2g[RTW_REGD_WW][bw][rs][ch_idx] = ww;
+ } else if (band == PHY_BAND_5G) {
hal->tx_pwr_limit_5g[regd][bw][rs][ch_idx] = pwr_limit;
+ ww = hal->tx_pwr_limit_5g[RTW_REGD_WW][bw][rs][ch_idx];
+ ww = min_t(s8, ww, pwr_limit);
+ hal->tx_pwr_limit_5g[RTW_REGD_WW][bw][rs][ch_idx] = ww;
+ }
}
void rtw_parse_tbl_txpwr_lmt(struct rtw_dev *rtwdev,