ath11k: add support to set txpower for 6GHz via iw

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
This commit is contained in:
Arif Alam
2024-03-04 20:57:16 -05:00
committed by John Crispin
parent f0c34c39da
commit 206b4348fc

View File

@@ -0,0 +1,58 @@
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -786,6 +786,7 @@ struct ath11k {
u32 max_tx_power;
u32 txpower_limit_2g;
u32 txpower_limit_5g;
+ u32 txpower_limit_6g;
u32 txpower_scale;
u32 power_scale;
u32 chan_tx_pwr;
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -633,6 +633,7 @@ static void ath11k_pdev_caps_update(stru
ar->txpower_limit_2g = ar->max_tx_power;
ar->txpower_limit_5g = ar->max_tx_power;
+ ar->txpower_limit_6g = ar->max_tx_power;
ar->txpower_scale = WMI_HOST_TP_SCALE_MAX;
}
@@ -803,6 +804,16 @@ static int ath11k_mac_txpower_recalc(str
ar->txpower_limit_5g = txpower;
}
+ if ((ar->hw->wiphy->bands[NL80211_BAND_6GHZ]) &&
+ ar->txpower_limit_6g != txpower) {
+ param = WMI_PDEV_PARAM_TXPOWER_LIMIT5G;
+ ret = ath11k_wmi_pdev_set_param(ar, param,
+ txpower, ar->pdev->pdev_id);
+ if (ret)
+ goto fail;
+ ar->txpower_limit_6g = txpower;
+ }
+
return 0;
fail:
@@ -3542,18 +3553,8 @@ static void ath11k_mac_op_bss_info_chang
ath11k_dbg(ar->ab, ATH11K_DBG_MAC, "mac vdev_id %i txpower %d\n",
arvif->vdev_id, info->txpower);
- if (ar->supports_6ghz && info->chandef.chan &&
- info->chandef.chan->band == NL80211_BAND_6GHZ &&
- (arvif->vdev_type == WMI_VDEV_TYPE_STA ||
- arvif->vdev_type == WMI_VDEV_TYPE_AP) &&
- test_bit(WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT,
- ar->ab->wmi_ab.svc_map)) {
- ath11k_dbg(ar->ab, ATH11K_DBG_MAC,
- "discard tx power, change to set TPC power\n");
- } else {
- arvif->txpower = info->txpower;
- ath11k_mac_txpower_recalc(ar);
- }
+ arvif->txpower = info->txpower;
+ ath11k_mac_txpower_recalc(ar);
}
if (changed & BSS_CHANGED_MCAST_RATE &&