developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From 252b23b1e979d3b44ca148407d0166c9b618c9e2 Mon Sep 17 00:00:00 2001 |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Fri, 24 Feb 2023 16:29:42 +0800 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 4 | Subject: [PATCH 1026/1052] wifi: mt76: mt7915: disable SW-ACI by default |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 5 | |
| 6 | Support to enable/disable SW-ACI by module parameter "sw_aci_enable". |
| 7 | SW-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 | |
| 15 | diff --git a/mt7915/main.c b/mt7915/main.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 16 | index 4a5a0155..75042189 100644 |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 17 | --- 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) { |
| 41 | diff --git a/mt7915/mcu.c b/mt7915/mcu.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 42 | index ca18acfb..7a7b3bac 100644 |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 43 | --- a/mt7915/mcu.c |
| 44 | +++ b/mt7915/mcu.c |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 45 | @@ -5222,3 +5222,18 @@ int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value) |
| 46 | |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 47 | return 0; |
| 48 | } |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 49 | + |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 50 | +int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val) |
| 51 | +{ |
| 52 | +#define SWLNA_ENABLE 6 |
| 53 | + struct { |
| 54 | + u32 subcmd; |
| 55 | + u8 enable; |
| 56 | + } req = { |
| 57 | + .subcmd = SWLNA_ENABLE, |
| 58 | + .enable = val ? 1 : 0, |
| 59 | + }; |
| 60 | + |
| 61 | + return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SWLNA_ACI_CTRL), &req, |
| 62 | + sizeof(req), NULL); |
| 63 | +} |
| 64 | diff --git a/mt7915/mt7915.h b/mt7915/mt7915.h |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 65 | index 82d374eb..3fa32574 100644 |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 66 | --- a/mt7915/mt7915.h |
| 67 | +++ b/mt7915/mt7915.h |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 68 | @@ -801,6 +801,7 @@ int mt7915_vendor_amnt_sta_remove(struct mt7915_phy *phy, |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 69 | #endif |
| 70 | int mt7915_mcu_set_edcca(struct mt7915_phy *phy, int mode, u8 *value, s8 compensation); |
| 71 | int mt7915_mcu_get_edcca(struct mt7915_phy *phy, u8 mode, s8 *value); |
| 72 | +int mt7915_mcu_sw_aci_set(struct mt7915_dev *dev, bool val); |
| 73 | int mt7915_mcu_ipi_hist_ctrl(struct mt7915_phy *phy, void *data, u8 cmd, bool wait_resp); |
| 74 | int mt7915_mcu_ipi_hist_scan(struct mt7915_phy *phy, void *data, u8 mode, bool wait_resp); |
| 75 | |
| 76 | diff --git a/mt7915/mtk_debugfs.c b/mt7915/mtk_debugfs.c |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 77 | index 3e84d753..d9323603 100644 |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 78 | --- a/mt7915/mtk_debugfs.c |
| 79 | +++ b/mt7915/mtk_debugfs.c |
developer | a46f613 | 2024-03-26 14:09:54 +0800 | [diff] [blame] | 80 | @@ -3773,16 +3773,12 @@ static int mt7915_show_eeprom_mode(struct seq_file *s, void *data) |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 81 | static int |
| 82 | mt7915_sw_aci_set(void *data, u64 val) |
| 83 | { |
| 84 | -#define SWLNA_ENABLE 6 |
| 85 | struct mt7915_dev *dev = data; |
| 86 | - struct { |
| 87 | - u32 subcmd; |
| 88 | - u8 enable; |
| 89 | - } req = { |
| 90 | - .subcmd = SWLNA_ENABLE, |
| 91 | - .enable = (u8) val, |
| 92 | - }; |
| 93 | - return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(SWLNA_ACI_CTRL), &req, sizeof(req), NULL); |
| 94 | + |
| 95 | + if (val > 1) |
| 96 | + return -EINVAL; |
| 97 | + |
| 98 | + return mt7915_mcu_sw_aci_set(dev, !!val); |
| 99 | } |
| 100 | |
| 101 | |
| 102 | -- |
developer | bd9fa1e | 2023-10-16 11:04:00 +0800 | [diff] [blame] | 103 | 2.18.0 |
developer | 963a66b | 2023-04-11 13:34:56 +0800 | [diff] [blame] | 104 | |