wifi: mt76: mt7921: add 6GHz power type support for clc

There are several power type should be supported in 6GHz band. mt7921
apply 6GHz power type from AP settings and clc will setup the
corresponding regulatory power.

Signed-off-by: Ming Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Deren Wu <deren.wu@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Ming Yen Hsieh
2023-09-30 10:25:07 +08:00
committed by Felix Fietkau
parent 7801da3388
commit 51ba0e3a15
3 changed files with 46 additions and 1 deletions

View File

@@ -682,6 +682,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)
{
@@ -717,6 +749,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;

View File

@@ -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;

View File

@@ -66,6 +66,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 {
@@ -117,6 +125,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;