18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Register definition file for Samsung MFC V8.x Interface (FIMV) driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2014 Samsung Electronics Co., Ltd.
68c2ecf20Sopenharmony_ci *		http://www.samsung.com/
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef _REGS_MFC_V8_H
108c2ecf20Sopenharmony_ci#define _REGS_MFC_V8_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/sizes.h>
138c2ecf20Sopenharmony_ci#include "regs-mfc-v7.h"
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/* Additional registers for v8 */
168c2ecf20Sopenharmony_ci#define S5P_FIMV_D_MVC_NUM_VIEWS_V8		0xf104
178c2ecf20Sopenharmony_ci#define S5P_FIMV_D_MIN_SCRATCH_BUFFER_SIZE_V8	0xf108
188c2ecf20Sopenharmony_ci#define S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8	0xf144
198c2ecf20Sopenharmony_ci#define S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8	0xf148
208c2ecf20Sopenharmony_ci#define S5P_FIMV_D_MV_BUFFER_SIZE_V8		0xf150
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8	0xf138
238c2ecf20Sopenharmony_ci#define S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8	0xf13c
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define S5P_FIMV_D_FIRST_PLANE_DPB_V8		0xf160
268c2ecf20Sopenharmony_ci#define S5P_FIMV_D_SECOND_PLANE_DPB_V8		0xf260
278c2ecf20Sopenharmony_ci#define S5P_FIMV_D_MV_BUFFER_V8			0xf460
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define S5P_FIMV_D_NUM_MV_V8			0xf134
308c2ecf20Sopenharmony_ci#define S5P_FIMV_D_INIT_BUFFER_OPTIONS_V8	0xf154
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define S5P_FIMV_D_SCRATCH_BUFFER_ADDR_V8	0xf560
338c2ecf20Sopenharmony_ci#define S5P_FIMV_D_SCRATCH_BUFFER_SIZE_V8	0xf564
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define S5P_FIMV_D_CPB_BUFFER_ADDR_V8		0xf5b0
368c2ecf20Sopenharmony_ci#define S5P_FIMV_D_CPB_BUFFER_SIZE_V8		0xf5b4
378c2ecf20Sopenharmony_ci#define S5P_FIMV_D_AVAILABLE_DPB_FLAG_LOWER_V8	0xf5bc
388c2ecf20Sopenharmony_ci#define S5P_FIMV_D_CPB_BUFFER_OFFSET_V8		0xf5c0
398c2ecf20Sopenharmony_ci#define S5P_FIMV_D_SLICE_IF_ENABLE_V8		0xf5c4
408c2ecf20Sopenharmony_ci#define S5P_FIMV_D_STREAM_DATA_SIZE_V8		0xf5d0
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* Display information register */
438c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_FRAME_WIDTH_V8	0xf600
448c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_FRAME_HEIGHT_V8	0xf604
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci/* Display status */
478c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_STATUS_V8		0xf608
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_FIRST_PLANE_ADDR_V8	0xf60c
508c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_SECOND_PLANE_ADDR_V8	0xf610
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_FRAME_TYPE_V8	0xf618
538c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_CROP_INFO1_V8	0xf61c
548c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_CROP_INFO2_V8	0xf620
558c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_PICTURE_PROFILE_V8	0xf624
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/* Decoded picture information register */
588c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DECODED_STATUS_V8		0xf644
598c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DECODED_FIRST_PLANE_ADDR_V8	0xf648
608c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DECODED_SECOND_PLANE_ADDR_V8	0xf64c
618c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DECODED_THIRD_PLANE_ADDR_V8	0xf650
628c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DECODED_FRAME_TYPE_V8	0xf654
638c2ecf20Sopenharmony_ci#define S5P_FIMV_D_DECODED_NAL_SIZE_V8          0xf664
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* Returned value register for specific setting */
668c2ecf20Sopenharmony_ci#define S5P_FIMV_D_RET_PICTURE_TAG_TOP_V8	0xf674
678c2ecf20Sopenharmony_ci#define S5P_FIMV_D_RET_PICTURE_TAG_BOT_V8	0xf678
688c2ecf20Sopenharmony_ci#define S5P_FIMV_D_MVC_VIEW_ID_V8		0xf6d8
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* SEI related information */
718c2ecf20Sopenharmony_ci#define S5P_FIMV_D_FRAME_PACK_SEI_AVAIL_V8	0xf6dc
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/* Encoder Registers */
748c2ecf20Sopenharmony_ci#define S5P_FIMV_E_FIXED_PICTURE_QP_V8		0xf794
758c2ecf20Sopenharmony_ci#define S5P_FIMV_E_RC_CONFIG_V8			0xf798
768c2ecf20Sopenharmony_ci#define S5P_FIMV_E_RC_QP_BOUND_V8		0xf79c
778c2ecf20Sopenharmony_ci#define S5P_FIMV_E_RC_RPARAM_V8			0xf7a4
788c2ecf20Sopenharmony_ci#define S5P_FIMV_E_MB_RC_CONFIG_V8		0xf7a8
798c2ecf20Sopenharmony_ci#define S5P_FIMV_E_PADDING_CTRL_V8		0xf7ac
808c2ecf20Sopenharmony_ci#define S5P_FIMV_E_MV_HOR_RANGE_V8		0xf7b4
818c2ecf20Sopenharmony_ci#define S5P_FIMV_E_MV_VER_RANGE_V8		0xf7b8
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define S5P_FIMV_E_VBV_BUFFER_SIZE_V8		0xf78c
848c2ecf20Sopenharmony_ci#define S5P_FIMV_E_VBV_INIT_DELAY_V8		0xf790
858c2ecf20Sopenharmony_ci#define S5P_FIMV_E_MIN_SCRATCH_BUFFER_SIZE_V8   0xf894
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci#define S5P_FIMV_E_ASPECT_RATIO_V8		0xfb4c
888c2ecf20Sopenharmony_ci#define S5P_FIMV_E_EXTENDED_SAR_V8		0xfb50
898c2ecf20Sopenharmony_ci#define S5P_FIMV_E_H264_OPTIONS_V8		0xfb54
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci/* MFCv8 Context buffer sizes */
928c2ecf20Sopenharmony_ci#define MFC_CTX_BUF_SIZE_V8		(36 * SZ_1K)	/*  36KB */
938c2ecf20Sopenharmony_ci#define MFC_H264_DEC_CTX_BUF_SIZE_V8	(2 * SZ_1M)	/*  2MB */
948c2ecf20Sopenharmony_ci#define MFC_OTHER_DEC_CTX_BUF_SIZE_V8	(20 * SZ_1K)	/*  20KB */
958c2ecf20Sopenharmony_ci#define MFC_H264_ENC_CTX_BUF_SIZE_V8	(100 * SZ_1K)	/* 100KB */
968c2ecf20Sopenharmony_ci#define MFC_OTHER_ENC_CTX_BUF_SIZE_V8	(10 * SZ_1K)	/*  10KB */
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* Buffer size defines */
998c2ecf20Sopenharmony_ci#define S5P_FIMV_TMV_BUFFER_SIZE_V8(w, h)	(((w) + 1) * ((h) + 1) * 8)
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define S5P_FIMV_SCRATCH_BUF_SIZE_H264_DEC_V8(w, h)	(((w) * 704) + 2176)
1028c2ecf20Sopenharmony_ci#define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_DEC_V8(w, h) \
1038c2ecf20Sopenharmony_ci		(((w) * 576 + (h) * 128)  + 4128)
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define S5P_FIMV_SCRATCH_BUF_SIZE_H264_ENC_V8(w, h) \
1068c2ecf20Sopenharmony_ci			(((w) * 592) + 2336)
1078c2ecf20Sopenharmony_ci#define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_ENC_V8(w, h) \
1088c2ecf20Sopenharmony_ci			(((w) * 576) + 10512 + \
1098c2ecf20Sopenharmony_ci			((((((w) * 16) * ((h) * 16)) * 3) / 2) * 4))
1108c2ecf20Sopenharmony_ci#define S5P_FIMV_ME_BUFFER_SIZE_V8(imw, imh, mbw, mbh) \
1118c2ecf20Sopenharmony_ci	((DIV_ROUND_UP((mbw * 16), 64) *  DIV_ROUND_UP((mbh * 16), 64) * 256) \
1128c2ecf20Sopenharmony_ci	 + (DIV_ROUND_UP((mbw) * (mbh), 32) * 16))
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/* BUffer alignment defines */
1158c2ecf20Sopenharmony_ci#define S5P_FIMV_D_ALIGN_PLANE_SIZE_V8	64
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* MFCv8 variant defines */
1188c2ecf20Sopenharmony_ci#define MAX_FW_SIZE_V8			(SZ_512K)	/* 512KB */
1198c2ecf20Sopenharmony_ci#define MAX_CPB_SIZE_V8			(3 * SZ_1M)	/* 3MB */
1208c2ecf20Sopenharmony_ci#define MFC_VERSION_V8			0x80
1218c2ecf20Sopenharmony_ci#define MFC_NUM_PORTS_V8		1
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#endif /*_REGS_MFC_V8_H*/
124