Files
android/drivers/misc/mediatek/irrx/inc/mtk_ir_common.h
T
threeeye bc1d038eac REVVL 6 Pro kernel bring-up: full working tree snapshot (2026-09-12)
Squashed backup commit (no shallow-clone history issues) of
xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream
commit 9eece662e) plus all fixes applied to get everpal_defconfig building
clean against a modern (GCC 15.2.0) toolchain -- see the previous commit
message on the lineage-23.2 branch (also in this repo history is not
available here since this is a squashed snapshot; full incremental history
lives in the local DL380 checkout and the upstream GitHub remote).

Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
2026-09-12 13:36:46 +00:00

109 lines
2.4 KiB
C

/*
* Copyright (C) 2016 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 http://www.gnu.org/licenses/gpl-2.0.html for more details.
*/
#ifndef __MTK_IR_COMMON_H__
#define __MTK_IR_COMMON_H__
#ifdef __KERNEL__
#include <linux/ioctl.h>
#include <linux/kernel.h>
#include <linux/printk.h>
#else
#include <sys/ioctl.h>
#include <stdio.h>
#include <stdlib.h>
#endif
struct mtk_ir_msg {
u32 scancode;
u32 keycode;
};
struct mtk_ir_mouse_code {
u32 scanleft;
u32 scanright;
u32 scanup;
u32 scandown;
u32 scanenter;
u32 scanswitch;
};
struct mtk_ir_mouse_step {
u32 x_step_s;
u32 y_step_s;
u32 x_step_l;
u32 y_step_l;
};
enum MTK_IR_DEVICE_MODE {
MTK_IR_AS_IRRX = 0,
MTK_IR_AS_MOUSE,
};
enum MTK_IR_MODE {
MTK_IR_FACTORY = 0,
MTK_IR_NORMAL,
MTK_IR_MAX,
};
#define BTN_NONE 0XFFFFFFFF
#define BTN_INVALID_KEY -1
#define MTK_IR_CHUNK_SIZE sizeof(struct mtk_ir_msg)
#ifdef __KERNEL__
extern int ir_log_debug_on;
extern void mtk_ir_core_log_always(const char *fmt, ...);
#define MTK_IR_DEBUG 1
#define MTK_IR_TAG "[MTK_IRRX]"
#define MTK_IR_FUN(f) \
do { \
if (ir_log_debug_on) \
pr_err(MTK_IR_TAG"%s++++\n", __func__); \
else \
pr_debug(MTK_IR_TAG"%s++++\n", __func__); \
} while (0)
#define MTK_IR_LOG(fmt, args...) \
do { \
if (ir_log_debug_on) \
pr_err(MTK_IR_TAG fmt, ##args); \
else if (MTK_IR_DEBUG) \
pr_debug(MTK_IR_TAG fmt, ##args); \
} while (0)
#define MTK_IR_ERR(fmt, args...) \
pr_err(MTK_IR_TAG"%s %d : "fmt, __func__, __LINE__, ##args)
#define MTK_IR_KEY_LOG(fmt, arg...) \
mtk_ir_core_log_always("[IRRX_KEY] "fmt, ##arg)
extern void AssertIR(const char *szExpress, const char *szFile, int i4Line);
#undef ASSERT
#define ASSERT(x) ((x) ? (void)0 : AssertIR(#x, __FILE__, __LINE__))
#else
#define MTK_IR_TAG "[MTK_IR_USER]"
#define MTK_IR_LOG(fmt, args...) pr_debug(MTK_IR_TAG fmt, ##args)
extern void Assert(const char *szExpress, const char *szFile, int i4Line);
#define ASSERT(x) ((x) ? (void)0 : Assert(#x, __FILE__, __LINE__))
#endif
#endif