xref: /linux/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.h (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (c) 2016 MediaTek Inc.
4 * Author: PC Chen <pc.chen@mediatek.com>
5 *         Tiffany Lin <tiffany.lin@mediatek.com>
6 */
7 
8 #ifndef _MTK_VCODEC_ENC_H_
9 #define _MTK_VCODEC_ENC_H_
10 
11 #include <media/videobuf2-core.h>
12 #include <media/v4l2-mem2mem.h>
13 
14 #include "mtk_vcodec_enc_drv.h"
15 
16 #define MTK_VENC_IRQ_STATUS_SPS	0x1
17 #define MTK_VENC_IRQ_STATUS_PPS	0x2
18 #define MTK_VENC_IRQ_STATUS_FRM	0x4
19 #define MTK_VENC_IRQ_STATUS_DRAM	0x8
20 #define MTK_VENC_IRQ_STATUS_PAUSE	0x10
21 #define MTK_VENC_IRQ_STATUS_SWITCH	0x20
22 
23 #define MTK_VENC_IRQ_STATUS_OFFSET	0x05C
24 #define MTK_VENC_IRQ_ACK_OFFSET	0x060
25 
26 /**
27  * struct mtk_video_enc_buf - Private data related to each VB2 buffer.
28  * @m2m_buf:	M2M buffer
29  * @param_change: Types of encode parameter change before encoding this
30  *				buffer
31  * @enc_params: Encode parameters changed before encode this buffer
32  */
33 struct mtk_video_enc_buf {
34 	struct v4l2_m2m_buffer m2m_buf;
35 
36 	u32 param_change;
37 	struct mtk_enc_params enc_params;
38 };
39 
40 extern const struct v4l2_ioctl_ops mtk_venc_ioctl_ops;
41 extern const struct v4l2_m2m_ops mtk_venc_m2m_ops;
42 
43 int mtk_venc_unlock(struct mtk_vcodec_enc_ctx *ctx);
44 int mtk_venc_lock(struct mtk_vcodec_enc_ctx *ctx);
45 int mtk_vcodec_enc_queue_init(void *priv, struct vb2_queue *src_vq,
46 			      struct vb2_queue *dst_vq);
47 void mtk_vcodec_enc_release(struct mtk_vcodec_enc_ctx *ctx);
48 int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_enc_ctx *ctx);
49 void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_enc_ctx *ctx);
50 
51 #endif /* _MTK_VCODEC_ENC_H_ */
52