developer | 12a4279 | 2023-07-29 05:30:55 +0800 | [diff] [blame^] | 1 | From 68c4629afaa8f5e74ecd852b56d552fc09677764 Mon Sep 17 00:00:00 2001 |
developer | c923344 | 2023-04-04 06:06:17 +0800 | [diff] [blame] | 2 | From: Evelyn Tsai <evelyn.tsai@mediatek.com> |
| 3 | Date: Tue, 4 Apr 2023 02:23:57 +0800 |
developer | 8f0d89b | 2023-07-28 07:16:44 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1003/1034] wifi: mt76: mt7915: add support for muru_onoff via |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 5 | |
| 6 | --- |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 7 | mt7915/init.c | 2 ++ |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 8 | mt7915/mcu.c | 10 ++++++++-- |
developer | 5ce5ea4 | 2022-08-31 14:12:29 +0800 | [diff] [blame] | 9 | mt7915/mcu.h | 6 ++++++ |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 10 | mt7915/mt7915.h | 2 ++ |
developer | 5ce5ea4 | 2022-08-31 14:12:29 +0800 | [diff] [blame] | 11 | mt7915/mtk_debugfs.c | 33 +++++++++++++++++++++++++++++++++ |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 12 | 5 files changed, 51 insertions(+), 2 deletions(-) |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 13 | |
| 14 | diff --git a/mt7915/init.c b/mt7915/init.c |
developer | 12a4279 | 2023-07-29 05:30:55 +0800 | [diff] [blame^] | 15 | index c5bcbff..e36c09b 100644 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 16 | --- a/mt7915/init.c |
| 17 | +++ b/mt7915/init.c |
developer | 2157bf8 | 2023-06-26 02:27:49 +0800 | [diff] [blame] | 18 | @@ -457,6 +457,8 @@ mt7915_init_wiphy(struct mt7915_phy *phy) |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 19 | 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; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 24 | } |
| 25 | |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 26 | static void |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 27 | diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
developer | 8f0d89b | 2023-07-28 07:16:44 +0800 | [diff] [blame] | 28 | index 8994ea6..fdb6bc5 100644 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 29 | --- a/mt7915/mcu.c |
| 30 | +++ b/mt7915/mcu.c |
developer | c1571f9 | 2023-07-04 22:11:24 +0800 | [diff] [blame] | 31 | @@ -873,6 +873,7 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 32 | { |
developer | c1571f9 | 2023-07-04 22:11:24 +0800 | [diff] [blame] | 33 | struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 34 | struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; |
developer | c1571f9 | 2023-07-04 22:11:24 +0800 | [diff] [blame] | 35 | + struct mt7915_phy *phy = mvif->phy; |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 36 | struct sta_rec_muru *muru; |
| 37 | struct tlv *tlv; |
developer | c1571f9 | 2023-07-04 22:11:24 +0800 | [diff] [blame] | 38 | |
| 39 | @@ -884,13 +885,18 @@ mt7915_mcu_sta_muru_tlv(struct mt7915_dev *dev, struct sk_buff *skb, |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 40 | |
| 41 | muru = (struct sta_rec_muru *)tlv; |
| 42 | |
developer | c1571f9 | 2023-07-04 22:11:24 +0800 | [diff] [blame] | 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 | + mvif->cap.vht_mu_ebfee) && |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 48 | + !!(phy->muru_onoff & MUMIMO_DL); |
developer | f64861f | 2022-06-22 11:44:53 +0800 | [diff] [blame] | 49 | if (!is_mt7915(&dev->mt76)) |
| 50 | muru->cfg.mimo_ul_en = true; |
| 51 | muru->cfg.ofdma_dl_en = true; |
| 52 | |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 53 | + 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); |
developer | f64861f | 2022-06-22 11:44:53 +0800 | [diff] [blame] | 56 | + |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 57 | if (sta->deflink.vht_cap.vht_supported) |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 58 | muru->mimo_dl.vht_mu_bfee = |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 59 | !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 60 | diff --git a/mt7915/mcu.h b/mt7915/mcu.h |
developer | 12a4279 | 2023-07-29 05:30:55 +0800 | [diff] [blame^] | 61 | index 67eac5c..84c52d9 100644 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 62 | --- a/mt7915/mcu.h |
| 63 | +++ b/mt7915/mcu.h |
developer | bbd45e1 | 2023-05-19 08:22:06 +0800 | [diff] [blame] | 64 | @@ -666,4 +666,10 @@ struct csi_data { |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 65 | }; |
| 66 | #endif |
| 67 | |
| 68 | +/* MURU */ |
developer | 4721e25 | 2022-06-21 16:41:28 +0800 | [diff] [blame] | 69 | +#define OFDMA_DL BIT(0) |
| 70 | +#define OFDMA_UL BIT(1) |
| 71 | +#define MUMIMO_DL BIT(2) |
| 72 | +#define MUMIMO_UL BIT(3) |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 73 | + |
| 74 | #endif |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 75 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | c1571f9 | 2023-07-04 22:11:24 +0800 | [diff] [blame] | 76 | index 01d487c..1663814 100644 |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 77 | --- a/mt7915/mt7915.h |
| 78 | +++ b/mt7915/mt7915.h |
developer | c1571f9 | 2023-07-04 22:11:24 +0800 | [diff] [blame] | 79 | @@ -252,6 +252,8 @@ struct mt7915_phy { |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 80 | u32 rx_ampdu_ts; |
| 81 | u32 ampdu_ref; |
| 82 | |
| 83 | + u8 muru_onoff; |
| 84 | + |
developer | 2157bf8 | 2023-06-26 02:27:49 +0800 | [diff] [blame] | 85 | struct mt76_mib_stats mib; |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 86 | struct mt76_channel_state state_ts; |
| 87 | |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 88 | diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c |
developer | 12a4279 | 2023-07-29 05:30:55 +0800 | [diff] [blame^] | 89 | index e6796bc..e1758ed 100644 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 90 | --- a/mt7915/mtk_debugfs.c |
| 91 | +++ b/mt7915/mtk_debugfs.c |
developer | d75d363 | 2023-01-05 14:31:01 +0800 | [diff] [blame] | 92 | @@ -2558,6 +2558,38 @@ static int mt7915_token_txd_read(struct seq_file *s, void *data) |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 93 | return 0; |
| 94 | } |
| 95 | |
| 96 | +static int mt7915_muru_onoff_get(void *data, u64 *val) |
| 97 | +{ |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 98 | + struct mt7915_phy *phy = data; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 99 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 100 | + *val = phy->muru_onoff; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 101 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 102 | + 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)); |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 107 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 108 | + return 0; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 109 | +} |
| 110 | + |
| 111 | +static int mt7915_muru_onoff_set(void *data, u64 val) |
| 112 | +{ |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 113 | + struct mt7915_phy *phy = data; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 114 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 115 | + if (val > 15) { |
| 116 | + printk("Wrong value! The value is between 0 ~ 15.\n"); |
| 117 | + goto exit; |
| 118 | + } |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 119 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 120 | + phy->muru_onoff = val; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 121 | +exit: |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 122 | + return 0; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 123 | +} |
| 124 | + |
| 125 | +DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_onoff, mt7915_muru_onoff_get, |
developer | 4721e25 | 2022-06-21 16:41:28 +0800 | [diff] [blame] | 126 | + mt7915_muru_onoff_set, "%llx\n"); |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 127 | + |
| 128 | static int mt7915_amsduinfo_read(struct seq_file *s, void *data) |
| 129 | { |
| 130 | struct mt7915_dev *dev = dev_get_drvdata(s->private); |
developer | 2157bf8 | 2023-06-26 02:27:49 +0800 | [diff] [blame] | 131 | @@ -3554,6 +3586,7 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir) |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 132 | |
| 133 | mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, 0); |
| 134 | |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 135 | + debugfs_create_file("muru_onoff", 0600, dir, phy, &fops_muru_onoff); |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 136 | 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 | -- |
developer | 2324aa2 | 2023-04-12 11:30:15 +0800 | [diff] [blame] | 140 | 2.18.0 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 141 | |