blob: e96992e5ce05f794ced27a5005961b77fdf44c1b [file] [log] [blame]
From 7f50bd85cb6e13254fa6e72667e1b34599c64f27 Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Fri, 24 Feb 2023 16:29:42 +0800
Subject: [PATCH] wifi: mt76: mt7915: disable SW-ACI by default
Support to enable/disable SW-ACI by module parameter "sw_aci_enable".
SW-ACI feature is disable by default.
---
mt7915/main.c | 8 ++++++++
mt7915/mcu.c | 15 +++++++++++++++
mt7915/mt7915.h | 1 +
mt7915/mtk_debugfs.c | 14 +++++---------
4 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/mt7915/main.c b/mt7915/main.c
index 9fa01e9..05076b3 100644
--- a/mt7915/main.c
+++ b/mt7915/main.c
@@ -8,6 +8,10 @@
#include "mt7915.h"
#include "mcu.h"
+static bool sw_aci_enable = false;
+module_param(sw_aci_enable, bool, 0644);
+MODULE_PARM_DESC(sw_aci_enable, "Enable the feature of Adjacent Channel Interference Detection");
+
static bool mt7915_dev_running(struct mt7915_dev *dev)
{
struct mt7915_phy *phy;
@@ -41,6 +45,10 @@ int mt7915_run(struct ieee80211_hw *hw)
goto out;
mt7915_mac_enable_nf(dev, dev->phy.mt76->band_idx);
+
+ ret = mt7915_mcu_sw_aci_set(dev, sw_aci_enable);
+ if (ret)
+ goto out;
}
if (phy != &dev->phy) {
diff --git a/mt7915/mcu.c b/mt7915/mcu.c
index 8e895b3..236f666 100644
--- a/mt7915/mcu.c
+++ b/mt7915/mcu.c
@@ -5222,3 +5222,18 @@ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value)
return 0;
}
+
+int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val)
+{
+#define SWLNA_ENABLE 6
+ struct {
+ u32 subcmd;
+ u8 enable;
+ } req = {
+ .subcmd = SWLNA_ENABLE,
+ .enable = val ? 1 : 0,
+ };
+
+ return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SWLNA_ACI_CTRL), &req,
+ sizeof(req), NULL);
+}
diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h
index 82d374e..3fa3257 100644
--- a/mt7915/mt7915.h
+++ b/mt7915/mt7915.h
@@ -801,6 +801,7 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy,
#endif
int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation);
int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value);
+int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val);
int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp);
int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp);
diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c
index 3e84d75..d932360 100644
--- a/mt7915/mtk_debugfs.c
+++ b/mt7915/mtk_debugfs.c
@@ -3773,16 +3773,12 @@ static int mt7915_show_eeprom_mode(struct seq_file *s, void *data)
static int
mt7915_sw_aci_set(void *data, u64 val)
{
-#define SWLNA_ENABLE 6
struct mt7915_dev *dev = data;
- struct {
- u32 subcmd;
- u8 enable;
- } req = {
- .subcmd = SWLNA_ENABLE,
- .enable = (u8) val,
- };
- return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SWLNA_ACI_CTRL), &req, sizeof(req), NULL);
+
+ if (val > 1)
+ return -EINVAL;
+
+ return mt7915_mcu_sw_aci_set(dev, !!val);
}
--
2.18.0