| From c79fc4ca594e0c4506d8601243523476b47a13eb Mon Sep 17 00:00:00 2001 |
| From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| Date: Tue, 4 Apr 2023 02:23:57 +0800 |
| Subject: [PATCH 1002/1031] wifi: mt76: mt7915: add support for muru_onoff via |
| |
| --- |
| mt7915/init.c | 2 ++ |
| mt7915/mcu.c | 10 ++++++++-- |
| mt7915/mcu.h | 6 ++++++ |
| mt7915/mt7915.h | 2 ++ |
| mt7915/mtk_debugfs.c | 33 +++++++++++++++++++++++++++++++++ |
| 5 files changed, 51 insertions(+), 2 deletions(-) |
| |
| diff --git a/mt7915/init.c b/mt7915/init.c |
| index d42d17b..41f137c 100644 |
| --- a/mt7915/init.c |
| +++ b/mt7915/init.c |
| @@ -457,6 +457,8 @@ mt7915_init_wiphy(struct mt7915_phy *phy) |
| mphy->leds.cdev.brightness_set = mt7915_led_set_brightness; |
| mphy->leds.cdev.blink_set = mt7915_led_set_blink; |
| } |
| + |
| + phy->muru_onoff = OFDMA_DL | MUMIMO_UL | MUMIMO_DL; |
| } |
| |
| static void |
| diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
| index 4ef5190..a4a8194 100644 |
| --- a/mt7915/mcu.c |
| +++ b/mt7915/mcu.c |
| @@ -870,6 +870,7 @@ static void |
| mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
| struct ieee80211_sta *sta, struct ieee80211_vif *vif) |
| { |
| + struct mt7915_phy *phy = mvif->phy; |
| struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; |
| struct sta_rec_muru *muru; |
| struct tlv *tlv; |
| @@ -882,13 +883,18 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
| |
| muru = (struct sta_rec_muru *)tlv; |
| |
| - muru->cfg.mimo_dl_en = vif->bss_conf.he_mu_beamformer || |
| + muru->cfg.mimo_dl_en = (vif->bss_conf.he_mu_beamformer || |
| vif->bss_conf.vht_mu_beamformer || |
| - vif->bss_conf.vht_mu_beamformee; |
| + vif->bss_conf.vht_mu_beamformee) && |
| + !!(phy->muru_onoff & MUMIMO_DL); |
| if (!is_mt7915(&dev->mt76)) |
| muru->cfg.mimo_ul_en = true; |
| muru->cfg.ofdma_dl_en = true; |
| |
| + muru->cfg.mimo_ul_en = !!(phy->muru_onoff & MUMIMO_UL); |
| + muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL); |
| + muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL); |
| + |
| if (sta->deflink.vht_cap.vht_supported) |
| muru->mimo_dl.vht_mu_bfee = |
| !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); |
| diff --git a/mt7915/mcu.h b/mt7915/mcu.h |
| index e082511..fedae7e 100644 |
| --- a/mt7915/mcu.h |
| +++ b/mt7915/mcu.h |
| @@ -666,4 +666,10 @@ struct csi_data { |
| }; |
| #endif |
| |
| +/* MURU */ |
| +#define OFDMA_DL BIT(0) |
| +#define OFDMA_UL BIT(1) |
| +#define MUMIMO_DL BIT(2) |
| +#define MUMIMO_UL BIT(3) |
| + |
| #endif |
| diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
| index 7a9752f..2befa44 100644 |
| --- a/mt7915/mt7915.h |
| +++ b/mt7915/mt7915.h |
| @@ -238,6 +238,8 @@ struct mt7915_phy { |
| u32 rx_ampdu_ts; |
| u32 ampdu_ref; |
| |
| + u8 muru_onoff; |
| + |
| struct mt76_mib_stats mib; |
| struct mt76_channel_state state_ts; |
| |
| diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c |
| index 70e4cb2..e5fb2ce 100644 |
| --- a/mt7915/mtk_debugfs.c |
| +++ b/mt7915/mtk_debugfs.c |
| @@ -2558,6 +2558,38 @@ static int mt7915_token_txd_read(struct seq_file *s, void *data) |
| return 0; |
| } |
| |
| +static int mt7915_muru_onoff_get(void *data, u64 *val) |
| +{ |
| + struct mt7915_phy *phy = data; |
| + |
| + *val = phy->muru_onoff; |
| + |
| + printk("mumimo ul:%d, mumimo dl:%d, ofdma ul:%d, ofdma dl:%d\n", |
| + !!(phy->muru_onoff & MUMIMO_UL), |
| + !!(phy->muru_onoff & MUMIMO_DL), |
| + !!(phy->muru_onoff & OFDMA_UL), |
| + !!(phy->muru_onoff & OFDMA_DL)); |
| + |
| + return 0; |
| +} |
| + |
| +static int mt7915_muru_onoff_set(void *data, u64 val) |
| +{ |
| + struct mt7915_phy *phy = data; |
| + |
| + if (val > 15) { |
| + printk("Wrong value! The value is between 0 ~ 15.\n"); |
| + goto exit; |
| + } |
| + |
| + phy->muru_onoff = val; |
| +exit: |
| + return 0; |
| +} |
| + |
| +DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_onoff, mt7915_muru_onoff_get, |
| + mt7915_muru_onoff_set, "%llx\n"); |
| + |
| static int mt7915_amsduinfo_read(struct seq_file *s, void *data) |
| { |
| struct mt7915_dev *dev = dev_get_drvdata(s->private); |
| @@ -3554,6 +3586,7 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir) |
| |
| mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, 0); |
| |
| + debugfs_create_file("muru_onoff", 0600, dir, phy, &fops_muru_onoff); |
| debugfs_create_file("fw_debug_module", 0600, dir, dev, |
| &fops_fw_debug_module); |
| debugfs_create_file("fw_debug_level", 0600, dir, dev, |
| -- |
| 2.18.0 |
| |