162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Register definition file for Samsung MFC V8.x Interface (FIMV) driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2014 Samsung Electronics Co., Ltd.
662306a36Sopenharmony_ci *		http://www.samsung.com/
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef _REGS_MFC_V8_H
1062306a36Sopenharmony_ci#define _REGS_MFC_V8_H
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/sizes.h>
1362306a36Sopenharmony_ci#include "regs-mfc-v7.h"
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/* Additional registers for v8 */
1662306a36Sopenharmony_ci#define S5P_FIMV_D_MVC_NUM_VIEWS_V8		0xf104
1762306a36Sopenharmony_ci#define S5P_FIMV_D_MIN_SCRATCH_BUFFER_SIZE_V8	0xf108
1862306a36Sopenharmony_ci#define S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8	0xf144
1962306a36Sopenharmony_ci#define S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V8	0xf148
2062306a36Sopenharmony_ci#define S5P_FIMV_D_MV_BUFFER_SIZE_V8		0xf150
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define S5P_FIMV_D_FIRST_PLANE_DPB_STRIDE_SIZE_V8	0xf138
2362306a36Sopenharmony_ci#define S5P_FIMV_D_SECOND_PLANE_DPB_STRIDE_SIZE_V8	0xf13c
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define S5P_FIMV_D_FIRST_PLANE_DPB_V8		0xf160
2662306a36Sopenharmony_ci#define S5P_FIMV_D_SECOND_PLANE_DPB_V8		0xf260
2762306a36Sopenharmony_ci#define S5P_FIMV_D_MV_BUFFER_V8			0xf460
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define S5P_FIMV_D_NUM_MV_V8			0xf134
3062306a36Sopenharmony_ci#define S5P_FIMV_D_INIT_BUFFER_OPTIONS_V8	0xf154
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define S5P_FIMV_D_SCRATCH_BUFFER_ADDR_V8	0xf560
3362306a36Sopenharmony_ci#define S5P_FIMV_D_SCRATCH_BUFFER_SIZE_V8	0xf564
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define S5P_FIMV_D_CPB_BUFFER_ADDR_V8		0xf5b0
3662306a36Sopenharmony_ci#define S5P_FIMV_D_CPB_BUFFER_SIZE_V8		0xf5b4
3762306a36Sopenharmony_ci#define S5P_FIMV_D_AVAILABLE_DPB_FLAG_LOWER_V8	0xf5bc
3862306a36Sopenharmony_ci#define S5P_FIMV_D_CPB_BUFFER_OFFSET_V8		0xf5c0
3962306a36Sopenharmony_ci#define S5P_FIMV_D_SLICE_IF_ENABLE_V8		0xf5c4
4062306a36Sopenharmony_ci#define S5P_FIMV_D_STREAM_DATA_SIZE_V8		0xf5d0
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci/* Display information register */
4362306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_FRAME_WIDTH_V8	0xf600
4462306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_FRAME_HEIGHT_V8	0xf604
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci/* Display status */
4762306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_STATUS_V8		0xf608
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_FIRST_PLANE_ADDR_V8	0xf60c
5062306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_SECOND_PLANE_ADDR_V8	0xf610
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_FRAME_TYPE_V8	0xf618
5362306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_CROP_INFO1_V8	0xf61c
5462306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_CROP_INFO2_V8	0xf620
5562306a36Sopenharmony_ci#define S5P_FIMV_D_DISPLAY_PICTURE_PROFILE_V8	0xf624
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/* Decoded picture information register */
5862306a36Sopenharmony_ci#define S5P_FIMV_D_DECODED_STATUS_V8		0xf644
5962306a36Sopenharmony_ci#define S5P_FIMV_D_DECODED_FIRST_PLANE_ADDR_V8	0xf648
6062306a36Sopenharmony_ci#define S5P_FIMV_D_DECODED_SECOND_PLANE_ADDR_V8	0xf64c
6162306a36Sopenharmony_ci#define S5P_FIMV_D_DECODED_THIRD_PLANE_ADDR_V8	0xf650
6262306a36Sopenharmony_ci#define S5P_FIMV_D_DECODED_FRAME_TYPE_V8	0xf654
6362306a36Sopenharmony_ci#define S5P_FIMV_D_DECODED_NAL_SIZE_V8          0xf664
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/* Returned value register for specific setting */
6662306a36Sopenharmony_ci#define S5P_FIMV_D_RET_PICTURE_TAG_TOP_V8	0xf674
6762306a36Sopenharmony_ci#define S5P_FIMV_D_RET_PICTURE_TAG_BOT_V8	0xf678
6862306a36Sopenharmony_ci#define S5P_FIMV_D_MVC_VIEW_ID_V8		0xf6d8
6962306a36Sopenharmony_ci
7062306a36Sopenharmony_ci/* SEI related information */
7162306a36Sopenharmony_ci#define S5P_FIMV_D_FRAME_PACK_SEI_AVAIL_V8	0xf6dc
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci/* Encoder Registers */
7462306a36Sopenharmony_ci#define S5P_FIMV_E_FIXED_PICTURE_QP_V8		0xf794
7562306a36Sopenharmony_ci#define S5P_FIMV_E_RC_CONFIG_V8			0xf798
7662306a36Sopenharmony_ci#define S5P_FIMV_E_RC_QP_BOUND_V8		0xf79c
7762306a36Sopenharmony_ci#define S5P_FIMV_E_RC_RPARAM_V8			0xf7a4
7862306a36Sopenharmony_ci#define S5P_FIMV_E_MB_RC_CONFIG_V8		0xf7a8
7962306a36Sopenharmony_ci#define S5P_FIMV_E_PADDING_CTRL_V8		0xf7ac
8062306a36Sopenharmony_ci#define S5P_FIMV_E_MV_HOR_RANGE_V8		0xf7b4
8162306a36Sopenharmony_ci#define S5P_FIMV_E_MV_VER_RANGE_V8		0xf7b8
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci#define S5P_FIMV_E_VBV_BUFFER_SIZE_V8		0xf78c
8462306a36Sopenharmony_ci#define S5P_FIMV_E_VBV_INIT_DELAY_V8		0xf790
8562306a36Sopenharmony_ci#define S5P_FIMV_E_MIN_SCRATCH_BUFFER_SIZE_V8   0xf894
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci#define S5P_FIMV_E_ASPECT_RATIO_V8		0xfb4c
8862306a36Sopenharmony_ci#define S5P_FIMV_E_EXTENDED_SAR_V8		0xfb50
8962306a36Sopenharmony_ci#define S5P_FIMV_E_H264_OPTIONS_V8		0xfb54
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci/* MFCv8 Context buffer sizes */
9262306a36Sopenharmony_ci#define MFC_CTX_BUF_SIZE_V8		(36 * SZ_1K)	/*  36KB */
9362306a36Sopenharmony_ci#define MFC_H264_DEC_CTX_BUF_SIZE_V8	(2 * SZ_1M)	/*  2MB */
9462306a36Sopenharmony_ci#define MFC_OTHER_DEC_CTX_BUF_SIZE_V8	(20 * SZ_1K)	/*  20KB */
9562306a36Sopenharmony_ci#define MFC_H264_ENC_CTX_BUF_SIZE_V8	(100 * SZ_1K)	/* 100KB */
9662306a36Sopenharmony_ci#define MFC_OTHER_ENC_CTX_BUF_SIZE_V8	(10 * SZ_1K)	/*  10KB */
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci/* Buffer size defines */
9962306a36Sopenharmony_ci#define S5P_FIMV_TMV_BUFFER_SIZE_V8(w, h)	(((w) + 1) * ((h) + 1) * 8)
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ci#define S5P_FIMV_SCRATCH_BUF_SIZE_H264_DEC_V8(w, h)	(((w) * 704) + 2176)
10262306a36Sopenharmony_ci#define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_DEC_V8(w, h) \
10362306a36Sopenharmony_ci		(((w) * 576 + (h) * 128)  + 4128)
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci#define S5P_FIMV_SCRATCH_BUF_SIZE_H264_ENC_V8(w, h) \
10662306a36Sopenharmony_ci			(((w) * 592) + 2336)
10762306a36Sopenharmony_ci#define S5P_FIMV_SCRATCH_BUF_SIZE_VP8_ENC_V8(w, h) \
10862306a36Sopenharmony_ci			(((w) * 576) + 10512 + \
10962306a36Sopenharmony_ci			((((((w) * 16) * ((h) * 16)) * 3) / 2) * 4))
11062306a36Sopenharmony_ci#define S5P_FIMV_ME_BUFFER_SIZE_V8(imw, imh, mbw, mbh) \
11162306a36Sopenharmony_ci	((DIV_ROUND_UP((mbw * 16), 64) *  DIV_ROUND_UP((mbh * 16), 64) * 256) \
11262306a36Sopenharmony_ci	 + (DIV_ROUND_UP((mbw) * (mbh), 32) * 16))
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci/* BUffer alignment defines */
11562306a36Sopenharmony_ci#define S5P_FIMV_D_ALIGN_PLANE_SIZE_V8	64
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci/* MFCv8 variant defines */
11862306a36Sopenharmony_ci#define MAX_FW_SIZE_V8			(SZ_512K)	/* 512KB */
11962306a36Sopenharmony_ci#define MAX_CPB_SIZE_V8			(3 * SZ_1M)	/* 3MB */
12062306a36Sopenharmony_ci#define MFC_VERSION_V8			0x80
12162306a36Sopenharmony_ci#define MFC_NUM_PORTS_V8		1
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#endif /*_REGS_MFC_V8_H*/
124