2 * Copyright (c) 2016 MediaTek Inc.
3 * Author: PC Chen <pc.chen@mediatek.com>
4 * Tiffany Lin <tiffany.lin@mediatek.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #ifndef _MTK_VCODEC_UTIL_H_
17 #define _MTK_VCODEC_UTIL_H_
19 #include <linux/types.h>
20 #include <linux/dma-direction.h>
22 struct mtk_vcodec_mem
{
28 struct mtk_vcodec_ctx
;
29 struct mtk_vcodec_dev
;
31 extern int mtk_v4l2_dbg_level
;
32 extern bool mtk_vcodec_dbg
;
38 #define mtk_v4l2_debug(level, fmt, args...) \
40 if (mtk_v4l2_dbg_level >= level) \
41 pr_info("[MTK_V4L2] level=%d %s(),%d: " fmt "\n",\
42 level, __func__, __LINE__, ##args); \
45 #define mtk_v4l2_err(fmt, args...) \
46 pr_err("[MTK_V4L2][ERROR] %s:%d: " fmt "\n", __func__, __LINE__, \
50 #define mtk_v4l2_debug_enter() mtk_v4l2_debug(3, "+")
51 #define mtk_v4l2_debug_leave() mtk_v4l2_debug(3, "-")
53 #define mtk_vcodec_debug(h, fmt, args...) \
56 pr_info("[MTK_VCODEC][%d]: %s() " fmt "\n", \
57 ((struct mtk_vcodec_ctx *)h->ctx)->id, \
61 #define mtk_vcodec_err(h, fmt, args...) \
62 pr_err("[MTK_VCODEC][ERROR][%d]: %s() " fmt "\n", \
63 ((struct mtk_vcodec_ctx *)h->ctx)->id, __func__, ##args)
65 #define mtk_vcodec_debug_enter(h) mtk_vcodec_debug(h, "+")
66 #define mtk_vcodec_debug_leave(h) mtk_vcodec_debug(h, "-")
70 #define mtk_v4l2_debug(level, fmt, args...)
71 #define mtk_v4l2_err(fmt, args...)
72 #define mtk_v4l2_debug_enter()
73 #define mtk_v4l2_debug_leave()
75 #define mtk_vcodec_debug(h, fmt, args...)
76 #define mtk_vcodec_err(h, fmt, args...)
77 #define mtk_vcodec_debug_enter(h)
78 #define mtk_vcodec_debug_leave(h)
82 void __iomem
*mtk_vcodec_get_reg_addr(struct mtk_vcodec_ctx
*data
,
83 unsigned int reg_idx
);
84 int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx
*data
,
85 struct mtk_vcodec_mem
*mem
);
86 void mtk_vcodec_mem_free(struct mtk_vcodec_ctx
*data
,
87 struct mtk_vcodec_mem
*mem
);
88 void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev
*dev
,
89 struct mtk_vcodec_ctx
*ctx
);
90 struct mtk_vcodec_ctx
*mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev
*dev
);
92 #endif /* _MTK_VCODEC_UTIL_H_ */