18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd 48c2ecf20Sopenharmony_ci * Zheng Yang <zhengyang@rock-chips.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef __RK3066_HDMI_H__ 88c2ecf20Sopenharmony_ci#define __RK3066_HDMI_H__ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#define GRF_SOC_CON0 0x150 118c2ecf20Sopenharmony_ci#define HDMI_VIDEO_SEL BIT(14) 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define DDC_SEGMENT_ADDR 0x30 148c2ecf20Sopenharmony_ci#define HDMI_SCL_RATE (50 * 1000) 158c2ecf20Sopenharmony_ci#define HDMI_MAXIMUM_INFO_FRAME_SIZE 0x11 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define N_32K 0x1000 188c2ecf20Sopenharmony_ci#define N_441K 0x1880 198c2ecf20Sopenharmony_ci#define N_882K 0x3100 208c2ecf20Sopenharmony_ci#define N_1764K 0x6200 218c2ecf20Sopenharmony_ci#define N_48K 0x1800 228c2ecf20Sopenharmony_ci#define N_96K 0x3000 238c2ecf20Sopenharmony_ci#define N_192K 0x6000 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define HDMI_SYS_CTRL 0x000 268c2ecf20Sopenharmony_ci#define HDMI_LR_SWAP_N3 0x004 278c2ecf20Sopenharmony_ci#define HDMI_N2 0x008 288c2ecf20Sopenharmony_ci#define HDMI_N1 0x00c 298c2ecf20Sopenharmony_ci#define HDMI_SPDIF_FS_CTS_INT3 0x010 308c2ecf20Sopenharmony_ci#define HDMI_CTS_INT2 0x014 318c2ecf20Sopenharmony_ci#define HDMI_CTS_INT1 0x018 328c2ecf20Sopenharmony_ci#define HDMI_CTS_EXT3 0x01c 338c2ecf20Sopenharmony_ci#define HDMI_CTS_EXT2 0x020 348c2ecf20Sopenharmony_ci#define HDMI_CTS_EXT1 0x024 358c2ecf20Sopenharmony_ci#define HDMI_AUDIO_CTRL1 0x028 368c2ecf20Sopenharmony_ci#define HDMI_AUDIO_CTRL2 0x02c 378c2ecf20Sopenharmony_ci#define HDMI_I2S_AUDIO_CTRL 0x030 388c2ecf20Sopenharmony_ci#define HDMI_I2S_SWAP 0x040 398c2ecf20Sopenharmony_ci#define HDMI_AUDIO_STA_BIT_CTRL1 0x044 408c2ecf20Sopenharmony_ci#define HDMI_AUDIO_STA_BIT_CTRL2 0x048 418c2ecf20Sopenharmony_ci#define HDMI_AUDIO_SRC_NUM_AND_LENGTH 0x050 428c2ecf20Sopenharmony_ci#define HDMI_AV_CTRL1 0x054 438c2ecf20Sopenharmony_ci#define HDMI_VIDEO_CTRL1 0x058 448c2ecf20Sopenharmony_ci#define HDMI_DEEP_COLOR_MODE 0x05c 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci#define HDMI_EXT_VIDEO_PARA 0x0c0 478c2ecf20Sopenharmony_ci#define HDMI_EXT_HTOTAL_L 0x0c4 488c2ecf20Sopenharmony_ci#define HDMI_EXT_HTOTAL_H 0x0c8 498c2ecf20Sopenharmony_ci#define HDMI_EXT_HBLANK_L 0x0cc 508c2ecf20Sopenharmony_ci#define HDMI_EXT_HBLANK_H 0x0d0 518c2ecf20Sopenharmony_ci#define HDMI_EXT_HDELAY_L 0x0d4 528c2ecf20Sopenharmony_ci#define HDMI_EXT_HDELAY_H 0x0d8 538c2ecf20Sopenharmony_ci#define HDMI_EXT_HDURATION_L 0x0dc 548c2ecf20Sopenharmony_ci#define HDMI_EXT_HDURATION_H 0x0e0 558c2ecf20Sopenharmony_ci#define HDMI_EXT_VTOTAL_L 0x0e4 568c2ecf20Sopenharmony_ci#define HDMI_EXT_VTOTAL_H 0x0e8 578c2ecf20Sopenharmony_ci#define HDMI_AV_CTRL2 0x0ec 588c2ecf20Sopenharmony_ci#define HDMI_EXT_VBLANK_L 0x0f4 598c2ecf20Sopenharmony_ci#define HDMI_EXT_VBLANK_H 0x10c 608c2ecf20Sopenharmony_ci#define HDMI_EXT_VDELAY 0x0f8 618c2ecf20Sopenharmony_ci#define HDMI_EXT_VDURATION 0x0fc 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#define HDMI_CP_MANU_SEND_CTRL 0x100 648c2ecf20Sopenharmony_ci#define HDMI_CP_AUTO_SEND_CTRL 0x104 658c2ecf20Sopenharmony_ci#define HDMI_AUTO_CHECKSUM_OPT 0x108 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define HDMI_VIDEO_CTRL2 0x114 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define HDMI_PHY_OPTION 0x144 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_ci#define HDMI_CP_BUF_INDEX 0x17c 728c2ecf20Sopenharmony_ci#define HDMI_CP_BUF_ACC_HB0 0x180 738c2ecf20Sopenharmony_ci#define HDMI_CP_BUF_ACC_HB1 0x184 748c2ecf20Sopenharmony_ci#define HDMI_CP_BUF_ACC_HB2 0x188 758c2ecf20Sopenharmony_ci#define HDMI_CP_BUF_ACC_PB0 0x18c 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci#define HDMI_DDC_READ_FIFO_ADDR 0x200 788c2ecf20Sopenharmony_ci#define HDMI_DDC_BUS_FREQ_L 0x204 798c2ecf20Sopenharmony_ci#define HDMI_DDC_BUS_FREQ_H 0x208 808c2ecf20Sopenharmony_ci#define HDMI_DDC_BUS_CTRL 0x2dc 818c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_LEN 0x278 828c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_OFFSET 0x280 838c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_CTRL 0x284 848c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_READ_BUF0 0x288 858c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_READ_BUF1 0x28c 868c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_READ_BUF2 0x290 878c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_READ_BUF3 0x294 888c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_WRITE_BUF0 0x298 898c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_WRITE_BUF1 0x29c 908c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_WRITE_BUF2 0x2a0 918c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_WRITE_BUF3 0x2a4 928c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_WRITE_BUF4 0x2ac 938c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_WRITE_BUF5 0x2b0 948c2ecf20Sopenharmony_ci#define HDMI_DDC_I2C_WRITE_BUF6 0x2b4 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci#define HDMI_INTR_MASK1 0x248 978c2ecf20Sopenharmony_ci#define HDMI_INTR_MASK2 0x24c 988c2ecf20Sopenharmony_ci#define HDMI_INTR_STATUS1 0x250 998c2ecf20Sopenharmony_ci#define HDMI_INTR_STATUS2 0x254 1008c2ecf20Sopenharmony_ci#define HDMI_INTR_MASK3 0x258 1018c2ecf20Sopenharmony_ci#define HDMI_INTR_MASK4 0x25c 1028c2ecf20Sopenharmony_ci#define HDMI_INTR_STATUS3 0x260 1038c2ecf20Sopenharmony_ci#define HDMI_INTR_STATUS4 0x264 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_ci#define HDMI_HDCP_CTRL 0x2bc 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define HDMI_EDID_SEGMENT_POINTER 0x310 1088c2ecf20Sopenharmony_ci#define HDMI_EDID_WORD_ADDR 0x314 1098c2ecf20Sopenharmony_ci#define HDMI_EDID_FIFO_ADDR 0x318 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci#define HDMI_HPG_MENS_STA 0x37c 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#define HDMI_INTERNAL_CLK_DIVIDER 0x800 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_cienum { 1168c2ecf20Sopenharmony_ci /* HDMI_SYS_CTRL */ 1178c2ecf20Sopenharmony_ci HDMI_SYS_POWER_MODE_MASK = 0xf0, 1188c2ecf20Sopenharmony_ci HDMI_SYS_POWER_MODE_A = 0x10, 1198c2ecf20Sopenharmony_ci HDMI_SYS_POWER_MODE_B = 0x20, 1208c2ecf20Sopenharmony_ci HDMI_SYS_POWER_MODE_D = 0x40, 1218c2ecf20Sopenharmony_ci HDMI_SYS_POWER_MODE_E = 0x80, 1228c2ecf20Sopenharmony_ci HDMI_SYS_PLL_RESET_MASK = 0x0c, 1238c2ecf20Sopenharmony_ci HDMI_SYS_PLL_RESET = 0x0c, 1248c2ecf20Sopenharmony_ci HDMI_SYS_PLLB_RESET = 0x08, 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci /* HDMI_LR_SWAP_N3 */ 1278c2ecf20Sopenharmony_ci HDMI_AUDIO_LR_SWAP_MASK = 0xf0, 1288c2ecf20Sopenharmony_ci HDMI_AUDIO_LR_SWAP_SUBPACKET0 = 0x10, 1298c2ecf20Sopenharmony_ci HDMI_AUDIO_LR_SWAP_SUBPACKET1 = 0x20, 1308c2ecf20Sopenharmony_ci HDMI_AUDIO_LR_SWAP_SUBPACKET2 = 0x40, 1318c2ecf20Sopenharmony_ci HDMI_AUDIO_LR_SWAP_SUBPACKET3 = 0x80, 1328c2ecf20Sopenharmony_ci HDMI_AUDIO_N_19_16_MASK = 0x0f, 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_ci /* HDMI_AUDIO_CTRL1 */ 1358c2ecf20Sopenharmony_ci HDMI_AUDIO_EXTERNAL_CTS = BIT(7), 1368c2ecf20Sopenharmony_ci HDMI_AUDIO_INPUT_IIS = 0, 1378c2ecf20Sopenharmony_ci HDMI_AUDIO_INPUT_SPDIF = 0x08, 1388c2ecf20Sopenharmony_ci HDMI_AUDIO_INPUT_MCLK_ACTIVE = 0x04, 1398c2ecf20Sopenharmony_ci HDMI_AUDIO_INPUT_MCLK_DEACTIVE = 0, 1408c2ecf20Sopenharmony_ci HDMI_AUDIO_INPUT_MCLK_RATE_128X = 0, 1418c2ecf20Sopenharmony_ci HDMI_AUDIO_INPUT_MCLK_RATE_256X = 1, 1428c2ecf20Sopenharmony_ci HDMI_AUDIO_INPUT_MCLK_RATE_384X = 2, 1438c2ecf20Sopenharmony_ci HDMI_AUDIO_INPUT_MCLK_RATE_512X = 3, 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci /* HDMI_I2S_AUDIO_CTRL */ 1468c2ecf20Sopenharmony_ci HDMI_AUDIO_I2S_FORMAT_STANDARD = 0, 1478c2ecf20Sopenharmony_ci HDMI_AUDIO_I2S_CHANNEL_1_2 = 0x04, 1488c2ecf20Sopenharmony_ci HDMI_AUDIO_I2S_CHANNEL_3_4 = 0x0c, 1498c2ecf20Sopenharmony_ci HDMI_AUDIO_I2S_CHANNEL_5_6 = 0x1c, 1508c2ecf20Sopenharmony_ci HDMI_AUDIO_I2S_CHANNEL_7_8 = 0x3c, 1518c2ecf20Sopenharmony_ci 1528c2ecf20Sopenharmony_ci /* HDMI_AV_CTRL1 */ 1538c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_MASK = 0xf0, 1548c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_32000 = 0x30, 1558c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_44100 = 0, 1568c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_48000 = 0x20, 1578c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_88200 = 0x80, 1588c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_96000 = 0xa0, 1598c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_176400 = 0xc0, 1608c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_192000 = 0xe0, 1618c2ecf20Sopenharmony_ci HDMI_AUDIO_SAMPLE_FRE_768000 = 0x90, 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_FORMAT_MASK = 0x0e, 1648c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_RGB_YCBCR444 = 0, 1658c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_YCBCR422 = 0x02, 1668c2ecf20Sopenharmony_ci HDMI_VIDEO_DE_MASK = 0x1, 1678c2ecf20Sopenharmony_ci HDMI_VIDEO_INTERNAL_DE = 0, 1688c2ecf20Sopenharmony_ci HDMI_VIDEO_EXTERNAL_DE = 0x01, 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci /* HDMI_VIDEO_CTRL1 */ 1718c2ecf20Sopenharmony_ci HDMI_VIDEO_OUTPUT_FORMAT_MASK = 0xc0, 1728c2ecf20Sopenharmony_ci HDMI_VIDEO_OUTPUT_RGB444 = 0, 1738c2ecf20Sopenharmony_ci HDMI_VIDEO_OUTPUT_YCBCR444 = 0x40, 1748c2ecf20Sopenharmony_ci HDMI_VIDEO_OUTPUT_YCBCR422 = 0x80, 1758c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_DATA_DEPTH_MASK = 0x30, 1768c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_DATA_DEPTH_12BIT = 0, 1778c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_DATA_DEPTH_10BIT = 0x10, 1788c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_DATA_DEPTH_8BIT = 0x30, 1798c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_COLOR_MASK = 1, 1808c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_COLOR_RGB = 0, 1818c2ecf20Sopenharmony_ci HDMI_VIDEO_INPUT_COLOR_YCBCR = 1, 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci /* HDMI_EXT_VIDEO_PARA */ 1848c2ecf20Sopenharmony_ci HDMI_VIDEO_VSYNC_OFFSET_SHIFT = 4, 1858c2ecf20Sopenharmony_ci HDMI_VIDEO_VSYNC_ACTIVE_HIGH = BIT(3), 1868c2ecf20Sopenharmony_ci HDMI_VIDEO_VSYNC_ACTIVE_LOW = 0, 1878c2ecf20Sopenharmony_ci HDMI_VIDEO_HSYNC_ACTIVE_HIGH = BIT(2), 1888c2ecf20Sopenharmony_ci HDMI_VIDEO_HSYNC_ACTIVE_LOW = 0, 1898c2ecf20Sopenharmony_ci HDMI_VIDEO_MODE_INTERLACE = BIT(1), 1908c2ecf20Sopenharmony_ci HDMI_VIDEO_MODE_PROGRESSIVE = 0, 1918c2ecf20Sopenharmony_ci HDMI_EXT_VIDEO_SET_EN = BIT(0), 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci /* HDMI_CP_AUTO_SEND_CTRL */ 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci /* HDMI_VIDEO_CTRL2 */ 1968c2ecf20Sopenharmony_ci HDMI_VIDEO_AV_MUTE_MASK = 0xc0, 1978c2ecf20Sopenharmony_ci HDMI_VIDEO_CLR_AV_MUTE = BIT(7), 1988c2ecf20Sopenharmony_ci HDMI_VIDEO_SET_AV_MUTE = BIT(6), 1998c2ecf20Sopenharmony_ci HDMI_AUDIO_CP_LOGIC_RESET_MASK = BIT(2), 2008c2ecf20Sopenharmony_ci HDMI_AUDIO_CP_LOGIC_RESET = BIT(2), 2018c2ecf20Sopenharmony_ci HDMI_VIDEO_AUDIO_DISABLE_MASK = 0x3, 2028c2ecf20Sopenharmony_ci HDMI_AUDIO_DISABLE = BIT(1), 2038c2ecf20Sopenharmony_ci HDMI_VIDEO_DISABLE = BIT(0), 2048c2ecf20Sopenharmony_ci 2058c2ecf20Sopenharmony_ci /* HDMI_CP_BUF_INDEX */ 2068c2ecf20Sopenharmony_ci HDMI_INFOFRAME_VSI = 0x05, 2078c2ecf20Sopenharmony_ci HDMI_INFOFRAME_AVI = 0x06, 2088c2ecf20Sopenharmony_ci HDMI_INFOFRAME_AAI = 0x08, 2098c2ecf20Sopenharmony_ci 2108c2ecf20Sopenharmony_ci /* HDMI_INTR_MASK1 */ 2118c2ecf20Sopenharmony_ci /* HDMI_INTR_STATUS1 */ 2128c2ecf20Sopenharmony_ci HDMI_INTR_HOTPLUG = BIT(7), 2138c2ecf20Sopenharmony_ci HDMI_INTR_MSENS = BIT(6), 2148c2ecf20Sopenharmony_ci HDMI_INTR_VSYNC = BIT(5), 2158c2ecf20Sopenharmony_ci HDMI_INTR_AUDIO_FIFO_FULL = BIT(4), 2168c2ecf20Sopenharmony_ci HDMI_INTR_EDID_MASK = 0x6, 2178c2ecf20Sopenharmony_ci HDMI_INTR_EDID_READY = BIT(2), 2188c2ecf20Sopenharmony_ci HDMI_INTR_EDID_ERR = BIT(1), 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci /* HDMI_HDCP_CTRL */ 2218c2ecf20Sopenharmony_ci HDMI_VIDEO_MODE_MASK = BIT(1), 2228c2ecf20Sopenharmony_ci HDMI_VIDEO_MODE_HDMI = BIT(1), 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci /* HDMI_HPG_MENS_STA */ 2258c2ecf20Sopenharmony_ci HDMI_HPG_IN_STATUS_HIGH = BIT(7), 2268c2ecf20Sopenharmony_ci HDMI_MSENS_IN_STATUS_HIGH = BIT(6), 2278c2ecf20Sopenharmony_ci}; 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci#endif /* __RK3066_HDMI_H__ */ 230