developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 1 | From 3a4da64bbf85e4aeb52e4e07236d209eda8ba6ef Mon Sep 17 00:00:00 2001 |
| 2 | From: MeiChia Chiu <meichia.chiu@mediatek.com> |
| 3 | Date: Thu, 17 Feb 2022 00:28:21 +0800 |
| 4 | Subject: [PATCH 1004/1005] mt76: mt7915: add support for muru_onoff via |
| 5 | debugfs |
| 6 | |
| 7 | --- |
| 8 | .../net/wireless/mediatek/mt76/mt7915/init.c | 1 + |
| 9 | .../net/wireless/mediatek/mt76/mt7915/mcu.c | 12 ++++--- |
| 10 | .../net/wireless/mediatek/mt76/mt7915/mcu.h | 6 ++++ |
| 11 | .../wireless/mediatek/mt76/mt7915/mt7915.h | 1 + |
| 12 | .../mediatek/mt76/mt7915/mtk_debugfs.c | 33 +++++++++++++++++++ |
| 13 | 5 files changed, 49 insertions(+), 4 deletions(-) |
| 14 | |
| 15 | diff --git a/mt7915/init.c b/mt7915/init.c |
| 16 | index b97e912..bb766ed 100644 |
| 17 | --- a/mt7915/init.c |
| 18 | +++ b/mt7915/init.c |
| 19 | @@ -570,6 +570,7 @@ static void mt7915_init_work(struct work_struct *work) |
| 20 | mt7915_init_txpower(dev, &dev->mphy.sband_5g.sband); |
| 21 | mt7915_init_txpower(dev, &dev->mphy.sband_6g.sband); |
| 22 | mt7915_txbf_init(dev); |
| 23 | + dev->dbg.muru_onoff = OFDMA_DL | MUMIMO_UL | MUMIMO_DL; |
| 24 | } |
| 25 | |
| 26 | static void mt7915_wfsys_reset(struct mt7915_dev *dev) |
| 27 | diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
| 28 | index 4d26a7a..ecc96f1 100644 |
| 29 | --- a/mt7915/mcu.c |
| 30 | +++ b/mt7915/mcu.c |
| 31 | @@ -939,6 +939,7 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, |
| 32 | struct ieee80211_vif *vif) |
| 33 | { |
| 34 | struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; |
| 35 | + struct mt7915_dev *dev = mvif->phy->dev; |
| 36 | struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem; |
| 37 | struct sta_rec_muru *muru; |
| 38 | struct tlv *tlv; |
| 39 | @@ -951,11 +952,14 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, |
| 40 | |
| 41 | muru = (struct sta_rec_muru *)tlv; |
| 42 | |
| 43 | - muru->cfg.mimo_dl_en = mvif->cap.he_mu_ebfer || |
| 44 | + muru->cfg.mimo_dl_en = (mvif->cap.he_mu_ebfer || |
| 45 | mvif->cap.vht_mu_ebfer || |
| 46 | - mvif->cap.vht_mu_ebfee; |
| 47 | - muru->cfg.mimo_ul_en = true; |
| 48 | - muru->cfg.ofdma_dl_en = true; |
| 49 | + mvif->cap.vht_mu_ebfee) && |
| 50 | + !!(dev->dbg.muru_onoff & MUMIMO_DL); |
| 51 | + |
| 52 | + muru->cfg.mimo_ul_en = !!(dev->dbg.muru_onoff & MUMIMO_UL); |
| 53 | + muru->cfg.ofdma_dl_en = !!(dev->dbg.muru_onoff & OFDMA_DL); |
| 54 | + muru->cfg.ofdma_ul_en = !!(dev->dbg.muru_onoff & OFDMA_UL); |
| 55 | |
| 56 | if (sta->vht_cap.vht_supported) |
| 57 | muru->mimo_dl.vht_mu_bfee = |
| 58 | diff --git a/mt7915/mcu.h b/mt7915/mcu.h |
| 59 | index 007282d..a5e5afa 100644 |
| 60 | --- a/mt7915/mcu.h |
| 61 | +++ b/mt7915/mcu.h |
| 62 | @@ -569,4 +569,10 @@ struct csi_data { |
| 63 | }; |
| 64 | #endif |
| 65 | |
| 66 | +/* MURU */ |
| 67 | +#define OFDMA_DL BIT(0) |
| 68 | +#define OFDMA_UL BIT(1) |
| 69 | +#define MUMIMO_DL BIT(2) |
| 70 | +#define MUMIMO_UL BIT(3) |
| 71 | + |
| 72 | #endif |
| 73 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
| 74 | index 6e62a46..746e05c 100644 |
| 75 | --- a/mt7915/mt7915.h |
| 76 | +++ b/mt7915/mt7915.h |
| 77 | @@ -383,6 +383,7 @@ struct mt7915_dev { |
| 78 | u32 bcn_total_cnt[2]; |
| 79 | u16 fwlog_seq; |
| 80 | u32 token_idx; |
| 81 | + u8 muru_onoff; |
| 82 | } dbg; |
| 83 | const struct mt7915_dbg_reg_desc *dbg_reg; |
| 84 | #endif |
| 85 | diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c |
| 86 | index 2616fbf..4ebeeb2 100644 |
| 87 | --- a/mt7915/mtk_debugfs.c |
| 88 | +++ b/mt7915/mtk_debugfs.c |
| 89 | @@ -2430,6 +2430,38 @@ static int mt7915_token_txd_read(struct seq_file *s, void *data) |
| 90 | return 0; |
| 91 | } |
| 92 | |
| 93 | +static int mt7915_muru_onoff_get(void *data, u64 *val) |
| 94 | +{ |
| 95 | + struct mt7915_dev *dev = data; |
| 96 | + |
| 97 | + *val = dev->dbg.muru_onoff; |
| 98 | + |
| 99 | + printk("mumimo ul:%d, mumimo dl:%d, ofdma ul:%d, ofdma dl:%d\n", |
| 100 | + !!(dev->dbg.muru_onoff & MUMIMO_UL), |
| 101 | + !!(dev->dbg.muru_onoff & MUMIMO_DL), |
| 102 | + !!(dev->dbg.muru_onoff & OFDMA_UL), |
| 103 | + !!(dev->dbg.muru_onoff & OFDMA_DL)); |
| 104 | + |
| 105 | + return 0; |
| 106 | +} |
| 107 | + |
| 108 | +static int mt7915_muru_onoff_set(void *data, u64 val) |
| 109 | +{ |
| 110 | + struct mt7915_dev *dev = data; |
| 111 | + |
| 112 | + if (val > 15) { |
| 113 | + printk("Wrong value! The value is between 0 ~ 15.\n"); |
| 114 | + goto exit; |
| 115 | + } |
| 116 | + |
| 117 | + dev->dbg.muru_onoff = val; |
| 118 | +exit: |
| 119 | + return 0; |
| 120 | +} |
| 121 | + |
| 122 | +DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_onoff, mt7915_muru_onoff_get, |
| 123 | + mt7915_muru_onoff_set, "%llx\n"); |
| 124 | + |
| 125 | static int mt7915_amsduinfo_read(struct seq_file *s, void *data) |
| 126 | { |
| 127 | struct mt7915_dev *dev = dev_get_drvdata(s->private); |
| 128 | @@ -2807,6 +2839,7 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir) |
| 129 | |
| 130 | mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, 0); |
| 131 | |
| 132 | + debugfs_create_file("muru_onoff", 0600, dir, dev, &fops_muru_onoff); |
| 133 | debugfs_create_file("fw_debug_module", 0600, dir, dev, |
| 134 | &fops_fw_debug_module); |
| 135 | debugfs_create_file("fw_debug_level", 0600, dir, dev, |
| 136 | -- |
| 137 | 2.25.1 |
| 138 | |