blob: 9e7064405c1d7701ece11bfddc7957203288f9d9 [file] [log] [blame]
developer1a173672023-12-21 14:49:33 +08001From d83b800e9615b4d861fd79c5f71e26cd8d0c4141 Mon Sep 17 00:00:00 2001
developerbd9fa1e2023-10-16 11:04:00 +08002From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Fri, 22 Sep 2023 10:32:37 +0800
developer1a173672023-12-21 14:49:33 +08004Subject: [PATCH 23/23] mtk: wifi: mt76: mt7996: add preamble puncture support
5 for mt7996
developerbd9fa1e2023-10-16 11:04:00 +08006
7Add support configure preamble puncture feature through mcu commands.
8
9Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
10---
11 mt76_connac_mcu.h | 1 +
12 mt7996/mcu.c | 30 ++++++++++++++++++++++++++++++
13 mt7996/mcu.h | 4 ++++
14 mt7996/mt7996.h | 2 ++
15 4 files changed, 37 insertions(+)
16
17diff --git a/mt76_connac_mcu.h b/mt76_connac_mcu.h
developer1a173672023-12-21 14:49:33 +080018index 84e77fa0..823b3626 100644
developerbd9fa1e2023-10-16 11:04:00 +080019--- a/mt76_connac_mcu.h
20+++ b/mt76_connac_mcu.h
developer1a173672023-12-21 14:49:33 +080021@@ -1259,6 +1259,7 @@ enum {
developerbd9fa1e2023-10-16 11:04:00 +080022 MCU_UNI_CMD_CHANNEL_SWITCH = 0x34,
23 MCU_UNI_CMD_THERMAL = 0x35,
24 MCU_UNI_CMD_VOW = 0x37,
25+ MCU_UNI_CMD_PP = 0x38,
26 MCU_UNI_CMD_FIXED_RATE_TABLE = 0x40,
27 MCU_UNI_CMD_RRO = 0x57,
28 MCU_UNI_CMD_OFFCH_SCAN_CTRL = 0x58,
29diff --git a/mt7996/mcu.c b/mt7996/mcu.c
developer1a173672023-12-21 14:49:33 +080030index 475a5e18..deabdb1f 100644
developerbd9fa1e2023-10-16 11:04:00 +080031--- a/mt7996/mcu.c
32+++ b/mt7996/mcu.c
developer1a173672023-12-21 14:49:33 +080033@@ -4534,3 +4534,33 @@ int mt7996_mcu_set_txpower_sku(struct mt7996_phy *phy)
34 return mt76_mcu_skb_send_msg(&dev->mt76, skb,
35 MCU_WM_UNI_CMD(TXPOWER), true);
developerbd9fa1e2023-10-16 11:04:00 +080036 }
37+
38+int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, bool auto_mode,
39+ u8 force_bitmap_ctrl, u16 bitmap)
40+{
41+ struct mt7996_dev *dev = phy->dev;
42+ struct {
43+ u8 _rsv[4];
44+
45+ __le16 tag;
46+ __le16 len;
47+ bool mgmt_mode;
48+ u8 band_idx;
49+ u8 force_bitmap_ctrl;
50+ bool auto_mode;
51+ __le16 bitmap;
52+ u8 _rsv2[2];
53+ } __packed req = {
54+ .tag = cpu_to_le16(UNI_CMD_PP_EN_CTRL),
55+ .len = cpu_to_le16(sizeof(req) - 4),
56+
57+ .mgmt_mode = !auto_mode,
58+ .band_idx = phy->mt76->band_idx,
59+ .force_bitmap_ctrl = force_bitmap_ctrl,
60+ .auto_mode = auto_mode,
61+ .bitmap = cpu_to_le16(bitmap),
62+ };
63+
64+ return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(PP),
65+ &req, sizeof(req), false);
66+}
67diff --git a/mt7996/mcu.h b/mt7996/mcu.h
developer1a173672023-12-21 14:49:33 +080068index a9ba63d1..238c4c53 100644
developerbd9fa1e2023-10-16 11:04:00 +080069--- a/mt7996/mcu.h
70+++ b/mt7996/mcu.h
developer1a173672023-12-21 14:49:33 +080071@@ -923,6 +923,10 @@ enum {
developerbd9fa1e2023-10-16 11:04:00 +080072 MT7996_SEC_MODE_MAX,
73 };
74
75+enum {
76+ UNI_CMD_PP_EN_CTRL,
77+};
78+
79 #define MT7996_PATCH_SEC GENMASK(31, 24)
80 #define MT7996_PATCH_SCRAMBLE_KEY GENMASK(15, 8)
81 #define MT7996_PATCH_AES_KEY GENMASK(7, 0)
82diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
developer1a173672023-12-21 14:49:33 +080083index e1610d3b..4176e51a 100644
developerbd9fa1e2023-10-16 11:04:00 +080084--- a/mt7996/mt7996.h
85+++ b/mt7996/mt7996.h
developer1a173672023-12-21 14:49:33 +080086@@ -654,6 +654,8 @@ int mt7996_mcu_bcn_prot_enable(struct mt7996_dev *dev, struct ieee80211_vif *vif
developerbd9fa1e2023-10-16 11:04:00 +080087 int mt7996_mcu_wtbl_update_hdr_trans(struct mt7996_dev *dev,
88 struct ieee80211_vif *vif,
89 struct ieee80211_sta *sta);
90+int mt7996_mcu_set_pp_en(struct mt7996_phy *phy, bool auto_mode, u8 force_bitmap,
91+ u16 bitmap);
92 #ifdef CONFIG_MAC80211_DEBUGFS
93 void mt7996_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
94 struct ieee80211_sta *sta, struct dentry *dir);
95--
962.18.0
97