18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
48c2ecf20Sopenharmony_ci * Author: Jacob Chen <jacob-chen@iotwrt.com>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci#ifndef __RGA_HW_H__
78c2ecf20Sopenharmony_ci#define __RGA_HW_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define RGA_CMDBUF_SIZE 0x20
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/* Hardware limits */
128c2ecf20Sopenharmony_ci#define MAX_WIDTH 8192
138c2ecf20Sopenharmony_ci#define MAX_HEIGHT 8192
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define MIN_WIDTH 34
168c2ecf20Sopenharmony_ci#define MIN_HEIGHT 34
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define DEFAULT_WIDTH 100
198c2ecf20Sopenharmony_ci#define DEFAULT_HEIGHT 100
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define RGA_TIMEOUT 500
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci/* Registers address */
248c2ecf20Sopenharmony_ci#define RGA_SYS_CTRL 0x0000
258c2ecf20Sopenharmony_ci#define RGA_CMD_CTRL 0x0004
268c2ecf20Sopenharmony_ci#define RGA_CMD_BASE 0x0008
278c2ecf20Sopenharmony_ci#define RGA_INT 0x0010
288c2ecf20Sopenharmony_ci#define RGA_MMU_CTRL0 0x0014
298c2ecf20Sopenharmony_ci#define RGA_VERSION_INFO 0x0028
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define RGA_MODE_BASE_REG 0x0100
328c2ecf20Sopenharmony_ci#define RGA_MODE_MAX_REG 0x017C
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define RGA_MODE_CTRL 0x0100
358c2ecf20Sopenharmony_ci#define RGA_SRC_INFO 0x0104
368c2ecf20Sopenharmony_ci#define RGA_SRC_Y_RGB_BASE_ADDR 0x0108
378c2ecf20Sopenharmony_ci#define RGA_SRC_CB_BASE_ADDR 0x010c
388c2ecf20Sopenharmony_ci#define RGA_SRC_CR_BASE_ADDR 0x0110
398c2ecf20Sopenharmony_ci#define RGA_SRC1_RGB_BASE_ADDR 0x0114
408c2ecf20Sopenharmony_ci#define RGA_SRC_VIR_INFO 0x0118
418c2ecf20Sopenharmony_ci#define RGA_SRC_ACT_INFO 0x011c
428c2ecf20Sopenharmony_ci#define RGA_SRC_X_FACTOR 0x0120
438c2ecf20Sopenharmony_ci#define RGA_SRC_Y_FACTOR 0x0124
448c2ecf20Sopenharmony_ci#define RGA_SRC_BG_COLOR 0x0128
458c2ecf20Sopenharmony_ci#define RGA_SRC_FG_COLOR 0x012c
468c2ecf20Sopenharmony_ci#define RGA_SRC_TR_COLOR0 0x0130
478c2ecf20Sopenharmony_ci#define RGA_SRC_TR_COLOR1 0x0134
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define RGA_DST_INFO 0x0138
508c2ecf20Sopenharmony_ci#define RGA_DST_Y_RGB_BASE_ADDR 0x013c
518c2ecf20Sopenharmony_ci#define RGA_DST_CB_BASE_ADDR 0x0140
528c2ecf20Sopenharmony_ci#define RGA_DST_CR_BASE_ADDR 0x0144
538c2ecf20Sopenharmony_ci#define RGA_DST_VIR_INFO 0x0148
548c2ecf20Sopenharmony_ci#define RGA_DST_ACT_INFO 0x014c
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci#define RGA_ALPHA_CTRL0 0x0150
578c2ecf20Sopenharmony_ci#define RGA_ALPHA_CTRL1 0x0154
588c2ecf20Sopenharmony_ci#define RGA_FADING_CTRL 0x0158
598c2ecf20Sopenharmony_ci#define RGA_PAT_CON 0x015c
608c2ecf20Sopenharmony_ci#define RGA_ROP_CON0 0x0160
618c2ecf20Sopenharmony_ci#define RGA_ROP_CON1 0x0164
628c2ecf20Sopenharmony_ci#define RGA_MASK_BASE 0x0168
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define RGA_MMU_CTRL1 0x016C
658c2ecf20Sopenharmony_ci#define RGA_MMU_SRC_BASE 0x0170
668c2ecf20Sopenharmony_ci#define RGA_MMU_SRC1_BASE 0x0174
678c2ecf20Sopenharmony_ci#define RGA_MMU_DST_BASE 0x0178
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci/* Registers value */
708c2ecf20Sopenharmony_ci#define RGA_MODE_RENDER_BITBLT 0
718c2ecf20Sopenharmony_ci#define RGA_MODE_RENDER_COLOR_PALETTE 1
728c2ecf20Sopenharmony_ci#define RGA_MODE_RENDER_RECTANGLE_FILL 2
738c2ecf20Sopenharmony_ci#define RGA_MODE_RENDER_UPDATE_PALETTE_LUT_RAM 3
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define RGA_MODE_BITBLT_MODE_SRC_TO_DST 0
768c2ecf20Sopenharmony_ci#define RGA_MODE_BITBLT_MODE_SRC_SRC1_TO_DST 1
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci#define RGA_MODE_CF_ROP4_SOLID 0
798c2ecf20Sopenharmony_ci#define RGA_MODE_CF_ROP4_PATTERN 1
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_ABGR8888 0
828c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_XBGR8888 1
838c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_RGB888 2
848c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_BGR565 4
858c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_ABGR1555 5
868c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_ABGR4444 6
878c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_YUV422SP 8
888c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_YUV422P 9
898c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_YUV420SP 10
908c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_YUV420P 11
918c2ecf20Sopenharmony_ci/* SRC_COLOR Palette */
928c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_CP_1BPP 12
938c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_CP_2BPP 13
948c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_CP_4BPP 14
958c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_CP_8BPP 15
968c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_MASK 15
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_IS_YUV(fmt) \
998c2ecf20Sopenharmony_ci	(((fmt) >= RGA_COLOR_FMT_YUV422SP) && ((fmt) < RGA_COLOR_FMT_CP_1BPP))
1008c2ecf20Sopenharmony_ci#define RGA_COLOR_FMT_IS_RGB(fmt) \
1018c2ecf20Sopenharmony_ci	((fmt) < RGA_COLOR_FMT_YUV422SP)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define RGA_COLOR_NONE_SWAP 0
1048c2ecf20Sopenharmony_ci#define RGA_COLOR_RB_SWAP 1
1058c2ecf20Sopenharmony_ci#define RGA_COLOR_ALPHA_SWAP 2
1068c2ecf20Sopenharmony_ci#define RGA_COLOR_UV_SWAP 4
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci#define RGA_SRC_CSC_MODE_BYPASS 0
1098c2ecf20Sopenharmony_ci#define RGA_SRC_CSC_MODE_BT601_R0 1
1108c2ecf20Sopenharmony_ci#define RGA_SRC_CSC_MODE_BT601_R1 2
1118c2ecf20Sopenharmony_ci#define RGA_SRC_CSC_MODE_BT709_R0 3
1128c2ecf20Sopenharmony_ci#define RGA_SRC_CSC_MODE_BT709_R1 4
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci#define RGA_SRC_ROT_MODE_0_DEGREE 0
1158c2ecf20Sopenharmony_ci#define RGA_SRC_ROT_MODE_90_DEGREE 1
1168c2ecf20Sopenharmony_ci#define RGA_SRC_ROT_MODE_180_DEGREE 2
1178c2ecf20Sopenharmony_ci#define RGA_SRC_ROT_MODE_270_DEGREE 3
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define RGA_SRC_MIRR_MODE_NO 0
1208c2ecf20Sopenharmony_ci#define RGA_SRC_MIRR_MODE_X 1
1218c2ecf20Sopenharmony_ci#define RGA_SRC_MIRR_MODE_Y 2
1228c2ecf20Sopenharmony_ci#define RGA_SRC_MIRR_MODE_X_Y 3
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#define RGA_SRC_HSCL_MODE_NO 0
1258c2ecf20Sopenharmony_ci#define RGA_SRC_HSCL_MODE_DOWN 1
1268c2ecf20Sopenharmony_ci#define RGA_SRC_HSCL_MODE_UP 2
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci#define RGA_SRC_VSCL_MODE_NO 0
1298c2ecf20Sopenharmony_ci#define RGA_SRC_VSCL_MODE_DOWN 1
1308c2ecf20Sopenharmony_ci#define RGA_SRC_VSCL_MODE_UP 2
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci#define RGA_SRC_TRANS_ENABLE_R 1
1338c2ecf20Sopenharmony_ci#define RGA_SRC_TRANS_ENABLE_G 2
1348c2ecf20Sopenharmony_ci#define RGA_SRC_TRANS_ENABLE_B 4
1358c2ecf20Sopenharmony_ci#define RGA_SRC_TRANS_ENABLE_A 8
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define RGA_SRC_BIC_COE_SELEC_CATROM 0
1388c2ecf20Sopenharmony_ci#define RGA_SRC_BIC_COE_SELEC_MITCHELL 1
1398c2ecf20Sopenharmony_ci#define RGA_SRC_BIC_COE_SELEC_HERMITE 2
1408c2ecf20Sopenharmony_ci#define RGA_SRC_BIC_COE_SELEC_BSPLINE 3
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci#define RGA_DST_DITHER_MODE_888_TO_666 0
1438c2ecf20Sopenharmony_ci#define RGA_DST_DITHER_MODE_888_TO_565 1
1448c2ecf20Sopenharmony_ci#define RGA_DST_DITHER_MODE_888_TO_555 2
1458c2ecf20Sopenharmony_ci#define RGA_DST_DITHER_MODE_888_TO_444 3
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci#define RGA_DST_CSC_MODE_BYPASS 0
1488c2ecf20Sopenharmony_ci#define RGA_DST_CSC_MODE_BT601_R0 1
1498c2ecf20Sopenharmony_ci#define RGA_DST_CSC_MODE_BT601_R1 2
1508c2ecf20Sopenharmony_ci#define RGA_DST_CSC_MODE_BT709_R0 3
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci#define RGA_ALPHA_ROP_MODE_2 0
1538c2ecf20Sopenharmony_ci#define RGA_ALPHA_ROP_MODE_3 1
1548c2ecf20Sopenharmony_ci#define RGA_ALPHA_ROP_MODE_4 2
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define RGA_ALPHA_SELECT_ALPHA 0
1578c2ecf20Sopenharmony_ci#define RGA_ALPHA_SELECT_ROP 1
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#define RGA_ALPHA_MASK_BIG_ENDIAN 0
1608c2ecf20Sopenharmony_ci#define RGA_ALPHA_MASK_LITTLE_ENDIAN 1
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci#define RGA_ALPHA_NORMAL 0
1638c2ecf20Sopenharmony_ci#define RGA_ALPHA_REVERSE 1
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci#define RGA_ALPHA_BLEND_GLOBAL 0
1668c2ecf20Sopenharmony_ci#define RGA_ALPHA_BLEND_NORMAL 1
1678c2ecf20Sopenharmony_ci#define RGA_ALPHA_BLEND_MULTIPLY 2
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci#define RGA_ALPHA_CAL_CUT 0
1708c2ecf20Sopenharmony_ci#define RGA_ALPHA_CAL_NORMAL 1
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define RGA_ALPHA_FACTOR_ZERO 0
1738c2ecf20Sopenharmony_ci#define RGA_ALPHA_FACTOR_ONE 1
1748c2ecf20Sopenharmony_ci#define RGA_ALPHA_FACTOR_OTHER 2
1758c2ecf20Sopenharmony_ci#define RGA_ALPHA_FACTOR_OTHER_REVERSE 3
1768c2ecf20Sopenharmony_ci#define RGA_ALPHA_FACTOR_SELF 4
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#define RGA_ALPHA_COLOR_NORMAL 0
1798c2ecf20Sopenharmony_ci#define RGA_ALPHA_COLOR_MULTIPLY_CAL 1
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/* Registers union */
1828c2ecf20Sopenharmony_ciunion rga_mode_ctrl {
1838c2ecf20Sopenharmony_ci	unsigned int val;
1848c2ecf20Sopenharmony_ci	struct {
1858c2ecf20Sopenharmony_ci		/* [0:2] */
1868c2ecf20Sopenharmony_ci		unsigned int render:3;
1878c2ecf20Sopenharmony_ci		/* [3:6] */
1888c2ecf20Sopenharmony_ci		unsigned int bitblt:1;
1898c2ecf20Sopenharmony_ci		unsigned int cf_rop4_pat:1;
1908c2ecf20Sopenharmony_ci		unsigned int alpha_zero_key:1;
1918c2ecf20Sopenharmony_ci		unsigned int gradient_sat:1;
1928c2ecf20Sopenharmony_ci		/* [7:31] */
1938c2ecf20Sopenharmony_ci		unsigned int reserved:25;
1948c2ecf20Sopenharmony_ci	} data;
1958c2ecf20Sopenharmony_ci};
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ciunion rga_src_info {
1988c2ecf20Sopenharmony_ci	unsigned int val;
1998c2ecf20Sopenharmony_ci	struct {
2008c2ecf20Sopenharmony_ci		/* [0:3] */
2018c2ecf20Sopenharmony_ci		unsigned int format:4;
2028c2ecf20Sopenharmony_ci		/* [4:7] */
2038c2ecf20Sopenharmony_ci		unsigned int swap:3;
2048c2ecf20Sopenharmony_ci		unsigned int cp_endian:1;
2058c2ecf20Sopenharmony_ci		/* [8:17] */
2068c2ecf20Sopenharmony_ci		unsigned int csc_mode:2;
2078c2ecf20Sopenharmony_ci		unsigned int rot_mode:2;
2088c2ecf20Sopenharmony_ci		unsigned int mir_mode:2;
2098c2ecf20Sopenharmony_ci		unsigned int hscl_mode:2;
2108c2ecf20Sopenharmony_ci		unsigned int vscl_mode:2;
2118c2ecf20Sopenharmony_ci		/* [18:22] */
2128c2ecf20Sopenharmony_ci		unsigned int trans_mode:1;
2138c2ecf20Sopenharmony_ci		unsigned int trans_enable:4;
2148c2ecf20Sopenharmony_ci		/* [23:25] */
2158c2ecf20Sopenharmony_ci		unsigned int dither_up_en:1;
2168c2ecf20Sopenharmony_ci		unsigned int bic_coe_sel:2;
2178c2ecf20Sopenharmony_ci		/* [26:31] */
2188c2ecf20Sopenharmony_ci		unsigned int reserved:6;
2198c2ecf20Sopenharmony_ci	} data;
2208c2ecf20Sopenharmony_ci};
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ciunion rga_src_vir_info {
2238c2ecf20Sopenharmony_ci	unsigned int val;
2248c2ecf20Sopenharmony_ci	struct {
2258c2ecf20Sopenharmony_ci		/* [0:15] */
2268c2ecf20Sopenharmony_ci		unsigned int vir_width:15;
2278c2ecf20Sopenharmony_ci		unsigned int reserved:1;
2288c2ecf20Sopenharmony_ci		/* [16:25] */
2298c2ecf20Sopenharmony_ci		unsigned int vir_stride:10;
2308c2ecf20Sopenharmony_ci		/* [26:31] */
2318c2ecf20Sopenharmony_ci		unsigned int reserved1:6;
2328c2ecf20Sopenharmony_ci	} data;
2338c2ecf20Sopenharmony_ci};
2348c2ecf20Sopenharmony_ci
2358c2ecf20Sopenharmony_ciunion rga_src_act_info {
2368c2ecf20Sopenharmony_ci	unsigned int val;
2378c2ecf20Sopenharmony_ci	struct {
2388c2ecf20Sopenharmony_ci		/* [0:15] */
2398c2ecf20Sopenharmony_ci		unsigned int act_width:13;
2408c2ecf20Sopenharmony_ci		unsigned int reserved:3;
2418c2ecf20Sopenharmony_ci		/* [16:31] */
2428c2ecf20Sopenharmony_ci		unsigned int act_height:13;
2438c2ecf20Sopenharmony_ci		unsigned int reserved1:3;
2448c2ecf20Sopenharmony_ci	} data;
2458c2ecf20Sopenharmony_ci};
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ciunion rga_src_x_factor {
2488c2ecf20Sopenharmony_ci	unsigned int val;
2498c2ecf20Sopenharmony_ci	struct {
2508c2ecf20Sopenharmony_ci		/* [0:15] */
2518c2ecf20Sopenharmony_ci		unsigned int down_scale_factor:16;
2528c2ecf20Sopenharmony_ci		/* [16:31] */
2538c2ecf20Sopenharmony_ci		unsigned int up_scale_factor:16;
2548c2ecf20Sopenharmony_ci	} data;
2558c2ecf20Sopenharmony_ci};
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ciunion rga_src_y_factor {
2588c2ecf20Sopenharmony_ci	unsigned int val;
2598c2ecf20Sopenharmony_ci	struct {
2608c2ecf20Sopenharmony_ci		/* [0:15] */
2618c2ecf20Sopenharmony_ci		unsigned int down_scale_factor:16;
2628c2ecf20Sopenharmony_ci		/* [16:31] */
2638c2ecf20Sopenharmony_ci		unsigned int up_scale_factor:16;
2648c2ecf20Sopenharmony_ci	} data;
2658c2ecf20Sopenharmony_ci};
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci/* Alpha / Red / Green / Blue */
2688c2ecf20Sopenharmony_ciunion rga_src_cp_gr_color {
2698c2ecf20Sopenharmony_ci	unsigned int val;
2708c2ecf20Sopenharmony_ci	struct {
2718c2ecf20Sopenharmony_ci		/* [0:15] */
2728c2ecf20Sopenharmony_ci		unsigned int gradient_x:16;
2738c2ecf20Sopenharmony_ci		/* [16:31] */
2748c2ecf20Sopenharmony_ci		unsigned int gradient_y:16;
2758c2ecf20Sopenharmony_ci	} data;
2768c2ecf20Sopenharmony_ci};
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ciunion rga_src_transparency_color0 {
2798c2ecf20Sopenharmony_ci	unsigned int val;
2808c2ecf20Sopenharmony_ci	struct {
2818c2ecf20Sopenharmony_ci		/* [0:7] */
2828c2ecf20Sopenharmony_ci		unsigned int trans_rmin:8;
2838c2ecf20Sopenharmony_ci		/* [8:15] */
2848c2ecf20Sopenharmony_ci		unsigned int trans_gmin:8;
2858c2ecf20Sopenharmony_ci		/* [16:23] */
2868c2ecf20Sopenharmony_ci		unsigned int trans_bmin:8;
2878c2ecf20Sopenharmony_ci		/* [24:31] */
2888c2ecf20Sopenharmony_ci		unsigned int trans_amin:8;
2898c2ecf20Sopenharmony_ci	} data;
2908c2ecf20Sopenharmony_ci};
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ciunion rga_src_transparency_color1 {
2938c2ecf20Sopenharmony_ci	unsigned int val;
2948c2ecf20Sopenharmony_ci	struct {
2958c2ecf20Sopenharmony_ci		/* [0:7] */
2968c2ecf20Sopenharmony_ci		unsigned int trans_rmax:8;
2978c2ecf20Sopenharmony_ci		/* [8:15] */
2988c2ecf20Sopenharmony_ci		unsigned int trans_gmax:8;
2998c2ecf20Sopenharmony_ci		/* [16:23] */
3008c2ecf20Sopenharmony_ci		unsigned int trans_bmax:8;
3018c2ecf20Sopenharmony_ci		/* [24:31] */
3028c2ecf20Sopenharmony_ci		unsigned int trans_amax:8;
3038c2ecf20Sopenharmony_ci	} data;
3048c2ecf20Sopenharmony_ci};
3058c2ecf20Sopenharmony_ci
3068c2ecf20Sopenharmony_ciunion rga_dst_info {
3078c2ecf20Sopenharmony_ci	unsigned int val;
3088c2ecf20Sopenharmony_ci	struct {
3098c2ecf20Sopenharmony_ci		/* [0:3] */
3108c2ecf20Sopenharmony_ci		unsigned int format:4;
3118c2ecf20Sopenharmony_ci		/* [4:6] */
3128c2ecf20Sopenharmony_ci		unsigned int swap:3;
3138c2ecf20Sopenharmony_ci		/* [7:9] */
3148c2ecf20Sopenharmony_ci		unsigned int src1_format:3;
3158c2ecf20Sopenharmony_ci		/* [10:11] */
3168c2ecf20Sopenharmony_ci		unsigned int src1_swap:2;
3178c2ecf20Sopenharmony_ci		/* [12:15] */
3188c2ecf20Sopenharmony_ci		unsigned int dither_up_en:1;
3198c2ecf20Sopenharmony_ci		unsigned int dither_down_en:1;
3208c2ecf20Sopenharmony_ci		unsigned int dither_down_mode:2;
3218c2ecf20Sopenharmony_ci		/* [16:18] */
3228c2ecf20Sopenharmony_ci		unsigned int csc_mode:2;
3238c2ecf20Sopenharmony_ci		unsigned int csc_clip:1;
3248c2ecf20Sopenharmony_ci		/* [19:31] */
3258c2ecf20Sopenharmony_ci		unsigned int reserved:13;
3268c2ecf20Sopenharmony_ci	} data;
3278c2ecf20Sopenharmony_ci};
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ciunion rga_dst_vir_info {
3308c2ecf20Sopenharmony_ci	unsigned int val;
3318c2ecf20Sopenharmony_ci	struct {
3328c2ecf20Sopenharmony_ci		/* [0:15] */
3338c2ecf20Sopenharmony_ci		unsigned int vir_stride:15;
3348c2ecf20Sopenharmony_ci		unsigned int reserved:1;
3358c2ecf20Sopenharmony_ci		/* [16:31] */
3368c2ecf20Sopenharmony_ci		unsigned int src1_vir_stride:15;
3378c2ecf20Sopenharmony_ci		unsigned int reserved1:1;
3388c2ecf20Sopenharmony_ci	} data;
3398c2ecf20Sopenharmony_ci};
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ciunion rga_dst_act_info {
3428c2ecf20Sopenharmony_ci	unsigned int val;
3438c2ecf20Sopenharmony_ci	struct {
3448c2ecf20Sopenharmony_ci		/* [0:15] */
3458c2ecf20Sopenharmony_ci		unsigned int act_width:12;
3468c2ecf20Sopenharmony_ci		unsigned int reserved:4;
3478c2ecf20Sopenharmony_ci		/* [16:31] */
3488c2ecf20Sopenharmony_ci		unsigned int act_height:12;
3498c2ecf20Sopenharmony_ci		unsigned int reserved1:4;
3508c2ecf20Sopenharmony_ci	} data;
3518c2ecf20Sopenharmony_ci};
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ciunion rga_alpha_ctrl0 {
3548c2ecf20Sopenharmony_ci	unsigned int val;
3558c2ecf20Sopenharmony_ci	struct {
3568c2ecf20Sopenharmony_ci		/* [0:3] */
3578c2ecf20Sopenharmony_ci		unsigned int rop_en:1;
3588c2ecf20Sopenharmony_ci		unsigned int rop_select:1;
3598c2ecf20Sopenharmony_ci		unsigned int rop_mode:2;
3608c2ecf20Sopenharmony_ci		/* [4:11] */
3618c2ecf20Sopenharmony_ci		unsigned int src_fading_val:8;
3628c2ecf20Sopenharmony_ci		/* [12:20] */
3638c2ecf20Sopenharmony_ci		unsigned int dst_fading_val:8;
3648c2ecf20Sopenharmony_ci		unsigned int mask_endian:1;
3658c2ecf20Sopenharmony_ci		/* [21:31] */
3668c2ecf20Sopenharmony_ci		unsigned int reserved:11;
3678c2ecf20Sopenharmony_ci	} data;
3688c2ecf20Sopenharmony_ci};
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ciunion rga_alpha_ctrl1 {
3718c2ecf20Sopenharmony_ci	unsigned int val;
3728c2ecf20Sopenharmony_ci	struct {
3738c2ecf20Sopenharmony_ci		/* [0:1] */
3748c2ecf20Sopenharmony_ci		unsigned int dst_color_m0:1;
3758c2ecf20Sopenharmony_ci		unsigned int src_color_m0:1;
3768c2ecf20Sopenharmony_ci		/* [2:7] */
3778c2ecf20Sopenharmony_ci		unsigned int dst_factor_m0:3;
3788c2ecf20Sopenharmony_ci		unsigned int src_factor_m0:3;
3798c2ecf20Sopenharmony_ci		/* [8:9] */
3808c2ecf20Sopenharmony_ci		unsigned int dst_alpha_cal_m0:1;
3818c2ecf20Sopenharmony_ci		unsigned int src_alpha_cal_m0:1;
3828c2ecf20Sopenharmony_ci		/* [10:13] */
3838c2ecf20Sopenharmony_ci		unsigned int dst_blend_m0:2;
3848c2ecf20Sopenharmony_ci		unsigned int src_blend_m0:2;
3858c2ecf20Sopenharmony_ci		/* [14:15] */
3868c2ecf20Sopenharmony_ci		unsigned int dst_alpha_m0:1;
3878c2ecf20Sopenharmony_ci		unsigned int src_alpha_m0:1;
3888c2ecf20Sopenharmony_ci		/* [16:21] */
3898c2ecf20Sopenharmony_ci		unsigned int dst_factor_m1:3;
3908c2ecf20Sopenharmony_ci		unsigned int src_factor_m1:3;
3918c2ecf20Sopenharmony_ci		/* [22:23] */
3928c2ecf20Sopenharmony_ci		unsigned int dst_alpha_cal_m1:1;
3938c2ecf20Sopenharmony_ci		unsigned int src_alpha_cal_m1:1;
3948c2ecf20Sopenharmony_ci		/* [24:27] */
3958c2ecf20Sopenharmony_ci		unsigned int dst_blend_m1:2;
3968c2ecf20Sopenharmony_ci		unsigned int src_blend_m1:2;
3978c2ecf20Sopenharmony_ci		/* [28:29] */
3988c2ecf20Sopenharmony_ci		unsigned int dst_alpha_m1:1;
3998c2ecf20Sopenharmony_ci		unsigned int src_alpha_m1:1;
4008c2ecf20Sopenharmony_ci		/* [30:31] */
4018c2ecf20Sopenharmony_ci		unsigned int reserved:2;
4028c2ecf20Sopenharmony_ci	} data;
4038c2ecf20Sopenharmony_ci};
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_ciunion rga_fading_ctrl {
4068c2ecf20Sopenharmony_ci	unsigned int val;
4078c2ecf20Sopenharmony_ci	struct {
4088c2ecf20Sopenharmony_ci		/* [0:7] */
4098c2ecf20Sopenharmony_ci		unsigned int fading_offset_r:8;
4108c2ecf20Sopenharmony_ci		/* [8:15] */
4118c2ecf20Sopenharmony_ci		unsigned int fading_offset_g:8;
4128c2ecf20Sopenharmony_ci		/* [16:23] */
4138c2ecf20Sopenharmony_ci		unsigned int fading_offset_b:8;
4148c2ecf20Sopenharmony_ci		/* [24:31] */
4158c2ecf20Sopenharmony_ci		unsigned int fading_en:1;
4168c2ecf20Sopenharmony_ci		unsigned int reserved:7;
4178c2ecf20Sopenharmony_ci	} data;
4188c2ecf20Sopenharmony_ci};
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ciunion rga_pat_con {
4218c2ecf20Sopenharmony_ci	unsigned int val;
4228c2ecf20Sopenharmony_ci	struct {
4238c2ecf20Sopenharmony_ci		/* [0:7] */
4248c2ecf20Sopenharmony_ci		unsigned int width:8;
4258c2ecf20Sopenharmony_ci		/* [8:15] */
4268c2ecf20Sopenharmony_ci		unsigned int height:8;
4278c2ecf20Sopenharmony_ci		/* [16:23] */
4288c2ecf20Sopenharmony_ci		unsigned int offset_x:8;
4298c2ecf20Sopenharmony_ci		/* [24:31] */
4308c2ecf20Sopenharmony_ci		unsigned int offset_y:8;
4318c2ecf20Sopenharmony_ci	} data;
4328c2ecf20Sopenharmony_ci};
4338c2ecf20Sopenharmony_ci
4348c2ecf20Sopenharmony_ci#endif
435