developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 1 | From ef4a19e3bb7aebd2ceb745cefc45fd7000db2014 Mon Sep 17 00:00:00 2001 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Mon, 3 Jun 2024 15:18:05 +0800 |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 4 | Subject: [PATCH 160/223] mtk: mt76: mt7996: support muru dbg info debug |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 5 | commands |
| 6 | |
| 7 | Support enable muru debug functionality by debugfs. |
| 8 | Usage: |
| 9 | $ echo <item>-<val> > /sys/kernel/debug/ieee80211/phy0/mt76/muru_dbg |
| 10 | |
| 11 | The purpose of this commit is for WiFi 7 R1 cert UL-MU test cases. |
| 12 | |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 13 | Change-Id: Id7877a3c6d4e45585bfe14885b2eaea2620dfd5b |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 14 | Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 15 | --- |
| 16 | mt7996/mtk_debugfs.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ |
| 17 | 1 file changed, 44 insertions(+) |
| 18 | |
| 19 | diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 20 | index 422518f5..02a6ee81 100644 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 21 | --- a/mt7996/mtk_debugfs.c |
| 22 | +++ b/mt7996/mtk_debugfs.c |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 23 | @@ -4325,6 +4325,48 @@ mt7996_drr_info(struct seq_file *s, void *data) |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 24 | 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 */ |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 72 | @@ -4446,6 +4488,8 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir) |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 73 | /* 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 | -- |
developer | d0c8945 | 2024-10-11 16:53:27 +0800 | [diff] [blame^] | 82 | 2.45.2 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 83 | |