developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1 | From bfbeab14fc5c4a9caab56873328caee7fb407721 Mon Sep 17 00:00:00 2001 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 2 | From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 3 | Date: Thu, 16 May 2024 18:03:19 +0800 |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 123/223] mtk: mt76: mt7996: add per-band debugfs folder |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 5 | |
| 6 | Add per-band debugfs folder and move upstream debugfs knob to it. |
| 7 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 8 | Change-Id: I4bafff017c6d1264cffab18a5ac6748cc0661c8f |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 9 | Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 10 | --- |
| 11 | mt7996/debugfs.c | 43 +++++++++++++++++++++++++++++++------------ |
| 12 | mt7996/init.c | 14 +++++++++----- |
| 13 | mt7996/mt7996.h | 3 ++- |
| 14 | 3 files changed, 42 insertions(+), 18 deletions(-) |
| 15 | |
| 16 | diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 17 | index 7e545f61..d2b38efb 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 18 | --- a/mt7996/debugfs.c |
| 19 | +++ b/mt7996/debugfs.c |
| 20 | @@ -1073,21 +1073,49 @@ mt7996_airtime_read(struct seq_file *s, void *data) |
| 21 | return 0; |
| 22 | } |
| 23 | |
| 24 | -int mt7996_init_debugfs(struct mt7996_phy *phy) |
| 25 | +int mt7996_init_band_debugfs(struct mt7996_phy *phy) |
| 26 | { |
| 27 | struct mt7996_dev *dev = phy->dev; |
| 28 | struct dentry *dir; |
| 29 | + char dir_name[10]; |
| 30 | |
| 31 | - dir = mt76_register_debugfs_fops(phy->mt76, NULL); |
| 32 | + if (!dev->debugfs_dir) |
| 33 | + return -EINVAL; |
| 34 | + |
| 35 | + snprintf(dir_name, sizeof(dir_name), "band%d", phy->mt76->band_idx); |
| 36 | + |
| 37 | + dir = debugfs_create_dir(dir_name, dev->debugfs_dir); |
| 38 | if (!dir) |
| 39 | return -ENOMEM; |
| 40 | + |
| 41 | debugfs_create_file("hw-queues", 0400, dir, phy, |
| 42 | &mt7996_hw_queues_fops); |
| 43 | debugfs_create_file("xmit-queues", 0400, dir, phy, |
| 44 | &mt7996_xmit_queues_fops); |
| 45 | - debugfs_create_file("tx_stats", 0400, dir, phy, &mt7996_tx_stats_fops); |
| 46 | debugfs_create_file("sys_recovery", 0600, dir, phy, |
| 47 | &mt7996_sys_recovery_ops); |
| 48 | + debugfs_create_file("atf_enable", 0600, dir, phy, &fops_atf_enable); |
| 49 | + debugfs_create_file("tx_stats", 0400, dir, phy, &mt7996_tx_stats_fops); |
| 50 | + if (phy->mt76->cap.has_5ghz) { |
| 51 | + debugfs_create_u32("dfs_hw_pattern", 0400, dir, |
| 52 | + &dev->hw_pattern); |
| 53 | + debugfs_create_file("radar_trigger", 0200, dir, dev, |
| 54 | + &fops_radar_trigger); |
| 55 | + debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir, |
| 56 | + mt7996_rdd_monitor); |
| 57 | + } |
| 58 | + |
| 59 | + return 0; |
| 60 | +} |
| 61 | + |
| 62 | +int mt7996_init_dev_debugfs(struct mt7996_phy *phy) |
| 63 | +{ |
| 64 | + struct mt7996_dev *dev = phy->dev; |
| 65 | + struct dentry *dir; |
| 66 | + |
| 67 | + dir = mt76_register_debugfs_fops(phy->mt76, NULL); |
| 68 | + if (!dir) |
| 69 | + return -ENOMEM; |
| 70 | debugfs_create_file("fw_debug_wm", 0600, dir, dev, &fops_fw_debug_wm); |
| 71 | debugfs_create_file("fw_debug_wa", 0600, dir, dev, &fops_fw_debug_wa); |
| 72 | debugfs_create_file("fw_debug_bin", 0600, dir, dev, &fops_fw_debug_bin); |
| 73 | @@ -1103,18 +1131,9 @@ int mt7996_init_debugfs(struct mt7996_phy *phy) |
| 74 | debugfs_create_file("otp", 0400, dir, dev, &mt7996_efuse_ops); |
| 75 | debugfs_create_devm_seqfile(dev->mt76.dev, "vow_info", dir, |
| 76 | mt7996_vow_info_read); |
| 77 | - debugfs_create_file("atf_enable", 0600, dir, phy, &fops_atf_enable); |
| 78 | debugfs_create_devm_seqfile(dev->mt76.dev, "airtime", dir, |
| 79 | mt7996_airtime_read); |
| 80 | |
| 81 | - if (phy->mt76->cap.has_5ghz) { |
| 82 | - debugfs_create_u32("dfs_hw_pattern", 0400, dir, |
| 83 | - &dev->hw_pattern); |
| 84 | - debugfs_create_file("radar_trigger", 0200, dir, dev, |
| 85 | - &fops_radar_trigger); |
| 86 | - debugfs_create_devm_seqfile(dev->mt76.dev, "rdd_monitor", dir, |
| 87 | - mt7996_rdd_monitor); |
| 88 | - } |
| 89 | debugfs_create_file("fw_debug_muru_disable", 0600, dir, dev, |
| 90 | &fops_fw_debug_muru_disable); |
| 91 | |
| 92 | diff --git a/mt7996/init.c b/mt7996/init.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 93 | index e674361a..9a2e51f8 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 94 | --- a/mt7996/init.c |
| 95 | +++ b/mt7996/init.c |
| 96 | @@ -787,7 +787,7 @@ static int mt7996_register_phy(struct mt7996_dev *dev, struct mt7996_phy *phy, |
| 97 | goto error; |
| 98 | } |
| 99 | |
| 100 | - ret = mt7996_init_debugfs(phy); |
| 101 | + ret = mt7996_init_band_debugfs(phy); |
| 102 | if (ret) |
| 103 | goto error; |
| 104 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 105 | @@ -1728,6 +1728,14 @@ int mt7996_register_device(struct mt7996_dev *dev) |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 106 | if (ret) |
| 107 | return ret; |
| 108 | |
| 109 | + ret = mt7996_init_dev_debugfs(&dev->phy); |
| 110 | + if (ret) |
| 111 | + goto error; |
| 112 | + |
| 113 | + ret = mt7996_init_band_debugfs(&dev->phy); |
| 114 | + if (ret) |
| 115 | + goto error; |
| 116 | + |
| 117 | ret = mt7996_register_phy(dev, mt7996_phy2(dev), MT_BAND1); |
| 118 | if (ret) |
| 119 | return ret; |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 120 | @@ -1752,10 +1760,6 @@ int mt7996_register_device(struct mt7996_dev *dev) |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 121 | goto error; |
| 122 | } |
| 123 | |
| 124 | - ret = mt7996_init_debugfs(&dev->phy); |
| 125 | - if (ret) |
| 126 | - goto error; |
| 127 | - |
| 128 | ret = mt7996_coredump_register(dev); |
| 129 | if (ret) |
| 130 | goto error; |
| 131 | diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 132 | index 94121471..ef41beee 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 133 | --- a/mt7996/mt7996.h |
| 134 | +++ b/mt7996/mt7996.h |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 135 | @@ -1230,7 +1230,8 @@ int mt7996_dfs_init_radar_detector(struct mt7996_phy *phy); |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 136 | void mt7996_set_stream_he_eht_caps(struct mt7996_phy *phy); |
| 137 | void mt7996_set_stream_vht_txbf_caps(struct mt7996_phy *phy); |
| 138 | void mt7996_update_channel(struct mt76_phy *mphy); |
| 139 | -int mt7996_init_debugfs(struct mt7996_phy *phy); |
| 140 | +int mt7996_init_dev_debugfs(struct mt7996_phy *phy); |
| 141 | +int mt7996_init_band_debugfs(struct mt7996_phy *phy); |
| 142 | void mt7996_debugfs_rx_fw_monitor(struct mt7996_dev *dev, const void *data, int len); |
| 143 | bool mt7996_debugfs_rx_log(struct mt7996_dev *dev, const void *data, int len); |
| 144 | int mt7996_mcu_add_key(struct mt76_dev *dev, struct mt7996_bss_conf *mconf, |
| 145 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 146 | 2.45.2 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 147 | |