Skip to content

Commit

Permalink
ath11k: add support to set txpower for 6GHz via iw
Browse files Browse the repository at this point in the history
Signed-off-by: Arif Alam <[email protected]>
  • Loading branch information
ArifAlam committed Mar 5, 2024
1 parent f0c34c3 commit 01862f1
Showing 1 changed file with 58 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 &&

0 comments on commit 01862f1

Please sign in to comment.