wifi: ath12k: Send WMI_VDEV_SET_TPC_POWER_CMD for AP vdev

The power value is 6 dBm on an AP operating on the 6 GHz channel.
This is a very low value.

On 6 GHz, the target computes the EIRP based on the power values sent
in the WMI_VDEV_SET_TPC_POWER_CMD. Currently, this is being sent only
for station interfaces and not for AP interfaces.

Therefore, add AP vdev to the condition in
ath12k_mac_station_supports_tpc() and rename
ath12k_mac_station_supports_tpc() to ath12k_mac_supports_tpc().

For a AP vdev, hardcode ap_power_type as IEEE80211_REG_LPI_AP, which is
filled in the WMI_VDEV_SET_TPC_POWER_CMDID sent to the target.
Currently, LPI is the only supported AP power mode. Since there is
no method currently to set the AP power mode from user-space, the
power mode is hard-coded to LPI.

Retain the existing logic for populating the power mode for a station
vdev.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Signed-off-by: Hariharan Basuthkar <quic_hbasuthk@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250606112316.39316-1-quic_hbasuthk@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
This commit is contained in:
Hariharan Basuthkar 2025-06-06 16:53:16 +05:30 committed by Jeff Johnson
parent 9903c0986f
commit a44958c83e

View File

@ -3775,13 +3775,13 @@ static void ath12k_mac_vif_setup_ps(struct ath12k_link_vif *arvif)
psmode, arvif->vdev_id, ret);
}
static bool ath12k_mac_supports_station_tpc(struct ath12k *ar,
struct ath12k_vif *ahvif,
const struct cfg80211_chan_def *chandef)
static bool ath12k_mac_supports_tpc(struct ath12k *ar, struct ath12k_vif *ahvif,
const struct cfg80211_chan_def *chandef)
{
return ath12k_wmi_supports_6ghz_cc_ext(ar) &&
test_bit(WMI_TLV_SERVICE_EXT_TPC_REG_SUPPORT, ar->ab->wmi_ab.svc_map) &&
ahvif->vdev_type == WMI_VDEV_TYPE_STA &&
(ahvif->vdev_type == WMI_VDEV_TYPE_STA ||
ahvif->vdev_type == WMI_VDEV_TYPE_AP) &&
ahvif->vdev_subtype == WMI_VDEV_SUBTYPE_NONE &&
chandef->chan &&
chandef->chan->band == NL80211_BAND_6GHZ;
@ -9964,7 +9964,7 @@ ath12k_mac_vdev_start_restart(struct ath12k_link_vif *arvif,
/* TODO: For now we only set TPC power here. However when
* channel changes, say CSA, it should be updated again.
*/
if (ath12k_mac_supports_station_tpc(ar, ahvif, chandef)) {
if (ath12k_mac_supports_tpc(ar, ahvif, chandef)) {
ath12k_mac_fill_reg_tpc_info(ar, arvif, ctx);
ath12k_wmi_send_vdev_set_tpc_power(ar, arvif->vdev_id,
&arvif->reg_tpc_info);
@ -10519,7 +10519,9 @@ void ath12k_mac_fill_reg_tpc_info(struct ath12k *ar,
bool is_psd_power = false, is_tpe_present = false;
s8 max_tx_power[ATH12K_NUM_PWR_LEVELS],
psd_power, tx_power, eirp_power;
struct ath12k_vif *ahvif = arvif->ahvif;
u16 start_freq, center_freq;
u8 reg_6ghz_power_mode;
chan = ctx->def.chan;
start_freq = ath12k_mac_get_6ghz_start_frequency(&ctx->def);
@ -10675,8 +10677,14 @@ void ath12k_mac_fill_reg_tpc_info(struct ath12k *ar,
reg_tpc_info->num_pwr_levels = num_pwr_levels;
reg_tpc_info->is_psd_power = is_psd_power;
reg_tpc_info->eirp_power = eirp_power;
if (ahvif->vdev_type == WMI_VDEV_TYPE_STA)
reg_6ghz_power_mode = bss_conf->power_type;
else
/* For now, LPI is the only supported AP power mode */
reg_6ghz_power_mode = IEEE80211_REG_LPI_AP;
reg_tpc_info->ap_power_type =
ath12k_reg_ap_pwr_convert(bss_conf->power_type);
ath12k_reg_ap_pwr_convert(reg_6ghz_power_mode);
}
static void ath12k_mac_parse_tx_pwr_env(struct ath12k *ar,