1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2016 MediaTek Inc.
4 * Author: PC Chen <pc.chen@mediatek.com>
5 * Tiffany Lin <tiffany.lin@mediatek.com>
8 #ifndef _MTK_VCODEC_UTIL_H_
9 #define _MTK_VCODEC_UTIL_H_
11 #include <linux/types.h>
12 #include <linux/dma-direction.h>
14 struct mtk_vcodec_mem {
20 struct mtk_vcodec_fb {
25 struct mtk_vcodec_ctx;
26 struct mtk_vcodec_dev;
29 #define pr_fmt(fmt) "%s(),%d: " fmt, __func__, __LINE__
31 #define mtk_v4l2_err(fmt, args...) \
32 pr_err("[MTK_V4L2][ERROR] " fmt "\n", ##args)
34 #define mtk_vcodec_err(h, fmt, args...) \
35 pr_err("[MTK_VCODEC][ERROR][%d]: " fmt "\n", \
36 ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args)
39 #define mtk_v4l2_debug(level, fmt, args...) pr_debug(fmt, ##args)
41 #define mtk_v4l2_debug_enter() mtk_v4l2_debug(3, "+")
42 #define mtk_v4l2_debug_leave() mtk_v4l2_debug(3, "-")
44 #define mtk_vcodec_debug(h, fmt, args...) \
45 pr_debug("[MTK_VCODEC][%d]: " fmt "\n", \
46 ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args)
48 #define mtk_vcodec_debug_enter(h) mtk_vcodec_debug(h, "+")
49 #define mtk_vcodec_debug_leave(h) mtk_vcodec_debug(h, "-")
51 void __iomem *mtk_vcodec_get_reg_addr(struct mtk_vcodec_ctx *data,
52 unsigned int reg_idx);
53 int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data,
54 struct mtk_vcodec_mem *mem);
55 void mtk_vcodec_mem_free(struct mtk_vcodec_ctx *data,
56 struct mtk_vcodec_mem *mem);
57 void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev,
58 struct mtk_vcodec_ctx *ctx, int hw_idx);
59 struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev,
61 void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dev *dev, int hw_idx);
63 #endif /* _MTK_VCODEC_UTIL_H_ */