18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef _ANALOGIX_I2C_TXCOMMON_H_
68c2ecf20Sopenharmony_ci#define _ANALOGIX_I2C_TXCOMMON_H_
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/***************************************************************/
98c2ecf20Sopenharmony_ci/* Register definitions for TX_P2                              */
108c2ecf20Sopenharmony_ci/***************************************************************/
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci/*
138c2ecf20Sopenharmony_ci * Core Register Definitions
148c2ecf20Sopenharmony_ci */
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* Device ID Low Byte Register */
178c2ecf20Sopenharmony_ci#define SP_DEVICE_IDL_REG		0x02
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci/* Device ID High Byte Register */
208c2ecf20Sopenharmony_ci#define SP_DEVICE_IDH_REG		0x03
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* Device version register */
238c2ecf20Sopenharmony_ci#define SP_DEVICE_VERSION_REG		0x04
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Power Down Control Register */
268c2ecf20Sopenharmony_ci#define SP_POWERDOWN_CTRL_REG		0x05
278c2ecf20Sopenharmony_ci#define SP_REGISTER_PD			BIT(7)
288c2ecf20Sopenharmony_ci#define SP_HDCP_PD			BIT(5)
298c2ecf20Sopenharmony_ci#define SP_AUDIO_PD			BIT(4)
308c2ecf20Sopenharmony_ci#define SP_VIDEO_PD			BIT(3)
318c2ecf20Sopenharmony_ci#define SP_LINK_PD			BIT(2)
328c2ecf20Sopenharmony_ci#define SP_TOTAL_PD			BIT(1)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* Reset Control Register 1 */
358c2ecf20Sopenharmony_ci#define SP_RESET_CTRL1_REG		0x06
368c2ecf20Sopenharmony_ci#define SP_MISC_RST			BIT(7)
378c2ecf20Sopenharmony_ci#define SP_VIDCAP_RST			BIT(6)
388c2ecf20Sopenharmony_ci#define SP_VIDFIF_RST			BIT(5)
398c2ecf20Sopenharmony_ci#define SP_AUDFIF_RST			BIT(4)
408c2ecf20Sopenharmony_ci#define SP_AUDCAP_RST			BIT(3)
418c2ecf20Sopenharmony_ci#define SP_HDCP_RST			BIT(2)
428c2ecf20Sopenharmony_ci#define SP_SW_RST			BIT(1)
438c2ecf20Sopenharmony_ci#define SP_HW_RST			BIT(0)
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* Reset Control Register 2 */
468c2ecf20Sopenharmony_ci#define SP_RESET_CTRL2_REG		0x07
478c2ecf20Sopenharmony_ci#define SP_AUX_RST			BIT(2)
488c2ecf20Sopenharmony_ci#define SP_SERDES_FIFO_RST		BIT(1)
498c2ecf20Sopenharmony_ci#define SP_I2C_REG_RST			BIT(0)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* Video Control Register 1 */
528c2ecf20Sopenharmony_ci#define SP_VID_CTRL1_REG		0x08
538c2ecf20Sopenharmony_ci#define SP_VIDEO_EN			BIT(7)
548c2ecf20Sopenharmony_ci#define SP_VIDEO_MUTE			BIT(2)
558c2ecf20Sopenharmony_ci#define SP_DE_GEN			BIT(1)
568c2ecf20Sopenharmony_ci#define SP_DEMUX			BIT(0)
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci/* Video Control Register 2 */
598c2ecf20Sopenharmony_ci#define SP_VID_CTRL2_REG		0x09
608c2ecf20Sopenharmony_ci#define SP_IN_COLOR_F_MASK		0x03
618c2ecf20Sopenharmony_ci#define SP_IN_YC_BIT_SEL		BIT(2)
628c2ecf20Sopenharmony_ci#define SP_IN_BPC_MASK			0x70
638c2ecf20Sopenharmony_ci#define SP_IN_BPC_SHIFT			4
648c2ecf20Sopenharmony_ci#  define SP_IN_BPC_12BIT		0x03
658c2ecf20Sopenharmony_ci#  define SP_IN_BPC_10BIT		0x02
668c2ecf20Sopenharmony_ci#  define SP_IN_BPC_8BIT		0x01
678c2ecf20Sopenharmony_ci#  define SP_IN_BPC_6BIT		0x00
688c2ecf20Sopenharmony_ci#define SP_IN_D_RANGE			BIT(7)
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* Video Control Register 3 */
718c2ecf20Sopenharmony_ci#define SP_VID_CTRL3_REG		0x0a
728c2ecf20Sopenharmony_ci#define SP_HPD_OUT			BIT(6)
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci/* Video Control Register 5 */
758c2ecf20Sopenharmony_ci#define SP_VID_CTRL5_REG		0x0c
768c2ecf20Sopenharmony_ci#define SP_CSC_STD_SEL			BIT(7)
778c2ecf20Sopenharmony_ci#define SP_XVYCC_RNG_LMT		BIT(6)
788c2ecf20Sopenharmony_ci#define SP_RANGE_Y2R			BIT(5)
798c2ecf20Sopenharmony_ci#define SP_CSPACE_Y2R			BIT(4)
808c2ecf20Sopenharmony_ci#define SP_RGB_RNG_LMT			BIT(3)
818c2ecf20Sopenharmony_ci#define SP_Y_RNG_LMT			BIT(2)
828c2ecf20Sopenharmony_ci#define SP_RANGE_R2Y			BIT(1)
838c2ecf20Sopenharmony_ci#define SP_CSPACE_R2Y			BIT(0)
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci/* Video Control Register 6 */
868c2ecf20Sopenharmony_ci#define SP_VID_CTRL6_REG		0x0d
878c2ecf20Sopenharmony_ci#define SP_TEST_PATTERN_EN		BIT(7)
888c2ecf20Sopenharmony_ci#define SP_VIDEO_PROCESS_EN		BIT(6)
898c2ecf20Sopenharmony_ci#define SP_VID_US_MODE			BIT(3)
908c2ecf20Sopenharmony_ci#define SP_VID_DS_MODE			BIT(2)
918c2ecf20Sopenharmony_ci#define SP_UP_SAMPLE			BIT(1)
928c2ecf20Sopenharmony_ci#define SP_DOWN_SAMPLE			BIT(0)
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci/* Video Control Register 8 */
958c2ecf20Sopenharmony_ci#define SP_VID_CTRL8_REG		0x0f
968c2ecf20Sopenharmony_ci#define SP_VID_VRES_TH			BIT(0)
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/* Total Line Status Low Byte Register */
998c2ecf20Sopenharmony_ci#define SP_TOTAL_LINE_STAL_REG		0x24
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci/* Total Line Status High Byte Register */
1028c2ecf20Sopenharmony_ci#define SP_TOTAL_LINE_STAH_REG		0x25
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* Active Line Status Low Byte Register */
1058c2ecf20Sopenharmony_ci#define SP_ACT_LINE_STAL_REG		0x26
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci/* Active Line Status High Byte Register */
1088c2ecf20Sopenharmony_ci#define SP_ACT_LINE_STAH_REG		0x27
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* Vertical Front Porch Status Register */
1118c2ecf20Sopenharmony_ci#define SP_V_F_PORCH_STA_REG		0x28
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/* Vertical SYNC Width Status Register */
1148c2ecf20Sopenharmony_ci#define SP_V_SYNC_STA_REG		0x29
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* Vertical Back Porch Status Register */
1178c2ecf20Sopenharmony_ci#define SP_V_B_PORCH_STA_REG		0x2a
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/* Total Pixel Status Low Byte Register */
1208c2ecf20Sopenharmony_ci#define SP_TOTAL_PIXEL_STAL_REG		0x2b
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci/* Total Pixel Status High Byte Register */
1238c2ecf20Sopenharmony_ci#define SP_TOTAL_PIXEL_STAH_REG		0x2c
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci/* Active Pixel Status Low Byte Register */
1268c2ecf20Sopenharmony_ci#define SP_ACT_PIXEL_STAL_REG		0x2d
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci/* Active Pixel Status High Byte Register */
1298c2ecf20Sopenharmony_ci#define SP_ACT_PIXEL_STAH_REG		0x2e
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/* Horizontal Front Porch Status Low Byte Register */
1328c2ecf20Sopenharmony_ci#define SP_H_F_PORCH_STAL_REG		0x2f
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/* Horizontal Front Porch Statys High Byte Register */
1358c2ecf20Sopenharmony_ci#define SP_H_F_PORCH_STAH_REG		0x30
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/* Horizontal SYNC Width Status Low Byte Register */
1388c2ecf20Sopenharmony_ci#define SP_H_SYNC_STAL_REG		0x31
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci/* Horizontal SYNC Width Status High Byte Register */
1418c2ecf20Sopenharmony_ci#define SP_H_SYNC_STAH_REG		0x32
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci/* Horizontal Back Porch Status Low Byte Register */
1448c2ecf20Sopenharmony_ci#define SP_H_B_PORCH_STAL_REG		0x33
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci/* Horizontal Back Porch Status High Byte Register */
1478c2ecf20Sopenharmony_ci#define SP_H_B_PORCH_STAH_REG		0x34
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/* InfoFrame AVI Packet DB1 Register */
1508c2ecf20Sopenharmony_ci#define SP_INFOFRAME_AVI_DB1_REG	0x70
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/* Bit Control Specific Register */
1538c2ecf20Sopenharmony_ci#define SP_BIT_CTRL_SPECIFIC_REG	0x80
1548c2ecf20Sopenharmony_ci#define SP_BIT_CTRL_SELECT_SHIFT	1
1558c2ecf20Sopenharmony_ci#define SP_ENABLE_BIT_CTRL		BIT(0)
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci/* InfoFrame Audio Packet DB1 Register */
1588c2ecf20Sopenharmony_ci#define SP_INFOFRAME_AUD_DB1_REG	0x83
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ci/* InfoFrame MPEG Packet DB1 Register */
1618c2ecf20Sopenharmony_ci#define SP_INFOFRAME_MPEG_DB1_REG	0xb0
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/* Audio Channel Status Registers */
1648c2ecf20Sopenharmony_ci#define SP_AUD_CH_STATUS_BASE		0xd0
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci/* Audio Channel Num Register 5 */
1678c2ecf20Sopenharmony_ci#define SP_I2S_CHANNEL_NUM_MASK		0xe0
1688c2ecf20Sopenharmony_ci#  define SP_I2S_CH_NUM_1		(0x00 << 5)
1698c2ecf20Sopenharmony_ci#  define SP_I2S_CH_NUM_2		(0x01 << 5)
1708c2ecf20Sopenharmony_ci#  define SP_I2S_CH_NUM_3		(0x02 << 5)
1718c2ecf20Sopenharmony_ci#  define SP_I2S_CH_NUM_4		(0x03 << 5)
1728c2ecf20Sopenharmony_ci#  define SP_I2S_CH_NUM_5		(0x04 << 5)
1738c2ecf20Sopenharmony_ci#  define SP_I2S_CH_NUM_6		(0x05 << 5)
1748c2ecf20Sopenharmony_ci#  define SP_I2S_CH_NUM_7		(0x06 << 5)
1758c2ecf20Sopenharmony_ci#  define SP_I2S_CH_NUM_8		(0x07 << 5)
1768c2ecf20Sopenharmony_ci#define SP_EXT_VUCP			BIT(2)
1778c2ecf20Sopenharmony_ci#define SP_VBIT				BIT(1)
1788c2ecf20Sopenharmony_ci#define SP_AUDIO_LAYOUT			BIT(0)
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/* Analog Debug Register 1 */
1818c2ecf20Sopenharmony_ci#define SP_ANALOG_DEBUG1_REG		0xdc
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* Analog Debug Register 2 */
1848c2ecf20Sopenharmony_ci#define SP_ANALOG_DEBUG2_REG		0xdd
1858c2ecf20Sopenharmony_ci#define SP_FORCE_SW_OFF_BYPASS		0x20
1868c2ecf20Sopenharmony_ci#define SP_XTAL_FRQ			0x1c
1878c2ecf20Sopenharmony_ci#  define SP_XTAL_FRQ_19M2		(0x00 << 2)
1888c2ecf20Sopenharmony_ci#  define SP_XTAL_FRQ_24M		(0x01 << 2)
1898c2ecf20Sopenharmony_ci#  define SP_XTAL_FRQ_25M		(0x02 << 2)
1908c2ecf20Sopenharmony_ci#  define SP_XTAL_FRQ_26M		(0x03 << 2)
1918c2ecf20Sopenharmony_ci#  define SP_XTAL_FRQ_27M		(0x04 << 2)
1928c2ecf20Sopenharmony_ci#  define SP_XTAL_FRQ_38M4		(0x05 << 2)
1938c2ecf20Sopenharmony_ci#  define SP_XTAL_FRQ_52M		(0x06 << 2)
1948c2ecf20Sopenharmony_ci#define SP_POWERON_TIME_1P5MS		0x03
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_ci/* Analog Control 0 Register */
1978c2ecf20Sopenharmony_ci#define SP_ANALOG_CTRL0_REG		0xe1
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci/* Common Interrupt Status Register 1 */
2008c2ecf20Sopenharmony_ci#define SP_COMMON_INT_STATUS_BASE	(0xf1 - 1)
2018c2ecf20Sopenharmony_ci#define SP_PLL_LOCK_CHG			0x40
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/* Common Interrupt Status Register 2 */
2048c2ecf20Sopenharmony_ci#define SP_COMMON_INT_STATUS2		0xf2
2058c2ecf20Sopenharmony_ci#define SP_HDCP_AUTH_CHG		BIT(1)
2068c2ecf20Sopenharmony_ci#define SP_HDCP_AUTH_DONE		BIT(0)
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci#define SP_HDCP_LINK_CHECK_FAIL		BIT(0)
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci/* Common Interrupt Status Register 4 */
2118c2ecf20Sopenharmony_ci#define SP_COMMON_INT_STATUS4_REG	0xf4
2128c2ecf20Sopenharmony_ci#define SP_HPD_IRQ			BIT(6)
2138c2ecf20Sopenharmony_ci#define SP_HPD_ESYNC_ERR		BIT(4)
2148c2ecf20Sopenharmony_ci#define SP_HPD_CHG			BIT(2)
2158c2ecf20Sopenharmony_ci#define SP_HPD_LOST			BIT(1)
2168c2ecf20Sopenharmony_ci#define SP_HPD_PLUG			BIT(0)
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* DP Interrupt Status Register */
2198c2ecf20Sopenharmony_ci#define SP_DP_INT_STATUS1_REG		0xf7
2208c2ecf20Sopenharmony_ci#define SP_TRAINING_FINISH		BIT(5)
2218c2ecf20Sopenharmony_ci#define SP_POLLING_ERR			BIT(4)
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci/* Common Interrupt Mask Register */
2248c2ecf20Sopenharmony_ci#define SP_COMMON_INT_MASK_BASE		(0xf8 - 1)
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci#define SP_COMMON_INT_MASK4_REG		0xfb
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci/* DP Interrupts Mask Register */
2298c2ecf20Sopenharmony_ci#define SP_DP_INT_MASK1_REG		0xfe
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci/* Interrupt Control Register */
2328c2ecf20Sopenharmony_ci#define SP_INT_CTRL_REG			0xff
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci#endif /* _ANALOGIX_I2C_TXCOMMON_H_ */
235