blob: 72f8d249119930ac67c9710f73ca27ed603e4d9a [file] [log] [blame]
From 37b133c4d8fa05aae067dfb5fb68c24d3cabea2d Mon Sep 17 00:00:00 2001
From: MeiChia Chiu <meichia.chiu@mediatek.com>
Date: Mon, 28 Mar 2022 09:19:29 +0800
Subject: [PATCH 1004/1007] mt76: mt7915: add support for muru_onoff via
debugfs
---
mt7915/init.c | 1 +
mt7915/mcu.c | 12 ++++++++----
mt7915/mcu.h | 6 ++++++
mt7915/mt7915.h | 1 +
mt7915/mtk_debugfs.c | 33 +++++++++++++++++++++++++++++++++
5 files changed, 49 insertions(+), 4 deletions(-)
diff --git a/mt7915/init.c b/mt7915/init.c
index 258bb20a..2b8d758f 100644
--- a/mt7915/init.c
+++ b/mt7915/init.c
@@ -576,6 +576,7 @@ static void mt7915_init_work(struct work_struct *work)
mt7915_init_txpower(dev, &dev->mphy.sband_5g.sband);
mt7915_init_txpower(dev, &dev->mphy.sband_6g.sband);
mt7915_txbf_init(dev);
+ dev->dbg.muru_onoff = OFDMA_DL | MUMIMO_UL | MUMIMO_DL;
}
void mt7915_wfsys_reset(struct mt7915_dev *dev)
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
index 18b05b2e..5df0b4fd 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -944,6 +944,7 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
struct ieee80211_vif *vif)
{
struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
+ struct mt7915_dev *dev = mvif->phy->dev;
struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
struct sta_rec_muru *muru;
struct tlv *tlv;
@@ -956,11 +957,14 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
muru = (struct sta_rec_muru *)tlv;
- muru->cfg.mimo_dl_en = mvif->cap.he_mu_ebfer ||
+ muru->cfg.mimo_dl_en = (mvif->cap.he_mu_ebfer ||
mvif->cap.vht_mu_ebfer ||
- mvif->cap.vht_mu_ebfee;
- muru->cfg.mimo_ul_en = true;
- muru->cfg.ofdma_dl_en = true;
+ mvif->cap.vht_mu_ebfee) &&
+ !!(dev->dbg.muru_onoff & MUMIMO_DL);
+
+ muru->cfg.mimo_ul_en = !!(dev->dbg.muru_onoff & MUMIMO_UL);
+ muru->cfg.ofdma_dl_en = !!(dev->dbg.muru_onoff & OFDMA_DL);
+ muru->cfg.ofdma_ul_en = !!(dev->dbg.muru_onoff & OFDMA_UL);
if (sta->vht_cap.vht_supported)
muru->mimo_dl.vht_mu_bfee =
diff --git a/mt7915/mcu.h b/mt7915/mcu.h
index cb854b28..0ff1fd11 100644
--- a/mt7915/mcu.h
+++ b/mt7915/mcu.h
@@ -589,4 +589,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 ace01e15..06f2737f 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -403,6 +403,7 @@ struct mt7915_dev {
bool dump_rx_pkt;
bool dump_rx_raw;
u32 token_idx;
+ u8 muru_onoff;
} dbg;
const struct mt7915_dbg_reg_desc *dbg_reg;
#endif
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
index ccaaea78..d2dbae45 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -2480,6 +2480,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_dev *dev = data;
+
+ *val = dev->dbg.muru_onoff;
+
+ printk("mumimo ul:%d, mumimo dl:%d, ofdma ul:%d, ofdma dl:%d\n",
+ !!(dev->dbg.muru_onoff & MUMIMO_UL),
+ !!(dev->dbg.muru_onoff & MUMIMO_DL),
+ !!(dev->dbg.muru_onoff & OFDMA_UL),
+ !!(dev->dbg.muru_onoff & OFDMA_DL));
+
+ return 0;
+}
+
+static int mt7915_muru_onoff_set(void *data, u64 val)
+{
+ struct mt7915_dev *dev = data;
+
+ if (val > 15) {
+ printk("Wrong value! The value is between 0 ~ 15.\n");
+ goto exit;
+ }
+
+ dev->dbg.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);
@@ -2857,6 +2889,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, dev, &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