Commit 51ba0e3a authored by Ming Yen Hsieh's avatar Ming Yen Hsieh Committed by Felix Fietkau

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: default avatarMing Yen Hsieh <mingyen.hsieh@mediatek.com>
Co-developed-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarDeren Wu <deren.wu@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 7801da33
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment