162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * Copyright (c) 2017 Samsung Electronics Co., Ltd.
562306a36Sopenharmony_ci *     http://www.samsung.com/
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Register definition file for Samsung MFC V10.x Interface (FIMV) driver
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef _REGS_MFC_V10_H
1262306a36Sopenharmony_ci#define _REGS_MFC_V10_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#include <linux/sizes.h>
1562306a36Sopenharmony_ci#include "regs-mfc-v8.h"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/* MFCv10 register definitions*/
1862306a36Sopenharmony_ci#define S5P_FIMV_MFC_CLOCK_OFF_V10			0x7120
1962306a36Sopenharmony_ci#define S5P_FIMV_MFC_STATE_V10				0x7124
2062306a36Sopenharmony_ci#define S5P_FIMV_D_STATIC_BUFFER_ADDR_V10		0xF570
2162306a36Sopenharmony_ci#define S5P_FIMV_D_STATIC_BUFFER_SIZE_V10		0xF574
2262306a36Sopenharmony_ci#define S5P_FIMV_E_NUM_T_LAYER_V10			0xFBAC
2362306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER0_V10		0xFBB0
2462306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER1_V10		0xFBB4
2562306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER2_V10		0xFBB8
2662306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER3_V10		0xFBBC
2762306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER4_V10		0xFBC0
2862306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER5_V10		0xFBC4
2962306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER6_V10		0xFBC8
3062306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER0_V10	0xFD18
3162306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER1_V10	0xFD1C
3262306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER2_V10	0xFD20
3362306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER3_V10	0xFD24
3462306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER4_V10	0xFD28
3562306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER5_V10	0xFD2C
3662306a36Sopenharmony_ci#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER6_V10	0xFD30
3762306a36Sopenharmony_ci#define S5P_FIMV_E_HEVC_OPTIONS_V10			0xFDD4
3862306a36Sopenharmony_ci#define S5P_FIMV_E_HEVC_REFRESH_PERIOD_V10		0xFDD8
3962306a36Sopenharmony_ci#define S5P_FIMV_E_HEVC_CHROMA_QP_OFFSET_V10		0xFDDC
4062306a36Sopenharmony_ci#define S5P_FIMV_E_HEVC_LF_BETA_OFFSET_DIV2_V10		0xFDE0
4162306a36Sopenharmony_ci#define S5P_FIMV_E_HEVC_LF_TC_OFFSET_DIV2_V10		0xFDE4
4262306a36Sopenharmony_ci#define S5P_FIMV_E_HEVC_NAL_CONTROL_V10			0xFDE8
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* MFCv10 Context buffer sizes */
4562306a36Sopenharmony_ci#define MFC_CTX_BUF_SIZE_V10		(30 * SZ_1K)
4662306a36Sopenharmony_ci#define MFC_H264_DEC_CTX_BUF_SIZE_V10	(2 * SZ_1M)
4762306a36Sopenharmony_ci#define MFC_OTHER_DEC_CTX_BUF_SIZE_V10	(20 * SZ_1K)
4862306a36Sopenharmony_ci#define MFC_H264_ENC_CTX_BUF_SIZE_V10	(100 * SZ_1K)
4962306a36Sopenharmony_ci#define MFC_HEVC_ENC_CTX_BUF_SIZE_V10	(30 * SZ_1K)
5062306a36Sopenharmony_ci#define MFC_OTHER_ENC_CTX_BUF_SIZE_V10  (15 * SZ_1K)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/* MFCv10 variant defines */
5362306a36Sopenharmony_ci#define MAX_FW_SIZE_V10		(SZ_1M)
5462306a36Sopenharmony_ci#define MAX_CPB_SIZE_V10	(3 * SZ_1M)
5562306a36Sopenharmony_ci#define MFC_VERSION_V10		0xA0
5662306a36Sopenharmony_ci#define MFC_NUM_PORTS_V10	1
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/* MFCv10 codec defines*/
5962306a36Sopenharmony_ci#define S5P_FIMV_CODEC_HEVC_DEC		17
6062306a36Sopenharmony_ci#define S5P_FIMV_CODEC_VP9_DEC		18
6162306a36Sopenharmony_ci#define S5P_FIMV_CODEC_HEVC_ENC         26
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci/* Decoder buffer size for MFC v10 */
6462306a36Sopenharmony_ci#define DEC_VP9_STATIC_BUFFER_SIZE	20480
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/* Encoder buffer size for MFC v10.0 */
6762306a36Sopenharmony_ci#define ENC_V100_BASE_SIZE(x, y) \
6862306a36Sopenharmony_ci	(((x + 3) * (y + 3) * 8) \
6962306a36Sopenharmony_ci	+  ((y * 64) + 1280) * DIV_ROUND_UP(x, 8))
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci#define ENC_V100_H264_ME_SIZE(x, y) \
7262306a36Sopenharmony_ci	(ENC_V100_BASE_SIZE(x, y) \
7362306a36Sopenharmony_ci	+ (DIV_ROUND_UP(x * y, 64) * 32))
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci#define ENC_V100_MPEG4_ME_SIZE(x, y) \
7662306a36Sopenharmony_ci	(ENC_V100_BASE_SIZE(x, y) \
7762306a36Sopenharmony_ci	+ (DIV_ROUND_UP(x * y, 128) * 16))
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci#define ENC_V100_VP8_ME_SIZE(x, y) \
8062306a36Sopenharmony_ci	ENC_V100_BASE_SIZE(x, y)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci#define ENC_V100_HEVC_ME_SIZE(x, y)	\
8362306a36Sopenharmony_ci	(((x + 3) * (y + 3) * 32)	\
8462306a36Sopenharmony_ci	 + ((y * 128) + 1280) * DIV_ROUND_UP(x, 4))
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#endif /*_REGS_MFC_V10_H*/
8762306a36Sopenharmony_ci
88