blob: f8abe01bc2c27a464f2f427201395820883d26c2 [file] [log] [blame]
developer96ba36c2021-12-21 16:46:38 +08001diff --git a/package/kernel/mt76/patches/1006-mt7915-muru-onoff-switch-via-debugfs.patch b/package/kernel/mt76/patches/1006-mt7915-muru-onoff-switch-via-debugfs.patch
2new file mode 100644
3index 0000000..ce576e9
4--- /dev/null
5+++ b/package/kernel/mt76/patches/1006-mt7915-muru-onoff-switch-via-debugfs.patch
6@@ -0,0 +1,135 @@
7+diff --git a/mt7915/init.c b/mt7915/init.c
8+index 67677021..62a6d53b 100644
9+--- a/mt7915/init.c
10++++ b/mt7915/init.c
11+@@ -515,6 +515,7 @@ static void mt7915_init_work(struct work_struct *work)
12+ mt7915_init_txpower(dev, &dev->mphy.sband_2g.sband);
13+ mt7915_init_txpower(dev, &dev->mphy.sband_5g.sband);
14+ mt7915_txbf_init(dev);
15++ dev->dbg.muru_onoff = OFDMA_DL | MUMIMO_UL | MUMIMO_DL;
16+ }
17+
18+ static void mt7915_wfsys_reset(struct mt7915_dev *dev)
19+diff --git a/mt7915/mcu.c b/mt7915/mcu.c
20+index eb003bbc..dae38e63 100644
21+--- a/mt7915/mcu.c
22++++ b/mt7915/mcu.c
23+@@ -1535,6 +1535,7 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
24+ struct ieee80211_vif *vif)
25+ {
26+ struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;
27++ struct mt7915_dev *dev = mvif->phy->dev;
28+ struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem;
29+ struct sta_rec_muru *muru;
30+ struct tlv *tlv;
31+@@ -1550,9 +1551,10 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
32+
33+ muru = (struct sta_rec_muru *)tlv;
34+
35+- muru->cfg.mimo_dl_en = mvif->cap.he_mu_ebfer ||
36++ muru->cfg.mimo_dl_en = (mvif->cap.he_mu_ebfer ||
37+ mvif->cap.vht_mu_ebfer ||
38+- mvif->cap.vht_mu_ebfee;
39++ mvif->cap.vht_mu_ebfee) &&
40++ !!(dev->dbg.muru_onoff & MUMIMO_DL);
41+
42+ muru->mimo_dl.vht_mu_bfee =
43+ !!(sta->vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
44+@@ -1563,13 +1565,14 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta,
45+ muru->mimo_dl.partial_bw_dl_mimo =
46+ HE_PHY(CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO, elem->phy_cap_info[6]);
47+
48+- muru->cfg.mimo_ul_en = true;
49++ muru->cfg.mimo_ul_en = !!(dev->dbg.muru_onoff & MUMIMO_UL);
50+ muru->mimo_ul.full_ul_mimo =
51+ HE_PHY(CAP2_UL_MU_FULL_MU_MIMO, elem->phy_cap_info[2]);
52+ muru->mimo_ul.partial_ul_mimo =
53+ HE_PHY(CAP2_UL_MU_PARTIAL_MU_MIMO, elem->phy_cap_info[2]);
54+
55+- muru->cfg.ofdma_dl_en = true;
56++ muru->cfg.ofdma_dl_en = !!(dev->dbg.muru_onoff & OFDMA_DL);
57++ muru->cfg.ofdma_ul_en = !!(dev->dbg.muru_onoff & OFDMA_UL);
58+ muru->ofdma_dl.punc_pream_rx =
59+ HE_PHY(CAP1_PREAMBLE_PUNC_RX_MASK, elem->phy_cap_info[1]);
60+ muru->ofdma_dl.he_20m_in_40m_2g =
61+diff --git a/mt7915/mcu.h b/mt7915/mcu.h
62+index a50c7692..41825cef 100644
63+--- a/mt7915/mcu.h
64++++ b/mt7915/mcu.h
65+@@ -1326,4 +1326,10 @@ struct csi_data {
66+ };
67+ #endif
68+
69++/* MURU */
70++#define OFDMA_DL BIT(0)
71++#define OFDMA_UL BIT(1)
72++#define MUMIMO_DL BIT(2)
73++#define MUMIMO_UL BIT(3)
74++
75+ #endif
76+diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
77+index 3caa2c2a..3edb1033 100644
78+--- a/mt7915/mt7915.h
79++++ b/mt7915/mt7915.h
80+@@ -351,6 +351,7 @@ struct mt7915_dev {
81+ u32 bcn_total_cnt[2];
82+ u16 fwlog_seq;
83+ u32 token_idx;
84++ u8 muru_onoff;
85+ } dbg;
86+ #endif
87+ };
88+diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
89+index 9072ff3f..a2cdc6d5 100644
90+--- a/mt7915/mtk_debugfs.c
91++++ b/mt7915/mtk_debugfs.c
92+@@ -2628,6 +2628,38 @@ static int mt7915_token_txd_read(struct seq_file *s, void *data)
93+ return 0;
94+ }
95+
96++static int mt7915_muru_onoff_get(void *data, u64 *val)
97++{
98++ struct mt7915_dev *dev = data;
99++
100++ *val = dev->dbg.muru_onoff;
101++
102++ printk("mumimo ul:%d, mumimo dl:%d, ofdma ul:%d, ofdma dl:%d\n",
103++ !!(dev->dbg.muru_onoff & MUMIMO_UL),
104++ !!(dev->dbg.muru_onoff & MUMIMO_DL),
105++ !!(dev->dbg.muru_onoff & OFDMA_UL),
106++ !!(dev->dbg.muru_onoff & OFDMA_DL));
107++
108++ return 0;
109++}
110++
111++static int mt7915_muru_onoff_set(void *data, u64 val)
112++{
113++ struct mt7915_dev *dev = data;
114++
115++ if (val > 15) {
116++ printk("Wrong value! The value is between 0 ~ 15.\n");
117++ goto exit;
118++ }
119++
120++ dev->dbg.muru_onoff = val;
121++exit:
122++ return 0;
123++}
124++
125++DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_onoff, mt7915_muru_onoff_get,
126++ mt7915_muru_onoff_set, "%llx\n");
127++
128+ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
129+ {
130+ struct mt7915_dev *dev = phy->dev;
131+@@ -2637,6 +2669,7 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
132+ dev->dbg.fwlog_server_ip = 0xFFFFFFFF;
133+ scnprintf(dev->dbg.fwlog_ifname, sizeof(dev->dbg.fwlog_ifname), "wlan0");
134+
135++ debugfs_create_file("muru_onoff", 0600, dir, dev, &fops_muru_onoff);
136+ debugfs_create_file("fw_debug_internal", 0600, dir, phy, &fops_fw_debug);
137+ debugfs_create_file("fw_debug_module", 0600, dir, dev,
138+ &fops_fw_debug_module);
139+--
140+2.29.2
141+
142--
1432.29.2
144