18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright 2016 Linaro Ltd. 48c2ecf20Sopenharmony_ci * Copyright 2016 ZTE Corporation. 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef __ZX_VOU_REGS_H__ 88c2ecf20Sopenharmony_ci#define __ZX_VOU_REGS_H__ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* Sub-module offset */ 118c2ecf20Sopenharmony_ci#define MAIN_GL_OFFSET 0x130 128c2ecf20Sopenharmony_ci#define MAIN_GL_CSC_OFFSET 0x580 138c2ecf20Sopenharmony_ci#define MAIN_CHN_CSC_OFFSET 0x6c0 148c2ecf20Sopenharmony_ci#define MAIN_HBSC_OFFSET 0x820 158c2ecf20Sopenharmony_ci#define MAIN_DITHER_OFFSET 0x960 168c2ecf20Sopenharmony_ci#define MAIN_RSZ_OFFSET 0x600 /* OTFPPU sub-module */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#define AUX_GL_OFFSET 0x200 198c2ecf20Sopenharmony_ci#define AUX_GL_CSC_OFFSET 0x5d0 208c2ecf20Sopenharmony_ci#define AUX_CHN_CSC_OFFSET 0x710 218c2ecf20Sopenharmony_ci#define AUX_HBSC_OFFSET 0x860 228c2ecf20Sopenharmony_ci#define AUX_DITHER_OFFSET 0x970 238c2ecf20Sopenharmony_ci#define AUX_RSZ_OFFSET 0x800 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define OSD_VL0_OFFSET 0x040 268c2ecf20Sopenharmony_ci#define OSD_VL_OFFSET(i) (OSD_VL0_OFFSET + 0x050 * (i)) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define HBSC_VL0_OFFSET 0x760 298c2ecf20Sopenharmony_ci#define HBSC_VL_OFFSET(i) (HBSC_VL0_OFFSET + 0x040 * (i)) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define RSZ_VL1_U0 0xa00 328c2ecf20Sopenharmony_ci#define RSZ_VL_OFFSET(i) (RSZ_VL1_U0 + 0x200 * (i)) 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci/* OSD (GPC_GLOBAL) registers */ 358c2ecf20Sopenharmony_ci#define OSD_INT_STA 0x04 368c2ecf20Sopenharmony_ci#define OSD_INT_CLRSTA 0x08 378c2ecf20Sopenharmony_ci#define OSD_INT_MSK 0x0c 388c2ecf20Sopenharmony_ci#define OSD_INT_AUX_UPT BIT(14) 398c2ecf20Sopenharmony_ci#define OSD_INT_MAIN_UPT BIT(13) 408c2ecf20Sopenharmony_ci#define OSD_INT_GL1_LBW BIT(10) 418c2ecf20Sopenharmony_ci#define OSD_INT_GL0_LBW BIT(9) 428c2ecf20Sopenharmony_ci#define OSD_INT_VL2_LBW BIT(8) 438c2ecf20Sopenharmony_ci#define OSD_INT_VL1_LBW BIT(7) 448c2ecf20Sopenharmony_ci#define OSD_INT_VL0_LBW BIT(6) 458c2ecf20Sopenharmony_ci#define OSD_INT_BUS_ERR BIT(3) 468c2ecf20Sopenharmony_ci#define OSD_INT_CFG_ERR BIT(2) 478c2ecf20Sopenharmony_ci#define OSD_INT_ERROR (\ 488c2ecf20Sopenharmony_ci OSD_INT_GL1_LBW | OSD_INT_GL0_LBW | \ 498c2ecf20Sopenharmony_ci OSD_INT_VL2_LBW | OSD_INT_VL1_LBW | OSD_INT_VL0_LBW | \ 508c2ecf20Sopenharmony_ci OSD_INT_BUS_ERR | OSD_INT_CFG_ERR \ 518c2ecf20Sopenharmony_ci) 528c2ecf20Sopenharmony_ci#define OSD_INT_ENABLE (OSD_INT_ERROR | OSD_INT_AUX_UPT | OSD_INT_MAIN_UPT) 538c2ecf20Sopenharmony_ci#define OSD_CTRL0 0x10 548c2ecf20Sopenharmony_ci#define OSD_CTRL0_VL0_EN BIT(13) 558c2ecf20Sopenharmony_ci#define OSD_CTRL0_VL0_SEL BIT(12) 568c2ecf20Sopenharmony_ci#define OSD_CTRL0_VL1_EN BIT(11) 578c2ecf20Sopenharmony_ci#define OSD_CTRL0_VL1_SEL BIT(10) 588c2ecf20Sopenharmony_ci#define OSD_CTRL0_VL2_EN BIT(9) 598c2ecf20Sopenharmony_ci#define OSD_CTRL0_VL2_SEL BIT(8) 608c2ecf20Sopenharmony_ci#define OSD_CTRL0_GL0_EN BIT(7) 618c2ecf20Sopenharmony_ci#define OSD_CTRL0_GL0_SEL BIT(6) 628c2ecf20Sopenharmony_ci#define OSD_CTRL0_GL1_EN BIT(5) 638c2ecf20Sopenharmony_ci#define OSD_CTRL0_GL1_SEL BIT(4) 648c2ecf20Sopenharmony_ci#define OSD_RST_CLR 0x1c 658c2ecf20Sopenharmony_ci#define RST_PER_FRAME BIT(19) 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci/* Main/Aux channel registers */ 688c2ecf20Sopenharmony_ci#define OSD_MAIN_CHN 0x470 698c2ecf20Sopenharmony_ci#define OSD_AUX_CHN 0x4d0 708c2ecf20Sopenharmony_ci#define CHN_CTRL0 0x00 718c2ecf20Sopenharmony_ci#define CHN_ENABLE BIT(0) 728c2ecf20Sopenharmony_ci#define CHN_CTRL1 0x04 738c2ecf20Sopenharmony_ci#define CHN_SCREEN_W_SHIFT 18 748c2ecf20Sopenharmony_ci#define CHN_SCREEN_W_MASK (0x1fff << CHN_SCREEN_W_SHIFT) 758c2ecf20Sopenharmony_ci#define CHN_SCREEN_H_SHIFT 5 768c2ecf20Sopenharmony_ci#define CHN_SCREEN_H_MASK (0x1fff << CHN_SCREEN_H_SHIFT) 778c2ecf20Sopenharmony_ci#define CHN_UPDATE 0x08 788c2ecf20Sopenharmony_ci#define CHN_INTERLACE_BUF_CTRL 0x24 798c2ecf20Sopenharmony_ci#define CHN_INTERLACE_EN BIT(2) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci/* Dither registers */ 828c2ecf20Sopenharmony_ci#define OSD_DITHER_CTRL0 0x00 838c2ecf20Sopenharmony_ci#define DITHER_BYSPASS BIT(31) 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci/* TIMING_CTRL registers */ 868c2ecf20Sopenharmony_ci#define TIMING_TC_ENABLE 0x04 878c2ecf20Sopenharmony_ci#define AUX_TC_EN BIT(1) 888c2ecf20Sopenharmony_ci#define MAIN_TC_EN BIT(0) 898c2ecf20Sopenharmony_ci#define FIR_MAIN_ACTIVE 0x08 908c2ecf20Sopenharmony_ci#define FIR_AUX_ACTIVE 0x0c 918c2ecf20Sopenharmony_ci#define V_ACTIVE_SHIFT 16 928c2ecf20Sopenharmony_ci#define V_ACTIVE_MASK (0xffff << V_ACTIVE_SHIFT) 938c2ecf20Sopenharmony_ci#define H_ACTIVE_SHIFT 0 948c2ecf20Sopenharmony_ci#define H_ACTIVE_MASK (0xffff << H_ACTIVE_SHIFT) 958c2ecf20Sopenharmony_ci#define FIR_MAIN_H_TIMING 0x10 968c2ecf20Sopenharmony_ci#define FIR_MAIN_V_TIMING 0x14 978c2ecf20Sopenharmony_ci#define FIR_AUX_H_TIMING 0x18 988c2ecf20Sopenharmony_ci#define FIR_AUX_V_TIMING 0x1c 998c2ecf20Sopenharmony_ci#define SYNC_WIDE_SHIFT 22 1008c2ecf20Sopenharmony_ci#define SYNC_WIDE_MASK (0x3ff << SYNC_WIDE_SHIFT) 1018c2ecf20Sopenharmony_ci#define BACK_PORCH_SHIFT 11 1028c2ecf20Sopenharmony_ci#define BACK_PORCH_MASK (0x7ff << BACK_PORCH_SHIFT) 1038c2ecf20Sopenharmony_ci#define FRONT_PORCH_SHIFT 0 1048c2ecf20Sopenharmony_ci#define FRONT_PORCH_MASK (0x7ff << FRONT_PORCH_SHIFT) 1058c2ecf20Sopenharmony_ci#define TIMING_CTRL 0x20 1068c2ecf20Sopenharmony_ci#define AUX_POL_SHIFT 3 1078c2ecf20Sopenharmony_ci#define AUX_POL_MASK (0x7 << AUX_POL_SHIFT) 1088c2ecf20Sopenharmony_ci#define MAIN_POL_SHIFT 0 1098c2ecf20Sopenharmony_ci#define MAIN_POL_MASK (0x7 << MAIN_POL_SHIFT) 1108c2ecf20Sopenharmony_ci#define POL_DE_SHIFT 2 1118c2ecf20Sopenharmony_ci#define POL_VSYNC_SHIFT 1 1128c2ecf20Sopenharmony_ci#define POL_HSYNC_SHIFT 0 1138c2ecf20Sopenharmony_ci#define TIMING_INT_CTRL 0x24 1148c2ecf20Sopenharmony_ci#define TIMING_INT_STATE 0x28 1158c2ecf20Sopenharmony_ci#define TIMING_INT_AUX_FRAME BIT(3) 1168c2ecf20Sopenharmony_ci#define TIMING_INT_MAIN_FRAME BIT(1) 1178c2ecf20Sopenharmony_ci#define TIMING_INT_AUX_FRAME_SEL_VSW (0x2 << 10) 1188c2ecf20Sopenharmony_ci#define TIMING_INT_MAIN_FRAME_SEL_VSW (0x2 << 6) 1198c2ecf20Sopenharmony_ci#define TIMING_INT_ENABLE (\ 1208c2ecf20Sopenharmony_ci TIMING_INT_MAIN_FRAME_SEL_VSW | TIMING_INT_AUX_FRAME_SEL_VSW | \ 1218c2ecf20Sopenharmony_ci TIMING_INT_MAIN_FRAME | TIMING_INT_AUX_FRAME \ 1228c2ecf20Sopenharmony_ci) 1238c2ecf20Sopenharmony_ci#define TIMING_MAIN_SHIFT 0x2c 1248c2ecf20Sopenharmony_ci#define TIMING_AUX_SHIFT 0x30 1258c2ecf20Sopenharmony_ci#define H_SHIFT_VAL 0x0048 1268c2ecf20Sopenharmony_ci#define V_SHIFT_VAL 0x0001 1278c2ecf20Sopenharmony_ci#define SCAN_CTRL 0x34 1288c2ecf20Sopenharmony_ci#define AUX_PI_EN BIT(19) 1298c2ecf20Sopenharmony_ci#define MAIN_PI_EN BIT(18) 1308c2ecf20Sopenharmony_ci#define AUX_INTERLACE_SEL BIT(1) 1318c2ecf20Sopenharmony_ci#define MAIN_INTERLACE_SEL BIT(0) 1328c2ecf20Sopenharmony_ci#define SEC_V_ACTIVE 0x38 1338c2ecf20Sopenharmony_ci#define SEC_VACT_MAIN_SHIFT 0 1348c2ecf20Sopenharmony_ci#define SEC_VACT_MAIN_MASK (0xffff << SEC_VACT_MAIN_SHIFT) 1358c2ecf20Sopenharmony_ci#define SEC_VACT_AUX_SHIFT 16 1368c2ecf20Sopenharmony_ci#define SEC_VACT_AUX_MASK (0xffff << SEC_VACT_AUX_SHIFT) 1378c2ecf20Sopenharmony_ci#define SEC_MAIN_V_TIMING 0x3c 1388c2ecf20Sopenharmony_ci#define SEC_AUX_V_TIMING 0x40 1398c2ecf20Sopenharmony_ci#define TIMING_MAIN_PI_SHIFT 0x68 1408c2ecf20Sopenharmony_ci#define TIMING_AUX_PI_SHIFT 0x6c 1418c2ecf20Sopenharmony_ci#define H_PI_SHIFT_VAL 0x000f 1428c2ecf20Sopenharmony_ci 1438c2ecf20Sopenharmony_ci#define V_ACTIVE(x) (((x) << V_ACTIVE_SHIFT) & V_ACTIVE_MASK) 1448c2ecf20Sopenharmony_ci#define H_ACTIVE(x) (((x) << H_ACTIVE_SHIFT) & H_ACTIVE_MASK) 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_ci#define SYNC_WIDE(x) (((x) << SYNC_WIDE_SHIFT) & SYNC_WIDE_MASK) 1478c2ecf20Sopenharmony_ci#define BACK_PORCH(x) (((x) << BACK_PORCH_SHIFT) & BACK_PORCH_MASK) 1488c2ecf20Sopenharmony_ci#define FRONT_PORCH(x) (((x) << FRONT_PORCH_SHIFT) & FRONT_PORCH_MASK) 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci/* DTRC registers */ 1518c2ecf20Sopenharmony_ci#define DTRC_F0_CTRL 0x2c 1528c2ecf20Sopenharmony_ci#define DTRC_F1_CTRL 0x5c 1538c2ecf20Sopenharmony_ci#define DTRC_DECOMPRESS_BYPASS BIT(17) 1548c2ecf20Sopenharmony_ci#define DTRC_DETILE_CTRL 0x68 1558c2ecf20Sopenharmony_ci#define TILE2RASTESCAN_BYPASS_MODE BIT(30) 1568c2ecf20Sopenharmony_ci#define DETILE_ARIDR_MODE_MASK (0x3 << 0) 1578c2ecf20Sopenharmony_ci#define DETILE_ARID_ALL 0 1588c2ecf20Sopenharmony_ci#define DETILE_ARID_IN_ARIDR 1 1598c2ecf20Sopenharmony_ci#define DETILE_ARID_BYP_BUT_ARIDR 2 1608c2ecf20Sopenharmony_ci#define DETILE_ARID_IN_ARIDR2 3 1618c2ecf20Sopenharmony_ci#define DTRC_ARID 0x6c 1628c2ecf20Sopenharmony_ci#define DTRC_ARID3_SHIFT 24 1638c2ecf20Sopenharmony_ci#define DTRC_ARID3_MASK (0xff << DTRC_ARID3_SHIFT) 1648c2ecf20Sopenharmony_ci#define DTRC_ARID2_SHIFT 16 1658c2ecf20Sopenharmony_ci#define DTRC_ARID2_MASK (0xff << DTRC_ARID2_SHIFT) 1668c2ecf20Sopenharmony_ci#define DTRC_ARID1_SHIFT 8 1678c2ecf20Sopenharmony_ci#define DTRC_ARID1_MASK (0xff << DTRC_ARID1_SHIFT) 1688c2ecf20Sopenharmony_ci#define DTRC_ARID0_SHIFT 0 1698c2ecf20Sopenharmony_ci#define DTRC_ARID0_MASK (0xff << DTRC_ARID0_SHIFT) 1708c2ecf20Sopenharmony_ci#define DTRC_DEC2DDR_ARID 0x70 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci#define DTRC_ARID3(x) (((x) << DTRC_ARID3_SHIFT) & DTRC_ARID3_MASK) 1738c2ecf20Sopenharmony_ci#define DTRC_ARID2(x) (((x) << DTRC_ARID2_SHIFT) & DTRC_ARID2_MASK) 1748c2ecf20Sopenharmony_ci#define DTRC_ARID1(x) (((x) << DTRC_ARID1_SHIFT) & DTRC_ARID1_MASK) 1758c2ecf20Sopenharmony_ci#define DTRC_ARID0(x) (((x) << DTRC_ARID0_SHIFT) & DTRC_ARID0_MASK) 1768c2ecf20Sopenharmony_ci 1778c2ecf20Sopenharmony_ci/* VOU_CTRL registers */ 1788c2ecf20Sopenharmony_ci#define VOU_INF_EN 0x00 1798c2ecf20Sopenharmony_ci#define VOU_INF_CH_SEL 0x04 1808c2ecf20Sopenharmony_ci#define VOU_INF_DATA_SEL 0x08 1818c2ecf20Sopenharmony_ci#define VOU_SOFT_RST 0x14 1828c2ecf20Sopenharmony_ci#define VOU_CLK_SEL 0x18 1838c2ecf20Sopenharmony_ci#define VGA_AUX_DIV_SHIFT 29 1848c2ecf20Sopenharmony_ci#define VGA_MAIN_DIV_SHIFT 26 1858c2ecf20Sopenharmony_ci#define PIC_MAIN_DIV_SHIFT 23 1868c2ecf20Sopenharmony_ci#define PIC_AUX_DIV_SHIFT 20 1878c2ecf20Sopenharmony_ci#define VOU_CLK_VL2_SEL BIT(8) 1888c2ecf20Sopenharmony_ci#define VOU_CLK_VL1_SEL BIT(7) 1898c2ecf20Sopenharmony_ci#define VOU_CLK_VL0_SEL BIT(6) 1908c2ecf20Sopenharmony_ci#define VOU_CLK_GL1_SEL BIT(5) 1918c2ecf20Sopenharmony_ci#define VOU_CLK_GL0_SEL BIT(4) 1928c2ecf20Sopenharmony_ci#define VOU_DIV_PARA 0x1c 1938c2ecf20Sopenharmony_ci#define DIV_PARA_UPDATE BIT(31) 1948c2ecf20Sopenharmony_ci#define TVENC_AUX_DIV_SHIFT 28 1958c2ecf20Sopenharmony_ci#define HDMI_AUX_PNX_DIV_SHIFT 25 1968c2ecf20Sopenharmony_ci#define HDMI_MAIN_PNX_DIV_SHIFT 22 1978c2ecf20Sopenharmony_ci#define HDMI_AUX_DIV_SHIFT 19 1988c2ecf20Sopenharmony_ci#define HDMI_MAIN_DIV_SHIFT 16 1998c2ecf20Sopenharmony_ci#define TVENC_MAIN_DIV_SHIFT 13 2008c2ecf20Sopenharmony_ci#define INF_AUX_DIV_SHIFT 9 2018c2ecf20Sopenharmony_ci#define INF_MAIN_DIV_SHIFT 6 2028c2ecf20Sopenharmony_ci#define LAYER_AUX_DIV_SHIFT 3 2038c2ecf20Sopenharmony_ci#define LAYER_MAIN_DIV_SHIFT 0 2048c2ecf20Sopenharmony_ci#define VOU_CLK_REQEN 0x20 2058c2ecf20Sopenharmony_ci#define VOU_CLK_EN 0x24 2068c2ecf20Sopenharmony_ci#define VOU_INF_HDMI_CTRL 0x30 2078c2ecf20Sopenharmony_ci#define VOU_HDMI_AUD_MASK 0x1f 2088c2ecf20Sopenharmony_ci 2098c2ecf20Sopenharmony_ci/* OTFPPU_CTRL registers */ 2108c2ecf20Sopenharmony_ci#define OTFPPU_RSZ_DATA_SOURCE 0x04 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci#endif /* __ZX_VOU_REGS_H__ */ 213