blob: 1f278bd6a5c09d8eb73b8e061effa47fc07a8da1 [file] [log] [blame]
developerd0c89452024-10-11 16:53:27 +08001From ef4a19e3bb7aebd2ceb745cefc45fd7000db2014 Mon Sep 17 00:00:00 2001
developer05f3b2b2024-08-19 19:17:34 +08002From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Mon, 3 Jun 2024 15:18:05 +0800
developerd0c89452024-10-11 16:53:27 +08004Subject: [PATCH 160/223] mtk: mt76: mt7996: support muru dbg info debug
developer05f3b2b2024-08-19 19:17:34 +08005 commands
6
7Support enable muru debug functionality by debugfs.
8Usage:
9$ echo <item>-<val> > /sys/kernel/debug/ieee80211/phy0/mt76/muru_dbg
10
11The purpose of this commit is for WiFi 7 R1 cert UL-MU test cases.
12
developerd0c89452024-10-11 16:53:27 +080013Change-Id: Id7877a3c6d4e45585bfe14885b2eaea2620dfd5b
developer05f3b2b2024-08-19 19:17:34 +080014Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
15---
16 mt7996/mtk_debugfs.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
17 1 file changed, 44 insertions(+)
18
19diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
developerd0c89452024-10-11 16:53:27 +080020index 422518f5..02a6ee81 100644
developer05f3b2b2024-08-19 19:17:34 +080021--- a/mt7996/mtk_debugfs.c
22+++ b/mt7996/mtk_debugfs.c
developerd0c89452024-10-11 16:53:27 +080023@@ -4325,6 +4325,48 @@ mt7996_drr_info(struct seq_file *s, void *data)
developer05f3b2b2024-08-19 19:17:34 +080024 return 0;
25 }
26
27+static ssize_t mt7996_muru_dbg_info_set(struct file *file,
28+ const char __user *user_buf,
29+ size_t count, loff_t *ppos)
30+{
31+ struct mt7996_dev *dev = file->private_data;
32+ char buf[10];
33+ u16 item;
34+ u8 val;
35+ int ret;
36+
37+ if (count >= sizeof(buf))
38+ return -EINVAL;
39+
40+ if (copy_from_user(buf, user_buf, count))
41+ return -EFAULT;
42+
43+ if (count && buf[count - 1] == '\n')
44+ buf[count - 1] = '\0';
45+ else
46+ buf[count] = '\0';
47+
48+ if (sscanf(buf, "%hu-%hhu", &item, &val) != 2) {
49+ dev_warn(dev->mt76.dev,"format: item-value\n");
50+ return -EINVAL;
51+ }
52+
53+ ret = mt7996_mcu_muru_dbg_info(dev, item, val);
54+ if (ret) {
55+ dev_warn(dev->mt76.dev, "Fail to send mcu cmd.\n");
56+ return -EFAULT;
57+ }
58+
59+ return count;
60+}
61+
62+static const struct file_operations fops_muru_dbg_info = {
63+ .write = mt7996_muru_dbg_info_set,
64+ .open = simple_open,
65+ .owner = THIS_MODULE,
66+ .llseek = default_llseek,
67+};
68+
69 void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
70 {
71 /* agg */
developerd0c89452024-10-11 16:53:27 +080072@@ -4446,6 +4488,8 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
developer05f3b2b2024-08-19 19:17:34 +080073 /* Drop counters */
74 debugfs_create_file("tx_drop_stats", 0400, dir, dev, &mt7996_tx_drop_fops);
75 debugfs_create_file("rx_drop_stats", 0400, dir, dev, &mt7996_rx_drop_fops);
76+
77+ debugfs_create_file("muru_dbg", 0200, dir, dev, &fops_muru_dbg_info);
78 }
79
80 #endif
81--
developerd0c89452024-10-11 16:53:27 +0800822.45.2
developer05f3b2b2024-08-19 19:17:34 +080083