Initial commit: Linux kernel 4.19 for Unplugged OS

This commit is contained in:
ziv committed 2025-10-06 13:52:42 +00:00
commit d30235b04c
80519 files changed
+35800681

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
config MTK_MMPROFILE_SUPPORT
bool "MMProfile function enable or disable"
default y
help
Multimedia profiling mechanism function support.
By enable this config, the actual implementation under mmp/src/
will be used.
Otherwise mmp/dummy/ is used to provide empty functions. In this
situation, the profiling mechanism will not work.
config MMPROFILE
bool "MMProfile module enable or disable"
default y
help
Enable other module to use Multimedia profiling mechanism.
By enable this config, the mmp/ driver is built into kernel.
Otherwise other module will use empty functions in header file
instead. This is to make the profiling mechanism driver to be
a switchable module.
+23
View File
@@ -0,0 +1,23 @@
#
# Copyright (C) 2015 MediaTek Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
ifeq ($(CONFIG_MTK_MMPROFILE_SUPPORT),y)
# The src folder should exist
obj-y += src/
else
obj-y += dummy/
endif
+16
View File
@@ -0,0 +1,16 @@
#
# Copyright (C) 2015 MediaTek Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
ccflags-y += -I$(srctree)/drivers/misc/mediatek/mmp/
obj-y += mmprofile.o
+182
View File
@@ -0,0 +1,182 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#include <linux/miscdevice.h>
#include <linux/fs.h>
#include <linux/file.h>
#include <linux/cdev.h>
#include <linux/io.h>
#include <generated/autoconf.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/uaccess.h>
#include "mmprofile_internal.h"
#include "mmprofile_function.h"
#include "mmprofile_static_event.h"
/* #pragma GCC optimize ("O0") */
#define MMP_DEVNAME "mmp"
void mmprofile_start(int start)
{
}
EXPORT_SYMBOL(mmprofile_start);
void mmprofile_enable(int enable)
{
}
EXPORT_SYMBOL(mmprofile_enable);
/* Exposed APIs begin */
mmp_event mmprofile_register_event(mmp_event parent, const char *name)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_register_event);
mmp_event mmprofile_find_event(mmp_event parent, const char *name)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_find_event);
void mmprofile_enable_event(mmp_event event, long enable)
{
}
EXPORT_SYMBOL(mmprofile_enable_event);
void mmprofile_enable_event_recursive(mmp_event event, long enable)
{
}
EXPORT_SYMBOL(mmprofile_enable_event_recursive);
long mmprofile_query_enable(mmp_event event)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_query_enable);
void mmprofile_log_ex(mmp_event event, enum mmp_log_type type,
unsigned long data1, unsigned long data2)
{
}
EXPORT_SYMBOL(mmprofile_log_ex);
void mmprofile_log(mmp_event event, enum mmp_log_type type)
{
}
EXPORT_SYMBOL(mmprofile_log);
long mmprofile_log_meta(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_t *pMetaData)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_log_meta);
long mmprofile_log_meta_structure(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_structure_t *pMetaData)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_log_meta_structure);
long mmprofile_log_meta_string_ex(mmp_event event, enum mmp_log_type type,
unsigned long data1, unsigned long data2, const char *str)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_log_meta_string_ex);
long mmprofile_log_meta_string(mmp_event event, enum mmp_log_type type,
const char *str)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_log_meta_string);
long mmprofile_log_meta_bitmap(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_bitmap_t *pMetaData)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_log_meta_bitmap);
long mmprofile_log_meta_yuv_bitmap(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_bitmap_t *pMetaData)
{
return 0;
}
EXPORT_SYMBOL(mmprofile_log_meta_yuv_bitmap);
/* Exposed APIs end */
/* Driver specific begin */
static int mmprofile_release(struct inode *inode, struct file *file)
{
return 0;
}
static int mmprofile_open(struct inode *inode, struct file *file)
{
return 0;
}
static ssize_t mmprofile_read(struct file *file, char __user *data,
size_t len, loff_t *ppos)
{
return 0;
}
static ssize_t mmprofile_write(struct file *file, const char __user *data,
size_t len,
loff_t *ppos)
{
return 0;
}
static long mmprofile_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
return 0;
}
static int mmprofile_mmap(struct file *file, struct vm_area_struct *vma)
{
return -EINVAL;
}
const struct file_operations mmprofile_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = mmprofile_ioctl,
.open = mmprofile_open,
.release = mmprofile_release,
.read = mmprofile_read,
.write = mmprofile_write,
.mmap = mmprofile_mmap,
};
static int __init mmprofile_init(void)
{
return 0;
}
static void __exit mmprofile_exit(void)
{
}
/* Driver specific end */
module_init(mmprofile_init);
module_exit(mmprofile_exit);
MODULE_AUTHOR("Tianshu Qiu <tianshu.qiu@mediatek.com>");
MODULE_DESCRIPTION("MMProfile Driver");
MODULE_LICENSE("GPL");
+222
View File
@@ -0,0 +1,222 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
* Author: Joey Pan <joey.pan@mediatek.com>
*/
#ifndef __MMPROFILE_H__
#define __MMPROFILE_H__
#include "mmprofile_static_event.h"
#define MMPROFILE_EVENT_NAME_MAX_LEN 31
#define MMP_Event mmp_event
#define mmp_event unsigned int
enum mmp_log_type {
MMPROFILE_FLAG_START = 1,
MMPROFILE_FLAG_END = 2,
MMPROFILE_FLAG_PULSE = 4,
MMPROFILE_FLAG_EVENT_SEPARATOR = 8,
MMPROFILE_FLAG_SYSTRACE = 0x80000000,
MMPROFILE_FLAG_MAX = 0xFFFFFFFF
};
enum mmp_metadata_type {
MMPROFILE_META_STRING_MBS = 1,
MMPROFILE_META_STRING_WCS,
MMPROFILE_META_STRUCTURE,
MMPROFILE_META_BITMAP,
MMPROFILE_META_RAW,
MMPROFILE_META_USER = 0x10000000,
MMPROFILE_META_USER_M4U_REG,
MMPROFILE_META_MAX = 0xFFFFFFFF
};
enum mmp_pixel_format {
MMPROFILE_BITMAP_RGB565 = 1,
MMPROFILE_BITMAP_RGB888,
MMPROFILE_BITMAP_RGBA8888,
MMPROFILE_BITMAP_BGR888,
MMPROFILE_BITMAP_BGRA8888,
MMPROFILE_BITMAP_UYVY,
MMPROFILE_BITMAP_VYUY,
MMPROFILE_BITMAP_YUYV,
MMPROFILE_BITMAP_YVYU,
MMPROFILE_BITMAP_MAX = 0xFFFFFFFF
};
struct mmp_metadata_t {
unsigned int data1; /* data1 (user defined) */
unsigned int data2; /* data2 (user defined) */
enum mmp_metadata_type data_type; /* meta data type */
unsigned int size; /* meta data size */
void *p_data; /* meta data pointer */
};
#ifdef CONFIG_COMPAT
struct compat_mmp_metadata_t {
unsigned int data1; /* data1 (user defined) */
unsigned int data2; /* data2 (user defined) */
enum mmp_metadata_type data_type; /* meta data type */
unsigned int size; /* meta data size */
unsigned int p_data; /* meta data pointer */
};
#endif
struct mmp_metadata_structure_t {
unsigned int data1; /* data1 (user defined) */
unsigned int data2; /* data2 (user defined) */
unsigned int struct_size; /* structure size (bytes) */
void *p_data; /* structure pointer */
char struct_name[32]; /* structure name */
};
struct mmp_metadata_bitmap_t {
unsigned int data1; /* data1 (user defined) */
unsigned int data2; /* data2 (user defined) */
unsigned int width; /* image width */
unsigned int height; /* image height */
enum mmp_pixel_format format; /* image pixel format */
/* start offset of image data (base on p_data) */
unsigned int start_pos;
unsigned int bpp; /* bits per pixel */
int pitch; /* image pitch (bytes per line) */
unsigned int data_size; /* image data size (bytes) */
unsigned int down_sample_x; /* horizontal down sample rate (>=1) */
unsigned int down_sample_y; /* vertical down sample rate (>=1) */
void *p_data; /* image buffer address */
};
#ifdef CONFIG_MMPROFILE
mmp_event mmprofile_register_event(mmp_event parent, const char *name);
mmp_event mmprofile_find_event(mmp_event parent, const char *name);
void mmprofile_enable_event(mmp_event event, long enable);
void mmprofile_enable_ftrace_event(mmp_event event, long enable, long ftrace);
void mmprofile_enable_event_recursive(mmp_event event, long enable);
void mmprofile_enable_ftrace_event_recursive(mmp_event event, long enable,
long ftrace);
long mmprofile_query_enable(mmp_event event);
void mmprofile_log(mmp_event event, enum mmp_log_type type);
void mmprofile_log_ex(mmp_event event, enum mmp_log_type type,
unsigned long data1, unsigned long data2);
long mmprofile_log_meta(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_t *p_meta_data);
long mmprofile_log_meta_string(mmp_event event, enum mmp_log_type type,
const char *str);
long mmprofile_log_meta_string_ex(mmp_event event, enum mmp_log_type type,
unsigned long data1, unsigned long data2, const char *str);
long mmprofile_log_meta_structure(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_structure_t *p_meta_data);
long mmprofile_log_meta_bitmap(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_bitmap_t *p_meta_data);
long mmprofile_log_meta_yuv_bitmap(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_bitmap_t *p_meta_data);
void mmprofile_start(int start);
void mmprofile_enable(int enable);
unsigned int mmprofile_get_dump_size(void);
void mmprofile_get_dump_buffer(unsigned int start, unsigned long *p_addr,
unsigned int *p_size);
#else
/*
* if in kernel config CONFIG_MMPROFILE is not set,
* and the kernel makefile had define
* obj-$(CONFIG_MMPROFILE) += mmp/
* , the mmp/ driver is compiled but not built-in.
* Put dummy API implementation here.
*/
static inline mmp_event mmprofile_register_event(mmp_event parent,
const char *name)
{
return 0;
}
static inline mmp_event mmprofile_find_event(mmp_event parent, const char *name)
{
return 0;
}
static inline void mmprofile_enable_event(mmp_event event, long enable)
{
}
static inline void mmprofile_enable_event_recursive(mmp_event event,
long enable)
{
}
static inline void mmprofile_enable_ftrace_event(mmp_event event, long enable,
long ftrace)
{
}
static inline void mmprofile_enable_ftrace_event_recursive(mmp_event event,
long enable, long ftrace)
{
}
static inline long mmprofile_query_enable(mmp_event event)
{
return 0;
}
static inline void mmprofile_log_ex(mmp_event event, enum mmp_log_type type,
unsigned long data1, unsigned long data2)
{
}
static inline void mmprofile_log(mmp_event event, enum mmp_log_type type)
{
}
static inline long mmprofile_log_meta(mmp_event event, enum mmp_log_type type,
struct mmp_metadata_t *p_meta_data)
{
return 0;
}
static inline long mmprofile_log_meta_structure(mmp_event event,
enum mmp_log_type type, struct mmp_metadata_structure_t *p_meta_data)
{
return 0;
}
static inline long mmprofile_log_meta_string_ex(mmp_event event,
enum mmp_log_type type, unsigned long data1, unsigned long data2,
const char *str)
{
return 0;
}
static inline long mmprofile_log_meta_string(mmp_event event,
enum mmp_log_type type, const char *str)
{
return 0;
}
static inline long mmprofile_log_meta_bitmap(mmp_event event,
enum mmp_log_type type, struct mmp_metadata_bitmap_t *p_meta_data)
{
return 0;
}
static inline long mmprofile_log_meta_yuv_bitmap(mmp_event event,
enum mmp_log_type type, struct mmp_metadata_bitmap_t *p_meta_data)
{
return 0;
}
static inline void mmprofile_start(int start)
{
}
static inline void mmprofile_enable(int enable)
{
}
#endif
#endif
@@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
* Author: Joey Pan <joey.pan@mediatek.com>
*/
#ifndef __MMPROFILE_FUNCTION_H__
#define __MMPROFILE_FUNCTION_H__
#include "mmprofile.h"
#include "mmprofile_static_event.h"
#endif
@@ -0,0 +1,126 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
* Author: Joey Pan <joey.pan@mediatek.com>
*/
#ifndef __MMPROFILE_INTERNAL_H__
#define __MMPROFILE_INTERNAL_H__
#include "mmprofile.h"
#include "mmprofile_function.h"
#define MMProfileMaxEventCount 1000
#define MMPROFILE_MAX_EVENT_COUNT 1000
#define MMP_EVENT_STATE_ENABLED (1 << 0)
#define MMP_EVENT_STATE_FTRACE (1 << 1)
struct mmprofile_eventinfo_t {
unsigned int parent_id;
char name[MMPROFILE_EVENT_NAME_MAX_LEN + 1];
};
struct mmprofile_eventsetting_t {
mmp_event event;
unsigned int enable;
unsigned int recursive;
unsigned int ftrace;
};
struct mmprofile_eventlog_t {
mmp_event event;
enum mmp_log_type type;
unsigned int data1;
unsigned int data2;
};
struct mmprofile_event_t {
unsigned int lock;
unsigned int id;
unsigned int time_low;
unsigned int time_high;
unsigned int flag;
unsigned int data1;
unsigned int data2;
unsigned int meta_data_cookie;
};
struct mmprofile_global_t {
unsigned int enable;
unsigned int start;
unsigned int write_pointer;
unsigned int reg_event_index;
unsigned int buffer_size_record;
unsigned int buffer_size_bytes;
unsigned int record_size;
unsigned int meta_buffer_size;
unsigned int new_buffer_size_record;
unsigned int new_meta_buffer_size;
unsigned int selected_buffer;
unsigned int max_event_count;
unsigned int event_state[MMPROFILE_MAX_EVENT_COUNT];
};
struct mmprofile_metadata_t {
unsigned int cookie;
enum mmp_metadata_type data_type;
unsigned int data_size;
unsigned int data_offset;
};
struct mmprofile_metalog_t {
unsigned int id;
enum mmp_log_type type;
struct mmp_metadata_t meta_data;
};
#ifdef CONFIG_COMPAT
struct compat_mmprofile_metalog_t {
unsigned int id;
enum mmp_log_type type;
struct compat_mmp_metadata_t meta_data;
};
#endif
#define MMPROFILE_GLOBALS_SIZE \
((sizeof(struct mmprofile_global_t)+(PAGE_SIZE-1))&(~(PAGE_SIZE-1)))
#define CONFIG_MMPROFILE_PATH "/data/MMProfileConfig.dat"
#define MMPROFILE_PRIMARY_BUFFER 1
#define MMPROFILE_GLOBALS_BUFFER 2
#define MMPROFILE_DATA_BUFFER 3
#define MMP_IOC_MAGIC 'M'
/* Note: MMP_IOC_DUMPEVENTINFO, arg points to a buffer:
* sizeof(mmprofile_eventinfo_t)*MMPROFILE_MAX_EVENT_COUNT
* Note: MMP_IOC_DUMPMETADATA, arg points to a buffer:
* mmprofile_globals.meta_buffer_size
*/
#define MMP_IOC_ENABLE _IOW(MMP_IOC_MAGIC, 1, unsigned int)
#define MMP_IOC_START _IOW(MMP_IOC_MAGIC, 2, unsigned int)
#define MMP_IOC_TIME _IOR(MMP_IOC_MAGIC, 3, unsigned long long)
#define MMP_IOC_REGEVENT \
_IOWR(MMP_IOC_MAGIC, 4, struct mmprofile_eventinfo_t)
#define MMP_IOC_FINDEVENT \
_IOWR(MMP_IOC_MAGIC, 5, struct mmprofile_eventinfo_t)
#define MMP_IOC_ENABLEEVENT \
_IOW(MMP_IOC_MAGIC, 6, struct mmprofile_eventsetting_t)
#define MMP_IOC_LOG \
_IOW(MMP_IOC_MAGIC, 7, struct mmprofile_eventlog_t)
#define MMP_IOC_DUMPEVENTINFO \
_IOR(MMP_IOC_MAGIC, 8, struct mmprofile_eventinfo_t)
#define MMP_IOC_METADATALOG _IOW(MMP_IOC_MAGIC, 9, struct mmprofile_metalog_t)
#define MMP_IOC_DUMPMETADATA \
_IOR(MMP_IOC_MAGIC, 10, struct mmprofile_metalog_t)
#define MMP_IOC_SELECTBUFFER _IOW(MMP_IOC_MAGIC, 11, unsigned int)
#define MMP_IOC_TRYLOG _IOWR(MMP_IOC_MAGIC, 12, unsigned int)
#define MMP_IOC_ISENABLE _IOR(MMP_IOC_MAGIC, 13, unsigned int)
#define MMP_IOC_REMOTESTART _IOW(MMP_IOC_MAGIC, 14, unsigned int)
#define MMP_IOC_TEST _IOWR(MMP_IOC_MAGIC, 100, unsigned int)
#endif
@@ -0,0 +1,33 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
* Author: Joey Pan <joey.pan@mediatek.com>
*/
#ifndef __MMPROFILE_STATIC_EVENT_H__
#define __MMPROFILE_STATIC_EVENT_H__
enum mmp_static_events {
MMP_INVALID_EVENT = 0,
MMP_ROOT_EVENT = 1,
/* User defined static events begin */
MMP_TOUCH_PANEL_EVENT,
/* User defined static events end. */
MMP_MAX_STATIC_EVENT
};
#ifdef MMPROFILE_INTERNAL
struct mmp_static_event_t {
enum mmp_static_events event;
char *name;
enum mmp_static_events parent;
};
static struct mmp_static_event_t mmprofile_static_events[] = {
{MMP_ROOT_EVENT, "Root_Event", MMP_INVALID_EVENT},
{MMP_TOUCH_PANEL_EVENT, "TouchPanel_Event", MMP_ROOT_EVENT},
};
#endif
#endif
+23
View File
@@ -0,0 +1,23 @@
#
# Copyright (C) 2015 MediaTek Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
ccflags-y += -I$(srctree)/drivers/misc/mediatek/mmp/
subdir-ccflags-y += -I$(srctree)/drivers/misc/mediatek/include
obj-y += mmprofile.o
# while the project is not GMO RAM optimize, other kernel modules can start MMP
# at init (which will occupy some memory at system boot-up)
ifeq ($(CONFIG_MTK_GMO_RAM_OPTIMIZE),y)
ccflags-y += -DFORBID_MMP_START
endif
File diff suppressed because it is too large. Load diff