162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci *  Cloned from drivers/media/video/s5p-tv/regs-mixer.h
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
762306a36Sopenharmony_ci * http://www.samsung.com/
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * Mixer register header file for Samsung Mixer driver
1062306a36Sopenharmony_ci*/
1162306a36Sopenharmony_ci#ifndef SAMSUNG_REGS_MIXER_H
1262306a36Sopenharmony_ci#define SAMSUNG_REGS_MIXER_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/*
1562306a36Sopenharmony_ci * Register part
1662306a36Sopenharmony_ci */
1762306a36Sopenharmony_ci#define MXR_STATUS			0x0000
1862306a36Sopenharmony_ci#define MXR_CFG				0x0004
1962306a36Sopenharmony_ci#define MXR_INT_EN			0x0008
2062306a36Sopenharmony_ci#define MXR_INT_STATUS			0x000C
2162306a36Sopenharmony_ci#define MXR_LAYER_CFG			0x0010
2262306a36Sopenharmony_ci#define MXR_VIDEO_CFG			0x0014
2362306a36Sopenharmony_ci#define MXR_GRAPHIC0_CFG		0x0020
2462306a36Sopenharmony_ci#define MXR_GRAPHIC0_BASE		0x0024
2562306a36Sopenharmony_ci#define MXR_GRAPHIC0_SPAN		0x0028
2662306a36Sopenharmony_ci#define MXR_GRAPHIC0_SXY		0x002C
2762306a36Sopenharmony_ci#define MXR_GRAPHIC0_WH			0x0030
2862306a36Sopenharmony_ci#define MXR_GRAPHIC0_DXY		0x0034
2962306a36Sopenharmony_ci#define MXR_GRAPHIC0_BLANK		0x0038
3062306a36Sopenharmony_ci#define MXR_GRAPHIC1_CFG		0x0040
3162306a36Sopenharmony_ci#define MXR_GRAPHIC1_BASE		0x0044
3262306a36Sopenharmony_ci#define MXR_GRAPHIC1_SPAN		0x0048
3362306a36Sopenharmony_ci#define MXR_GRAPHIC1_SXY		0x004C
3462306a36Sopenharmony_ci#define MXR_GRAPHIC1_WH			0x0050
3562306a36Sopenharmony_ci#define MXR_GRAPHIC1_DXY		0x0054
3662306a36Sopenharmony_ci#define MXR_GRAPHIC1_BLANK		0x0058
3762306a36Sopenharmony_ci#define MXR_BG_CFG			0x0060
3862306a36Sopenharmony_ci#define MXR_BG_COLOR0			0x0064
3962306a36Sopenharmony_ci#define MXR_BG_COLOR1			0x0068
4062306a36Sopenharmony_ci#define MXR_BG_COLOR2			0x006C
4162306a36Sopenharmony_ci#define MXR_CM_COEFF_Y			0x0080
4262306a36Sopenharmony_ci#define MXR_CM_COEFF_CB			0x0084
4362306a36Sopenharmony_ci#define MXR_CM_COEFF_CR			0x0088
4462306a36Sopenharmony_ci#define MXR_MO				0x0304
4562306a36Sopenharmony_ci#define MXR_RESOLUTION			0x0310
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#define MXR_CFG_S			0x2004
4862306a36Sopenharmony_ci#define MXR_GRAPHIC0_BASE_S		0x2024
4962306a36Sopenharmony_ci#define MXR_GRAPHIC1_BASE_S		0x2044
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci/* for parametrized access to layer registers */
5262306a36Sopenharmony_ci#define MXR_GRAPHIC_CFG(i)		(0x0020 + (i) * 0x20)
5362306a36Sopenharmony_ci#define MXR_GRAPHIC_BASE(i)		(0x0024 + (i) * 0x20)
5462306a36Sopenharmony_ci#define MXR_GRAPHIC_SPAN(i)		(0x0028 + (i) * 0x20)
5562306a36Sopenharmony_ci#define MXR_GRAPHIC_SXY(i)		(0x002C + (i) * 0x20)
5662306a36Sopenharmony_ci#define MXR_GRAPHIC_WH(i)		(0x0030 + (i) * 0x20)
5762306a36Sopenharmony_ci#define MXR_GRAPHIC_DXY(i)		(0x0034 + (i) * 0x20)
5862306a36Sopenharmony_ci#define MXR_GRAPHIC_BLANK(i)		(0x0038 + (i) * 0x20)
5962306a36Sopenharmony_ci#define MXR_GRAPHIC_BASE_S(i)		(0x2024 + (i) * 0x20)
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci/*
6262306a36Sopenharmony_ci * Bit definition part
6362306a36Sopenharmony_ci */
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/* generates mask for range of bits */
6662306a36Sopenharmony_ci#define MXR_MASK(high_bit, low_bit) \
6762306a36Sopenharmony_ci	(((2 << ((high_bit) - (low_bit))) - 1) << (low_bit))
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#define MXR_MASK_VAL(val, high_bit, low_bit) \
7062306a36Sopenharmony_ci	(((val) << (low_bit)) & MXR_MASK(high_bit, low_bit))
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci/* bits for MXR_STATUS */
7362306a36Sopenharmony_ci#define MXR_STATUS_SOFT_RESET		(1 << 8)
7462306a36Sopenharmony_ci#define MXR_STATUS_16_BURST		(1 << 7)
7562306a36Sopenharmony_ci#define MXR_STATUS_BURST_MASK		(1 << 7)
7662306a36Sopenharmony_ci#define MXR_STATUS_BIG_ENDIAN		(1 << 3)
7762306a36Sopenharmony_ci#define MXR_STATUS_ENDIAN_MASK		(1 << 3)
7862306a36Sopenharmony_ci#define MXR_STATUS_SYNC_ENABLE		(1 << 2)
7962306a36Sopenharmony_ci#define MXR_STATUS_REG_IDLE		(1 << 1)
8062306a36Sopenharmony_ci#define MXR_STATUS_REG_RUN		(1 << 0)
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci/* bits for MXR_CFG */
8362306a36Sopenharmony_ci#define MXR_CFG_LAYER_UPDATE		(1 << 31)
8462306a36Sopenharmony_ci#define MXR_CFG_LAYER_UPDATE_COUNT_MASK (3 << 29)
8562306a36Sopenharmony_ci#define MXR_CFG_QUANT_RANGE_FULL	(0 << 9)
8662306a36Sopenharmony_ci#define MXR_CFG_QUANT_RANGE_LIMITED	(1 << 9)
8762306a36Sopenharmony_ci#define MXR_CFG_RGB601			(0 << 10)
8862306a36Sopenharmony_ci#define MXR_CFG_RGB709			(1 << 10)
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci#define MXR_CFG_RGB_FMT_MASK		0x600
9162306a36Sopenharmony_ci#define MXR_CFG_OUT_YUV444		(0 << 8)
9262306a36Sopenharmony_ci#define MXR_CFG_OUT_RGB888		(1 << 8)
9362306a36Sopenharmony_ci#define MXR_CFG_OUT_MASK		(1 << 8)
9462306a36Sopenharmony_ci#define MXR_CFG_DST_SDO			(0 << 7)
9562306a36Sopenharmony_ci#define MXR_CFG_DST_HDMI		(1 << 7)
9662306a36Sopenharmony_ci#define MXR_CFG_DST_MASK		(1 << 7)
9762306a36Sopenharmony_ci#define MXR_CFG_SCAN_HD_720		(0 << 6)
9862306a36Sopenharmony_ci#define MXR_CFG_SCAN_HD_1080		(1 << 6)
9962306a36Sopenharmony_ci#define MXR_CFG_GRP1_ENABLE		(1 << 5)
10062306a36Sopenharmony_ci#define MXR_CFG_GRP0_ENABLE		(1 << 4)
10162306a36Sopenharmony_ci#define MXR_CFG_VP_ENABLE		(1 << 3)
10262306a36Sopenharmony_ci#define MXR_CFG_SCAN_INTERLACE		(0 << 2)
10362306a36Sopenharmony_ci#define MXR_CFG_SCAN_PROGRESSIVE	(1 << 2)
10462306a36Sopenharmony_ci#define MXR_CFG_SCAN_NTSC		(0 << 1)
10562306a36Sopenharmony_ci#define MXR_CFG_SCAN_PAL		(1 << 1)
10662306a36Sopenharmony_ci#define MXR_CFG_SCAN_SD			(0 << 0)
10762306a36Sopenharmony_ci#define MXR_CFG_SCAN_HD			(1 << 0)
10862306a36Sopenharmony_ci#define MXR_CFG_SCAN_MASK		0x47
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci/* bits for MXR_VIDEO_CFG */
11162306a36Sopenharmony_ci#define MXR_VID_CFG_BLEND_EN		(1 << 16)
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/* bits for MXR_GRAPHICn_CFG */
11462306a36Sopenharmony_ci#define MXR_GRP_CFG_COLOR_KEY_DISABLE	(1 << 21)
11562306a36Sopenharmony_ci#define MXR_GRP_CFG_BLEND_PRE_MUL	(1 << 20)
11662306a36Sopenharmony_ci#define MXR_GRP_CFG_WIN_BLEND_EN	(1 << 17)
11762306a36Sopenharmony_ci#define MXR_GRP_CFG_PIXEL_BLEND_EN	(1 << 16)
11862306a36Sopenharmony_ci#define MXR_GRP_CFG_MISC_MASK		((3 << 16) | (3 << 20) | 0xff)
11962306a36Sopenharmony_ci#define MXR_GRP_CFG_FORMAT_VAL(x)	MXR_MASK_VAL(x, 11, 8)
12062306a36Sopenharmony_ci#define MXR_GRP_CFG_FORMAT_MASK		MXR_GRP_CFG_FORMAT_VAL(~0)
12162306a36Sopenharmony_ci#define MXR_GRP_CFG_ALPHA_VAL(x)	MXR_MASK_VAL(x, 7, 0)
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci/* bits for MXR_GRAPHICn_WH */
12462306a36Sopenharmony_ci#define MXR_GRP_WH_H_SCALE(x)		MXR_MASK_VAL(x, 28, 28)
12562306a36Sopenharmony_ci#define MXR_GRP_WH_V_SCALE(x)		MXR_MASK_VAL(x, 12, 12)
12662306a36Sopenharmony_ci#define MXR_GRP_WH_WIDTH(x)		MXR_MASK_VAL(x, 26, 16)
12762306a36Sopenharmony_ci#define MXR_GRP_WH_HEIGHT(x)		MXR_MASK_VAL(x, 10, 0)
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci/* bits for MXR_RESOLUTION */
13062306a36Sopenharmony_ci#define MXR_MXR_RES_HEIGHT(x)		MXR_MASK_VAL(x, 26, 16)
13162306a36Sopenharmony_ci#define MXR_MXR_RES_WIDTH(x)		MXR_MASK_VAL(x, 10, 0)
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_ci/* bits for MXR_GRAPHICn_SXY */
13462306a36Sopenharmony_ci#define MXR_GRP_SXY_SX(x)		MXR_MASK_VAL(x, 26, 16)
13562306a36Sopenharmony_ci#define MXR_GRP_SXY_SY(x)		MXR_MASK_VAL(x, 10, 0)
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci/* bits for MXR_GRAPHICn_DXY */
13862306a36Sopenharmony_ci#define MXR_GRP_DXY_DX(x)		MXR_MASK_VAL(x, 26, 16)
13962306a36Sopenharmony_ci#define MXR_GRP_DXY_DY(x)		MXR_MASK_VAL(x, 10, 0)
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci/* bits for MXR_INT_EN */
14262306a36Sopenharmony_ci#define MXR_INT_EN_VSYNC		(1 << 11)
14362306a36Sopenharmony_ci#define MXR_INT_EN_ALL			(0x0f << 8)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci/* bits for MXR_INT_STATUS */
14662306a36Sopenharmony_ci#define MXR_INT_CLEAR_VSYNC		(1 << 11)
14762306a36Sopenharmony_ci#define MXR_INT_STATUS_VSYNC		(1 << 0)
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci/* bits for MXR_LAYER_CFG */
15062306a36Sopenharmony_ci#define MXR_LAYER_CFG_GRP1_VAL(x)	MXR_MASK_VAL(x, 11, 8)
15162306a36Sopenharmony_ci#define MXR_LAYER_CFG_GRP1_MASK		MXR_LAYER_CFG_GRP1_VAL(~0)
15262306a36Sopenharmony_ci#define MXR_LAYER_CFG_GRP0_VAL(x)	MXR_MASK_VAL(x, 7, 4)
15362306a36Sopenharmony_ci#define MXR_LAYER_CFG_GRP0_MASK		MXR_LAYER_CFG_GRP0_VAL(~0)
15462306a36Sopenharmony_ci#define MXR_LAYER_CFG_VP_VAL(x)		MXR_MASK_VAL(x, 3, 0)
15562306a36Sopenharmony_ci#define MXR_LAYER_CFG_VP_MASK		MXR_LAYER_CFG_VP_VAL(~0)
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci/* bits for MXR_CM_COEFF_Y */
15862306a36Sopenharmony_ci#define MXR_CM_COEFF_RGB_FULL		(1 << 30)
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci#endif /* SAMSUNG_REGS_MIXER_H */
16162306a36Sopenharmony_ci
162