diff options
author | Shayne Chen <shayne.chen@mediatek.com> | 2021-10-21 19:38:39 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2021-10-23 13:23:44 +0200 |
commit | 9b121acd4e853c9cfb8b11c014435e6cbb3e25f6 (patch) | |
tree | b07c79af2665b6cf4f50f698452bc9bba77fb236 /drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | |
parent | mt76: mt7915: fix endiannes warning mt7915_mcu_beacon_check_caps (diff) | |
download | linux-9b121acd4e853c9cfb8b11c014435e6cbb3e25f6.tar.xz linux-9b121acd4e853c9cfb8b11c014435e6cbb3e25f6.zip |
mt76: mt7915: add WA firmware log support
Support to turn on/off WA firmware log from debugfs.
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c index 4bd2a5c7f72d..182cc6cf095e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c @@ -82,7 +82,7 @@ DEFINE_DEBUGFS_ATTRIBUTE(fops_radar_trigger, NULL, mt7915_radar_trigger, "%lld\n"); static int -mt7915_fw_debug_set(void *data, u64 val) +mt7915_fw_debug_wm_set(void *data, u64 val) { struct mt7915_dev *dev = data; enum { @@ -92,29 +92,58 @@ mt7915_fw_debug_set(void *data, u64 val) DEBUG_SPL, DEBUG_RPT_RX, } debug; + int ret; - dev->fw_debug = !!val; + dev->fw_debug_wm = val ? MCU_FW_LOG_TO_HOST : 0; - mt7915_mcu_fw_log_2_host(dev, dev->fw_debug ? 2 : 0); + ret = mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WM, dev->fw_debug_wm); + if (ret) + return ret; - for (debug = DEBUG_TXCMD; debug <= DEBUG_RPT_RX; debug++) - mt7915_mcu_fw_dbg_ctrl(dev, debug, dev->fw_debug); + for (debug = DEBUG_TXCMD; debug <= DEBUG_RPT_RX; debug++) { + ret = mt7915_mcu_fw_dbg_ctrl(dev, debug, !!dev->fw_debug_wm); + if (ret) + return ret; + } return 0; } static int -mt7915_fw_debug_get(void *data, u64 *val) +mt7915_fw_debug_wm_get(void *data, u64 *val) +{ + struct mt7915_dev *dev = data; + + *val = dev->fw_debug_wm; + + return 0; +} + +DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug_wm, mt7915_fw_debug_wm_get, + mt7915_fw_debug_wm_set, "%lld\n"); + +static int +mt7915_fw_debug_wa_set(void *data, u64 val) +{ + struct mt7915_dev *dev = data; + + dev->fw_debug_wa = val ? MCU_FW_LOG_TO_HOST : 0; + + return mt7915_mcu_fw_log_2_host(dev, MCU_FW_LOG_WA, dev->fw_debug_wa); +} + +static int +mt7915_fw_debug_wa_get(void *data, u64 *val) { struct mt7915_dev *dev = data; - *val = dev->fw_debug; + *val = dev->fw_debug_wa; return 0; } -DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug, mt7915_fw_debug_get, - mt7915_fw_debug_set, "%lld\n"); +DEFINE_DEBUGFS_ATTRIBUTE(fops_fw_debug_wa, mt7915_fw_debug_wa_get, + mt7915_fw_debug_wa_set, "%lld\n"); static void mt7915_ampdu_stat_read_phy(struct mt7915_phy *phy, @@ -460,7 +489,8 @@ int mt7915_init_debugfs(struct mt7915_phy *phy) debugfs_create_file("xmit-queues", 0400, dir, phy, &mt7915_xmit_queues_fops); debugfs_create_file("tx_stats", 0400, dir, phy, &mt7915_tx_stats_fops); - debugfs_create_file("fw_debug", 0600, dir, dev, &fops_fw_debug); + debugfs_create_file("fw_debug_wm", 0600, dir, dev, &fops_fw_debug_wm); + debugfs_create_file("fw_debug_wa", 0600, dir, dev, &fops_fw_debug_wa); debugfs_create_file("implicit_txbf", 0600, dir, dev, &fops_implicit_txbf); debugfs_create_file("txpower_sku", 0400, dir, phy, |