@@ -701,6 +701,38 @@ static void mt7921_bss_info_changed(struct ieee80211_hw *hw,
mt792x_mutex_release(dev);
}
+static void
+mt7921_regd_set_6ghz_power_type(struct ieee80211_vif *vif)
+{
+ struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
+ struct mt792x_phy *phy = mvif->phy;
+ struct mt792x_dev *dev = phy->dev;
+
+ if (hweight64(dev->mt76.vif_mask) > 1) {
+ phy->power_type = MT_AP_DEFAULT;
+ goto out;
+ }
+
+ switch (vif->bss_conf.power_type) {
+ case IEEE80211_REG_SP_AP:
+ phy->power_type = MT_AP_SP;
+ break;
+ case IEEE80211_REG_VLP_AP:
+ phy->power_type = MT_AP_VLP;
+ break;
+ case IEEE80211_REG_LPI_AP:
+ phy->power_type = MT_AP_LPI;
+ break;
+ case IEEE80211_REG_UNSET_AP:
+ default:
+ phy->power_type = MT_AP_DEFAULT;
+ break;
+ }
+
+out:
+ mt7921_mcu_set_clc(dev, dev->mt76.alpha2, dev->country_ie_env);
+}
+
int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
@@ -736,6 +768,8 @@ int mt7921_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
if (ret)
return ret;
+ mt7921_regd_set_6ghz_power_type(vif);
+
mt76_connac_power_save_sched(&dev->mphy, &dev->pm);
return 0;
@@ -1254,10 +1254,12 @@ int __mt7921_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2,
u8 pad1;
u8 alpha2[2];
u8 type[2];
- u8 rsvd[64];
+ u8 env_6g;
+ u8 rsvd[63];
} __packed req = {
.idx = idx,
.env = env_cap,
+ .env_6g = dev->phy.power_type,
.acpi_conf = mt792x_acpi_get_flags(&dev->phy),
};
int ret, valid_cnt = 0;
@@ -63,6 +63,14 @@ enum {
MT792x_CLC_MAX_NUM,
};
+enum mt792x_reg_power_type {
+ MT_AP_UNSET = 0,
+ MT_AP_DEFAULT,
+ MT_AP_LPI,
+ MT_AP_SP,
+ MT_AP_VLP,
+};
+
DECLARE_EWMA(avg_signal, 10, 8)
struct mt792x_sta {
@@ -114,6 +122,7 @@ struct mt792x_phy {
struct mt76_mib_stats mib;
u8 sta_work_count;
+ enum mt792x_reg_power_type power_type;
struct sk_buff_head scan_event_list;
struct delayed_work scan_work;