drivers: add stub kperfmon
This commit is contained in:
parent
fdef7b54c3
commit
f90e79c77b
5 changed files with 118 additions and 0 deletions
|
@ -260,6 +260,7 @@ source "drivers/sti/common/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
|||
source "drivers/input/input_boost/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/battery/core/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/kq/mesh/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/kperfmon/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/vibrator/common/vib_info/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/input/sec_input/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
source "drivers/usb/common/vbus_notifier/Kconfig" # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
|
|
|
@ -216,6 +216,7 @@ obj-y += muic/common/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
|||
obj-y += input/input_boost/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += battery/core/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += kq/mesh/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += kperfmon/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += vibrator/common/vib_info/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += input/sec_input/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
obj-y += usb/common/vbus_notifier/ # ADDED BY LEGO AUTOMATICALLY: DO NOT SUBMIT
|
||||
|
|
25
drivers/kperfmon/Kconfig
Normal file
25
drivers/kperfmon/Kconfig
Normal file
|
@ -0,0 +1,25 @@
|
|||
#
|
||||
# Samsung Performance Logging system
|
||||
#
|
||||
|
||||
menu "samsung Performace manager"
|
||||
|
||||
config KPERFMON
|
||||
bool "Enable performance log"
|
||||
default y
|
||||
help
|
||||
Samsung performance log(OLOG).
|
||||
Say Y here if enable performance olog driver to do logging system resources.
|
||||
When some delay occurs in the kernel, native or user user space,
|
||||
the logging information should be restored into the system.
|
||||
|
||||
config KPERFMON_BUILD
|
||||
tristate "Building tyoe of performance log"
|
||||
default m
|
||||
help
|
||||
Samsung performance log(OLOG).
|
||||
This is to set a build type for module or build-in.
|
||||
Say m here if you want a module of performance olog driver.
|
||||
Say y here if you want build-in object of the performance olog driver.
|
||||
|
||||
endmenu
|
20
drivers/kperfmon/Makefile
Normal file
20
drivers/kperfmon/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
#
|
||||
# Makefile for the Linux kernel device drivers.
|
||||
#
|
||||
# Sep 2018, Binse Park <h22yap@gmail.com>
|
||||
# Rewritten to use lists instead of if-statements.
|
||||
#
|
||||
|
||||
FLAG=1
|
||||
|
||||
ifneq ($(CONFIG_KPERFMON), y)
|
||||
FLAG=0
|
||||
endif
|
||||
|
||||
ifeq ($(FLAG), 1)
|
||||
ifeq ($(CONFIG_KPERFMON_BUILD), y)
|
||||
obj-y += kperfmon.o
|
||||
else
|
||||
obj-m += kperfmon.o
|
||||
endif
|
||||
endif
|
71
drivers/kperfmon/kperfmon.c
Normal file
71
drivers/kperfmon/kperfmon.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
#define PROC_NAME "kperfmon"
|
||||
#define MESSAGE "kperfmon_version [1.0.1] kperfmon_read : 0x39b76d0, kperfmon_write : 0x39b76b8\njava_version [U14.1.0]\nnativelib_version [U14.1.0]\nperfmond_version [U14.3.0]\n[01-01 00:00:00.000 1 1181 0 ( 2)][LOG][LCDV] ON\n"
|
||||
|
||||
static ssize_t proc_read(struct file *file, char *buf, size_t count, loff_t *pos);
|
||||
static int proc_open(struct inode *inode, struct file *file);
|
||||
static ssize_t proc_write(struct file *file, const char __user *usr_buf, size_t count, loff_t *pos);
|
||||
|
||||
static struct proc_ops proc_ops = {
|
||||
.proc_read = proc_read,
|
||||
.proc_open = proc_open,
|
||||
.proc_write = proc_write,
|
||||
};
|
||||
|
||||
static int proc_init(void) {
|
||||
if (proc_create(PROC_NAME, 0664, NULL, &proc_ops) == NULL) {
|
||||
pr_info("%s() - Error creating entry in proc failed!!!\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
pr_info("%s()\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void proc_exit(void) {
|
||||
remove_proc_entry(PROC_NAME, NULL);
|
||||
pr_info("%s()\n", __func__);
|
||||
}
|
||||
|
||||
static ssize_t proc_read(struct file *file, char __user *usr_buf, size_t count, loff_t *pos) {
|
||||
int rv;
|
||||
char buffer[BUFFER_SIZE];
|
||||
|
||||
rv = snprintf(buffer, sizeof(buffer), MESSAGE);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
|
||||
if (*pos >= rv)
|
||||
return 0;
|
||||
|
||||
if (count > rv - *pos)
|
||||
count = rv - *pos;
|
||||
|
||||
if (copy_to_user(usr_buf, buffer + *pos, count)) {
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
*pos += count;
|
||||
return count;
|
||||
}
|
||||
|
||||
static int proc_open(struct inode *inode, struct file *file) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t proc_write(struct file *file, const char __user *usr_buf, size_t count, loff_t *pos) {
|
||||
return count;
|
||||
}
|
||||
|
||||
module_init(proc_init);
|
||||
module_exit(proc_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("Binse Park <unsang.park@samsung.com>");
|
||||
MODULE_DESCRIPTION("Performance Log(OLOG)");
|
Loading…
Reference in a new issue