blob: b8a705e04dbd2bbafa3af76be3a5b6722c1421c9 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 729686d815e03189a23d2f0a987289eb34ac7676 Mon Sep 17 00:00:00 2001
2From: Peter Chiu <chui-hao.chiu@mediatek.com>
3Date: Thu, 16 May 2024 18:04:28 +0800
4Subject: [PATCH 136/199] mtk: mt76: mt7996: move internal debugfs knob to
5 per-band folder
6
7Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
8---
9 mt7996/debugfs.c | 5 +-
10 mt7996/mt7996.h | 3 +-
11 mt7996/mtk_debugfs.c | 117 ++++++++++++++-----------------------------
12 3 files changed, 44 insertions(+), 81 deletions(-)
13
14diff --git a/mt7996/debugfs.c b/mt7996/debugfs.c
15index 9d74f659..71dc0449 100644
16--- a/mt7996/debugfs.c
17+++ b/mt7996/debugfs.c
18@@ -1105,6 +1105,9 @@ int mt7996_init_band_debugfs(struct mt7996_phy *phy)
19 mt7996_rdd_monitor);
20 }
21
22+#ifdef CONFIG_MTK_DEBUG
23+ mt7996_mtk_init_band_debugfs(phy, dir);
24+#endif
25 return 0;
26 }
27
28@@ -1146,7 +1149,7 @@ int mt7996_init_dev_debugfs(struct mt7996_phy *phy)
29
30 #ifdef CONFIG_MTK_DEBUG
31 debugfs_create_u16("wlan_idx", 0600, dir, &dev->wlan_idx);
32- mt7996_mtk_init_debugfs(phy, dir);
33+ mt7996_mtk_init_dev_debugfs(dev, dir);
34 #endif
35
36 return 0;
37diff --git a/mt7996/mt7996.h b/mt7996/mt7996.h
38index 08a43e61..cb35a927 100644
39--- a/mt7996/mt7996.h
40+++ b/mt7996/mt7996.h
41@@ -1286,7 +1286,8 @@ enum edcca_bw_id {
42 };
43
44 #ifdef CONFIG_MTK_DEBUG
45-int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir);
46+void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir);
47+void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir);
48 int mt7996_mcu_muru_dbg_info(struct mt7996_dev *dev, u16 item, u8 val);
49 int mt7996_mcu_set_sr_enable(struct mt7996_phy *phy, u8 action, u64 val, bool set);
50 void mt7996_mcu_rx_sr_event(struct mt7996_dev *dev, struct sk_buff *skb);
51diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
52index 0820e0d0..59c6db73 100644
53--- a/mt7996/mtk_debugfs.c
54+++ b/mt7996/mtk_debugfs.c
55@@ -14,13 +14,14 @@
56 #ifdef CONFIG_MTK_DEBUG
57
58 /* AGG INFO */
59-static int
60-mt7996_agginfo_read_per_band(struct seq_file *s, int band_idx)
61+static int mt7996_agginfo_show(struct seq_file *s, void *data)
62 {
63- struct mt7996_dev *dev = dev_get_drvdata(s->private);
64+ struct mt7996_phy *phy = s->private;
65+ struct mt7996_dev *dev = phy->dev;
66 u64 total_burst, total_ampdu, ampdu_cnt[16];
67 u32 value, idx, row_idx, col_idx, start_range, agg_rang_sel[16], burst_cnt[16], band_offset = 0;
68 u8 partial_str[16] = {}, full_str[64] = {};
69+ u8 band_idx = phy->mt76->band_idx;
70
71 switch (band_idx) {
72 case 0:
73@@ -204,24 +205,7 @@ mt7996_agginfo_read_per_band(struct seq_file *s, int band_idx)
74
75 return 0;
76 }
77-
78-static int mt7996_agginfo_read_band0(struct seq_file *s, void *data)
79-{
80- mt7996_agginfo_read_per_band(s, MT_BAND0);
81- return 0;
82-}
83-
84-static int mt7996_agginfo_read_band1(struct seq_file *s, void *data)
85-{
86- mt7996_agginfo_read_per_band(s, MT_BAND1);
87- return 0;
88-}
89-
90-static int mt7996_agginfo_read_band2(struct seq_file *s, void *data)
91-{
92- mt7996_agginfo_read_per_band(s, MT_BAND2);
93- return 0;
94-}
95+DEFINE_SHOW_ATTRIBUTE(mt7996_agginfo);
96
97 /* AMSDU INFO */
98 static int mt7996_amsdu_result_read(struct seq_file *s, void *data)
99@@ -704,10 +688,12 @@ static int mt7996_trinfo_read(struct seq_file *s, void *data)
100 }
101
102 /* MIB INFO */
103-static int mt7996_mibinfo_read_per_band(struct seq_file *s, int band_idx)
104+static int mt7996_mibinfo_show(struct seq_file *s, void *data)
105 {
106 #define BSS_NUM 4
107- struct mt7996_dev *dev = dev_get_drvdata(s->private);
108+ struct mt7996_phy *phy = s->private;
109+ struct mt7996_dev *dev = phy->dev;
110+ u8 band_idx = phy->mt76->band_idx;
111 u8 bss_nums = BSS_NUM;
112 u32 idx;
113 u32 mac_val, band_offset = 0, band_offset_umib = 0;
114@@ -920,24 +906,7 @@ static int mt7996_mibinfo_read_per_band(struct seq_file *s, int band_idx)
115
116 return 0;
117 }
118-
119-static int mt7996_mibinfo_band0(struct seq_file *s, void *data)
120-{
121- mt7996_mibinfo_read_per_band(s, MT_BAND0);
122- return 0;
123-}
124-
125-static int mt7996_mibinfo_band1(struct seq_file *s, void *data)
126-{
127- mt7996_mibinfo_read_per_band(s, MT_BAND1);
128- return 0;
129-}
130-
131-static int mt7996_mibinfo_band2(struct seq_file *s, void *data)
132-{
133- mt7996_mibinfo_read_per_band(s, MT_BAND2);
134- return 0;
135-}
136+DEFINE_SHOW_ATTRIBUTE(mt7996_mibinfo);
137
138 /* WTBL INFO */
139 static int
140@@ -3036,9 +3005,9 @@ static const struct file_operations fops_muru_fixed_group_rate = {
141
142 static int mt7996_muru_prot_thr_set(void *data, u64 val)
143 {
144- struct mt7996_phy *phy = data;
145+ struct mt7996_dev *dev = data;
146
147- return mt7996_mcu_muru_set_prot_frame_thr(phy->dev, (u32)val);
148+ return mt7996_mcu_muru_set_prot_frame_thr(dev, (u32)val);
149 }
150
151 DEFINE_DEBUGFS_ATTRIBUTE(fops_muru_prot_thr, NULL,
152@@ -4219,9 +4188,32 @@ mt7996_drr_info(struct seq_file *s, void *data)
153 return 0;
154 }
155
156-int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
157+void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
158+{
159+ /* agg */
160+ debugfs_create_file("agginfo", 0400, dir, phy, &mt7996_agginfo_fops);
161+ debugfs_create_file("mibinfo", 0400, dir, phy, &mt7996_mibinfo_fops);
162+ debugfs_create_file("txpower_level", 0600, dir, phy, &fops_txpower_level);
163+ debugfs_create_file("txpower_info", 0600, dir, phy, &mt7996_txpower_info_fops);
164+ debugfs_create_file("txpower_sku", 0600, dir, phy, &mt7996_txpower_sku_fops);
165+ debugfs_create_file("txpower_path", 0600, dir, phy, &mt7996_txpower_path_fops);
166+
167+ debugfs_create_file("sr_enable", 0600, dir, phy, &fops_sr_enable);
168+ debugfs_create_file("sr_enhanced_enable", 0600, dir, phy, &fops_sr_enhanced_enable);
169+ debugfs_create_file("sr_stats", 0400, dir, phy, &mt7996_sr_stats_fops);
170+ debugfs_create_file("sr_scene_cond", 0400, dir, phy, &mt7996_sr_scene_cond_fops);
171+
172+ debugfs_create_file("bf_txsnd_info", 0600, dir, phy, &fops_bf_txsnd_info);
173+ debugfs_create_file("bf_starec_read", 0600, dir, phy, &fops_starec_bf_read);
174+ debugfs_create_file("bf_fbk_rpt", 0600, dir, phy, &fops_bf_fbk_rpt);
175+ debugfs_create_file("pfmu_tag_read", 0600, dir, phy, &fops_bf_pfmu_tag_read);
176+
177+ debugfs_create_file("thermal_enable", 0600, dir, phy, &fops_thermal_enable);
178+ debugfs_create_file("scs_enable", 0200, dir, phy, &fops_scs_enable);
179+}
180+
181+void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
182 {
183- struct mt7996_dev *dev = phy->dev;
184 u32 device_id = (dev->mt76.rev) >> 16;
185 int i = 0;
186 static const struct mt7996_dbg_reg_desc dbg_reg_s[] = {
187@@ -4246,13 +4238,6 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
188 WTBL_LMAC_DW9 = WTBL_LMAC_DW9_7992;
189 }
190
191- /* agg */
192- debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info0", dir,
193- mt7996_agginfo_read_band0);
194- debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info1", dir,
195- mt7996_agginfo_read_band1);
196- debugfs_create_devm_seqfile(dev->mt76.dev, "agg_info2", dir,
197- mt7996_agginfo_read_band2);
198 /* amsdu */
199 debugfs_create_devm_seqfile(dev->mt76.dev, "amsdu_info", dir,
200 mt7996_amsdu_result_read);
201@@ -4270,24 +4255,12 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
202 debugfs_create_devm_seqfile(dev->mt76.dev, "fw_wm_info", dir,
203 mt7996_fw_wm_info_read);
204
205- debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info0", dir,
206- mt7996_mibinfo_band0);
207- debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info1", dir,
208- mt7996_mibinfo_band1);
209- debugfs_create_devm_seqfile(dev->mt76.dev, "mib_info2", dir,
210- mt7996_mibinfo_band2);
211-
212 debugfs_create_devm_seqfile(dev->mt76.dev, "sta_info", dir,
213 mt7996_sta_info);
214
215 debugfs_create_devm_seqfile(dev->mt76.dev, "tr_info", dir,
216 mt7996_trinfo_read);
217
218- debugfs_create_file("txpower_level", 0600, dir, phy, &fops_txpower_level);
219- debugfs_create_file("txpower_info", 0600, dir, phy, &mt7996_txpower_info_fops);
220- debugfs_create_file("txpower_sku", 0600, dir, phy, &mt7996_txpower_sku_fops);
221- debugfs_create_file("txpower_path", 0600, dir, phy, &mt7996_txpower_path_fops);
222-
223 debugfs_create_devm_seqfile(dev->mt76.dev, "eeprom_mode", dir,
224 mt7996_show_eeprom_mode);
225
226@@ -4300,23 +4273,12 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
227
228 dev->dbg.sku_disable = true; /* For SQC */
229 debugfs_create_u8("sku_disable", 0600, dir, &dev->dbg.sku_disable);
230- debugfs_create_file("scs_enable", 0200, dir, phy, &fops_scs_enable);
231-
232- debugfs_create_file("sr_enable", 0600, dir, phy, &fops_sr_enable);
233- debugfs_create_file("sr_enhanced_enable", 0600, dir, phy, &fops_sr_enhanced_enable);
234- debugfs_create_file("sr_stats", 0400, dir, phy, &mt7996_sr_stats_fops);
235- debugfs_create_file("sr_scene_cond", 0400, dir, phy, &mt7996_sr_scene_cond_fops);
236
237+ debugfs_create_file("muru_prot_thr", 0200, dir, dev, &fops_muru_prot_thr);
238 debugfs_create_file("muru_fixed_rate_enable", 0600, dir, dev,
239 &fops_muru_fixed_rate_enable);
240 debugfs_create_file("muru_fixed_group_rate", 0600, dir, dev,
241 &fops_muru_fixed_group_rate);
242- debugfs_create_file("bf_txsnd_info", 0600, dir, phy, &fops_bf_txsnd_info);
243- debugfs_create_file("bf_starec_read", 0600, dir, phy, &fops_starec_bf_read);
244- debugfs_create_file("bf_fbk_rpt", 0600, dir, phy, &fops_bf_fbk_rpt);
245- debugfs_create_file("pfmu_tag_read", 0600, dir, phy, &fops_bf_pfmu_tag_read);
246-
247- debugfs_create_file("muru_prot_thr", 0200, dir, phy, &fops_muru_prot_thr);
248
249 if (dev->has_rro) {
250 debugfs_create_u32("rro_sid", 0600, dir, &dev->dbg.sid);
251@@ -4326,7 +4288,6 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
252 mt7996_show_rro_mib);
253 }
254
255- debugfs_create_file("thermal_enable", 0600, dir, phy, &fops_thermal_enable);
256 debugfs_create_file("thermal_recal", 0200, dir, dev, &fops_thermal_recal);
257 debugfs_create_file("reset_counter", 0200, dir, dev, &fops_reset_counter);
258
259@@ -4346,8 +4307,6 @@ int mt7996_mtk_init_debugfs(struct mt7996_phy *phy, struct dentry *dir)
260 debugfs_create_file("amsdu_para", 0600, dir, dev, &fops_amsdu_para);
261 debugfs_create_devm_seqfile(dev->mt76.dev, "hw_amsdu_info", dir,
262 mt7996_hw_amsdu_info_read);
263-
264- return 0;
265 }
266
267 #endif
268--
2692.18.0
270