blob: eea919e10343d2490ea2d0c2cb60ce02aec8bb8a [file] [log] [blame]
developerbbd45e12023-05-19 08:22:06 +08001From e308945d818a93dd553f5f311865b1eff33954f2 Mon Sep 17 00:00:00 2001
developerc9233442023-04-04 06:06:17 +08002From: Evelyn Tsai <evelyn.tsai@mediatek.com>
3Date: Tue, 4 Apr 2023 02:23:57 +0800
developerbbd45e12023-05-19 08:22:06 +08004Subject: [PATCH 1003/1033] wifi: mt76: mt7915: add support for muru_onoff via
developere2cc0fa2022-03-29 17:31:03 +08005
6---
developereb2bd8e2023-02-09 11:16:04 +08007 mt7915/init.c | 2 ++
developerbbd45e12023-05-19 08:22:06 +08008 mt7915/mcu.c | 10 ++++++++--
developer5ce5ea42022-08-31 14:12:29 +08009 mt7915/mcu.h | 6 ++++++
developereb2bd8e2023-02-09 11:16:04 +080010 mt7915/mt7915.h | 2 ++
developer5ce5ea42022-08-31 14:12:29 +080011 mt7915/mtk_debugfs.c | 33 +++++++++++++++++++++++++++++++++
developerbbd45e12023-05-19 08:22:06 +080012 5 files changed, 51 insertions(+), 2 deletions(-)
developere2cc0fa2022-03-29 17:31:03 +080013
14diff --git a/mt7915/init.c b/mt7915/init.c
developerbbd45e12023-05-19 08:22:06 +080015index 1fe123d..7250998 100644
developere2cc0fa2022-03-29 17:31:03 +080016--- a/mt7915/init.c
17+++ b/mt7915/init.c
developerbbd45e12023-05-19 08:22:06 +080018@@ -449,6 +449,8 @@ mt7915_init_wiphy(struct mt7915_phy *phy)
developereb2bd8e2023-02-09 11:16:04 +080019 mphy->leds.cdev.brightness_set = mt7915_led_set_brightness;
20 mphy->leds.cdev.blink_set = mt7915_led_set_blink;
21 }
22+
23+ phy->muru_onoff = OFDMA_DL | MUMIMO_UL | MUMIMO_DL;
developere2cc0fa2022-03-29 17:31:03 +080024 }
25
developereb2bd8e2023-02-09 11:16:04 +080026 static void
developere2cc0fa2022-03-29 17:31:03 +080027diff --git a/mt7915/mcu.c b/mt7915/mcu.c
developerbbd45e12023-05-19 08:22:06 +080028index b3fdcdf..68e3583 100644
developere2cc0fa2022-03-29 17:31:03 +080029--- a/mt7915/mcu.c
30+++ b/mt7915/mcu.c
developerbbd45e12023-05-19 08:22:06 +080031@@ -866,6 +866,7 @@ static void
32 mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developereb2bd8e2023-02-09 11:16:04 +080033 struct ieee80211_sta *sta, struct ieee80211_vif *vif)
34 {
developereb2bd8e2023-02-09 11:16:04 +080035+ struct mt7915_phy *phy = mvif->phy;
developer6100db22023-04-05 13:22:26 +080036 struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem;
developereb2bd8e2023-02-09 11:16:04 +080037 struct sta_rec_muru *muru;
38 struct tlv *tlv;
developerbbd45e12023-05-19 08:22:06 +080039@@ -878,13 +879,18 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb,
developere2cc0fa2022-03-29 17:31:03 +080040
41 muru = (struct sta_rec_muru *)tlv;
42
developerbbd45e12023-05-19 08:22:06 +080043- muru->cfg.mimo_dl_en = vif->bss_conf.he_mu_beamformer ||
44+ muru->cfg.mimo_dl_en = (vif->bss_conf.he_mu_beamformer ||
45 vif->bss_conf.vht_mu_beamformer ||
46- vif->bss_conf.vht_mu_beamformee;
47+ vif->bss_conf.vht_mu_beamformee) &&
developereb2bd8e2023-02-09 11:16:04 +080048+ !!(phy->muru_onoff & MUMIMO_DL);
developerf64861f2022-06-22 11:44:53 +080049 if (!is_mt7915(&dev->mt76))
50 muru->cfg.mimo_ul_en = true;
51 muru->cfg.ofdma_dl_en = true;
52
developereb2bd8e2023-02-09 11:16:04 +080053+ muru->cfg.mimo_ul_en = !!(phy->muru_onoff & MUMIMO_UL);
54+ muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL);
55+ muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL);
developerf64861f2022-06-22 11:44:53 +080056+
developer6100db22023-04-05 13:22:26 +080057 if (sta->deflink.vht_cap.vht_supported)
developere2cc0fa2022-03-29 17:31:03 +080058 muru->mimo_dl.vht_mu_bfee =
developer6100db22023-04-05 13:22:26 +080059 !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE);
developere2cc0fa2022-03-29 17:31:03 +080060diff --git a/mt7915/mcu.h b/mt7915/mcu.h
developerbbd45e12023-05-19 08:22:06 +080061index e082511..fedae7e 100644
developere2cc0fa2022-03-29 17:31:03 +080062--- a/mt7915/mcu.h
63+++ b/mt7915/mcu.h
developerbbd45e12023-05-19 08:22:06 +080064@@ -666,4 +666,10 @@ struct csi_data {
developere2cc0fa2022-03-29 17:31:03 +080065 };
66 #endif
67
68+/* MURU */
developer4721e252022-06-21 16:41:28 +080069+#define OFDMA_DL BIT(0)
70+#define OFDMA_UL BIT(1)
71+#define MUMIMO_DL BIT(2)
72+#define MUMIMO_UL BIT(3)
developere2cc0fa2022-03-29 17:31:03 +080073+
74 #endif
developereb2bd8e2023-02-09 11:16:04 +080075diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
developerbbd45e12023-05-19 08:22:06 +080076index 51d7f34..7613e60 100644
developereb2bd8e2023-02-09 11:16:04 +080077--- a/mt7915/mt7915.h
78+++ b/mt7915/mt7915.h
developerbbd45e12023-05-19 08:22:06 +080079@@ -301,6 +301,8 @@ struct mt7915_phy {
developereb2bd8e2023-02-09 11:16:04 +080080 u32 rx_ampdu_ts;
81 u32 ampdu_ref;
82
83+ u8 muru_onoff;
84+
85 struct mib_stats mib;
86 struct mt76_channel_state state_ts;
87
developere2cc0fa2022-03-29 17:31:03 +080088diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
developer1d9da7d2023-04-15 12:45:34 +080089index 4bbb410..1db1d87 100644
developere2cc0fa2022-03-29 17:31:03 +080090--- a/mt7915/mtk_debugfs.c
91+++ b/mt7915/mtk_debugfs.c
developerd75d3632023-01-05 14:31:01 +080092@@ -2558,6 +2558,38 @@ static int mt7915_token_txd_read(struct seq_file *s, void *data)
developere2cc0fa2022-03-29 17:31:03 +080093 return 0;
94 }
95
96+static int mt7915_muru_onoff_get(void *data, u64 *val)
97+{
developereb2bd8e2023-02-09 11:16:04 +080098+ struct mt7915_phy *phy = data;
developere2cc0fa2022-03-29 17:31:03 +080099+
developereb2bd8e2023-02-09 11:16:04 +0800100+ *val = phy->muru_onoff;
developere2cc0fa2022-03-29 17:31:03 +0800101+
developereb2bd8e2023-02-09 11:16:04 +0800102+ printk("mumimo ul:%d, mumimo dl:%d, ofdma ul:%d, ofdma dl:%d\n",
103+ !!(phy->muru_onoff & MUMIMO_UL),
104+ !!(phy->muru_onoff & MUMIMO_DL),
105+ !!(phy->muru_onoff & OFDMA_UL),
106+ !!(phy->muru_onoff & OFDMA_DL));
developere2cc0fa2022-03-29 17:31:03 +0800107+
developereb2bd8e2023-02-09 11:16:04 +0800108+ return 0;
developere2cc0fa2022-03-29 17:31:03 +0800109+}
110+
111+static int mt7915_muru_onoff_set(void *data, u64 val)
112+{
developereb2bd8e2023-02-09 11:16:04 +0800113+ struct mt7915_phy *phy = data;
developere2cc0fa2022-03-29 17:31:03 +0800114+
developereb2bd8e2023-02-09 11:16:04 +0800115+ if (val > 15) {
116+ printk("Wrong value! The value is between 0 ~ 15.\n");
117+ goto exit;
118+ }
developere2cc0fa2022-03-29 17:31:03 +0800119+
developereb2bd8e2023-02-09 11:16:04 +0800120+ phy->muru_onoff = val;
developere2cc0fa2022-03-29 17:31:03 +0800121+exit:
developereb2bd8e2023-02-09 11:16:04 +0800122+ return 0;
developere2cc0fa2022-03-29 17:31:03 +0800123+}
124+
125+DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_onoff, mt7915_muru_onoff_get,
developer4721e252022-06-21 16:41:28 +0800126+ mt7915_muru_onoff_set, "%llx\n");
developere2cc0fa2022-03-29 17:31:03 +0800127+
128 static int mt7915_amsduinfo_read(struct seq_file *s, void *data)
129 {
130 struct mt7915_dev *dev = dev_get_drvdata(s->private);
developer2324aa22023-04-12 11:30:15 +0800131@@ -3538,6 +3570,7 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir)
developere2cc0fa2022-03-29 17:31:03 +0800132
133 mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, 0);
134
developereb2bd8e2023-02-09 11:16:04 +0800135+ debugfs_create_file("muru_onoff", 0600, dir, phy, &fops_muru_onoff);
developere2cc0fa2022-03-29 17:31:03 +0800136 debugfs_create_file("fw_debug_module", 0600, dir, dev,
137 &fops_fw_debug_module);
138 debugfs_create_file("fw_debug_level", 0600, dir, dev,
139--
developer2324aa22023-04-12 11:30:15 +08001402.18.0
developere2cc0fa2022-03-29 17:31:03 +0800141