OSDN Git Service

fs: proc: Import cpumaxfreq
authorwloot <wlootlxt123@gmail.com>
Fri, 3 May 2019 14:56:11 +0000 (22:56 +0800)
committer0ranko0P <ranko0p@outlook.com>
Wed, 4 Dec 2019 17:17:30 +0000 (01:17 +0800)
fs/proc/Makefile
fs/proc/cpumaxfreq.c [new file with mode: 0644]

index baab1da..8a74aca 100644 (file)
@@ -13,6 +13,7 @@ proc-$(CONFIG_TTY)      += proc_tty.o
 proc-y += cmdline.o
 proc-y += consoles.o
 proc-y += cpuinfo.o
+proc-y += cpumaxfreq.o
 proc-y += devices.o
 proc-y += interrupts.o
 proc-y += loadavg.o
diff --git a/fs/proc/cpumaxfreq.c b/fs/proc/cpumaxfreq.c
new file mode 100644 (file)
index 0000000..6a1e93a
--- /dev/null
@@ -0,0 +1,31 @@
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+
+static int cpumaxfreq_show(struct seq_file *m, void *v)
+{
+       /* C1, C2 and D5 all use msm8998 with maxfreq 2.45 */
+       seq_printf(m, "2.45\n");
+
+       return 0;
+}
+
+static int cpumaxfreq_open(struct inode *inode, struct file *file)
+{
+       return single_open(file, &cpumaxfreq_show, NULL);
+}
+
+static const struct file_operations proc_cpumaxfreq_operations = {
+       .open       = cpumaxfreq_open,
+       .read       = seq_read,
+       .llseek     = seq_lseek,
+       .release    = seq_release,
+};
+
+static int __init proc_cpumaxfreq_init(void)
+{
+       proc_create("cpumaxfreq", 0, NULL, &proc_cpumaxfreq_operations);
+       return 0;
+}
+fs_initcall(proc_cpumaxfreq_init);
\ No newline at end of file