162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2020 BayLibre, SAS
462306a36Sopenharmony_ci * Author: Neil Armstrong <narmstrong@baylibre.com>
562306a36Sopenharmony_ci * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __GE2D_REGS__
962306a36Sopenharmony_ci#define __GE2D_REGS__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/* Registers starts at (GE2D_REG(0x8a0 * 4) */
1262306a36Sopenharmony_ci#define GE2D_REG(x) ((0x8a0 + (x)) * 4)
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define GE2D_GEN_CTRL0 GE2D_REG(0x00)
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define GE2D_DST_BYTEMASK_ONLY		BIT(31)
1762306a36Sopenharmony_ci#define GE2D_DST_BITMASK_EN		BIT(30)
1862306a36Sopenharmony_ci#define GE2D_SRC2_KEY_EN		BIT(29)
1962306a36Sopenharmony_ci#define GE2D_SRC2_KEY_MODE		BIT(28)
2062306a36Sopenharmony_ci#define GE2D_SRC1_KEY_EN		BIT(27)
2162306a36Sopenharmony_ci#define GE2D_SRC1_KEY_MODE		BIT(26)
2262306a36Sopenharmony_ci#define GE2D_DST1_8B_MODE_SEL		GENMASK(25, 24)
2362306a36Sopenharmony_ci#define GE2D_DST_CLIP_MODE		BIT(23)
2462306a36Sopenharmony_ci#define GE2D_SRC2_8B_MODE_SEL		GENMASK(16, 15)
2562306a36Sopenharmony_ci#define GE2D_SRC2_FILL_MODE		BIT(14)
2662306a36Sopenharmony_ci#define GE2D_SRC2_PIC_STRUCT		GENMASK(13, 12)
2762306a36Sopenharmony_ci#define GE2D_SRC2_X_YC_RATIO		BIT(11)
2862306a36Sopenharmony_ci#define GE2D_SRC1_8B_MODE_SEL		GENMASK(6, 5)
2962306a36Sopenharmony_ci#define GE2D_SRC1_FILL_MODE		BIT(4)
3062306a36Sopenharmony_ci#define GE2D_SRC1_LUT_EN		BIT(3)
3162306a36Sopenharmony_ci#define GE2D_SRC1_PIC_STRUCT		GENMASK(2, 1)
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define GE2D_GEN_CTRL1 GE2D_REG(0x01)
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define GE2D_SOFT_RST			BIT(31)
3662306a36Sopenharmony_ci#define GE2D_DST_WRITE_RESP_CNT_RST	BIT(30)
3762306a36Sopenharmony_ci#define GE2D_DST_WRITE_RESP_CNT_ADD_DIS	BIT(29)
3862306a36Sopenharmony_ci#define GE2D_COLOR_CONVERSION_MODE1	BIT(26)
3962306a36Sopenharmony_ci#define GE2D_INTERRUPT_CTRL		GENMASK(25, 24)
4062306a36Sopenharmony_ci#define GE2D_SRC2_BURST_SIZE_CTRL	GENMASK(23, 22)
4162306a36Sopenharmony_ci#define GE2D_SRC1_BURST_SIZE_CTRL	GENMASK(21, 16)
4262306a36Sopenharmony_ci#define GE2D_DST1_PIC_STRUCT		GENMASK(15, 14)
4362306a36Sopenharmony_ci#define GE2D_SRC_RD_CTRL		GENMASK(13, 12)
4462306a36Sopenharmony_ci#define GE2D_DST2_URGENT_EN		BIT(11)
4562306a36Sopenharmony_ci#define GE2D_SRC1_URGENT_EN		BIT(10)
4662306a36Sopenharmony_ci#define GE2D_SRC2_URGENT_EN		BIT(9)
4762306a36Sopenharmony_ci#define GE2D_DST1_URGENT_EN		BIT(8)
4862306a36Sopenharmony_ci#define GE2D_SRC1_GB_ALPHA		GENMASK(7, 0)
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci#define GE2D_GEN_CTRL2 GE2D_REG(0x02)
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#define GE2D_ALPHA_CONVERSION_MODE0	BIT(31)
5362306a36Sopenharmony_ci#define GE2D_COLOR_CONVERSION_MODE0	BIT(30)
5462306a36Sopenharmony_ci#define GE2D_SRC1_GB_ALPHA_EN		BIT(29)
5562306a36Sopenharmony_ci#define GE2D_DST1_COLOR_ROUND_MODE	BIT(28)
5662306a36Sopenharmony_ci#define GE2D_SRC2_COLOR_EXPAND_MODE	BIT(27)
5762306a36Sopenharmony_ci#define GE2D_SRC2_ALPHA_EXPAND_MODE	BIT(26)
5862306a36Sopenharmony_ci#define GE2D_SRC1_COLOR_EXPAND_MODE	BIT(25)
5962306a36Sopenharmony_ci#define GE2D_SRC1_ALPHA_EXPAND_MODE	BIT(24)
6062306a36Sopenharmony_ci#define GE2D_DST_LITTLE_ENDIAN		BIT(23)
6162306a36Sopenharmony_ci#define GE2D_DST1_COLOR_MAP		GENMASK(22, 19)
6262306a36Sopenharmony_ci#define GE2D_ALU_MULT_MODE		BIT(18)
6362306a36Sopenharmony_ci#define GE2D_DST1_FORMAT		GENMASK(17, 16)
6462306a36Sopenharmony_ci#define GE2D_SRC2_LITTLE_ENDIAN		BIT(15)
6562306a36Sopenharmony_ci#define GE2D_SRC2_COLOR_MAP		GENMASK(14, 11)
6662306a36Sopenharmony_ci#define GE2D_ALPHA_CONVERSION_MODE1	BIT(10)
6762306a36Sopenharmony_ci#define GE2D_SRC2_FORMAT		GENMASK(9, 8)
6862306a36Sopenharmony_ci#define GE2D_SRC1_LITTLE_ENDIAN		BIT(7)
6962306a36Sopenharmony_ci#define GE2D_SRC1_COLOR_MAP		GENMASK(6, 3)
7062306a36Sopenharmony_ci#define GE2D_SRC1_DEEPCOLOR		BIT(2)
7162306a36Sopenharmony_ci#define GE2D_SRC1_FORMAT		GENMASK(1, 0)
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#define GE2D_FORMAT_8BIT	0
7462306a36Sopenharmony_ci#define GE2D_FORMAT_16BIT	1
7562306a36Sopenharmony_ci#define GE2D_FORMAT_24BIT	2
7662306a36Sopenharmony_ci#define GE2D_FORMAT_32BIT	3
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci/* 16 bit */
7962306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUV422		0
8062306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGB655		1
8162306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUV655		1
8262306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGB844		2
8362306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUV844		2
8462306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGBA6442		3
8562306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUVA6442		3
8662306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGBA4444		4
8762306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUVA4444		4
8862306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGB565		5
8962306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUV565		5
9062306a36Sopenharmony_ci#define GE2D_COLOR_MAP_ARGB4444		6
9162306a36Sopenharmony_ci#define GE2D_COLOR_MAP_AYUV4444		6
9262306a36Sopenharmony_ci#define GE2D_COLOR_MAP_ARGB1555		7
9362306a36Sopenharmony_ci#define GE2D_COLOR_MAP_AYUV1555		7
9462306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGBA4642		8
9562306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUVA4642		8
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/* 24 bit */
9862306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGB888		0
9962306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUV444		0
10062306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGBA5658		1
10162306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUVA5658		1
10262306a36Sopenharmony_ci#define GE2D_COLOR_MAP_ARGB8565		2
10362306a36Sopenharmony_ci#define GE2D_COLOR_MAP_AYUV8565		2
10462306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGBA6666		3
10562306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUVA6666		3
10662306a36Sopenharmony_ci#define GE2D_COLOR_MAP_ARGB6666		4
10762306a36Sopenharmony_ci#define GE2D_COLOR_MAP_AYUV6666		4
10862306a36Sopenharmony_ci#define GE2D_COLOR_MAP_BGR888		5
10962306a36Sopenharmony_ci#define GE2D_COLOR_MAP_VUY888		5
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci/* 32 bit */
11262306a36Sopenharmony_ci#define GE2D_COLOR_MAP_RGBA8888		0
11362306a36Sopenharmony_ci#define GE2D_COLOR_MAP_YUVA8888		0
11462306a36Sopenharmony_ci#define GE2D_COLOR_MAP_ARGB8888		1
11562306a36Sopenharmony_ci#define GE2D_COLOR_MAP_AYUV8888		1
11662306a36Sopenharmony_ci#define GE2D_COLOR_MAP_ABGR8888		2
11762306a36Sopenharmony_ci#define GE2D_COLOR_MAP_AVUY8888		2
11862306a36Sopenharmony_ci#define GE2D_COLOR_MAP_BGRA8888		3
11962306a36Sopenharmony_ci#define GE2D_COLOR_MAP_VUYA8888		3
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#define GE2D_CMD_CTRL GE2D_REG(0x03)
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci#define GE2D_SRC2_FILL_COLOR_EN		BIT(9)
12462306a36Sopenharmony_ci#define GE2D_SRC1_FILL_COLOR_EN		BIT(8)
12562306a36Sopenharmony_ci#define GE2D_DST_XY_SWAP		BIT(7)
12662306a36Sopenharmony_ci#define GE2D_DST_X_REV			BIT(6)
12762306a36Sopenharmony_ci#define GE2D_DST_Y_REV			BIT(5)
12862306a36Sopenharmony_ci#define GE2D_SRC2_X_REV			BIT(4)
12962306a36Sopenharmony_ci#define GE2D_SRC2_Y_REV			BIT(3)
13062306a36Sopenharmony_ci#define GE2D_SRC1_X_REV			BIT(2)
13162306a36Sopenharmony_ci#define GE2D_SRC1_Y_REV			BIT(1)
13262306a36Sopenharmony_ci#define GE2D_CBUS_CMD_WR		BIT(0)
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci#define GE2D_STATUS0 GE2D_REG(0x04)
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci#define GE2D_DST_WRITE_RSP_CNT		GENMASK(28, 17)
13762306a36Sopenharmony_ci#define GE2D_DP_STATUS			GENMASK(16, 7)
13862306a36Sopenharmony_ci#define GE2D_R1CMD_RDY			BIT(6)
13962306a36Sopenharmony_ci#define GE2D_R2CMD_RDY			BIT(5)
14062306a36Sopenharmony_ci#define GE2D_PDPCMD_VALID		BIT(4)
14162306a36Sopenharmony_ci#define GE2D_DPCMD_RDY			BIT(3)
14262306a36Sopenharmony_ci#define GE2D_BUF_CMD_VALID		BIT(2)
14362306a36Sopenharmony_ci#define GE2D_CURR_CMD_VALID		BIT(1)
14462306a36Sopenharmony_ci#define GE2D_GE2D_BUSY			BIT(0)
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci#define GE2D_STATUS1 GE2D_REG(0x05)
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci#define GE2D_WR_DST1_STATUS		GENMASK(29, 16)
14962306a36Sopenharmony_ci#define GE2D_RD_SRC2_FIFO_EMPTY		BIT(15)
15062306a36Sopenharmony_ci#define GE2D_RD_SRC2_FIFO_OVERFLOW	BIT(14)
15162306a36Sopenharmony_ci#define GE2D_RD_SRC2_STATE_Y		GENMASK(13, 12)
15262306a36Sopenharmony_ci#define GE2D_RD_SRC2_WIN_ERR		BIT(11)
15362306a36Sopenharmony_ci#define GE2D_RD_SRC2_CMD_BUSY		BIT(10)
15462306a36Sopenharmony_ci#define GE2D_RD_SRC1_FIFO_EMPTY		BIT(9)
15562306a36Sopenharmony_ci#define GE2D_RD_SRC1_FIFO_OVERFLOW	BIT(8)
15662306a36Sopenharmony_ci#define GE2D_RD_SRC1_STATE_CR		GENMASK(7, 6)
15762306a36Sopenharmony_ci#define GE2D_RD_SRC1_STATE_CB		GENMASK(5, 4)
15862306a36Sopenharmony_ci#define GE2D_RD_SRC1_STATE_Y		GENMASK(3, 2)
15962306a36Sopenharmony_ci#define GE2D_RD_SRC1_WIN_ERR		BIT(1)
16062306a36Sopenharmony_ci#define GE2D_RD_SRC1_CMD_BUSY		BIT(0)
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ci#define GE2D_SRC1_DEF_COLOR GE2D_REG(0x06)
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci#define GE2D_COLOR_R_Y			GENMASK(31, 24)
16562306a36Sopenharmony_ci#define GE2D_COLOR_B_CB			GENMASK(23, 16)
16662306a36Sopenharmony_ci#define GE2D_COLOR_B_CR			GENMASK(15, 8)
16762306a36Sopenharmony_ci#define GE2D_COLOR_ALPHA		GENMASK(7, 0)
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci#define GE2D_SRC1_CLIPX_START_END GE2D_REG(0x07)
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci#define GE2D_START_EXTRA	BIT(31) /* For GE2D_SRC1_CLIPX/Y_START_END */
17262306a36Sopenharmony_ci#define GE2D_START_EXTRA0	BIT(30)	/* For GE2D_SRC1_X/Y_START_END */
17362306a36Sopenharmony_ci#define GE2D_START		GENMASK(28, 16)
17462306a36Sopenharmony_ci#define GE2D_END_EXTRA		BIT(15) /* For GE2D_SRC1_CLIPX/Y_START_END */
17562306a36Sopenharmony_ci#define GE2D_END_EXTRA0		BIT(14)	/* For GE2D_SRC1_X/Y_START_END */
17662306a36Sopenharmony_ci#define GE2D_END		GENMASK(12, 0)
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci#define GE2D_SRC1_CLIPY_START_END GE2D_REG(0x08)
17962306a36Sopenharmony_ci#define GE2D_SRC1_CANVAS GE2D_REG(0x09)
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci#define GE2D_SRC1_CANVAS_ADDR	GENMASK(31, 24)
18262306a36Sopenharmony_ci
18362306a36Sopenharmony_ci#define GE2D_SRC1_X_START_END GE2D_REG(0x0a)
18462306a36Sopenharmony_ci#define GE2D_SRC1_Y_START_END GE2D_REG(0x0b)
18562306a36Sopenharmony_ci#define GE2D_SRC1_LUT_ADDR GE2D_REG(0x0c)
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#define GE2D_LUT_READ		BIT(8)
18862306a36Sopenharmony_ci#define GE2D_LUT_ADDR		GENMASK(7, 0)
18962306a36Sopenharmony_ci
19062306a36Sopenharmony_ci#define GE2D_SRC1_LUT_DAT GE2D_REG(0x0d)
19162306a36Sopenharmony_ci#define GE2D_SRC1_FMT_CTRL GE2D_REG(0x0e)
19262306a36Sopenharmony_ci#define GE2D_SRC2_DEF_COLOR GE2D_REG(0x0f)
19362306a36Sopenharmony_ci#define GE2D_SRC2_CLIPX_START_END GE2D_REG(0x10)
19462306a36Sopenharmony_ci#define GE2D_SRC2_CLIPY_START_END GE2D_REG(0x11)
19562306a36Sopenharmony_ci#define GE2D_SRC2_X_START_END GE2D_REG(0x12)
19662306a36Sopenharmony_ci#define GE2D_SRC2_Y_START_END GE2D_REG(0x13)
19762306a36Sopenharmony_ci#define GE2D_DST_CLIPX_START_END GE2D_REG(0x14)
19862306a36Sopenharmony_ci#define GE2D_DST_CLIPY_START_END GE2D_REG(0x15)
19962306a36Sopenharmony_ci#define GE2D_DST_X_START_END GE2D_REG(0x16)
20062306a36Sopenharmony_ci#define GE2D_DST_Y_START_END GE2D_REG(0x17)
20162306a36Sopenharmony_ci#define GE2D_SRC2_DST_CANVAS GE2D_REG(0x18)
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci#define GE2D_DST2_CANVAS_ADDR	GENMASK(23, 16)
20462306a36Sopenharmony_ci#define GE2D_SRC2_CANVAS_ADDR	GENMASK(15, 8)
20562306a36Sopenharmony_ci#define GE2D_DST1_CANVAS_ADDR	GENMASK(7, 0)
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci#define GE2D_VSC_START_PHASE_STEP GE2D_REG(0x19)
20862306a36Sopenharmony_ci#define GE2D_VSC_PHASE_SLOPE GE2D_REG(0x1a)
20962306a36Sopenharmony_ci#define GE2D_VSC_INI_CTRL GE2D_REG(0x1b)
21062306a36Sopenharmony_ci#define GE2D_HSC_START_PHASE_STEP GE2D_REG(0x1c)
21162306a36Sopenharmony_ci#define GE2D_HSC_PHASE_SLOPE GE2D_REG(0x1d)
21262306a36Sopenharmony_ci#define GE2D_HSC_INI_CTRL GE2D_REG(0x1e)
21362306a36Sopenharmony_ci#define GE2D_HSC_ADV_CTRL GE2D_REG(0x1f)
21462306a36Sopenharmony_ci#define GE2D_SC_MISC_CTRL GE2D_REG(0x20)
21562306a36Sopenharmony_ci#define GE2D_VSC_NRND_POINT GE2D_REG(0x21)
21662306a36Sopenharmony_ci#define GE2D_VSC_NRND_PHASE GE2D_REG(0x22)
21762306a36Sopenharmony_ci#define GE2D_HSC_NRND_POINT GE2D_REG(0x23)
21862306a36Sopenharmony_ci#define GE2D_HSC_NRND_PHASE GE2D_REG(0x24)
21962306a36Sopenharmony_ci#define GE2D_MATRIX_PRE_OFFSET GE2D_REG(0x25)
22062306a36Sopenharmony_ci#define GE2D_MATRIX_COEF00_01 GE2D_REG(0x26)
22162306a36Sopenharmony_ci#define GE2D_MATRIX_COEF02_10 GE2D_REG(0x27)
22262306a36Sopenharmony_ci#define GE2D_MATRIX_COEF11_12 GE2D_REG(0x28)
22362306a36Sopenharmony_ci#define GE2D_MATRIX_COEF20_21 GE2D_REG(0x29)
22462306a36Sopenharmony_ci#define GE2D_MATRIX_COEF22_CTRL GE2D_REG(0x2a)
22562306a36Sopenharmony_ci#define GE2D_MATRIX_OFFSET GE2D_REG(0x2b)
22662306a36Sopenharmony_ci#define GE2D_ALU_OP_CTRL GE2D_REG(0x2c)
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci#define GE2D_SRC1_COLOR_MULT_ALPHA_SEL	GENMASK(26, 25)
22962306a36Sopenharmony_ci#define GE2D_SRC2_COLOR_MULT_ALPHA_SEL	BIT(24)
23062306a36Sopenharmony_ci#define GE2D_ALU_BLEND_MODE		GENMASK(22, 20)
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci#define OPERATION_ADD           0    /* Cd = Cs*Fs+Cd*Fd */
23362306a36Sopenharmony_ci#define OPERATION_SUB           1    /* Cd = Cs*Fs-Cd*Fd */
23462306a36Sopenharmony_ci#define OPERATION_REVERSE_SUB   2    /* Cd = Cd*Fd-Cs*Fs */
23562306a36Sopenharmony_ci#define OPERATION_MIN           3    /* Cd = Min(Cd*Fd,Cs*Fs) */
23662306a36Sopenharmony_ci#define OPERATION_MAX           4    /* Cd = Max(Cd*Fd,Cs*Fs) */
23762306a36Sopenharmony_ci#define OPERATION_LOGIC         5
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci#define GE2D_ALU_SRC_COLOR_BLEND_FACTOR	GENMASK(19, 16)
24062306a36Sopenharmony_ci#define GE2D_ALU_DST_COLOR_BLEND_FACTOR	GENMASK(15, 12)
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci#define COLOR_FACTOR_ZERO                     0
24362306a36Sopenharmony_ci#define COLOR_FACTOR_ONE                      1
24462306a36Sopenharmony_ci#define COLOR_FACTOR_SRC_COLOR                2
24562306a36Sopenharmony_ci#define COLOR_FACTOR_ONE_MINUS_SRC_COLOR      3
24662306a36Sopenharmony_ci#define COLOR_FACTOR_DST_COLOR                4
24762306a36Sopenharmony_ci#define COLOR_FACTOR_ONE_MINUS_DST_COLOR      5
24862306a36Sopenharmony_ci#define COLOR_FACTOR_SRC_ALPHA                6
24962306a36Sopenharmony_ci#define COLOR_FACTOR_ONE_MINUS_SRC_ALPHA      7
25062306a36Sopenharmony_ci#define COLOR_FACTOR_DST_ALPHA                8
25162306a36Sopenharmony_ci#define COLOR_FACTOR_ONE_MINUS_DST_ALPHA      9
25262306a36Sopenharmony_ci#define COLOR_FACTOR_CONST_COLOR              10
25362306a36Sopenharmony_ci#define COLOR_FACTOR_ONE_MINUS_CONST_COLOR    11
25462306a36Sopenharmony_ci#define COLOR_FACTOR_CONST_ALPHA              12
25562306a36Sopenharmony_ci#define COLOR_FACTOR_ONE_MINUS_CONST_ALPHA    13
25662306a36Sopenharmony_ci#define COLOR_FACTOR_SRC_ALPHA_SATURATE       14
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci#define GE2D_ALU_OPERATION_LOGIC	GENMASK(15, 12)
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci#define LOGIC_OPERATION_CLEAR       0
26162306a36Sopenharmony_ci#define LOGIC_OPERATION_COPY        1
26262306a36Sopenharmony_ci#define LOGIC_OPERATION_NOOP        2
26362306a36Sopenharmony_ci#define LOGIC_OPERATION_SET         3
26462306a36Sopenharmony_ci#define LOGIC_OPERATION_COPY_INVERT 4
26562306a36Sopenharmony_ci#define LOGIC_OPERATION_INVERT      5
26662306a36Sopenharmony_ci#define LOGIC_OPERATION_AND_REVERSE 6
26762306a36Sopenharmony_ci#define LOGIC_OPERATION_OR_REVERSE  7
26862306a36Sopenharmony_ci#define LOGIC_OPERATION_AND         8
26962306a36Sopenharmony_ci#define LOGIC_OPERATION_OR          9
27062306a36Sopenharmony_ci#define LOGIC_OPERATION_NAND        10
27162306a36Sopenharmony_ci#define LOGIC_OPERATION_NOR         11
27262306a36Sopenharmony_ci#define LOGIC_OPERATION_XOR         12
27362306a36Sopenharmony_ci#define LOGIC_OPERATION_EQUIV       13
27462306a36Sopenharmony_ci#define LOGIC_OPERATION_AND_INVERT  14
27562306a36Sopenharmony_ci#define LOGIC_OPERATION_OR_INVERT   15
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_ci#define GE2D_ALU_ALPHA_BLEND_MODE	GENMASK(10, 8)
27862306a36Sopenharmony_ci#define GE2D_ALU_SRC_ALPHA_BLEND_FACTOR	GENMASK(7, 4)
27962306a36Sopenharmony_ci#define GE2D_ALU_DST_ALPHA_BLEND_FACTOR	GENMASK(3, 0)
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_ci#define ALPHA_FACTOR_ZERO                     0
28262306a36Sopenharmony_ci#define ALPHA_FACTOR_ONE                      1
28362306a36Sopenharmony_ci#define ALPHA_FACTOR_SRC_ALPHA                2
28462306a36Sopenharmony_ci#define ALPHA_FACTOR_ONE_MINUS_SRC_ALPHA      3
28562306a36Sopenharmony_ci#define ALPHA_FACTOR_DST_ALPHA                4
28662306a36Sopenharmony_ci#define ALPHA_FACTOR_ONE_MINUS_DST_ALPHA      5
28762306a36Sopenharmony_ci#define ALPHA_FACTOR_CONST_ALPHA              6
28862306a36Sopenharmony_ci#define ALPHA_FACTOR_ONE_MINUS_CONST_ALPHA    7
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci#define GE2D_ALU_ALPHA_OPERATION_LOGIC	GENMASK(3, 0)
29162306a36Sopenharmony_ci
29262306a36Sopenharmony_ci#define GE2D_ALU_COLOR_OP(__op, __src_factor, __dst_factor) \
29362306a36Sopenharmony_ci	(FIELD_PREP(GE2D_ALU_BLEND_MODE, __op) | \
29462306a36Sopenharmony_ci	 FIELD_PREP(GE2D_ALU_SRC_COLOR_BLEND_FACTOR, __src_factor) | \
29562306a36Sopenharmony_ci	 FIELD_PREP(GE2D_ALU_DST_COLOR_BLEND_FACTOR, __dst_factor))
29662306a36Sopenharmony_ci
29762306a36Sopenharmony_ci#define GE2D_ALU_DO_COLOR_OPERATION_LOGIC(__op, __src_factor) \
29862306a36Sopenharmony_ci	GE2D_ALU_COLOR_OP(OPERATION_LOGIC, __src_factor, __op)
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_ci#define GE2D_ALU_ALPHA_OP(__op, __src_factor, __dst_factor) \
30162306a36Sopenharmony_ci	(FIELD_PREP(GE2D_ALU_ALPHA_BLEND_MODE, __op) | \
30262306a36Sopenharmony_ci	 FIELD_PREP(GE2D_ALU_SRC_ALPHA_BLEND_FACTOR, __src_factor) | \
30362306a36Sopenharmony_ci	 FIELD_PREP(GE2D_ALU_DST_ALPHA_BLEND_FACTOR, __dst_factor))
30462306a36Sopenharmony_ci
30562306a36Sopenharmony_ci#define GE2D_ALU_DO_ALPHA_OPERATION_LOGIC(__op, __src_factor) \
30662306a36Sopenharmony_ci	GE2D_ALU_ALPHA_OP(OPERATION_LOGIC, __src_factor, __op)
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci#define GE2D_ALU_CONST_COLOR GE2D_REG(0x2d)
30962306a36Sopenharmony_ci#define GE2D_SRC1_KEY GE2D_REG(0x2e)
31062306a36Sopenharmony_ci#define GE2D_SRC1_KEY_MASK GE2D_REG(0x2f)
31162306a36Sopenharmony_ci#define GE2D_SRC2_KEY GE2D_REG(0x30)
31262306a36Sopenharmony_ci#define GE2D_SRC2_KEY_MASK GE2D_REG(0x31)
31362306a36Sopenharmony_ci#define GE2D_DST_BITMASK GE2D_REG(0x32)
31462306a36Sopenharmony_ci#define GE2D_DP_ONOFF_CTRL GE2D_REG(0x33)
31562306a36Sopenharmony_ci#define GE2D_SCALE_COEF_IDX GE2D_REG(0x34)
31662306a36Sopenharmony_ci#define GE2D_SCALE_COEF GE2D_REG(0x35)
31762306a36Sopenharmony_ci#define GE2D_SRC_OUTSIDE_ALPHA GE2D_REG(0x36)
31862306a36Sopenharmony_ci#define GE2D_ANTIFLICK_CTRL0 GE2D_REG(0x38)
31962306a36Sopenharmony_ci#define GE2D_ANTIFLICK_CTRL1 GE2D_REG(0x39)
32062306a36Sopenharmony_ci#define GE2D_ANTIFLICK_COLOR_FILT0 GE2D_REG(0x3a)
32162306a36Sopenharmony_ci#define GE2D_ANTIFLICK_COLOR_FILT1 GE2D_REG(0x3b)
32262306a36Sopenharmony_ci#define GE2D_ANTIFLICK_COLOR_FILT2 GE2D_REG(0x3c)
32362306a36Sopenharmony_ci#define GE2D_ANTIFLICK_COLOR_FILT3 GE2D_REG(0x3d)
32462306a36Sopenharmony_ci#define GE2D_ANTIFLICK_ALPHA_FILT0 GE2D_REG(0x3e)
32562306a36Sopenharmony_ci#define GE2D_ANTIFLICK_ALPHA_FILT1 GE2D_REG(0x3f)
32662306a36Sopenharmony_ci#define GE2D_ANTIFLICK_ALPHA_FILT2 GE2D_REG(0x40)
32762306a36Sopenharmony_ci#define GE2D_ANTIFLICK_ALPHA_FILT3 GE2D_REG(0x41)
32862306a36Sopenharmony_ci#define GE2D_SRC1_RANGE_MAP_Y_CTRL GE2D_REG(0x43)
32962306a36Sopenharmony_ci#define GE2D_SRC1_RANGE_MAP_CB_CTRL GE2D_REG(0x44)
33062306a36Sopenharmony_ci#define GE2D_SRC1_RANGE_MAP_CR_CTRL GE2D_REG(0x45)
33162306a36Sopenharmony_ci#define GE2D_ARB_BURST_NUM GE2D_REG(0x46)
33262306a36Sopenharmony_ci#define GE2D_TID_TOKEN GE2D_REG(0x47)
33362306a36Sopenharmony_ci#define GE2D_GEN_CTRL3 GE2D_REG(0x48)
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ci#define GE2D_DST2_BYTEMASK_VAL		GENMASK(31, 28)
33662306a36Sopenharmony_ci#define GE2D_DST2_PIC_STRUCT		GENMASK(27, 26)
33762306a36Sopenharmony_ci#define GE2D_DST2_8B_MODE_SEL		GENMASK(25, 24)
33862306a36Sopenharmony_ci#define GE2D_DST2_COLOR_MAP		GENMASK(22, 19)
33962306a36Sopenharmony_ci#define GE2D_DST2_FORMAT		GENMASK(17, 16)
34062306a36Sopenharmony_ci#define GE2D_DST2_COLOR_ROUND_MODE	BIT(14)
34162306a36Sopenharmony_ci#define GE2D_DST2_X_DISCARD_MODE	GENMASK(13, 12)
34262306a36Sopenharmony_ci#define GE2D_DST2_Y_DISCARD_MODE	GENMASK(11, 10)
34362306a36Sopenharmony_ci#define GE2D_DST2_ENABLE		BIT(8)
34462306a36Sopenharmony_ci#define GE2D_DST1_X_DISCARD_MODE	GENMASK(5, 4)
34562306a36Sopenharmony_ci#define GE2D_DST1_Y_DISCARD_MODE	GENMASK(3, 2)
34662306a36Sopenharmony_ci#define GE2D_DST1_ENABLE		BIT(0)
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_ci#define GE2D_STATUS2 GE2D_REG(0x49)
34962306a36Sopenharmony_ci#define GE2D_GEN_CTRL4 GE2D_REG(0x4a)
35062306a36Sopenharmony_ci#define GE2D_DST1_BADDR_CTRL  GE2D_REG(0x51)
35162306a36Sopenharmony_ci#define GE2D_DST1_STRIDE_CTRL GE2D_REG(0x52)
35262306a36Sopenharmony_ci
35362306a36Sopenharmony_ci#define GE2D_STRIDE_SIZE	GENMASK(19, 0)
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_ci#define GE2D_SRC1_BADDR_CTRL  GE2D_REG(0x53)
35662306a36Sopenharmony_ci#define GE2D_SRC1_STRIDE_CTRL GE2D_REG(0x54)
35762306a36Sopenharmony_ci#define GE2D_SRC2_BADDR_CTRL  GE2D_REG(0x55)
35862306a36Sopenharmony_ci#define GE2D_SRC2_STRIDE_CTRL GE2D_REG(0x56)
35962306a36Sopenharmony_ci
36062306a36Sopenharmony_ci#endif /* __GE2D_REGS__ */
361