1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
4  *
5  * Header file for Samsung MFC (Multi Function Codec - FIMV) driver
6  * Contains declarations of hw related functions.
7  *
8  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
9  *		http://www.samsung.com/
10  */
11 
12 #ifndef S5P_MFC_OPR_V6_H_
13 #define S5P_MFC_OPR_V6_H_
14 
15 #include "s5p_mfc_common.h"
16 #include "s5p_mfc_opr.h"
17 
18 #define MFC_CTRL_MODE_CUSTOM	MFC_CTRL_MODE_SFR
19 
20 #define MB_WIDTH(x_size)		DIV_ROUND_UP(x_size, 16)
21 #define MB_HEIGHT(y_size)		DIV_ROUND_UP(y_size, 16)
22 #define S5P_MFC_DEC_MV_SIZE_V6(x, y)	(MB_WIDTH(x) * \
23 					(((MB_HEIGHT(y)+1)/2)*2) * 64 + 128)
24 #define S5P_MFC_DEC_MV_SIZE_V10(x, y)	(MB_WIDTH(x) * \
25 					(((MB_HEIGHT(y)+1)/2)*2) * 64 + 512)
26 #define S5P_MFC_LCU_WIDTH(x_size)	DIV_ROUND_UP(x_size, 32)
27 #define S5P_MFC_LCU_HEIGHT(y_size)	DIV_ROUND_UP(y_size, 32)
28 
29 #define s5p_mfc_dec_hevc_mv_size(x, y) \
30 	(DIV_ROUND_UP(x, 64) * DIV_ROUND_UP(y, 64) * 256 + 512)
31 
32 /* Definition */
33 #define ENC_MULTI_SLICE_MB_MAX		((1 << 30) - 1)
34 #define ENC_MULTI_SLICE_BIT_MIN		2800
35 #define ENC_INTRA_REFRESH_MB_MAX	((1 << 18) - 1)
36 #define ENC_VBV_BUF_SIZE_MAX		((1 << 30) - 1)
37 #define ENC_H264_LOOP_FILTER_AB_MIN	-12
38 #define ENC_H264_LOOP_FILTER_AB_MAX	12
39 #define ENC_H264_RC_FRAME_RATE_MAX	((1 << 16) - 1)
40 #define ENC_H263_RC_FRAME_RATE_MAX	((1 << 16) - 1)
41 #define ENC_H264_PROFILE_MAX		3
42 #define ENC_H264_LEVEL_MAX		42
43 #define ENC_MPEG4_VOP_TIME_RES_MAX	((1 << 16) - 1)
44 #define FRAME_DELTA_H264_H263		1
45 #define TIGHT_CBR_MAX			10
46 #define ENC_HEVC_RC_FRAME_RATE_MAX	((1 << 16) - 1)
47 #define ENC_HEVC_QP_INDEX_MIN		-12
48 #define ENC_HEVC_QP_INDEX_MAX		12
49 #define ENC_HEVC_LOOP_FILTER_MIN	-12
50 #define ENC_HEVC_LOOP_FILTER_MAX	12
51 #define ENC_HEVC_LEVEL_MAX		62
52 
53 #define FRAME_DELTA_DEFAULT		1
54 
55 struct s5p_mfc_hw_ops *s5p_mfc_init_hw_ops_v6(void);
56 const struct s5p_mfc_regs *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev);
57 #endif /* S5P_MFC_OPR_V6_H_ */
58