[][openwrt][mt7988][tops][add cpu utilization fetching]
[Description]
Add cpu utilization fetching and refactor debugfs of trm and tops
Via reading debugfs file(/sys/kernel/debug/tops/trm/cpu-utilization)
to fetch each core's cpu utilization
[Release-log]
N/A
Change-Id: Iff4c965294c3054a54ba92263191856cd5c722c7
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7907085
diff --git a/package-21.02/kernel/tops/src/init.c b/package-21.02/kernel/tops/src/init.c
index 8c47546..05a7fe4 100644
--- a/package-21.02/kernel/tops/src/init.c
+++ b/package-21.02/kernel/tops/src/init.c
@@ -9,6 +9,7 @@
#include <linux/err.h>
#include <linux/device.h>
#include <linux/module.h>
+#include <linux/debugfs.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
@@ -29,6 +30,7 @@
#include "wdt.h"
struct device *tops_dev;
+struct dentry *tops_debugfs_root;
static int mtk_tops_post_init(struct platform_device *pdev)
{
@@ -200,6 +202,12 @@
static int __init mtk_tops_init(void)
{
+ tops_debugfs_root = debugfs_create_dir("tops", NULL);
+ if (IS_ERR(tops_debugfs_root)) {
+ TOPS_ERR("create tops debugfs root directory failed\n");
+ return PTR_ERR(tops_debugfs_root);
+ }
+
mtk_tops_mbox_init();
mtk_tops_hpdma_init();
@@ -218,6 +226,8 @@
mtk_tops_hpdma_exit();
mtk_tops_mbox_exit();
+
+ debugfs_remove_recursive(tops_debugfs_root);
}
module_init(mtk_tops_init);