blob: 1587427a2031fe8fc19e35be2d14bc246f4e4290 [file] [log] [blame]
From bc5844e85a6195f384fef07a8fda185d851c4ffd Mon Sep 17 00:00:00 2001
From: Howard Hsu <howard-yh.hsu@mediatek.com>
Date: Mon, 3 Jun 2024 15:18:05 +0800
Subject: [PATCH 160/193] mtk: mt76: mt7996: support muru dbg info debug
commands
Support enable muru debug functionality by debugfs.
Usage:
$ echo <item>-<val> > /sys/kernel/debug/ieee80211/phy0/mt76/muru_dbg
The purpose of this commit is for WiFi 7 R1 cert UL-MU test cases.
Change-Id: Id7877a3c6d4e45585bfe14885b2eaea2620dfd5b
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
---
mt7996/mtk_debugfs.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
index 422518f..02a6ee8 100644
--- a/mt7996/mtk_debugfs.c
+++ b/mt7996/mtk_debugfs.c
@@ -4325,6 +4325,48 @@ mt7996_drr_info(struct seq_file *s, void *data)
return 0;
}
+static ssize_t mt7996_muru_dbg_info_set(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct mt7996_dev *dev = file->private_data;
+ char buf[10];
+ u16 item;
+ u8 val;
+ int ret;
+
+ if (count >= sizeof(buf))
+ return -EINVAL;
+
+ if (copy_from_user(buf, user_buf, count))
+ return -EFAULT;
+
+ if (count && buf[count - 1] == '\n')
+ buf[count - 1] = '\0';
+ else
+ buf[count] = '\0';
+
+ if (sscanf(buf, "%hu-%hhu", &item, &val) != 2) {
+ dev_warn(dev->mt76.dev,"format: item-value\n");
+ return -EINVAL;
+ }
+
+ ret = mt7996_mcu_muru_dbg_info(dev, item, val);
+ if (ret) {
+ dev_warn(dev->mt76.dev, "Fail to send mcu cmd.\n");
+ return -EFAULT;
+ }
+
+ return count;
+}
+
+static const struct file_operations fops_muru_dbg_info = {
+ .write = mt7996_muru_dbg_info_set,
+ .open = simple_open,
+ .owner = THIS_MODULE,
+ .llseek = default_llseek,
+};
+
void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
{
/* agg */
@@ -4446,6 +4488,8 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
/* Drop counters */
debugfs_create_file("tx_drop_stats", 0400, dir, dev, &mt7996_tx_drop_fops);
debugfs_create_file("rx_drop_stats", 0400, dir, dev, &mt7996_rx_drop_fops);
+
+ debugfs_create_file("muru_dbg", 0200, dir, dev, &fops_muru_dbg_info);
}
#endif
--
2.45.2