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_ENC_H_ 17 #define _MTK_VCODEC_ENC_H_ 18 19 #include <media/videobuf2-core.h> 20 #include <media/videobuf2-v4l2.h> 21 22 #define MTK_VENC_IRQ_STATUS_SPS 0x1 23 #define MTK_VENC_IRQ_STATUS_PPS 0x2 24 #define MTK_VENC_IRQ_STATUS_FRM 0x4 25 #define MTK_VENC_IRQ_STATUS_DRAM 0x8 26 #define MTK_VENC_IRQ_STATUS_PAUSE 0x10 27 #define MTK_VENC_IRQ_STATUS_SWITCH 0x20 28 29 #define MTK_VENC_IRQ_STATUS_OFFSET 0x05C 30 #define MTK_VENC_IRQ_ACK_OFFSET 0x060 31 32 /** 33 * struct mtk_video_enc_buf - Private data related to each VB2 buffer. 34 * @vb: Pointer to related VB2 buffer. 35 * @list: list that buffer link to 36 * @param_change: Types of encode parameter change before encoding this 37 * buffer 38 * @enc_params: Encode parameters changed before encode this buffer 39 */ 40 struct mtk_video_enc_buf { 41 struct vb2_v4l2_buffer vb; 42 struct list_head list; 43 u32 param_change; 44 struct mtk_enc_params enc_params; 45 }; 46 47 extern const struct v4l2_ioctl_ops mtk_venc_ioctl_ops; 48 extern const struct v4l2_m2m_ops mtk_venc_m2m_ops; 49 50 int mtk_venc_unlock(struct mtk_vcodec_ctx *ctx); 51 int mtk_venc_lock(struct mtk_vcodec_ctx *ctx); 52 int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq, 53 struct vb2_queue *dst_vq); 54 void mtk_vcodec_enc_release(struct mtk_vcodec_ctx *ctx); 55 int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx); 56 void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx); 57 58 #endif /* _MTK_VCODEC_ENC_H_ */ 59