blob: 7b88df95402b3ed92ee12eec17e0be3aec1dfbf2 [file] [log] [blame]
developer7e2761e2023-10-12 08:11:13 +08001From ee2e6d4d137cadf56c1c102d73761f76fd97a6ea Mon Sep 17 00:00:00 2001
2From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Fri, 22 Sep 2023 10:32:37 +0800
4Subject: [PATCH 29/98] wifi: mt76: mt7996: add preamble puncture support for
5 mt7996
6
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
18index 8562ca4..6fac67b 100644
19--- a/mt76_connac_mcu.h
20+++ b/mt76_connac_mcu.h
21@@ -1241,6 +1241,7 @@ enum {
22 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
30index 39f76a0..60af1d4 100644
31--- a/mt7996/mcu.c
32+++ b/mt7996/mcu.c
33@@ -4308,3 +4308,33 @@ int mt7996_mcu_get_all_sta_info(struct mt7996_phy *phy, u16 tag)
34 return mt76_mcu_send_msg(&dev->mt76, MCU_WM_UNI_CMD(ALL_STA_INFO),
35 &req, sizeof(req), false);
36 }
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
68index 376931e..296acbd 100644
69--- a/mt7996/mcu.h
70+++ b/mt7996/mcu.h
71@@ -845,6 +845,10 @@ enum {
72 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
83index 31fa2b5..c4d74a0 100644
84--- a/mt7996/mt7996.h
85+++ b/mt7996/mt7996.h
86@@ -598,6 +598,8 @@ int mt7996_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif,
87 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