blob: fdd952ef2ac2103c1d525f1c4ec736876e07bf4b [file] [log] [blame]
From 8055630fc38101c33a667f4f1a31f6b301754130 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 123/193] mtk: mt76: mt7996: add per-band debugfs folder
Add per-band debugfs folder and move upstream debugfs knob to it.
Change-Id: I4bafff017c6d1264cffab18a5ac6748cc0661c8f
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 7e545f6..d2b38ef 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 252712d..e4fd6da 100644
--- a/mt7996/init.c
+++ b/mt7996/init.c
@@ -784,7 +784,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;
@@ -1725,6 +1725,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;
@@ -1749,10 +1757,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 9412147..ef41bee 100644
--- a/mt7996/mt7996.h
+++ b/mt7996/mt7996.h
@@ -1230,7 +1230,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.45.2