18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2018 Gateworks Corporation
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci/* Page 0x00 - General Control */
78c2ecf20Sopenharmony_ci#define REG_VERSION		0x0000
88c2ecf20Sopenharmony_ci#define REG_INPUT_SEL		0x0001
98c2ecf20Sopenharmony_ci#define REG_SVC_MODE		0x0002
108c2ecf20Sopenharmony_ci#define REG_HPD_MAN_CTRL	0x0003
118c2ecf20Sopenharmony_ci#define REG_RT_MAN_CTRL		0x0004
128c2ecf20Sopenharmony_ci#define REG_STANDBY_SOFT_RST	0x000A
138c2ecf20Sopenharmony_ci#define REG_HDMI_SOFT_RST	0x000B
148c2ecf20Sopenharmony_ci#define REG_HDMI_INFO_RST	0x000C
158c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_TOP	0x000E
168c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_SUS	0x000F
178c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_DDC	0x0010
188c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_RATE	0x0011
198c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_MODE	0x0012
208c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_INFO	0x0013
218c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_AUDIO	0x0014
228c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_HDCP	0x0015
238c2ecf20Sopenharmony_ci#define REG_INT_FLG_CLR_AFE	0x0016
248c2ecf20Sopenharmony_ci#define REG_INT_MASK_TOP	0x0017
258c2ecf20Sopenharmony_ci#define REG_INT_MASK_SUS	0x0018
268c2ecf20Sopenharmony_ci#define REG_INT_MASK_DDC	0x0019
278c2ecf20Sopenharmony_ci#define REG_INT_MASK_RATE	0x001A
288c2ecf20Sopenharmony_ci#define REG_INT_MASK_MODE	0x001B
298c2ecf20Sopenharmony_ci#define REG_INT_MASK_INFO	0x001C
308c2ecf20Sopenharmony_ci#define REG_INT_MASK_AUDIO	0x001D
318c2ecf20Sopenharmony_ci#define REG_INT_MASK_HDCP	0x001E
328c2ecf20Sopenharmony_ci#define REG_INT_MASK_AFE	0x001F
338c2ecf20Sopenharmony_ci#define REG_DETECT_5V		0x0020
348c2ecf20Sopenharmony_ci#define REG_SUS_STATUS		0x0021
358c2ecf20Sopenharmony_ci#define REG_V_PER		0x0022
368c2ecf20Sopenharmony_ci#define REG_H_PER		0x0025
378c2ecf20Sopenharmony_ci#define REG_HS_WIDTH		0x0027
388c2ecf20Sopenharmony_ci#define REG_FMT_H_TOT		0x0029
398c2ecf20Sopenharmony_ci#define REG_FMT_H_ACT		0x002b
408c2ecf20Sopenharmony_ci#define REG_FMT_H_FRONT		0x002d
418c2ecf20Sopenharmony_ci#define REG_FMT_H_SYNC		0x002f
428c2ecf20Sopenharmony_ci#define REG_FMT_H_BACK		0x0031
438c2ecf20Sopenharmony_ci#define REG_FMT_V_TOT		0x0033
448c2ecf20Sopenharmony_ci#define REG_FMT_V_ACT		0x0035
458c2ecf20Sopenharmony_ci#define REG_FMT_V_FRONT_F1	0x0037
468c2ecf20Sopenharmony_ci#define REG_FMT_V_FRONT_F2	0x0038
478c2ecf20Sopenharmony_ci#define REG_FMT_V_SYNC		0x0039
488c2ecf20Sopenharmony_ci#define REG_FMT_V_BACK_F1	0x003a
498c2ecf20Sopenharmony_ci#define REG_FMT_V_BACK_F2	0x003b
508c2ecf20Sopenharmony_ci#define REG_FMT_DE_ACT		0x003c
518c2ecf20Sopenharmony_ci#define REG_RATE_CTRL		0x0040
528c2ecf20Sopenharmony_ci#define REG_CLK_MIN_RATE	0x0043
538c2ecf20Sopenharmony_ci#define REG_CLK_MAX_RATE	0x0046
548c2ecf20Sopenharmony_ci#define REG_CLK_A_STATUS	0x0049
558c2ecf20Sopenharmony_ci#define REG_CLK_A_RATE		0x004A
568c2ecf20Sopenharmony_ci#define REG_DRIFT_CLK_A_REG	0x004D
578c2ecf20Sopenharmony_ci#define REG_CLK_B_STATUS	0x004E
588c2ecf20Sopenharmony_ci#define REG_CLK_B_RATE		0x004F
598c2ecf20Sopenharmony_ci#define REG_DRIFT_CLK_B_REG	0x0052
608c2ecf20Sopenharmony_ci#define REG_HDCP_CTRL		0x0060
618c2ecf20Sopenharmony_ci#define REG_HDCP_KDS		0x0061
628c2ecf20Sopenharmony_ci#define REG_HDCP_BCAPS		0x0063
638c2ecf20Sopenharmony_ci#define REG_HDCP_KEY_CTRL	0x0064
648c2ecf20Sopenharmony_ci#define REG_INFO_CTRL		0x0076
658c2ecf20Sopenharmony_ci#define REG_INFO_EXCEED		0x0077
668c2ecf20Sopenharmony_ci#define REG_PIX_REPEAT		0x007B
678c2ecf20Sopenharmony_ci#define REG_AUDIO_PATH		0x007C
688c2ecf20Sopenharmony_ci#define REG_AUDCFG		0x007D
698c2ecf20Sopenharmony_ci#define REG_AUDIO_OUT_ENABLE	0x007E
708c2ecf20Sopenharmony_ci#define REG_AUDIO_OUT_HIZ	0x007F
718c2ecf20Sopenharmony_ci#define REG_VDP_CTRL		0x0080
728c2ecf20Sopenharmony_ci#define REG_VDP_MATRIX		0x0081
738c2ecf20Sopenharmony_ci#define REG_VHREF_CTRL		0x00A0
748c2ecf20Sopenharmony_ci#define REG_PXCNT_PR		0x00A2
758c2ecf20Sopenharmony_ci#define REG_PXCNT_NPIX		0x00A4
768c2ecf20Sopenharmony_ci#define REG_LCNT_PR		0x00A6
778c2ecf20Sopenharmony_ci#define REG_LCNT_NLIN		0x00A8
788c2ecf20Sopenharmony_ci#define REG_HREF_S		0x00AA
798c2ecf20Sopenharmony_ci#define REG_HREF_E		0x00AC
808c2ecf20Sopenharmony_ci#define REG_HS_S		0x00AE
818c2ecf20Sopenharmony_ci#define REG_HS_E		0x00B0
828c2ecf20Sopenharmony_ci#define REG_VREF_F1_S		0x00B2
838c2ecf20Sopenharmony_ci#define REG_VREF_F1_WIDTH	0x00B4
848c2ecf20Sopenharmony_ci#define REG_VREF_F2_S		0x00B5
858c2ecf20Sopenharmony_ci#define REG_VREF_F2_WIDTH	0x00B7
868c2ecf20Sopenharmony_ci#define REG_VS_F1_LINE_S	0x00B8
878c2ecf20Sopenharmony_ci#define REG_VS_F1_LINE_WIDTH	0x00BA
888c2ecf20Sopenharmony_ci#define REG_VS_F2_LINE_S	0x00BB
898c2ecf20Sopenharmony_ci#define REG_VS_F2_LINE_WIDTH	0x00BD
908c2ecf20Sopenharmony_ci#define REG_VS_F1_PIX_S		0x00BE
918c2ecf20Sopenharmony_ci#define REG_VS_F1_PIX_E		0x00C0
928c2ecf20Sopenharmony_ci#define REG_VS_F2_PIX_S		0x00C2
938c2ecf20Sopenharmony_ci#define REG_VS_F2_PIX_E		0x00C4
948c2ecf20Sopenharmony_ci#define REG_FREF_F1_S		0x00C6
958c2ecf20Sopenharmony_ci#define REG_FREF_F2_S		0x00C8
968c2ecf20Sopenharmony_ci#define REG_FDW_S		0x00ca
978c2ecf20Sopenharmony_ci#define REG_FDW_E		0x00cc
988c2ecf20Sopenharmony_ci#define REG_BLK_GY		0x00da
998c2ecf20Sopenharmony_ci#define REG_BLK_BU		0x00dc
1008c2ecf20Sopenharmony_ci#define REG_BLK_RV		0x00de
1018c2ecf20Sopenharmony_ci#define REG_FILTERS_CTRL	0x00e0
1028c2ecf20Sopenharmony_ci#define REG_DITHERING_CTRL	0x00E9
1038c2ecf20Sopenharmony_ci#define REG_OF			0x00EA
1048c2ecf20Sopenharmony_ci#define REG_PCLK		0x00EB
1058c2ecf20Sopenharmony_ci#define REG_HS_HREF		0x00EC
1068c2ecf20Sopenharmony_ci#define REG_VS_VREF		0x00ED
1078c2ecf20Sopenharmony_ci#define REG_DE_FREF		0x00EE
1088c2ecf20Sopenharmony_ci#define REG_VP35_32_CTRL	0x00EF
1098c2ecf20Sopenharmony_ci#define REG_VP31_28_CTRL	0x00F0
1108c2ecf20Sopenharmony_ci#define REG_VP27_24_CTRL	0x00F1
1118c2ecf20Sopenharmony_ci#define REG_VP23_20_CTRL	0x00F2
1128c2ecf20Sopenharmony_ci#define REG_VP19_16_CTRL	0x00F3
1138c2ecf20Sopenharmony_ci#define REG_VP15_12_CTRL	0x00F4
1148c2ecf20Sopenharmony_ci#define REG_VP11_08_CTRL	0x00F5
1158c2ecf20Sopenharmony_ci#define REG_VP07_04_CTRL	0x00F6
1168c2ecf20Sopenharmony_ci#define REG_VP03_00_CTRL	0x00F7
1178c2ecf20Sopenharmony_ci#define REG_CURPAGE_00H		0xFF
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci#define MASK_VPER		0x3fffff
1208c2ecf20Sopenharmony_ci#define MASK_VHREF		0x3fff
1218c2ecf20Sopenharmony_ci#define MASK_HPER		0x0fff
1228c2ecf20Sopenharmony_ci#define MASK_HSWIDTH		0x03ff
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci/* HPD Detection */
1258c2ecf20Sopenharmony_ci#define DETECT_UTIL		BIT(7)	/* utility of HDMI level */
1268c2ecf20Sopenharmony_ci#define DETECT_HPD		BIT(6)	/* HPD of HDMI level */
1278c2ecf20Sopenharmony_ci#define DETECT_5V_SEL		BIT(2)	/* 5V present on selected input */
1288c2ecf20Sopenharmony_ci#define DETECT_5V_B		BIT(1)	/* 5V present on input B */
1298c2ecf20Sopenharmony_ci#define DETECT_5V_A		BIT(0)	/* 5V present on input A */
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/* Input Select */
1328c2ecf20Sopenharmony_ci#define INPUT_SEL_RST_FMT	BIT(7)	/* 1=reset format measurement */
1338c2ecf20Sopenharmony_ci#define INPUT_SEL_RST_VDP	BIT(2)	/* 1=reset video data path */
1348c2ecf20Sopenharmony_ci#define INPUT_SEL_OUT_MODE	BIT(1)	/* 0=loop 1=bypass */
1358c2ecf20Sopenharmony_ci#define INPUT_SEL_B		BIT(0)	/* 0=inputA 1=inputB */
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/* Service Mode */
1388c2ecf20Sopenharmony_ci#define SVC_MODE_CLK2_MASK	0xc0
1398c2ecf20Sopenharmony_ci#define SVC_MODE_CLK2_SHIFT	6
1408c2ecf20Sopenharmony_ci#define SVC_MODE_CLK2_XTL	0L
1418c2ecf20Sopenharmony_ci#define SVC_MODE_CLK2_XTLDIV2	1L
1428c2ecf20Sopenharmony_ci#define SVC_MODE_CLK2_HDMIX2	3L
1438c2ecf20Sopenharmony_ci#define SVC_MODE_CLK1_MASK	0x30
1448c2ecf20Sopenharmony_ci#define SVC_MODE_CLK1_SHIFT	4
1458c2ecf20Sopenharmony_ci#define SVC_MODE_CLK1_XTAL	0L
1468c2ecf20Sopenharmony_ci#define SVC_MODE_CLK1_XTLDIV2	1L
1478c2ecf20Sopenharmony_ci#define SVC_MODE_CLK1_HDMI	3L
1488c2ecf20Sopenharmony_ci#define SVC_MODE_RAMP		BIT(3)	/* 0=colorbar 1=ramp */
1498c2ecf20Sopenharmony_ci#define SVC_MODE_PAL		BIT(2)	/* 0=NTSC(480i/p) 1=PAL(576i/p) */
1508c2ecf20Sopenharmony_ci#define SVC_MODE_INT_PROG	BIT(1)	/* 0=interlaced 1=progressive */
1518c2ecf20Sopenharmony_ci#define SVC_MODE_SM_ON		BIT(0)	/* Enable color bars and tone gen */
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/* HDP Manual Control */
1548c2ecf20Sopenharmony_ci#define HPD_MAN_CTRL_HPD_PULSE	BIT(7)	/* HPD Pulse low 110ms */
1558c2ecf20Sopenharmony_ci#define HPD_MAN_CTRL_5VEN	BIT(2)	/* Output 5V */
1568c2ecf20Sopenharmony_ci#define HPD_MAN_CTRL_HPD_B	BIT(1)	/* Assert HPD High for Input A */
1578c2ecf20Sopenharmony_ci#define HPD_MAN_CTRL_HPD_A	BIT(0)	/* Assert HPD High for Input A */
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/* RT_MAN_CTRL */
1608c2ecf20Sopenharmony_ci#define RT_MAN_CTRL_RT_AUTO	BIT(7)
1618c2ecf20Sopenharmony_ci#define RT_MAN_CTRL_RT		BIT(6)
1628c2ecf20Sopenharmony_ci#define RT_MAN_CTRL_RT_B	BIT(1)	/* enable TMDS pull-up on Input B */
1638c2ecf20Sopenharmony_ci#define RT_MAN_CTRL_RT_A	BIT(0)	/* enable TMDS pull-up on Input A */
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/* VDP_CTRL */
1668c2ecf20Sopenharmony_ci#define VDP_CTRL_COMPDEL_BP	BIT(5)	/* bypass compdel */
1678c2ecf20Sopenharmony_ci#define VDP_CTRL_FORMATTER_BP	BIT(4)	/* bypass formatter */
1688c2ecf20Sopenharmony_ci#define VDP_CTRL_PREFILTER_BP	BIT(1)	/* bypass prefilter */
1698c2ecf20Sopenharmony_ci#define VDP_CTRL_MATRIX_BP	BIT(0)	/* bypass matrix conversion */
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/* REG_VHREF_CTRL */
1728c2ecf20Sopenharmony_ci#define VHREF_INT_DET		BIT(7)	/* interlace detect: 1=alt 0=frame */
1738c2ecf20Sopenharmony_ci#define VHREF_VSYNC_MASK	0x60
1748c2ecf20Sopenharmony_ci#define VHREF_VSYNC_SHIFT	6
1758c2ecf20Sopenharmony_ci#define VHREF_VSYNC_AUTO	0L
1768c2ecf20Sopenharmony_ci#define VHREF_VSYNC_FDW		1L
1778c2ecf20Sopenharmony_ci#define VHREF_VSYNC_EVEN	2L
1788c2ecf20Sopenharmony_ci#define VHREF_VSYNC_ODD		3L
1798c2ecf20Sopenharmony_ci#define VHREF_STD_DET_MASK	0x18
1808c2ecf20Sopenharmony_ci#define VHREF_STD_DET_SHIFT	3
1818c2ecf20Sopenharmony_ci#define VHREF_STD_DET_PAL	0L
1828c2ecf20Sopenharmony_ci#define VHREF_STD_DET_NTSC	1L
1838c2ecf20Sopenharmony_ci#define VHREF_STD_DET_AUTO	2L
1848c2ecf20Sopenharmony_ci#define VHREF_STD_DET_OFF	3L
1858c2ecf20Sopenharmony_ci#define VHREF_VREF_SRC_STD	BIT(2)	/* 1=from standard 0=manual */
1868c2ecf20Sopenharmony_ci#define VHREF_HREF_SRC_STD	BIT(1)	/* 1=from standard 0=manual */
1878c2ecf20Sopenharmony_ci#define VHREF_HSYNC_SEL_HS	BIT(0)	/* 1=HS 0=VS */
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/* AUDIO_OUT_ENABLE */
1908c2ecf20Sopenharmony_ci#define AUDIO_OUT_ENABLE_ACLK	BIT(5)
1918c2ecf20Sopenharmony_ci#define AUDIO_OUT_ENABLE_WS	BIT(4)
1928c2ecf20Sopenharmony_ci#define AUDIO_OUT_ENABLE_AP3	BIT(3)
1938c2ecf20Sopenharmony_ci#define AUDIO_OUT_ENABLE_AP2	BIT(2)
1948c2ecf20Sopenharmony_ci#define AUDIO_OUT_ENABLE_AP1	BIT(1)
1958c2ecf20Sopenharmony_ci#define AUDIO_OUT_ENABLE_AP0	BIT(0)
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci/* Prefilter Control */
1988c2ecf20Sopenharmony_ci#define FILTERS_CTRL_BU_MASK	0x0c
1998c2ecf20Sopenharmony_ci#define FILTERS_CTRL_BU_SHIFT	2
2008c2ecf20Sopenharmony_ci#define FILTERS_CTRL_RV_MASK	0x03
2018c2ecf20Sopenharmony_ci#define FILTERS_CTRL_RV_SHIFT	0
2028c2ecf20Sopenharmony_ci#define FILTERS_CTRL_OFF	0L	/* off */
2038c2ecf20Sopenharmony_ci#define FILTERS_CTRL_2TAP	1L	/* 2 Taps */
2048c2ecf20Sopenharmony_ci#define FILTERS_CTRL_7TAP	2L	/* 7 Taps */
2058c2ecf20Sopenharmony_ci#define FILTERS_CTRL_2_7TAP	3L	/* 2/7 Taps */
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci/* PCLK Configuration */
2088c2ecf20Sopenharmony_ci#define PCLK_DELAY_MASK		0x70
2098c2ecf20Sopenharmony_ci#define PCLK_DELAY_SHIFT	4	/* Pixel delay (-8..+7) */
2108c2ecf20Sopenharmony_ci#define PCLK_INV_SHIFT		2
2118c2ecf20Sopenharmony_ci#define PCLK_SEL_MASK		0x03	/* clock scaler */
2128c2ecf20Sopenharmony_ci#define PCLK_SEL_SHIFT		0
2138c2ecf20Sopenharmony_ci#define PCLK_SEL_X1		0L
2148c2ecf20Sopenharmony_ci#define PCLK_SEL_X2		1L
2158c2ecf20Sopenharmony_ci#define PCLK_SEL_DIV2		2L
2168c2ecf20Sopenharmony_ci#define PCLK_SEL_DIV4		3L
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* Pixel Repeater */
2198c2ecf20Sopenharmony_ci#define PIX_REPEAT_MASK_UP_SEL	0x30
2208c2ecf20Sopenharmony_ci#define PIX_REPEAT_MASK_REP	0x0f
2218c2ecf20Sopenharmony_ci#define PIX_REPEAT_SHIFT	4
2228c2ecf20Sopenharmony_ci#define PIX_REPEAT_CHROMA	1
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci/* Page 0x01 - HDMI info and packets */
2258c2ecf20Sopenharmony_ci#define REG_HDMI_FLAGS		0x0100
2268c2ecf20Sopenharmony_ci#define REG_DEEP_COLOR_MODE	0x0101
2278c2ecf20Sopenharmony_ci#define REG_AUDIO_FLAGS		0x0108
2288c2ecf20Sopenharmony_ci#define REG_AUDIO_FREQ		0x0109
2298c2ecf20Sopenharmony_ci#define REG_ACP_PACKET_TYPE	0x0141
2308c2ecf20Sopenharmony_ci#define REG_ISRC1_PACKET_TYPE	0x0161
2318c2ecf20Sopenharmony_ci#define REG_ISRC2_PACKET_TYPE	0x0181
2328c2ecf20Sopenharmony_ci#define REG_GBD_PACKET_TYPE	0x01a1
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci/* HDMI_FLAGS */
2358c2ecf20Sopenharmony_ci#define HDMI_FLAGS_AUDIO	BIT(7)	/* Audio packet in last videoframe */
2368c2ecf20Sopenharmony_ci#define HDMI_FLAGS_HDMI		BIT(6)	/* HDMI detected */
2378c2ecf20Sopenharmony_ci#define HDMI_FLAGS_EESS		BIT(5)	/* EESS detected */
2388c2ecf20Sopenharmony_ci#define HDMI_FLAGS_HDCP		BIT(4)	/* HDCP detected */
2398c2ecf20Sopenharmony_ci#define HDMI_FLAGS_AVMUTE	BIT(3)	/* AVMUTE */
2408c2ecf20Sopenharmony_ci#define HDMI_FLAGS_AUD_LAYOUT	BIT(2)	/* Layout status Audio sample packet */
2418c2ecf20Sopenharmony_ci#define HDMI_FLAGS_AUD_FIFO_OF	BIT(1)	/* FIFO read/write pointers crossed */
2428c2ecf20Sopenharmony_ci#define HDMI_FLAGS_AUD_FIFO_LOW	BIT(0)	/* FIFO read ptr within 2 of write */
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/* Page 0x12 - HDMI Extra control and debug */
2458c2ecf20Sopenharmony_ci#define REG_CLK_CFG		0x1200
2468c2ecf20Sopenharmony_ci#define REG_CLK_OUT_CFG		0x1201
2478c2ecf20Sopenharmony_ci#define REG_CFG1		0x1202
2488c2ecf20Sopenharmony_ci#define REG_CFG2		0x1203
2498c2ecf20Sopenharmony_ci#define REG_WDL_CFG		0x1210
2508c2ecf20Sopenharmony_ci#define REG_DELOCK_DELAY	0x1212
2518c2ecf20Sopenharmony_ci#define REG_PON_OVR_EN		0x12A0
2528c2ecf20Sopenharmony_ci#define REG_PON_CBIAS		0x12A1
2538c2ecf20Sopenharmony_ci#define REG_PON_RESCAL		0x12A2
2548c2ecf20Sopenharmony_ci#define REG_PON_RES		0x12A3
2558c2ecf20Sopenharmony_ci#define REG_PON_CLK		0x12A4
2568c2ecf20Sopenharmony_ci#define REG_PON_PLL		0x12A5
2578c2ecf20Sopenharmony_ci#define REG_PON_EQ		0x12A6
2588c2ecf20Sopenharmony_ci#define REG_PON_DES		0x12A7
2598c2ecf20Sopenharmony_ci#define REG_PON_OUT		0x12A8
2608c2ecf20Sopenharmony_ci#define REG_PON_MUX		0x12A9
2618c2ecf20Sopenharmony_ci#define REG_MODE_REC_CFG1	0x12F8
2628c2ecf20Sopenharmony_ci#define REG_MODE_REC_CFG2	0x12F9
2638c2ecf20Sopenharmony_ci#define REG_MODE_REC_STS	0x12FA
2648c2ecf20Sopenharmony_ci#define REG_AUDIO_LAYOUT	0x12D0
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci#define PON_EN			1
2678c2ecf20Sopenharmony_ci#define PON_DIS			0
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci/* CLK CFG */
2708c2ecf20Sopenharmony_ci#define CLK_CFG_INV_OUT_CLK	BIT(7)
2718c2ecf20Sopenharmony_ci#define CLK_CFG_INV_BUS_CLK	BIT(6)
2728c2ecf20Sopenharmony_ci#define CLK_CFG_SEL_ACLK_EN	BIT(1)
2738c2ecf20Sopenharmony_ci#define CLK_CFG_SEL_ACLK	BIT(0)
2748c2ecf20Sopenharmony_ci#define CLK_CFG_DIS		0
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_ci/* Page 0x13 - HDMI Extra control and debug */
2778c2ecf20Sopenharmony_ci#define REG_DEEP_COLOR_CTRL	0x1300
2788c2ecf20Sopenharmony_ci#define REG_CGU_DBG_SEL		0x1305
2798c2ecf20Sopenharmony_ci#define REG_HDCP_DDC_ADDR	0x1310
2808c2ecf20Sopenharmony_ci#define REG_HDCP_KIDX		0x1316
2818c2ecf20Sopenharmony_ci#define REG_DEEP_PLL7_BYP	0x1347
2828c2ecf20Sopenharmony_ci#define REG_HDCP_DE_CTRL	0x1370
2838c2ecf20Sopenharmony_ci#define REG_HDCP_EP_FILT_CTRL	0x1371
2848c2ecf20Sopenharmony_ci#define REG_HDMI_CTRL		0x1377
2858c2ecf20Sopenharmony_ci#define REG_HMTP_CTRL		0x137a
2868c2ecf20Sopenharmony_ci#define REG_TIMER_D		0x13CF
2878c2ecf20Sopenharmony_ci#define REG_SUS_SET_RGB0	0x13E1
2888c2ecf20Sopenharmony_ci#define REG_SUS_SET_RGB1	0x13E2
2898c2ecf20Sopenharmony_ci#define REG_SUS_SET_RGB2	0x13E3
2908c2ecf20Sopenharmony_ci#define REG_SUS_SET_RGB3	0x13E4
2918c2ecf20Sopenharmony_ci#define REG_SUS_SET_RGB4	0x13E5
2928c2ecf20Sopenharmony_ci#define REG_MAN_SUS_HDMI_SEL	0x13E8
2938c2ecf20Sopenharmony_ci#define REG_MAN_HDMI_SET	0x13E9
2948c2ecf20Sopenharmony_ci#define REG_SUS_CLOCK_GOOD	0x13EF
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci/* HDCP DE Control */
2978c2ecf20Sopenharmony_ci#define HDCP_DE_MODE_MASK	0xc0	/* DE Measurement mode */
2988c2ecf20Sopenharmony_ci#define HDCP_DE_MODE_SHIFT	6
2998c2ecf20Sopenharmony_ci#define HDCP_DE_REGEN_EN	BIT(5)	/* enable regen mode */
3008c2ecf20Sopenharmony_ci#define HDCP_DE_FILTER_MASK	0x18	/* DE filter sensitivity */
3018c2ecf20Sopenharmony_ci#define HDCP_DE_FILTER_SHIFT	3
3028c2ecf20Sopenharmony_ci#define HDCP_DE_COMP_MASK	0x07	/* DE Composition mode */
3038c2ecf20Sopenharmony_ci#define HDCP_DE_COMP_MIXED	6L
3048c2ecf20Sopenharmony_ci#define HDCP_DE_COMP_OR		5L
3058c2ecf20Sopenharmony_ci#define HDCP_DE_COMP_AND	4L
3068c2ecf20Sopenharmony_ci#define HDCP_DE_COMP_CH3	3L
3078c2ecf20Sopenharmony_ci#define HDCP_DE_COMP_CH2	2L
3088c2ecf20Sopenharmony_ci#define HDCP_DE_COMP_CH1	1L
3098c2ecf20Sopenharmony_ci#define HDCP_DE_COMP_CH0	0L
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci/* HDCP EP Filter Control */
3128c2ecf20Sopenharmony_ci#define HDCP_EP_FIL_CTL_MASK	0x30
3138c2ecf20Sopenharmony_ci#define HDCP_EP_FIL_CTL_SHIFT	4
3148c2ecf20Sopenharmony_ci#define HDCP_EP_FIL_VS_MASK	0x0c
3158c2ecf20Sopenharmony_ci#define HDCP_EP_FIL_VS_SHIFT	2
3168c2ecf20Sopenharmony_ci#define HDCP_EP_FIL_HS_MASK	0x03
3178c2ecf20Sopenharmony_ci#define HDCP_EP_FIL_HS_SHIFT	0
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci/* HDMI_CTRL */
3208c2ecf20Sopenharmony_ci#define HDMI_CTRL_MUTE_MASK	0x0c
3218c2ecf20Sopenharmony_ci#define HDMI_CTRL_MUTE_SHIFT	2
3228c2ecf20Sopenharmony_ci#define HDMI_CTRL_MUTE_AUTO	0L
3238c2ecf20Sopenharmony_ci#define HDMI_CTRL_MUTE_OFF	1L
3248c2ecf20Sopenharmony_ci#define HDMI_CTRL_MUTE_ON	2L
3258c2ecf20Sopenharmony_ci#define HDMI_CTRL_HDCP_MASK	0x03
3268c2ecf20Sopenharmony_ci#define HDMI_CTRL_HDCP_SHIFT	0
3278c2ecf20Sopenharmony_ci#define HDMI_CTRL_HDCP_EESS	2L
3288c2ecf20Sopenharmony_ci#define HDMI_CTRL_HDCP_OESS	1L
3298c2ecf20Sopenharmony_ci#define HDMI_CTRL_HDCP_AUTO	0L
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci/* CGU_DBG_SEL bits */
3328c2ecf20Sopenharmony_ci#define CGU_DBG_CLK_SEL_MASK	0x18
3338c2ecf20Sopenharmony_ci#define CGU_DBG_CLK_SEL_SHIFT	3
3348c2ecf20Sopenharmony_ci#define CGU_DBG_XO_FRO_SEL	BIT(2)
3358c2ecf20Sopenharmony_ci#define CGU_DBG_VDP_CLK_SEL	BIT(1)
3368c2ecf20Sopenharmony_ci#define CGU_DBG_PIX_CLK_SEL	BIT(0)
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci/* REG_MAN_SUS_HDMI_SEL / REG_MAN_HDMI_SET bits */
3398c2ecf20Sopenharmony_ci#define MAN_DIS_OUT_BUF		BIT(7)
3408c2ecf20Sopenharmony_ci#define MAN_DIS_ANA_PATH	BIT(6)
3418c2ecf20Sopenharmony_ci#define MAN_DIS_HDCP		BIT(5)
3428c2ecf20Sopenharmony_ci#define MAN_DIS_TMDS_ENC	BIT(4)
3438c2ecf20Sopenharmony_ci#define MAN_DIS_TMDS_FLOW	BIT(3)
3448c2ecf20Sopenharmony_ci#define MAN_RST_HDCP		BIT(2)
3458c2ecf20Sopenharmony_ci#define MAN_RST_TMDS_ENC	BIT(1)
3468c2ecf20Sopenharmony_ci#define MAN_RST_TMDS_FLOW	BIT(0)
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/* Page 0x14 - Audio Extra control and debug */
3498c2ecf20Sopenharmony_ci#define REG_FIFO_LATENCY_VAL	0x1403
3508c2ecf20Sopenharmony_ci#define REG_AUDIO_CLOCK		0x1411
3518c2ecf20Sopenharmony_ci#define REG_TEST_NCTS_CTRL	0x1415
3528c2ecf20Sopenharmony_ci#define REG_TEST_AUDIO_FREQ	0x1426
3538c2ecf20Sopenharmony_ci#define REG_TEST_MODE		0x1437
3548c2ecf20Sopenharmony_ci
3558c2ecf20Sopenharmony_ci/* Audio Clock Configuration */
3568c2ecf20Sopenharmony_ci#define AUDIO_CLOCK_PLL_PD	BIT(7)	/* powerdown PLL */
3578c2ecf20Sopenharmony_ci#define AUDIO_CLOCK_SEL_MASK	0x7f
3588c2ecf20Sopenharmony_ci#define AUDIO_CLOCK_SEL_16FS	0L	/* 16*fs */
3598c2ecf20Sopenharmony_ci#define AUDIO_CLOCK_SEL_32FS	1L	/* 32*fs */
3608c2ecf20Sopenharmony_ci#define AUDIO_CLOCK_SEL_64FS	2L	/* 64*fs */
3618c2ecf20Sopenharmony_ci#define AUDIO_CLOCK_SEL_128FS	3L	/* 128*fs */
3628c2ecf20Sopenharmony_ci#define AUDIO_CLOCK_SEL_256FS	4L	/* 256*fs */
3638c2ecf20Sopenharmony_ci#define AUDIO_CLOCK_SEL_512FS	5L	/* 512*fs */
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci/* Page 0x20: EDID and Hotplug Detect */
3668c2ecf20Sopenharmony_ci#define REG_EDID_IN_BYTE0	0x2000 /* EDID base */
3678c2ecf20Sopenharmony_ci#define REG_EDID_IN_VERSION	0x2080
3688c2ecf20Sopenharmony_ci#define REG_EDID_ENABLE		0x2081
3698c2ecf20Sopenharmony_ci#define REG_HPD_POWER		0x2084
3708c2ecf20Sopenharmony_ci#define REG_HPD_AUTO_CTRL	0x2085
3718c2ecf20Sopenharmony_ci#define REG_HPD_DURATION	0x2086
3728c2ecf20Sopenharmony_ci#define REG_RX_HPD_HEAC		0x2087
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci/* EDID_ENABLE */
3758c2ecf20Sopenharmony_ci#define EDID_ENABLE_NACK_OFF	BIT(7)
3768c2ecf20Sopenharmony_ci#define EDID_ENABLE_EDID_ONLY	BIT(6)
3778c2ecf20Sopenharmony_ci#define EDID_ENABLE_B_EN	BIT(1)
3788c2ecf20Sopenharmony_ci#define EDID_ENABLE_A_EN	BIT(0)
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci/* HPD Power */
3818c2ecf20Sopenharmony_ci#define HPD_POWER_BP_MASK	0x0c
3828c2ecf20Sopenharmony_ci#define HPD_POWER_BP_SHIFT	2
3838c2ecf20Sopenharmony_ci#define HPD_POWER_BP_LOW	0L
3848c2ecf20Sopenharmony_ci#define HPD_POWER_BP_HIGH	1L
3858c2ecf20Sopenharmony_ci#define HPD_POWER_EDID_ONLY	BIT(1)
3868c2ecf20Sopenharmony_ci
3878c2ecf20Sopenharmony_ci/* HPD Auto control */
3888c2ecf20Sopenharmony_ci#define HPD_AUTO_READ_EDID	BIT(7)
3898c2ecf20Sopenharmony_ci#define HPD_AUTO_HPD_F3TECH	BIT(5)
3908c2ecf20Sopenharmony_ci#define HPD_AUTO_HP_OTHER	BIT(4)
3918c2ecf20Sopenharmony_ci#define HPD_AUTO_HPD_UNSEL	BIT(3)
3928c2ecf20Sopenharmony_ci#define HPD_AUTO_HPD_ALL_CH	BIT(2)
3938c2ecf20Sopenharmony_ci#define HPD_AUTO_HPD_PRV_CH	BIT(1)
3948c2ecf20Sopenharmony_ci#define HPD_AUTO_HPD_NEW_CH	BIT(0)
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ci/* Page 0x21 - EDID content */
3978c2ecf20Sopenharmony_ci#define REG_EDID_IN_BYTE128	0x2100 /* CEA Extension block */
3988c2ecf20Sopenharmony_ci#define REG_EDID_IN_SPA_SUB	0x2180
3998c2ecf20Sopenharmony_ci#define REG_EDID_IN_SPA_AB_A	0x2181
4008c2ecf20Sopenharmony_ci#define REG_EDID_IN_SPA_CD_A	0x2182
4018c2ecf20Sopenharmony_ci#define REG_EDID_IN_CKSUM_A	0x2183
4028c2ecf20Sopenharmony_ci#define REG_EDID_IN_SPA_AB_B	0x2184
4038c2ecf20Sopenharmony_ci#define REG_EDID_IN_SPA_CD_B	0x2185
4048c2ecf20Sopenharmony_ci#define REG_EDID_IN_CKSUM_B	0x2186
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci/* Page 0x30 - NV Configuration */
4078c2ecf20Sopenharmony_ci#define REG_RT_AUTO_CTRL	0x3000
4088c2ecf20Sopenharmony_ci#define REG_EQ_MAN_CTRL0	0x3001
4098c2ecf20Sopenharmony_ci#define REG_EQ_MAN_CTRL1	0x3002
4108c2ecf20Sopenharmony_ci#define REG_OUTPUT_CFG		0x3003
4118c2ecf20Sopenharmony_ci#define REG_MUTE_CTRL		0x3004
4128c2ecf20Sopenharmony_ci#define REG_SLAVE_ADDR		0x3005
4138c2ecf20Sopenharmony_ci#define REG_CMTP_REG6		0x3006
4148c2ecf20Sopenharmony_ci#define REG_CMTP_REG7		0x3007
4158c2ecf20Sopenharmony_ci#define REG_CMTP_REG8		0x3008
4168c2ecf20Sopenharmony_ci#define REG_CMTP_REG9		0x3009
4178c2ecf20Sopenharmony_ci#define REG_CMTP_REGA		0x300A
4188c2ecf20Sopenharmony_ci#define REG_CMTP_REGB		0x300B
4198c2ecf20Sopenharmony_ci#define REG_CMTP_REGC		0x300C
4208c2ecf20Sopenharmony_ci#define REG_CMTP_REGD		0x300D
4218c2ecf20Sopenharmony_ci#define REG_CMTP_REGE		0x300E
4228c2ecf20Sopenharmony_ci#define REG_CMTP_REGF		0x300F
4238c2ecf20Sopenharmony_ci#define REG_CMTP_REG10		0x3010
4248c2ecf20Sopenharmony_ci#define REG_CMTP_REG11		0x3011
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_ci/* Page 0x80 - CEC */
4278c2ecf20Sopenharmony_ci#define REG_PWR_CONTROL		0x80F4
4288c2ecf20Sopenharmony_ci#define REG_OSC_DIVIDER		0x80F5
4298c2ecf20Sopenharmony_ci#define REG_EN_OSC_PERIOD_LSB	0x80F8
4308c2ecf20Sopenharmony_ci#define REG_CONTROL		0x80FF
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_ci/* global interrupt flags (INT_FLG_CRL_TOP) */
4338c2ecf20Sopenharmony_ci#define INTERRUPT_AFE		BIT(7) /* AFE module */
4348c2ecf20Sopenharmony_ci#define INTERRUPT_HDCP		BIT(6) /* HDCP module */
4358c2ecf20Sopenharmony_ci#define INTERRUPT_AUDIO		BIT(5) /* Audio module */
4368c2ecf20Sopenharmony_ci#define INTERRUPT_INFO		BIT(4) /* Infoframe module */
4378c2ecf20Sopenharmony_ci#define INTERRUPT_MODE		BIT(3) /* HDMI mode module */
4388c2ecf20Sopenharmony_ci#define INTERRUPT_RATE		BIT(2) /* rate module */
4398c2ecf20Sopenharmony_ci#define INTERRUPT_DDC		BIT(1) /* DDC module */
4408c2ecf20Sopenharmony_ci#define INTERRUPT_SUS		BIT(0) /* SUS module */
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci/* INT_FLG_CLR_HDCP bits */
4438c2ecf20Sopenharmony_ci#define MASK_HDCP_MTP		BIT(7) /* HDCP MTP busy */
4448c2ecf20Sopenharmony_ci#define MASK_HDCP_DLMTP		BIT(4) /* HDCP end download MTP to SRAM */
4458c2ecf20Sopenharmony_ci#define MASK_HDCP_DLRAM		BIT(3) /* HDCP end download keys from SRAM */
4468c2ecf20Sopenharmony_ci#define MASK_HDCP_ENC		BIT(2) /* HDCP ENC */
4478c2ecf20Sopenharmony_ci#define MASK_STATE_C5		BIT(1) /* HDCP State C5 reached */
4488c2ecf20Sopenharmony_ci#define MASK_AKSV		BIT(0) /* AKSV received (start of auth) */
4498c2ecf20Sopenharmony_ci
4508c2ecf20Sopenharmony_ci/* INT_FLG_CLR_RATE bits */
4518c2ecf20Sopenharmony_ci#define MASK_RATE_B_DRIFT	BIT(7) /* Rate measurement drifted */
4528c2ecf20Sopenharmony_ci#define MASK_RATE_B_ST		BIT(6) /* Rate measurement stability change */
4538c2ecf20Sopenharmony_ci#define MASK_RATE_B_ACT		BIT(5) /* Rate measurement activity change */
4548c2ecf20Sopenharmony_ci#define MASK_RATE_B_PST		BIT(4) /* Rate measreument presence change */
4558c2ecf20Sopenharmony_ci#define MASK_RATE_A_DRIFT	BIT(3) /* Rate measurement drifted */
4568c2ecf20Sopenharmony_ci#define MASK_RATE_A_ST		BIT(2) /* Rate measurement stability change */
4578c2ecf20Sopenharmony_ci#define MASK_RATE_A_ACT		BIT(1) /* Rate measurement presence change */
4588c2ecf20Sopenharmony_ci#define MASK_RATE_A_PST		BIT(0) /* Rate measreument presence change */
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci/* INT_FLG_CLR_SUS (Start Up Sequencer) bits */
4618c2ecf20Sopenharmony_ci#define MASK_MPT		BIT(7) /* Config MTP end of process */
4628c2ecf20Sopenharmony_ci#define MASK_FMT		BIT(5) /* Video format changed */
4638c2ecf20Sopenharmony_ci#define MASK_RT_PULSE		BIT(4) /* End of termination resistance pulse */
4648c2ecf20Sopenharmony_ci#define MASK_SUS_END		BIT(3) /* SUS last state reached */
4658c2ecf20Sopenharmony_ci#define MASK_SUS_ACT		BIT(2) /* Activity of selected input changed */
4668c2ecf20Sopenharmony_ci#define MASK_SUS_CH		BIT(1) /* Selected input changed */
4678c2ecf20Sopenharmony_ci#define MASK_SUS_ST		BIT(0) /* SUS state changed */
4688c2ecf20Sopenharmony_ci
4698c2ecf20Sopenharmony_ci/* INT_FLG_CLR_DDC bits */
4708c2ecf20Sopenharmony_ci#define MASK_EDID_MTP		BIT(7) /* EDID MTP end of process */
4718c2ecf20Sopenharmony_ci#define MASK_DDC_ERR		BIT(6) /* master DDC error */
4728c2ecf20Sopenharmony_ci#define MASK_DDC_CMD_DONE	BIT(5) /* master DDC cmd send correct */
4738c2ecf20Sopenharmony_ci#define MASK_READ_DONE		BIT(4) /* End of down EDID read */
4748c2ecf20Sopenharmony_ci#define MASK_RX_DDC_SW		BIT(3) /* Output DDC switching finished */
4758c2ecf20Sopenharmony_ci#define MASK_HDCP_DDC_SW	BIT(2) /* HDCP DDC switching finished */
4768c2ecf20Sopenharmony_ci#define MASK_HDP_PULSE_END	BIT(1) /* End of Hot Plug Detect pulse */
4778c2ecf20Sopenharmony_ci#define MASK_DET_5V		BIT(0) /* Detection of +5V */
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci/* INT_FLG_CLR_MODE bits */
4808c2ecf20Sopenharmony_ci#define MASK_HDMI_FLG		BIT(7) /* HDMI mode/avmute/encrypt/FIFO fail */
4818c2ecf20Sopenharmony_ci#define MASK_GAMUT		BIT(6) /* Gamut packet */
4828c2ecf20Sopenharmony_ci#define MASK_ISRC2		BIT(5) /* ISRC2 packet */
4838c2ecf20Sopenharmony_ci#define MASK_ISRC1		BIT(4) /* ISRC1 packet */
4848c2ecf20Sopenharmony_ci#define MASK_ACP		BIT(3) /* Audio Content Protection packet */
4858c2ecf20Sopenharmony_ci#define MASK_DC_NO_GCP		BIT(2) /* GCP not received in 5 frames */
4868c2ecf20Sopenharmony_ci#define MASK_DC_PHASE		BIT(1) /* deepcolor pixel phase needs update */
4878c2ecf20Sopenharmony_ci#define MASK_DC_MODE		BIT(0) /* deepcolor color depth changed */
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci/* INT_FLG_CLR_INFO bits (Infoframe Change Status) */
4908c2ecf20Sopenharmony_ci#define MASK_MPS_IF		BIT(6) /* MPEG Source Product */
4918c2ecf20Sopenharmony_ci#define MASK_AUD_IF		BIT(5) /* Audio */
4928c2ecf20Sopenharmony_ci#define MASK_SPD_IF		BIT(4) /* Source Product Descriptor */
4938c2ecf20Sopenharmony_ci#define MASK_AVI_IF		BIT(3) /* Auxiliary Video IF */
4948c2ecf20Sopenharmony_ci#define MASK_VS_IF_OTHER_BK2	BIT(2) /* Vendor Specific (bank2) */
4958c2ecf20Sopenharmony_ci#define MASK_VS_IF_OTHER_BK1	BIT(1) /* Vendor Specific (bank1) */
4968c2ecf20Sopenharmony_ci#define MASK_VS_IF_HDMI		BIT(0) /* Vendor Specific (w/ HDMI LLC code) */
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci/* INT_FLG_CLR_AUDIO bits */
4998c2ecf20Sopenharmony_ci#define MASK_AUDIO_FREQ_FLG	BIT(5) /* Audio freq change */
5008c2ecf20Sopenharmony_ci#define MASK_AUDIO_FLG		BIT(4) /* DST, OBA, HBR, ASP change */
5018c2ecf20Sopenharmony_ci#define MASK_MUTE_FLG		BIT(3) /* Audio Mute */
5028c2ecf20Sopenharmony_ci#define MASK_CH_STATE		BIT(2) /* Channel status */
5038c2ecf20Sopenharmony_ci#define MASK_UNMUTE_FIFO	BIT(1) /* Audio Unmute */
5048c2ecf20Sopenharmony_ci#define MASK_ERROR_FIFO_PT	BIT(0) /* Audio FIFO pointer error */
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci/* INT_FLG_CLR_AFE bits */
5078c2ecf20Sopenharmony_ci#define MASK_AFE_WDL_UNLOCKED	BIT(7) /* Wordlocker was unlocked */
5088c2ecf20Sopenharmony_ci#define MASK_AFE_GAIN_DONE	BIT(6) /* Gain calibration done */
5098c2ecf20Sopenharmony_ci#define MASK_AFE_OFFSET_DONE	BIT(5) /* Offset calibration done */
5108c2ecf20Sopenharmony_ci#define MASK_AFE_ACTIVITY_DET	BIT(4) /* Activity detected on data */
5118c2ecf20Sopenharmony_ci#define MASK_AFE_PLL_LOCK	BIT(3) /* TMDS PLL is locked */
5128c2ecf20Sopenharmony_ci#define MASK_AFE_TRMCAL_DONE	BIT(2) /* Termination calibration done */
5138c2ecf20Sopenharmony_ci#define MASK_AFE_ASU_STATE	BIT(1) /* ASU state is reached */
5148c2ecf20Sopenharmony_ci#define MASK_AFE_ASU_READY	BIT(0) /* AFE calibration done: TMDS ready */
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_ci/* Audio Output */
5178c2ecf20Sopenharmony_ci#define AUDCFG_CLK_INVERT	BIT(7)	/* invert A_CLK polarity */
5188c2ecf20Sopenharmony_ci#define AUDCFG_TEST_TONE	BIT(6)	/* enable test tone generator */
5198c2ecf20Sopenharmony_ci#define AUDCFG_BUS_SHIFT	5
5208c2ecf20Sopenharmony_ci#define AUDCFG_BUS_I2S		0L
5218c2ecf20Sopenharmony_ci#define AUDCFG_BUS_SPDIF	1L
5228c2ecf20Sopenharmony_ci#define AUDCFG_I2SW_SHIFT	4
5238c2ecf20Sopenharmony_ci#define AUDCFG_I2SW_16		0L
5248c2ecf20Sopenharmony_ci#define AUDCFG_I2SW_32		1L
5258c2ecf20Sopenharmony_ci#define AUDCFG_AUTO_MUTE_EN	BIT(3)	/* Enable Automatic audio mute */
5268c2ecf20Sopenharmony_ci#define AUDCFG_HBR_SHIFT	2
5278c2ecf20Sopenharmony_ci#define AUDCFG_HBR_STRAIGHT	0L	/* straight via AP0 */
5288c2ecf20Sopenharmony_ci#define AUDCFG_HBR_DEMUX	1L	/* demuxed via AP0:AP3 */
5298c2ecf20Sopenharmony_ci#define AUDCFG_TYPE_MASK	0x03
5308c2ecf20Sopenharmony_ci#define AUDCFG_TYPE_SHIFT	0
5318c2ecf20Sopenharmony_ci#define AUDCFG_TYPE_DST		3L	/* Direct Stream Transfer (DST) */
5328c2ecf20Sopenharmony_ci#define AUDCFG_TYPE_OBA		2L	/* One Bit Audio (OBA) */
5338c2ecf20Sopenharmony_ci#define AUDCFG_TYPE_HBR		1L	/* High Bit Rate (HBR) */
5348c2ecf20Sopenharmony_ci#define AUDCFG_TYPE_PCM		0L	/* Audio samples */
5358c2ecf20Sopenharmony_ci
5368c2ecf20Sopenharmony_ci/* Video Formatter */
5378c2ecf20Sopenharmony_ci#define OF_VP_ENABLE		BIT(7)	/* VP[35:0]/HS/VS/DE/CLK */
5388c2ecf20Sopenharmony_ci#define OF_BLK			BIT(4)	/* blanking codes */
5398c2ecf20Sopenharmony_ci#define OF_TRC			BIT(3)	/* timing codes (SAV/EAV) */
5408c2ecf20Sopenharmony_ci#define OF_FMT_MASK		0x3
5418c2ecf20Sopenharmony_ci#define OF_FMT_444		0L	/* RGB444/YUV444 */
5428c2ecf20Sopenharmony_ci#define OF_FMT_422_SMPT		1L	/* YUV422 semi-planar */
5438c2ecf20Sopenharmony_ci#define OF_FMT_422_CCIR		2L	/* YUV422 CCIR656 */
5448c2ecf20Sopenharmony_ci
5458c2ecf20Sopenharmony_ci/* HS/HREF output control */
5468c2ecf20Sopenharmony_ci#define HS_HREF_DELAY_MASK	0xf0
5478c2ecf20Sopenharmony_ci#define HS_HREF_DELAY_SHIFT	4	/* Pixel delay (-8..+7) */
5488c2ecf20Sopenharmony_ci#define HS_HREF_PXQ_SHIFT	3	/* Timing codes from HREF */
5498c2ecf20Sopenharmony_ci#define HS_HREF_INV_SHIFT	2	/* polarity (1=invert) */
5508c2ecf20Sopenharmony_ci#define HS_HREF_SEL_MASK	0x03
5518c2ecf20Sopenharmony_ci#define HS_HREF_SEL_SHIFT	0
5528c2ecf20Sopenharmony_ci#define HS_HREF_SEL_HS_VHREF	0L	/* HS from VHREF */
5538c2ecf20Sopenharmony_ci#define HS_HREF_SEL_HREF_VHREF	1L	/* HREF from VHREF */
5548c2ecf20Sopenharmony_ci#define HS_HREF_SEL_HREF_HDMI	2L	/* HREF from HDMI */
5558c2ecf20Sopenharmony_ci#define HS_HREF_SEL_NONE	3L	/* not generated */
5568c2ecf20Sopenharmony_ci
5578c2ecf20Sopenharmony_ci/* VS output control */
5588c2ecf20Sopenharmony_ci#define VS_VREF_DELAY_MASK	0xf0
5598c2ecf20Sopenharmony_ci#define VS_VREF_DELAY_SHIFT	4	/* Pixel delay (-8..+7) */
5608c2ecf20Sopenharmony_ci#define VS_VREF_INV_SHIFT	2	/* polarity (1=invert) */
5618c2ecf20Sopenharmony_ci#define VS_VREF_SEL_MASK	0x03
5628c2ecf20Sopenharmony_ci#define VS_VREF_SEL_SHIFT	0
5638c2ecf20Sopenharmony_ci#define VS_VREF_SEL_VS_VHREF	0L	/* VS from VHREF */
5648c2ecf20Sopenharmony_ci#define VS_VREF_SEL_VREF_VHREF	1L	/* VREF from VHREF */
5658c2ecf20Sopenharmony_ci#define VS_VREF_SEL_VREF_HDMI	2L	/* VREF from HDMI */
5668c2ecf20Sopenharmony_ci#define VS_VREF_SEL_NONE	3L	/* not generated */
5678c2ecf20Sopenharmony_ci
5688c2ecf20Sopenharmony_ci/* DE/FREF output control */
5698c2ecf20Sopenharmony_ci#define DE_FREF_DELAY_MASK	0xf0
5708c2ecf20Sopenharmony_ci#define DE_FREF_DELAY_SHIFT	4	/* Pixel delay (-8..+7) */
5718c2ecf20Sopenharmony_ci#define DE_FREF_DE_PXQ_SHIFT	3	/* Timing codes from DE */
5728c2ecf20Sopenharmony_ci#define DE_FREF_INV_SHIFT	2	/* polarity (1=invert) */
5738c2ecf20Sopenharmony_ci#define DE_FREF_SEL_MASK	0x03
5748c2ecf20Sopenharmony_ci#define DE_FREF_SEL_SHIFT	0
5758c2ecf20Sopenharmony_ci#define DE_FREF_SEL_DE_VHREF	0L	/* DE from VHREF (HREF and not(VREF) */
5768c2ecf20Sopenharmony_ci#define DE_FREF_SEL_FREF_VHREF	1L	/* FREF from VHREF */
5778c2ecf20Sopenharmony_ci#define DE_FREF_SEL_FREF_HDMI	2L	/* FREF from HDMI */
5788c2ecf20Sopenharmony_ci#define DE_FREF_SEL_NONE	3L	/* not generated */
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci/* HDMI_SOFT_RST bits */
5818c2ecf20Sopenharmony_ci#define RESET_DC		BIT(7)	/* Reset deep color module */
5828c2ecf20Sopenharmony_ci#define RESET_HDCP		BIT(6)	/* Reset HDCP module */
5838c2ecf20Sopenharmony_ci#define RESET_KSV		BIT(5)	/* Reset KSV-FIFO */
5848c2ecf20Sopenharmony_ci#define RESET_SCFG		BIT(4)	/* Reset HDCP and repeater function */
5858c2ecf20Sopenharmony_ci#define RESET_HCFG		BIT(3)	/* Reset HDCP DDC part */
5868c2ecf20Sopenharmony_ci#define RESET_PA		BIT(2)	/* Reset polarity adjust */
5878c2ecf20Sopenharmony_ci#define RESET_EP		BIT(1)	/* Reset Error protection */
5888c2ecf20Sopenharmony_ci#define RESET_TMDS		BIT(0)	/* Reset TMDS (calib, encoding, flow) */
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ci/* HDMI_INFO_RST bits */
5918c2ecf20Sopenharmony_ci#define NACK_HDCP		BIT(7)	/* No ACK on HDCP request */
5928c2ecf20Sopenharmony_ci#define RESET_FIFO		BIT(4)	/* Reset Audio FIFO control */
5938c2ecf20Sopenharmony_ci#define RESET_GAMUT		BIT(3)	/* Clear Gamut packet */
5948c2ecf20Sopenharmony_ci#define RESET_AI		BIT(2)	/* Clear ACP and ISRC packets */
5958c2ecf20Sopenharmony_ci#define RESET_IF		BIT(1)	/* Clear all Audio infoframe packets */
5968c2ecf20Sopenharmony_ci#define RESET_AUDIO		BIT(0)	/* Reset Audio FIFO control */
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ci/* HDCP_BCAPS bits */
5998c2ecf20Sopenharmony_ci#define HDCP_HDMI		BIT(7)	/* HDCP supports HDMI (vs DVI only) */
6008c2ecf20Sopenharmony_ci#define HDCP_REPEATER		BIT(6)	/* HDCP supports repeater function */
6018c2ecf20Sopenharmony_ci#define HDCP_READY		BIT(5)	/* set by repeater function */
6028c2ecf20Sopenharmony_ci#define HDCP_FAST		BIT(4)	/* Up to 400kHz */
6038c2ecf20Sopenharmony_ci#define HDCP_11			BIT(1)	/* HDCP 1.1 supported */
6048c2ecf20Sopenharmony_ci#define HDCP_FAST_REAUTH	BIT(0)	/* fast reauthentication supported */
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci/* Audio output formatter */
6078c2ecf20Sopenharmony_ci#define AUDIO_LAYOUT_SP_FLAG	BIT(2)	/* sp flag used by FIFO */
6088c2ecf20Sopenharmony_ci#define AUDIO_LAYOUT_MANUAL	BIT(1)	/* manual layout (vs per pkt) */
6098c2ecf20Sopenharmony_ci#define AUDIO_LAYOUT_LAYOUT1	BIT(0)  /* Layout1: AP0-3 vs Layout0:AP0 */
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_ci/* masks for interrupt status registers */
6128c2ecf20Sopenharmony_ci#define MASK_SUS_STATUS		0x1F
6138c2ecf20Sopenharmony_ci#define LAST_STATE_REACHED	0x1B
6148c2ecf20Sopenharmony_ci#define MASK_CLK_STABLE		0x04
6158c2ecf20Sopenharmony_ci#define MASK_CLK_ACTIVE		0x02
6168c2ecf20Sopenharmony_ci#define MASK_SUS_STATE		0x10
6178c2ecf20Sopenharmony_ci#define MASK_SR_FIFO_FIFO_CTRL	0x30
6188c2ecf20Sopenharmony_ci#define MASK_AUDIO_FLAG		0x10
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci/* Rate measurement */
6218c2ecf20Sopenharmony_ci#define RATE_REFTIM_ENABLE	0x01
6228c2ecf20Sopenharmony_ci#define CLK_MIN_RATE		0x0057e4
6238c2ecf20Sopenharmony_ci#define CLK_MAX_RATE		0x0395f8
6248c2ecf20Sopenharmony_ci#define WDL_CFG_VAL		0x82
6258c2ecf20Sopenharmony_ci#define DC_FILTER_VAL		0x31
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci/* Infoframe */
6288c2ecf20Sopenharmony_ci#define VS_HDMI_IF_UPDATE	0x0200
6298c2ecf20Sopenharmony_ci#define VS_HDMI_IF		0x0201
6308c2ecf20Sopenharmony_ci#define VS_BK1_IF_UPDATE	0x0220
6318c2ecf20Sopenharmony_ci#define VS_BK1_IF		0x0221
6328c2ecf20Sopenharmony_ci#define VS_BK2_IF_UPDATE	0x0240
6338c2ecf20Sopenharmony_ci#define VS_BK2_IF		0x0241
6348c2ecf20Sopenharmony_ci#define AVI_IF_UPDATE		0x0260
6358c2ecf20Sopenharmony_ci#define AVI_IF			0x0261
6368c2ecf20Sopenharmony_ci#define SPD_IF_UPDATE		0x0280
6378c2ecf20Sopenharmony_ci#define SPD_IF			0x0281
6388c2ecf20Sopenharmony_ci#define AUD_IF_UPDATE		0x02a0
6398c2ecf20Sopenharmony_ci#define AUD_IF			0x02a1
6408c2ecf20Sopenharmony_ci#define MPS_IF_UPDATE		0x02c0
6418c2ecf20Sopenharmony_ci#define MPS_IF			0x02c1
642