blob: d82f9b3447e49bdbb5819f8e0045ee459ad11629 [file] [log] [blame]
From 84c119a7ad5969f445513f9c5759f8b041620e1f Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Thu, 16 May 2024 18:03:19 +0800
Subject: [PATCH 135/199] mtk: mt76: mt7996: add per-band debugfs folder
Add per-band debugfs folder and move upstream debugfs knob to it.
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
mt7996/debugfs.c | 43 +++++++++++++++++++++++++++++++------------
mt7996/init.c | 14 +++++++++-----
mt7996/mt7996.h | 3 ++-
3 files changed, 42 insertions(+), 18 deletions(-)
diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
index 2c553cf3..9d74f659 100644
--- a/mt7996/debugfs.c
+++ b/mt7996/debugfs.c
@@ -1073,21 +1073,49 @@ mt7996_airtime_read(struct seq_file *s, void *data)
return 0;
}
-int mt7996_init_debugfs(struct mt7996_phy *phy)
+int mt7996_init_band_debugfs(struct mt7996_phy *phy)
{
struct mt7996_dev *dev = phy->dev;
struct dentry *dir;
+ char dir_name[10];
- dir = mt76_register_debugfs_fops(phy->mt76, NULL);
+ if (!dev->debugfs_dir)
+ return -EINVAL;
+
+ snprintf(dir_name, sizeof(dir_name), "band%d", phy->mt76->band_idx);
+
+ dir = debugfs_create_dir(dir_name, dev->debugfs_dir);
if (!dir)
return -ENOMEM;
+
debugfs_create_file("hw-queues", 0400, dir, phy,
&mt7996_hw_queues_fops);
debugfs_create_file("xmit-queues", 0400, dir, phy,
&mt7996_xmit_queues_fops);
- debugfs_create_file("tx_stats", 0400, dir, phy, &mt7996_tx_stats_fops);
debugfs_create_file("sys_recovery", 0600, dir, phy,
&mt7996_sys_recovery_ops);
+ debugfs_create_file("atf_enable", 0600, dir, phy, &fops_atf_enable);
+ debugfs_create_file("tx_stats", 0400, dir, phy, &mt7996_tx_stats_fops);
+ if (phy->mt76->cap.has_5ghz) {
+ debugfs_create_u32("dfs_hw_pattern", 0400, dir,
+ &dev->hw_pattern);
+ debugfs_create_file("radar_trigger", 0200, dir, dev,
+ &fops_radar_trigger);
+ debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir,
+ mt7996_rdd_monitor);
+ }
+
+ return 0;
+}
+
+int mt7996_init_dev_debugfs(struct mt7996_phy *phy)
+{
+ struct mt7996_dev *dev = phy->dev;
+ struct dentry *dir;
+
+ dir = mt76_register_debugfs_fops(phy->mt76, NULL);
+ if (!dir)
+ return -ENOMEM;
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("fw_debug_bin", 0600, dir, dev, &fops_fw_debug_bin);
@@ -1103,18 +1131,9 @@ int mt7996_init_debugfs(struct mt7996_phy *phy)
debugfs_create_file("otp", 0400, dir, dev, &mt7996_efuse_ops);
debugfs_create_devm_seqfile(dev->mt76.dev, "vow_info", dir,
mt7996_vow_info_read);
- debugfs_create_file("atf_enable", 0600, dir, phy, &fops_atf_enable);
debugfs_create_devm_seqfile(dev->mt76.dev, "airtime", dir,
mt7996_airtime_read);
- if (phy->mt76->cap.has_5ghz) {
- debugfs_create_u32("dfs_hw_pattern", 0400, dir,
- &dev->hw_pattern);
- debugfs_create_file("radar_trigger", 0200, dir, dev,
- &fops_radar_trigger);
- debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir,
- mt7996_rdd_monitor);
- }
debugfs_create_file("fw_debug_muru_disable", 0600, dir, dev,
&fops_fw_debug_muru_disable);
diff --git a/mt7996/init.c b/mt7996/init.c
index 6e20a174..01795404 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
@@ -787,7 +787,7 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy,
goto error;
}
- ret = mt7996_init_debugfs(phy);
+ ret = mt7996_init_band_debugfs(phy);
if (ret)
goto error;
@@ -1708,6 +1708,14 @@ int mt7996_register_device(struct mt7996_dev *dev)
if (ret)
return ret;
+ ret = mt7996_init_dev_debugfs(&dev->phy);
+ if (ret)
+ goto error;
+
+ ret = mt7996_init_band_debugfs(&dev->phy);
+ if (ret)
+ goto error;
+
ret = mt7996_register_phy(dev, mt7996_phy2(dev), MT_BAND1);
if (ret)
return ret;
@@ -1732,10 +1740,6 @@ int mt7996_register_device(struct mt7996_dev *dev)
goto error;
}
- ret = mt7996_init_debugfs(&dev->phy);
- if (ret)
- goto error;
-
ret = mt7996_coredump_register(dev);
if (ret)
goto error;
diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
index c60262ec..08a43e61 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -1226,7 +1226,8 @@ int mt7996_dfs_init_radar_detector(struct mt7996_phy *phy);
void mt7996_set_stream_he_eht_caps(struct mt7996_phy *phy);
void mt7996_set_stream_vht_txbf_caps(struct mt7996_phy *phy);
void mt7996_update_channel(struct mt76_phy *mphy);
-int mt7996_init_debugfs(struct mt7996_phy *phy);
+int mt7996_init_dev_debugfs(struct mt7996_phy *phy);
+int mt7996_init_band_debugfs(struct mt7996_phy *phy);
void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int len);
bool mt7996_debugfs_rx_log(struct mt7996_dev *dev, const void *data, int len);
int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf,
--
2.18.0