18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright(c) 2016, Analogix Semiconductor. 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Based on anx7808 driver obtained from chromeos with copyright: 68c2ecf20Sopenharmony_ci * Copyright(c) 2013, Google Inc. 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#ifndef _ANALOGIX_I2C_DPTX_H_ 98c2ecf20Sopenharmony_ci#define _ANALOGIX_I2C_DPTX_H_ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/***************************************************************/ 128c2ecf20Sopenharmony_ci/* Register definitions for TX_P0 */ 138c2ecf20Sopenharmony_ci/***************************************************************/ 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* HDCP Status Register */ 168c2ecf20Sopenharmony_ci#define SP_TX_HDCP_STATUS_REG 0x00 178c2ecf20Sopenharmony_ci#define SP_AUTH_FAIL BIT(5) 188c2ecf20Sopenharmony_ci#define SP_AUTHEN_PASS BIT(1) 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci/* HDCP Control Register 0 */ 218c2ecf20Sopenharmony_ci#define SP_HDCP_CTRL0_REG 0x01 228c2ecf20Sopenharmony_ci#define SP_RX_REPEATER BIT(6) 238c2ecf20Sopenharmony_ci#define SP_RE_AUTH BIT(5) 248c2ecf20Sopenharmony_ci#define SP_SW_AUTH_OK BIT(4) 258c2ecf20Sopenharmony_ci#define SP_HARD_AUTH_EN BIT(3) 268c2ecf20Sopenharmony_ci#define SP_HDCP_ENC_EN BIT(2) 278c2ecf20Sopenharmony_ci#define SP_BKSV_SRM_PASS BIT(1) 288c2ecf20Sopenharmony_ci#define SP_KSVLIST_VLD BIT(0) 298c2ecf20Sopenharmony_ci/* HDCP Function Enabled */ 308c2ecf20Sopenharmony_ci#define SP_HDCP_FUNCTION_ENABLED (BIT(0) | BIT(1) | BIT(2) | BIT(3)) 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* HDCP Receiver BSTATUS Register 0 */ 338c2ecf20Sopenharmony_ci#define SP_HDCP_RX_BSTATUS0_REG 0x1b 348c2ecf20Sopenharmony_ci/* HDCP Receiver BSTATUS Register 1 */ 358c2ecf20Sopenharmony_ci#define SP_HDCP_RX_BSTATUS1_REG 0x1c 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* HDCP Embedded "Blue Screen" Content Registers */ 388c2ecf20Sopenharmony_ci#define SP_HDCP_VID0_BLUE_SCREEN_REG 0x2c 398c2ecf20Sopenharmony_ci#define SP_HDCP_VID1_BLUE_SCREEN_REG 0x2d 408c2ecf20Sopenharmony_ci#define SP_HDCP_VID2_BLUE_SCREEN_REG 0x2e 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci/* HDCP Wait R0 Timing Register */ 438c2ecf20Sopenharmony_ci#define SP_HDCP_WAIT_R0_TIME_REG 0x40 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* HDCP Link Integrity Check Timer Register */ 468c2ecf20Sopenharmony_ci#define SP_HDCP_LINK_CHECK_TIMER_REG 0x41 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* HDCP Repeater Ready Wait Timer Register */ 498c2ecf20Sopenharmony_ci#define SP_HDCP_RPTR_RDY_WAIT_TIME_REG 0x42 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* HDCP Auto Timer Register */ 528c2ecf20Sopenharmony_ci#define SP_HDCP_AUTO_TIMER_REG 0x51 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/* HDCP Key Status Register */ 558c2ecf20Sopenharmony_ci#define SP_HDCP_KEY_STATUS_REG 0x5e 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* HDCP Key Command Register */ 588c2ecf20Sopenharmony_ci#define SP_HDCP_KEY_COMMAND_REG 0x5f 598c2ecf20Sopenharmony_ci#define SP_DISABLE_SYNC_HDCP BIT(2) 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* OTP Memory Key Protection Registers */ 628c2ecf20Sopenharmony_ci#define SP_OTP_KEY_PROTECT1_REG 0x60 638c2ecf20Sopenharmony_ci#define SP_OTP_KEY_PROTECT2_REG 0x61 648c2ecf20Sopenharmony_ci#define SP_OTP_KEY_PROTECT3_REG 0x62 658c2ecf20Sopenharmony_ci#define SP_OTP_PSW1 0xa2 668c2ecf20Sopenharmony_ci#define SP_OTP_PSW2 0x7e 678c2ecf20Sopenharmony_ci#define SP_OTP_PSW3 0xc6 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* DP System Control Registers */ 708c2ecf20Sopenharmony_ci#define SP_DP_SYSTEM_CTRL_BASE (0x80 - 1) 718c2ecf20Sopenharmony_ci/* Bits for DP System Control Register 2 */ 728c2ecf20Sopenharmony_ci#define SP_CHA_STA BIT(2) 738c2ecf20Sopenharmony_ci/* Bits for DP System Control Register 3 */ 748c2ecf20Sopenharmony_ci#define SP_HPD_STATUS BIT(6) 758c2ecf20Sopenharmony_ci#define SP_HPD_FORCE BIT(5) 768c2ecf20Sopenharmony_ci#define SP_HPD_CTRL BIT(4) 778c2ecf20Sopenharmony_ci#define SP_STRM_VALID BIT(2) 788c2ecf20Sopenharmony_ci#define SP_STRM_FORCE BIT(1) 798c2ecf20Sopenharmony_ci#define SP_STRM_CTRL BIT(0) 808c2ecf20Sopenharmony_ci/* Bits for DP System Control Register 4 */ 818c2ecf20Sopenharmony_ci#define SP_ENHANCED_MODE BIT(3) 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* DP Video Control Register */ 848c2ecf20Sopenharmony_ci#define SP_DP_VIDEO_CTRL_REG 0x84 858c2ecf20Sopenharmony_ci#define SP_COLOR_F_MASK 0x06 868c2ecf20Sopenharmony_ci#define SP_COLOR_F_SHIFT 1 878c2ecf20Sopenharmony_ci#define SP_BPC_MASK 0xe0 888c2ecf20Sopenharmony_ci#define SP_BPC_SHIFT 5 898c2ecf20Sopenharmony_ci# define SP_BPC_6BITS 0x00 908c2ecf20Sopenharmony_ci# define SP_BPC_8BITS 0x01 918c2ecf20Sopenharmony_ci# define SP_BPC_10BITS 0x02 928c2ecf20Sopenharmony_ci# define SP_BPC_12BITS 0x03 938c2ecf20Sopenharmony_ci 948c2ecf20Sopenharmony_ci/* DP Audio Control Register */ 958c2ecf20Sopenharmony_ci#define SP_DP_AUDIO_CTRL_REG 0x87 968c2ecf20Sopenharmony_ci#define SP_AUD_EN BIT(0) 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* 10us Pulse Generate Timer Registers */ 998c2ecf20Sopenharmony_ci#define SP_I2C_GEN_10US_TIMER0_REG 0x88 1008c2ecf20Sopenharmony_ci#define SP_I2C_GEN_10US_TIMER1_REG 0x89 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci/* Packet Send Control Register */ 1038c2ecf20Sopenharmony_ci#define SP_PACKET_SEND_CTRL_REG 0x90 1048c2ecf20Sopenharmony_ci#define SP_AUD_IF_UP BIT(7) 1058c2ecf20Sopenharmony_ci#define SP_AVI_IF_UD BIT(6) 1068c2ecf20Sopenharmony_ci#define SP_MPEG_IF_UD BIT(5) 1078c2ecf20Sopenharmony_ci#define SP_SPD_IF_UD BIT(4) 1088c2ecf20Sopenharmony_ci#define SP_AUD_IF_EN BIT(3) 1098c2ecf20Sopenharmony_ci#define SP_AVI_IF_EN BIT(2) 1108c2ecf20Sopenharmony_ci#define SP_MPEG_IF_EN BIT(1) 1118c2ecf20Sopenharmony_ci#define SP_SPD_IF_EN BIT(0) 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci/* DP HDCP Control Register */ 1148c2ecf20Sopenharmony_ci#define SP_DP_HDCP_CTRL_REG 0x92 1158c2ecf20Sopenharmony_ci#define SP_AUTO_EN BIT(7) 1168c2ecf20Sopenharmony_ci#define SP_AUTO_START BIT(5) 1178c2ecf20Sopenharmony_ci#define SP_LINK_POLLING BIT(1) 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci/* DP Main Link Bandwidth Setting Register */ 1208c2ecf20Sopenharmony_ci#define SP_DP_MAIN_LINK_BW_SET_REG 0xa0 1218c2ecf20Sopenharmony_ci#define SP_LINK_BW_SET_MASK 0x1f 1228c2ecf20Sopenharmony_ci#define SP_INITIAL_SLIM_M_AUD_SEL BIT(5) 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci/* DP Lane Count Setting Register */ 1258c2ecf20Sopenharmony_ci#define SP_DP_LANE_COUNT_SET_REG 0xa1 1268c2ecf20Sopenharmony_ci 1278c2ecf20Sopenharmony_ci/* DP Training Pattern Set Register */ 1288c2ecf20Sopenharmony_ci#define SP_DP_TRAINING_PATTERN_SET_REG 0xa2 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci/* DP Lane 0 Link Training Control Register */ 1318c2ecf20Sopenharmony_ci#define SP_DP_LANE0_LT_CTRL_REG 0xa3 1328c2ecf20Sopenharmony_ci#define SP_TX_SW_SET_MASK 0x1b 1338c2ecf20Sopenharmony_ci#define SP_MAX_PRE_REACH BIT(5) 1348c2ecf20Sopenharmony_ci#define SP_MAX_DRIVE_REACH BIT(4) 1358c2ecf20Sopenharmony_ci#define SP_PRE_EMP_LEVEL1 BIT(3) 1368c2ecf20Sopenharmony_ci#define SP_DRVIE_CURRENT_LEVEL1 BIT(0) 1378c2ecf20Sopenharmony_ci 1388c2ecf20Sopenharmony_ci/* DP Link Training Control Register */ 1398c2ecf20Sopenharmony_ci#define SP_DP_LT_CTRL_REG 0xa8 1408c2ecf20Sopenharmony_ci#define SP_DP_LT_INPROGRESS 0x80 1418c2ecf20Sopenharmony_ci#define SP_LT_ERROR_TYPE_MASK 0x70 1428c2ecf20Sopenharmony_ci# define SP_LT_NO_ERROR 0x00 1438c2ecf20Sopenharmony_ci# define SP_LT_AUX_WRITE_ERROR 0x01 1448c2ecf20Sopenharmony_ci# define SP_LT_MAX_DRIVE_REACHED 0x02 1458c2ecf20Sopenharmony_ci# define SP_LT_WRONG_LANE_COUNT_SET 0x03 1468c2ecf20Sopenharmony_ci# define SP_LT_LOOP_SAME_5_TIME 0x04 1478c2ecf20Sopenharmony_ci# define SP_LT_CR_FAIL_IN_EQ 0x05 1488c2ecf20Sopenharmony_ci# define SP_LT_EQ_LOOP_5_TIME 0x06 1498c2ecf20Sopenharmony_ci#define SP_LT_EN BIT(0) 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_ci/* DP CEP Training Control Registers */ 1528c2ecf20Sopenharmony_ci#define SP_DP_CEP_TRAINING_CTRL0_REG 0xa9 1538c2ecf20Sopenharmony_ci#define SP_DP_CEP_TRAINING_CTRL1_REG 0xaa 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci/* DP Debug Register 1 */ 1568c2ecf20Sopenharmony_ci#define SP_DP_DEBUG1_REG 0xb0 1578c2ecf20Sopenharmony_ci#define SP_DEBUG_PLL_LOCK BIT(4) 1588c2ecf20Sopenharmony_ci#define SP_POLLING_EN BIT(1) 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci/* DP Polling Control Register */ 1618c2ecf20Sopenharmony_ci#define SP_DP_POLLING_CTRL_REG 0xb4 1628c2ecf20Sopenharmony_ci#define SP_AUTO_POLLING_DISABLE BIT(0) 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_ci/* DP Link Debug Control Register */ 1658c2ecf20Sopenharmony_ci#define SP_DP_LINK_DEBUG_CTRL_REG 0xb8 1668c2ecf20Sopenharmony_ci#define SP_M_VID_DEBUG BIT(5) 1678c2ecf20Sopenharmony_ci#define SP_NEW_PRBS7 BIT(4) 1688c2ecf20Sopenharmony_ci#define SP_INSERT_ER BIT(1) 1698c2ecf20Sopenharmony_ci#define SP_PRBS31_EN BIT(0) 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci/* AUX Misc control Register */ 1728c2ecf20Sopenharmony_ci#define SP_AUX_MISC_CTRL_REG 0xbf 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci/* DP PLL control Register */ 1758c2ecf20Sopenharmony_ci#define SP_DP_PLL_CTRL_REG 0xc7 1768c2ecf20Sopenharmony_ci#define SP_PLL_RST BIT(6) 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_ci/* DP Analog Power Down Register */ 1798c2ecf20Sopenharmony_ci#define SP_DP_ANALOG_POWER_DOWN_REG 0xc8 1808c2ecf20Sopenharmony_ci#define SP_CH0_PD BIT(0) 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci/* DP Misc Control Register */ 1838c2ecf20Sopenharmony_ci#define SP_DP_MISC_CTRL_REG 0xcd 1848c2ecf20Sopenharmony_ci#define SP_EQ_TRAINING_LOOP BIT(6) 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci/* DP Extra I2C Device Address Register */ 1878c2ecf20Sopenharmony_ci#define SP_DP_EXTRA_I2C_DEV_ADDR_REG 0xce 1888c2ecf20Sopenharmony_ci#define SP_I2C_STRETCH_DISABLE BIT(7) 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci#define SP_I2C_EXTRA_ADDR 0x50 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci/* DP Downspread Control Register 1 */ 1938c2ecf20Sopenharmony_ci#define SP_DP_DOWNSPREAD_CTRL1_REG 0xd0 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci/* DP M Value Calculation Control Register */ 1968c2ecf20Sopenharmony_ci#define SP_DP_M_CALCULATION_CTRL_REG 0xd9 1978c2ecf20Sopenharmony_ci#define SP_M_GEN_CLK_SEL BIT(0) 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci/* AUX Channel Access Status Register */ 2008c2ecf20Sopenharmony_ci#define SP_AUX_CH_STATUS_REG 0xe0 2018c2ecf20Sopenharmony_ci#define SP_AUX_STATUS 0x0f 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci/* AUX Channel DEFER Control Register */ 2048c2ecf20Sopenharmony_ci#define SP_AUX_DEFER_CTRL_REG 0xe2 2058c2ecf20Sopenharmony_ci#define SP_DEFER_CTRL_EN BIT(7) 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci/* DP Buffer Data Count Register */ 2088c2ecf20Sopenharmony_ci#define SP_BUF_DATA_COUNT_REG 0xe4 2098c2ecf20Sopenharmony_ci#define SP_BUF_DATA_COUNT_MASK 0x1f 2108c2ecf20Sopenharmony_ci#define SP_BUF_CLR BIT(7) 2118c2ecf20Sopenharmony_ci 2128c2ecf20Sopenharmony_ci/* DP AUX Channel Control Register 1 */ 2138c2ecf20Sopenharmony_ci#define SP_DP_AUX_CH_CTRL1_REG 0xe5 2148c2ecf20Sopenharmony_ci#define SP_AUX_TX_COMM_MASK 0x0f 2158c2ecf20Sopenharmony_ci#define SP_AUX_LENGTH_MASK 0xf0 2168c2ecf20Sopenharmony_ci#define SP_AUX_LENGTH_SHIFT 4 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_ci/* DP AUX CH Address Register 0 */ 2198c2ecf20Sopenharmony_ci#define SP_AUX_ADDR_7_0_REG 0xe6 2208c2ecf20Sopenharmony_ci 2218c2ecf20Sopenharmony_ci/* DP AUX CH Address Register 1 */ 2228c2ecf20Sopenharmony_ci#define SP_AUX_ADDR_15_8_REG 0xe7 2238c2ecf20Sopenharmony_ci 2248c2ecf20Sopenharmony_ci/* DP AUX CH Address Register 2 */ 2258c2ecf20Sopenharmony_ci#define SP_AUX_ADDR_19_16_REG 0xe8 2268c2ecf20Sopenharmony_ci#define SP_AUX_ADDR_19_16_MASK 0x0f 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_ci/* DP AUX Channel Control Register 2 */ 2298c2ecf20Sopenharmony_ci#define SP_DP_AUX_CH_CTRL2_REG 0xe9 2308c2ecf20Sopenharmony_ci#define SP_AUX_SEL_RXCM BIT(6) 2318c2ecf20Sopenharmony_ci#define SP_AUX_CHSEL BIT(3) 2328c2ecf20Sopenharmony_ci#define SP_AUX_PN_INV BIT(2) 2338c2ecf20Sopenharmony_ci#define SP_ADDR_ONLY BIT(1) 2348c2ecf20Sopenharmony_ci#define SP_AUX_EN BIT(0) 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_ci/* DP Video Stream Control InfoFrame Register */ 2378c2ecf20Sopenharmony_ci#define SP_DP_3D_VSC_CTRL_REG 0xea 2388c2ecf20Sopenharmony_ci#define SP_INFO_FRAME_VSC_EN BIT(0) 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci/* DP Video Stream Data Byte 1 Register */ 2418c2ecf20Sopenharmony_ci#define SP_DP_VSC_DB1_REG 0xeb 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci/* DP AUX Channel Control Register 3 */ 2448c2ecf20Sopenharmony_ci#define SP_DP_AUX_CH_CTRL3_REG 0xec 2458c2ecf20Sopenharmony_ci#define SP_WAIT_COUNTER_7_0_MASK 0xff 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_ci/* DP AUX Channel Control Register 4 */ 2488c2ecf20Sopenharmony_ci#define SP_DP_AUX_CH_CTRL4_REG 0xed 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci/* DP AUX Buffer Data Registers */ 2518c2ecf20Sopenharmony_ci#define SP_DP_BUF_DATA0_REG 0xf0 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_cissize_t anx_dp_aux_transfer(struct regmap *map_dptx, 2548c2ecf20Sopenharmony_ci struct drm_dp_aux_msg *msg); 2558c2ecf20Sopenharmony_ci 2568c2ecf20Sopenharmony_ci#endif 257