blob: a6b71d54105702120aba1ee6941624f4f53181ab [file] [log] [blame]
developerdad89a32024-04-29 14:17:17 +08001From 0df14b3d2578681009ca9be604e98bb94ee1186a Mon Sep 17 00:00:00 2001
developer963a66b2023-04-11 13:34:56 +08002From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Fri, 24 Feb 2023 16:29:42 +0800
developerdad89a32024-04-29 14:17:17 +08004Subject: [PATCH] wifi: mt76: mt7915: disable SW-ACI by default
developer963a66b2023-04-11 13:34:56 +08005
6Support to enable/disable SW-ACI by module parameter "sw_aci_enable".
7SW-ACI feature is disable by default.
8---
9 mt7915/main.c | 8 ++++++++
10 mt7915/mcu.c | 15 +++++++++++++++
11 mt7915/mt7915.h | 1 +
12 mt7915/mtk_debugfs.c | 14 +++++---------
13 4 files changed, 29 insertions(+), 9 deletions(-)
14
15diff --git a/mt7915/main.c b/mt7915/main.c
developerdad89a32024-04-29 14:17:17 +080016index b80d6fd..2ff7667 100644
developer963a66b2023-04-11 13:34:56 +080017--- a/mt7915/main.c
18+++ b/mt7915/main.c
19@@ -8,6 +8,10 @@
20 #include "mt7915.h"
21 #include "mcu.h"
22
23+static bool sw_aci_enable = false;
24+module_param(sw_aci_enable, bool, 0644);
25+MODULE_PARM_DESC(sw_aci_enable, "Enable the feature of Adjacent Channel Interference Detection");
26+
27 static bool mt7915_dev_running(struct mt7915_dev *dev)
28 {
29 struct mt7915_phy *phy;
30@@ -41,6 +45,10 @@ int mt7915_run(struct ieee80211_hw *hw)
31 goto out;
32
33 mt7915_mac_enable_nf(dev, dev->phy.mt76->band_idx);
34+
35+ ret = mt7915_mcu_sw_aci_set(dev, sw_aci_enable);
36+ if (ret)
37+ goto out;
38 }
39
40 if (phy != &dev->phy) {
41diff --git a/mt7915/mcu.c b/mt7915/mcu.c
developerdad89a32024-04-29 14:17:17 +080042index 5534603..e95a5d7 100644
developer963a66b2023-04-11 13:34:56 +080043--- a/mt7915/mcu.c
44+++ b/mt7915/mcu.c
developerdad89a32024-04-29 14:17:17 +080045@@ -5223,6 +5223,21 @@ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value)
developer963a66b2023-04-11 13:34:56 +080046 return 0;
47 }
developerdad89a32024-04-29 14:17:17 +080048
developer963a66b2023-04-11 13:34:56 +080049+int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val)
50+{
51+#define SWLNA_ENABLE 6
52+ struct {
53+ u32 subcmd;
54+ u8 enable;
55+ } req = {
56+ .subcmd = SWLNA_ENABLE,
57+ .enable = val ? 1 : 0,
58+ };
59+
60+ return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SWLNA_ACI_CTRL), &req,
61+ sizeof(req), NULL);
62+}
developerdad89a32024-04-29 14:17:17 +080063+
64 int mt7915_mcu_set_qos_map(struct mt7915_dev *dev, struct ieee80211_vif *vif)
65 {
66 #define IP_DSCP_NUM 64
developer963a66b2023-04-11 13:34:56 +080067diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
developerdad89a32024-04-29 14:17:17 +080068index 9e7183c..c8b697c 100644
developer963a66b2023-04-11 13:34:56 +080069--- a/mt7915/mt7915.h
70+++ b/mt7915/mt7915.h
developerdad89a32024-04-29 14:17:17 +080071@@ -783,6 +783,7 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
developer963a66b2023-04-11 13:34:56 +080072 #endif
73 int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation);
74 int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
75+int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val);
76 int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp);
77 int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
78
79diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
developerdad89a32024-04-29 14:17:17 +080080index 8f2f496..ad7abda 100644
developer963a66b2023-04-11 13:34:56 +080081--- a/mt7915/mtk_debugfs.c
82+++ b/mt7915/mtk_debugfs.c
developera46f6132024-03-26 14:09:54 +080083@@ -3773,16 +3773,12 @@ static int mt7915_show_eeprom_mode(struct seq_file *s, void *data)
developer963a66b2023-04-11 13:34:56 +080084 static int
85 mt7915_sw_aci_set(void *data, u64 val)
86 {
87-#define SWLNA_ENABLE 6
88 struct mt7915_dev *dev = data;
89- struct {
90- u32 subcmd;
91- u8 enable;
92- } req = {
93- .subcmd = SWLNA_ENABLE,
94- .enable = (u8) val,
95- };
96- return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SWLNA_ACI_CTRL), &req, sizeof(req), NULL);
97+
98+ if (val > 1)
99+ return -EINVAL;
100+
101+ return mt7915_mcu_sw_aci_set(dev, !!val);
102 }
103
104
105--
developerbd9fa1e2023-10-16 11:04:00 +08001062.18.0
developer963a66b2023-04-11 13:34:56 +0800107