Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v4.12 91 lines 2.6 kB view raw
1/* 2* Copyright (c) 2016 MediaTek Inc. 3* Author: PC Chen <pc.chen@mediatek.com> 4* Tiffany Lin <tiffany.lin@mediatek.com> 5* 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. 9* 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. 14*/ 15 16#ifndef _MTK_VCODEC_UTIL_H_ 17#define _MTK_VCODEC_UTIL_H_ 18 19#include <linux/types.h> 20#include <linux/dma-direction.h> 21 22struct mtk_vcodec_mem { 23 size_t size; 24 void *va; 25 dma_addr_t dma_addr; 26}; 27 28struct mtk_vcodec_ctx; 29struct mtk_vcodec_dev; 30 31extern int mtk_v4l2_dbg_level; 32extern bool mtk_vcodec_dbg; 33 34 35#if defined(DEBUG) 36 37#define mtk_v4l2_debug(level, fmt, args...) \ 38 do { \ 39 if (mtk_v4l2_dbg_level >= level) \ 40 pr_info("[MTK_V4L2] level=%d %s(),%d: " fmt "\n",\ 41 level, __func__, __LINE__, ##args); \ 42 } while (0) 43 44#define mtk_v4l2_err(fmt, args...) \ 45 pr_err("[MTK_V4L2][ERROR] %s:%d: " fmt "\n", __func__, __LINE__, \ 46 ##args) 47 48 49#define mtk_v4l2_debug_enter() mtk_v4l2_debug(3, "+") 50#define mtk_v4l2_debug_leave() mtk_v4l2_debug(3, "-") 51 52#define mtk_vcodec_debug(h, fmt, args...) \ 53 do { \ 54 if (mtk_vcodec_dbg) \ 55 pr_info("[MTK_VCODEC][%d]: %s() " fmt "\n", \ 56 ((struct mtk_vcodec_ctx *)h->ctx)->id, \ 57 __func__, ##args); \ 58 } while (0) 59 60#define mtk_vcodec_err(h, fmt, args...) \ 61 pr_err("[MTK_VCODEC][ERROR][%d]: %s() " fmt "\n", \ 62 ((struct mtk_vcodec_ctx *)h->ctx)->id, __func__, ##args) 63 64#define mtk_vcodec_debug_enter(h) mtk_vcodec_debug(h, "+") 65#define mtk_vcodec_debug_leave(h) mtk_vcodec_debug(h, "-") 66 67#else 68 69#define mtk_v4l2_debug(level, fmt, args...) {} 70#define mtk_v4l2_err(fmt, args...) {} 71#define mtk_v4l2_debug_enter() {} 72#define mtk_v4l2_debug_leave() {} 73 74#define mtk_vcodec_debug(h, fmt, args...) {} 75#define mtk_vcodec_err(h, fmt, args...) {} 76#define mtk_vcodec_debug_enter(h) {} 77#define mtk_vcodec_debug_leave(h) {} 78 79#endif 80 81void __iomem *mtk_vcodec_get_reg_addr(struct mtk_vcodec_ctx *data, 82 unsigned int reg_idx); 83int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, 84 struct mtk_vcodec_mem *mem); 85void mtk_vcodec_mem_free(struct mtk_vcodec_ctx *data, 86 struct mtk_vcodec_mem *mem); 87void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *dev, 88 struct mtk_vcodec_ctx *ctx); 89struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *dev); 90 91#endif /* _MTK_VCODEC_UTIL_H_ */