developer | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 1 | From 0820da6d53f6847d38e2e10f0946eeb8f6fafa9b 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 | 2324aa2 | 2023-04-12 11:30:15 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1003/1009] 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 ++ |
| 8 | mt7915/mcu.c | 12 +++++++++--- |
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 | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 12 | 5 files changed, 52 insertions(+), 3 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 | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 15 | index d21086d1..f6f3e8a6 100644 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 16 | --- a/mt7915/init.c |
| 17 | +++ b/mt7915/init.c |
developer | 4f0d84b | 2023-03-03 14:21:44 +0800 | [diff] [blame] | 18 | @@ -445,6 +445,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 | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 28 | index 82cff6d3..2e680f68 100644 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 29 | --- a/mt7915/mcu.c |
| 30 | +++ b/mt7915/mcu.c |
developer | c923344 | 2023-04-04 06:06:17 +0800 | [diff] [blame] | 31 | @@ -865,6 +865,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 | struct ieee80211_sta *sta, struct ieee80211_vif *vif) |
| 33 | { |
| 34 | struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv; |
| 35 | + struct mt7915_phy *phy = mvif->phy; |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 36 | struct ieee80211_he_cap_elem *elem = &sta->deflink.he_cap.he_cap_elem; |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 37 | struct sta_rec_muru *muru; |
| 38 | struct tlv *tlv; |
developer | c923344 | 2023-04-04 06:06:17 +0800 | [diff] [blame] | 39 | @@ -877,13 +878,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 | |
| 43 | - muru->cfg.mimo_dl_en = mvif->cap.he_mu_ebfer || |
developer | eb6a018 | 2022-12-12 18:53:32 +0800 | [diff] [blame] | 44 | - mvif->cap.vht_mu_ebfer || |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 45 | - mvif->cap.vht_mu_ebfee; |
developer | eb6a018 | 2022-12-12 18:53:32 +0800 | [diff] [blame] | 46 | + muru->cfg.mimo_dl_en = (mvif->cap.he_mu_ebfer || |
developer | c923344 | 2023-04-04 06:06:17 +0800 | [diff] [blame] | 47 | + mvif->cap.vht_mu_ebfer || |
developer | eb6a018 | 2022-12-12 18:53:32 +0800 | [diff] [blame] | 48 | + mvif->cap.vht_mu_ebfee) && |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 49 | + !!(phy->muru_onoff & MUMIMO_DL); |
developer | f64861f | 2022-06-22 11:44:53 +0800 | [diff] [blame] | 50 | if (!is_mt7915(&dev->mt76)) |
| 51 | muru->cfg.mimo_ul_en = true; |
| 52 | muru->cfg.ofdma_dl_en = true; |
| 53 | |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 54 | + muru->cfg.mimo_ul_en = !!(phy->muru_onoff & MUMIMO_UL); |
| 55 | + muru->cfg.ofdma_dl_en = !!(phy->muru_onoff & OFDMA_DL); |
| 56 | + muru->cfg.ofdma_ul_en = !!(phy->muru_onoff & OFDMA_UL); |
developer | f64861f | 2022-06-22 11:44:53 +0800 | [diff] [blame] | 57 | + |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 58 | if (sta->deflink.vht_cap.vht_supported) |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 59 | muru->mimo_dl.vht_mu_bfee = |
developer | 6100db2 | 2023-04-05 13:22:26 +0800 | [diff] [blame] | 60 | !!(sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE); |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 61 | diff --git a/mt7915/mcu.h b/mt7915/mcu.h |
developer | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 62 | index 9a6a52a4..ac1109ea 100644 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 63 | --- a/mt7915/mcu.h |
| 64 | +++ b/mt7915/mcu.h |
developer | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 65 | @@ -647,4 +647,10 @@ struct csi_data { |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 66 | }; |
| 67 | #endif |
| 68 | |
| 69 | +/* MURU */ |
developer | 4721e25 | 2022-06-21 16:41:28 +0800 | [diff] [blame] | 70 | +#define OFDMA_DL BIT(0) |
| 71 | +#define OFDMA_UL BIT(1) |
| 72 | +#define MUMIMO_DL BIT(2) |
| 73 | +#define MUMIMO_UL BIT(3) |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 74 | + |
| 75 | #endif |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 76 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 77 | index 61a63744..f9f8c5de 100644 |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 78 | --- a/mt7915/mt7915.h |
| 79 | +++ b/mt7915/mt7915.h |
developer | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 80 | @@ -308,6 +308,8 @@ struct mt7915_phy { |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 81 | u32 rx_ampdu_ts; |
| 82 | u32 ampdu_ref; |
| 83 | |
| 84 | + u8 muru_onoff; |
| 85 | + |
| 86 | struct mib_stats mib; |
| 87 | struct mt76_channel_state state_ts; |
| 88 | |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 89 | diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c |
developer | 5bea732 | 2023-04-13 18:50:55 +0800 | [diff] [blame] | 90 | index 4bbb4100..1db1d87f 100644 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 91 | --- a/mt7915/mtk_debugfs.c |
| 92 | +++ b/mt7915/mtk_debugfs.c |
developer | d75d363 | 2023-01-05 14:31:01 +0800 | [diff] [blame] | 93 | @@ -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] | 94 | return 0; |
| 95 | } |
| 96 | |
| 97 | +static int mt7915_muru_onoff_get(void *data, u64 *val) |
| 98 | +{ |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 99 | + struct mt7915_phy *phy = data; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 100 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 101 | + *val = phy->muru_onoff; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 102 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 103 | + printk("mumimo ul:%d, mumimo dl:%d, ofdma ul:%d, ofdma dl:%d\n", |
| 104 | + !!(phy->muru_onoff & MUMIMO_UL), |
| 105 | + !!(phy->muru_onoff & MUMIMO_DL), |
| 106 | + !!(phy->muru_onoff & OFDMA_UL), |
| 107 | + !!(phy->muru_onoff & OFDMA_DL)); |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 108 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 109 | + return 0; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 110 | +} |
| 111 | + |
| 112 | +static int mt7915_muru_onoff_set(void *data, u64 val) |
| 113 | +{ |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 114 | + struct mt7915_phy *phy = data; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 115 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 116 | + if (val > 15) { |
| 117 | + printk("Wrong value! The value is between 0 ~ 15.\n"); |
| 118 | + goto exit; |
| 119 | + } |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 120 | + |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 121 | + phy->muru_onoff = val; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 122 | +exit: |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 123 | + return 0; |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 124 | +} |
| 125 | + |
| 126 | +DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_onoff, mt7915_muru_onoff_get, |
developer | 4721e25 | 2022-06-21 16:41:28 +0800 | [diff] [blame] | 127 | + mt7915_muru_onoff_set, "%llx\n"); |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 128 | + |
| 129 | static int mt7915_amsduinfo_read(struct seq_file *s, void *data) |
| 130 | { |
| 131 | struct mt7915_dev *dev = dev_get_drvdata(s->private); |
developer | 2324aa2 | 2023-04-12 11:30:15 +0800 | [diff] [blame] | 132 | @@ -3538,6 +3570,7 @@ int mt7915_mtk_init_debugfs(struct mt7915_phy *phy, struct dentry *dir) |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 133 | |
| 134 | mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, 0); |
| 135 | |
developer | eb2bd8e | 2023-02-09 11:16:04 +0800 | [diff] [blame] | 136 | + debugfs_create_file("muru_onoff", 0600, dir, phy, &fops_muru_onoff); |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 137 | debugfs_create_file("fw_debug_module", 0600, dir, dev, |
| 138 | &fops_fw_debug_module); |
| 139 | debugfs_create_file("fw_debug_level", 0600, dir, dev, |
| 140 | -- |
developer | 2324aa2 | 2023-04-12 11:30:15 +0800 | [diff] [blame] | 141 | 2.18.0 |
developer | e2cc0fa | 2022-03-29 17:31:03 +0800 | [diff] [blame] | 142 | |