summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/realtek
diff options
context:
space:
mode:
authorYan-Hsuan Chuang <yhchuang@realtek.com>2019-05-29 10:54:41 +0300
committerKalle Valo <kvalo@codeaurora.org>2019-06-27 20:24:25 +0300
commit764038160aea385bdab06c24c52c047dc4d13e11 (patch)
tree49124db842e588875cb85de7b2cefc4d5fdd56d5 /drivers/net/wireless/realtek
parent522801493e7bd9874745c128257308c2016abd62 (diff)
downloadlinux-764038160aea385bdab06c24c52c047dc4d13e11.tar.xz
rtw88: fix incorrect tx power limit at 5G
Tx power limit is stored separately by 2G and 5G. But driver did not get tx power limit from 5G and causes incorrect tx power. Check if the channel is beyond 2G and get the corresponding tx power limit. 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.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/net/wireless/realtek/rtw88/phy.c b/drivers/net/wireless/realtek/rtw88/phy.c
index 5b69389c26c0..95f2b87ad0cc 100644
--- a/drivers/net/wireless/realtek/rtw88/phy.c
+++ b/drivers/net/wireless/realtek/rtw88/phy.c
@@ -1466,15 +1466,6 @@ static u8 rtw_phy_get_5g_tx_power_index(struct rtw_dev *rtwdev,
return tx_power;
}
-static s8 __rtw_phy_get_tx_power_limit(struct rtw_hal *hal,
- u8 bw, u8 rs, u8 ch, u8 regd)
-{
- if (regd > RTW_REGD_WW)
- return RTW_MAX_POWER_INDEX;
-
- return hal->tx_pwr_limit_2g[regd][bw][rs][ch];
-}
-
static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
enum rtw_bandwidth bw, u8 rf_path,
u8 rate, u8 channel, u8 regd)
@@ -1484,6 +1475,9 @@ static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
u8 rs;
int ch_idx;
+ if (regd > RTW_REGD_WW)
+ return RTW_MAX_POWER_INDEX;
+
if (rate >= DESC_RATE1M && rate <= DESC_RATE11M)
rs = RTW_RATE_SECTION_CCK;
else if (rate >= DESC_RATE6M && rate <= DESC_RATE54M)
@@ -1503,7 +1497,10 @@ static s8 rtw_phy_get_tx_power_limit(struct rtw_dev *rtwdev, u8 band,
if (ch_idx < 0)
goto err;
- power_limit = __rtw_phy_get_tx_power_limit(hal, bw, rs, ch_idx, regd);
+ if (channel <= RTW_MAX_CHANNEL_NUM_2G)
+ power_limit = hal->tx_pwr_limit_2g[regd][bw][rs][ch_idx];
+ else
+ power_limit = hal->tx_pwr_limit_5g[regd][bw][rs][ch_idx];
return power_limit;