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

@@ -0,0 +1,80 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __CONN_MD_H_
#define __CONN_MD_H_
#include "conn_md_exp.h"
#include "conn_md_dump.h"
/*-----------------------Data Structure Definition-----------------------*/
enum user_state {
USER_MIN,
USER_REGED,
USER_ENABLED,
USER_DISABLED,
USER_UNREGED,
USER_MAX,
};
struct conn_md_user {
uint32 u_id;
enum user_state state;
struct conn_md_bridge_ops ops;
struct list_head entry;
};
struct conn_md_msg {
struct ipc_ilm ilm;
struct list_head entry;
struct local_para local_para;
};
struct conn_md_queue {
struct list_head list;
struct mutex lock;
uint32 counter;
};
struct conn_md_user_list {
uint32 counter;
struct list_head list;
struct mutex lock; /*lock for user add/delete/check */
};
struct conn_md_struct {
/*con-md-thread used for tx queue handle */
struct task_struct *p_task;
struct completion tx_comp;
struct conn_md_user_list user_list;
struct conn_md_queue act_queue;
struct conn_md_queue msg_queue;
struct conn_md_dmp_msg_log *p_msg_dmp_sys;
};
struct conn_md_time_struct {
unsigned long long sec;
unsigned long msec;
};
#define CONN_MD_MSG_MAX_NUM 5
#define CONN_MD_MSG_TIME_LENGTH 16
#define CONN_MD_BUF_SIZE (CONN_MD_MSG_MAX_NUM * CONN_MD_MSG_TIME_LENGTH)
struct conn_md_log_msg_info {
struct conn_md_time_struct msg_begin_time;
int msg_total;
char msg_buf[CONN_MD_BUF_SIZE];
};
extern int conn_md_send_msg(struct ipc_ilm *ilm);
extern int conn_md_del_user(uint32 u_id);
extern int conn_md_add_user(uint32 u_id, struct conn_md_bridge_ops *p_ops);
extern int conn_md_dmp_msg_logged(uint32 src_id, uint32 dst_id);
extern int conn_md_dmp_msg_active(uint32 src_id, uint32 dst_id);
extern int conn_md_dmp_msg_queued(uint32 src_id, uint32 dst_id);
#endif
@@ -0,0 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __CONN_MD_DBG_H_
#define __CONN_MD_DBG_H_
typedef int (*conn_md_dev_dbg_func) (int par1, int par2, int par3);
extern int conn_md_dbg_init(void);
extern int conn_md_test(void);
ssize_t conn_md_dbg_read(struct file *filp, char __user *buf,
size_t count, loff_t *f_pos);
ssize_t conn_md_dbg_write(struct file *filp, const char __user *buf,
size_t count, loff_t *f_pos);
#endif/*__CONN_MD_DBG_H_*/
@@ -0,0 +1,47 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __CONN_MD_DUMP_H_
#define __CONN_MD_DUMP_H_
#include "conn_md_log.h"
#include "conn_md_exp.h"
#define LENGTH_PER_PACKAGE 8
#define NUMBER_OF_MSG_LOGGED 16
enum conn_md_msg_type {
MSG_ENQUEUE = 1,
MSG_DEQUEUE = 2,
MSG_EN_DE_QUEUE = 3,
};
struct conn_md_dmp_msg_str {
unsigned int sec;
unsigned int usec;
enum conn_md_msg_type type;
struct ipc_ilm ilm;
uint16 msg_len;
uint8 data[LENGTH_PER_PACKAGE];
};
struct conn_md_dmp_msg_log {
struct conn_md_dmp_msg_str msg[NUMBER_OF_MSG_LOGGED];
uint16 in;
uint16 out;
uint32 size;
struct mutex lock;
};
extern struct conn_md_dmp_msg_log *conn_md_dmp_init(void);
extern int conn_md_dmp_deinit(struct conn_md_dmp_msg_log *p_log);
extern int conn_md_dmp_in(struct ipc_ilm *p_ilm,
enum conn_md_msg_type msg_type,
struct conn_md_dmp_msg_log *p_msg_log);
extern int conn_md_dmp_out(struct conn_md_dmp_msg_log *p_msg_log,
uint32 src_id, uint32 dst_id);
#endif
@@ -0,0 +1,48 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __CONN_MD_EXP_H_
#define __CONN_MD_EXP_H_
#include "port_ipc.h" /*mediatek/kernel/drivers/eccci */
#include "ccci_ipc_task_ID.h" /*mediatek/kernel/drivers/eccci */
#define uint32 unsigned int
#define uint8 unsigned char
#define uint16 unsigned short
#ifdef CHAR
#undef CHAR
#endif
/*
* Provide a common conn_md_ipc_ilm_t definition for wmt_drv.ko to reference,
* this decouples wmt_drv.ko away from ECCCI's ipc_ilm definition, as its
* naming varies between different Kernel versions currently.
* If in future the fields in this struct varies as well, we could either:
* 1. Redefine entire struct from conn_md, or
* 2. Let wmt_drv.ko handles the difference via:
* #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
*/
#define conn_md_ipc_ilm_t struct ipc_ilm
enum CONN_MD_ERR_CODE {
CONN_MD_ERR_NO_ERR = 0,
CONN_MD_ERR_DEF_ERR = -1,
CONN_MD_ERR_INVALID_PARAM = -2,
CONN_MD_ERR_OTHERS = -4,
};
/*For IDC test*/
typedef int (*conn_md_msg_rx_cb) (struct ipc_ilm *ilm);
struct conn_md_bridge_ops {
conn_md_msg_rx_cb rx_cb;
};
extern int mtk_conn_md_bridge_reg(uint32 u_id,
struct conn_md_bridge_ops *p_ops);
extern int mtk_conn_md_bridge_unreg(uint32 u_id);
extern int mtk_conn_md_bridge_send_msg(struct ipc_ilm *ilm);
#endif /*__CONN_MD_EXP_H_*/
@@ -0,0 +1,94 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef __CONN_MD_LOG_H_
#define __CONN_MD_LOG_H_
#include <linux/module.h>
#include <linux/types.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>
#include <linux/atomic.h>
#include <linux/list.h>
#include <linux/dma-mapping.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/string.h>
#include <linux/time.h> /* gettimeofday */
#include <linux/vmalloc.h>
#include <linux/mm.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/completion.h>
#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/kernel.h>
#define DBG_LOG_STR_SIZE 256
extern int g_conn_md_dbg_lvl;
extern int __conn_md_get_log_lvl(void);
extern int conn_md_log_set_lvl(int log_lvl);
extern int __conn_md_log_print(const char *str, ...);
#define CONN_MD_LOG_LOUD 4
#define CONN_MD_LOG_DBG 3
#define CONN_MD_LOG_INFO 2
#define CONN_MD_LOG_WARN 1
#define CONN_MD_LOG_ERR 0
#ifndef DFT_TAG
#define DFT_TAG "[CONN-MD-DFT]"
#endif
#define CONN_MD_LOUD_FUNC(fmt, arg ...) \
do { \
if (__conn_md_get_log_lvl() >= CONN_MD_LOG_LOUD) \
__conn_md_log_print(DFT_TAG "[L]%s:" fmt, \
__func__, ## arg); \
} while (0)
#define CONN_MD_INFO_FUNC(fmt, arg ...) \
do { \
if (__conn_md_get_log_lvl() >= CONN_MD_LOG_INFO)\
__conn_md_log_print(DFT_TAG "[I]%s:" fmt, \
__func__, ## arg); \
} while (0)
#define CONN_MD_WARN_FUNC(fmt, arg ...) \
do { \
if (__conn_md_get_log_lvl() >= CONN_MD_LOG_WARN)\
__conn_md_log_print(DFT_TAG "[W]%s:" fmt, \
__func__, ## arg); \
} while (0)
#define CONN_MD_ERR_FUNC(fmt, arg ...)\
do {\
if (__conn_md_get_log_lvl() >= CONN_MD_LOG_ERR)\
__conn_md_log_print(DFT_TAG "[E]%s(%d):" fmt,\
__func__, __LINE__, ## arg);\
} while (0)
#define CONN_MD_DBG_FUNC(fmt, arg ...) \
do { \
if (__conn_md_get_log_lvl() >= CONN_MD_LOG_DBG) \
__conn_md_log_print(DFT_TAG "[D]%s:" fmt, \
__func__, ## arg); \
} while (0)
#define CONN_MD_TRC_FUNC(f) \
do { \
if (__conn_md_get_log_lvl() >= CONN_MD_LOG_DBG) \
__conn_md_log_print(DFT_TAG "<%s> <%d>\n", \
__func__, __LINE__); \
} while (0)
#endif