1ad9301a2SIcenowy Zheng /* SPDX-License-Identifier: GPL-2.0-only */ 2ad9301a2SIcenowy Zheng /* 3ad9301a2SIcenowy Zheng * Copyright(c) 2016, Analogix Semiconductor. 4ad9301a2SIcenowy Zheng * 5ad9301a2SIcenowy Zheng * Based on anx7808 driver obtained from chromeos with copyright: 6ad9301a2SIcenowy Zheng * Copyright(c) 2013, Google Inc. 7ad9301a2SIcenowy Zheng */ 8ad9301a2SIcenowy Zheng #ifndef _ANALOGIX_I2C_DPTX_H_ 9ad9301a2SIcenowy Zheng #define _ANALOGIX_I2C_DPTX_H_ 10ad9301a2SIcenowy Zheng 11ad9301a2SIcenowy Zheng /***************************************************************/ 12ad9301a2SIcenowy Zheng /* Register definitions for TX_P0 */ 13ad9301a2SIcenowy Zheng /***************************************************************/ 14ad9301a2SIcenowy Zheng 15ad9301a2SIcenowy Zheng /* HDCP Status Register */ 16ad9301a2SIcenowy Zheng #define SP_TX_HDCP_STATUS_REG 0x00 17ad9301a2SIcenowy Zheng #define SP_AUTH_FAIL BIT(5) 18ad9301a2SIcenowy Zheng #define SP_AUTHEN_PASS BIT(1) 19ad9301a2SIcenowy Zheng 20ad9301a2SIcenowy Zheng /* HDCP Control Register 0 */ 21ad9301a2SIcenowy Zheng #define SP_HDCP_CTRL0_REG 0x01 22ad9301a2SIcenowy Zheng #define SP_RX_REPEATER BIT(6) 23ad9301a2SIcenowy Zheng #define SP_RE_AUTH BIT(5) 24ad9301a2SIcenowy Zheng #define SP_SW_AUTH_OK BIT(4) 25ad9301a2SIcenowy Zheng #define SP_HARD_AUTH_EN BIT(3) 26ad9301a2SIcenowy Zheng #define SP_HDCP_ENC_EN BIT(2) 27ad9301a2SIcenowy Zheng #define SP_BKSV_SRM_PASS BIT(1) 28ad9301a2SIcenowy Zheng #define SP_KSVLIST_VLD BIT(0) 29ad9301a2SIcenowy Zheng /* HDCP Function Enabled */ 30ad9301a2SIcenowy Zheng #define SP_HDCP_FUNCTION_ENABLED (BIT(0) | BIT(1) | BIT(2) | BIT(3)) 31ad9301a2SIcenowy Zheng 32ad9301a2SIcenowy Zheng /* HDCP Receiver BSTATUS Register 0 */ 33ad9301a2SIcenowy Zheng #define SP_HDCP_RX_BSTATUS0_REG 0x1b 34ad9301a2SIcenowy Zheng /* HDCP Receiver BSTATUS Register 1 */ 35ad9301a2SIcenowy Zheng #define SP_HDCP_RX_BSTATUS1_REG 0x1c 36ad9301a2SIcenowy Zheng 37ad9301a2SIcenowy Zheng /* HDCP Embedded "Blue Screen" Content Registers */ 38ad9301a2SIcenowy Zheng #define SP_HDCP_VID0_BLUE_SCREEN_REG 0x2c 39ad9301a2SIcenowy Zheng #define SP_HDCP_VID1_BLUE_SCREEN_REG 0x2d 40ad9301a2SIcenowy Zheng #define SP_HDCP_VID2_BLUE_SCREEN_REG 0x2e 41ad9301a2SIcenowy Zheng 42ad9301a2SIcenowy Zheng /* HDCP Wait R0 Timing Register */ 43ad9301a2SIcenowy Zheng #define SP_HDCP_WAIT_R0_TIME_REG 0x40 44ad9301a2SIcenowy Zheng 45ad9301a2SIcenowy Zheng /* HDCP Link Integrity Check Timer Register */ 46ad9301a2SIcenowy Zheng #define SP_HDCP_LINK_CHECK_TIMER_REG 0x41 47ad9301a2SIcenowy Zheng 48ad9301a2SIcenowy Zheng /* HDCP Repeater Ready Wait Timer Register */ 49ad9301a2SIcenowy Zheng #define SP_HDCP_RPTR_RDY_WAIT_TIME_REG 0x42 50ad9301a2SIcenowy Zheng 51ad9301a2SIcenowy Zheng /* HDCP Auto Timer Register */ 52ad9301a2SIcenowy Zheng #define SP_HDCP_AUTO_TIMER_REG 0x51 53ad9301a2SIcenowy Zheng 54ad9301a2SIcenowy Zheng /* HDCP Key Status Register */ 55ad9301a2SIcenowy Zheng #define SP_HDCP_KEY_STATUS_REG 0x5e 56ad9301a2SIcenowy Zheng 57ad9301a2SIcenowy Zheng /* HDCP Key Command Register */ 58ad9301a2SIcenowy Zheng #define SP_HDCP_KEY_COMMAND_REG 0x5f 59ad9301a2SIcenowy Zheng #define SP_DISABLE_SYNC_HDCP BIT(2) 60ad9301a2SIcenowy Zheng 61ad9301a2SIcenowy Zheng /* OTP Memory Key Protection Registers */ 62ad9301a2SIcenowy Zheng #define SP_OTP_KEY_PROTECT1_REG 0x60 63ad9301a2SIcenowy Zheng #define SP_OTP_KEY_PROTECT2_REG 0x61 64ad9301a2SIcenowy Zheng #define SP_OTP_KEY_PROTECT3_REG 0x62 65ad9301a2SIcenowy Zheng #define SP_OTP_PSW1 0xa2 66ad9301a2SIcenowy Zheng #define SP_OTP_PSW2 0x7e 67ad9301a2SIcenowy Zheng #define SP_OTP_PSW3 0xc6 68ad9301a2SIcenowy Zheng 69ad9301a2SIcenowy Zheng /* DP System Control Registers */ 70ad9301a2SIcenowy Zheng #define SP_DP_SYSTEM_CTRL_BASE (0x80 - 1) 71ad9301a2SIcenowy Zheng /* Bits for DP System Control Register 2 */ 72ad9301a2SIcenowy Zheng #define SP_CHA_STA BIT(2) 73ad9301a2SIcenowy Zheng /* Bits for DP System Control Register 3 */ 74ad9301a2SIcenowy Zheng #define SP_HPD_STATUS BIT(6) 75*dea73d61STorsten Duwe #define SP_HPD_FORCE BIT(5) 76*dea73d61STorsten Duwe #define SP_HPD_CTRL BIT(4) 77ad9301a2SIcenowy Zheng #define SP_STRM_VALID BIT(2) 78*dea73d61STorsten Duwe #define SP_STRM_FORCE BIT(1) 79*dea73d61STorsten Duwe #define SP_STRM_CTRL BIT(0) 80ad9301a2SIcenowy Zheng /* Bits for DP System Control Register 4 */ 81ad9301a2SIcenowy Zheng #define SP_ENHANCED_MODE BIT(3) 82ad9301a2SIcenowy Zheng 83ad9301a2SIcenowy Zheng /* DP Video Control Register */ 84ad9301a2SIcenowy Zheng #define SP_DP_VIDEO_CTRL_REG 0x84 85ad9301a2SIcenowy Zheng #define SP_COLOR_F_MASK 0x06 86ad9301a2SIcenowy Zheng #define SP_COLOR_F_SHIFT 1 87ad9301a2SIcenowy Zheng #define SP_BPC_MASK 0xe0 88ad9301a2SIcenowy Zheng #define SP_BPC_SHIFT 5 89ad9301a2SIcenowy Zheng # define SP_BPC_6BITS 0x00 90ad9301a2SIcenowy Zheng # define SP_BPC_8BITS 0x01 91ad9301a2SIcenowy Zheng # define SP_BPC_10BITS 0x02 92ad9301a2SIcenowy Zheng # define SP_BPC_12BITS 0x03 93ad9301a2SIcenowy Zheng 94ad9301a2SIcenowy Zheng /* DP Audio Control Register */ 95ad9301a2SIcenowy Zheng #define SP_DP_AUDIO_CTRL_REG 0x87 96ad9301a2SIcenowy Zheng #define SP_AUD_EN BIT(0) 97ad9301a2SIcenowy Zheng 98ad9301a2SIcenowy Zheng /* 10us Pulse Generate Timer Registers */ 99ad9301a2SIcenowy Zheng #define SP_I2C_GEN_10US_TIMER0_REG 0x88 100ad9301a2SIcenowy Zheng #define SP_I2C_GEN_10US_TIMER1_REG 0x89 101ad9301a2SIcenowy Zheng 102ad9301a2SIcenowy Zheng /* Packet Send Control Register */ 103ad9301a2SIcenowy Zheng #define SP_PACKET_SEND_CTRL_REG 0x90 104ad9301a2SIcenowy Zheng #define SP_AUD_IF_UP BIT(7) 105ad9301a2SIcenowy Zheng #define SP_AVI_IF_UD BIT(6) 106ad9301a2SIcenowy Zheng #define SP_MPEG_IF_UD BIT(5) 107ad9301a2SIcenowy Zheng #define SP_SPD_IF_UD BIT(4) 108ad9301a2SIcenowy Zheng #define SP_AUD_IF_EN BIT(3) 109ad9301a2SIcenowy Zheng #define SP_AVI_IF_EN BIT(2) 110ad9301a2SIcenowy Zheng #define SP_MPEG_IF_EN BIT(1) 111ad9301a2SIcenowy Zheng #define SP_SPD_IF_EN BIT(0) 112ad9301a2SIcenowy Zheng 113ad9301a2SIcenowy Zheng /* DP HDCP Control Register */ 114ad9301a2SIcenowy Zheng #define SP_DP_HDCP_CTRL_REG 0x92 115ad9301a2SIcenowy Zheng #define SP_AUTO_EN BIT(7) 116ad9301a2SIcenowy Zheng #define SP_AUTO_START BIT(5) 117ad9301a2SIcenowy Zheng #define SP_LINK_POLLING BIT(1) 118ad9301a2SIcenowy Zheng 119ad9301a2SIcenowy Zheng /* DP Main Link Bandwidth Setting Register */ 120ad9301a2SIcenowy Zheng #define SP_DP_MAIN_LINK_BW_SET_REG 0xa0 121ad9301a2SIcenowy Zheng #define SP_LINK_BW_SET_MASK 0x1f 122ad9301a2SIcenowy Zheng #define SP_INITIAL_SLIM_M_AUD_SEL BIT(5) 123ad9301a2SIcenowy Zheng 124*dea73d61STorsten Duwe /* DP Lane Count Setting Register */ 125*dea73d61STorsten Duwe #define SP_DP_LANE_COUNT_SET_REG 0xa1 126*dea73d61STorsten Duwe 127ad9301a2SIcenowy Zheng /* DP Training Pattern Set Register */ 128ad9301a2SIcenowy Zheng #define SP_DP_TRAINING_PATTERN_SET_REG 0xa2 129ad9301a2SIcenowy Zheng 130ad9301a2SIcenowy Zheng /* DP Lane 0 Link Training Control Register */ 131ad9301a2SIcenowy Zheng #define SP_DP_LANE0_LT_CTRL_REG 0xa3 132ad9301a2SIcenowy Zheng #define SP_TX_SW_SET_MASK 0x1b 133ad9301a2SIcenowy Zheng #define SP_MAX_PRE_REACH BIT(5) 134ad9301a2SIcenowy Zheng #define SP_MAX_DRIVE_REACH BIT(4) 135ad9301a2SIcenowy Zheng #define SP_PRE_EMP_LEVEL1 BIT(3) 136ad9301a2SIcenowy Zheng #define SP_DRVIE_CURRENT_LEVEL1 BIT(0) 137ad9301a2SIcenowy Zheng 138ad9301a2SIcenowy Zheng /* DP Link Training Control Register */ 139ad9301a2SIcenowy Zheng #define SP_DP_LT_CTRL_REG 0xa8 140*dea73d61STorsten Duwe #define SP_DP_LT_INPROGRESS 0x80 141ad9301a2SIcenowy Zheng #define SP_LT_ERROR_TYPE_MASK 0x70 142ad9301a2SIcenowy Zheng # define SP_LT_NO_ERROR 0x00 143ad9301a2SIcenowy Zheng # define SP_LT_AUX_WRITE_ERROR 0x01 144ad9301a2SIcenowy Zheng # define SP_LT_MAX_DRIVE_REACHED 0x02 145ad9301a2SIcenowy Zheng # define SP_LT_WRONG_LANE_COUNT_SET 0x03 146ad9301a2SIcenowy Zheng # define SP_LT_LOOP_SAME_5_TIME 0x04 147ad9301a2SIcenowy Zheng # define SP_LT_CR_FAIL_IN_EQ 0x05 148ad9301a2SIcenowy Zheng # define SP_LT_EQ_LOOP_5_TIME 0x06 149ad9301a2SIcenowy Zheng #define SP_LT_EN BIT(0) 150ad9301a2SIcenowy Zheng 151ad9301a2SIcenowy Zheng /* DP CEP Training Control Registers */ 152ad9301a2SIcenowy Zheng #define SP_DP_CEP_TRAINING_CTRL0_REG 0xa9 153ad9301a2SIcenowy Zheng #define SP_DP_CEP_TRAINING_CTRL1_REG 0xaa 154ad9301a2SIcenowy Zheng 155ad9301a2SIcenowy Zheng /* DP Debug Register 1 */ 156ad9301a2SIcenowy Zheng #define SP_DP_DEBUG1_REG 0xb0 157ad9301a2SIcenowy Zheng #define SP_DEBUG_PLL_LOCK BIT(4) 158ad9301a2SIcenowy Zheng #define SP_POLLING_EN BIT(1) 159ad9301a2SIcenowy Zheng 160ad9301a2SIcenowy Zheng /* DP Polling Control Register */ 161ad9301a2SIcenowy Zheng #define SP_DP_POLLING_CTRL_REG 0xb4 162ad9301a2SIcenowy Zheng #define SP_AUTO_POLLING_DISABLE BIT(0) 163ad9301a2SIcenowy Zheng 164ad9301a2SIcenowy Zheng /* DP Link Debug Control Register */ 165ad9301a2SIcenowy Zheng #define SP_DP_LINK_DEBUG_CTRL_REG 0xb8 166ad9301a2SIcenowy Zheng #define SP_M_VID_DEBUG BIT(5) 167ad9301a2SIcenowy Zheng #define SP_NEW_PRBS7 BIT(4) 168ad9301a2SIcenowy Zheng #define SP_INSERT_ER BIT(1) 169ad9301a2SIcenowy Zheng #define SP_PRBS31_EN BIT(0) 170ad9301a2SIcenowy Zheng 171ad9301a2SIcenowy Zheng /* AUX Misc control Register */ 172ad9301a2SIcenowy Zheng #define SP_AUX_MISC_CTRL_REG 0xbf 173ad9301a2SIcenowy Zheng 174ad9301a2SIcenowy Zheng /* DP PLL control Register */ 175ad9301a2SIcenowy Zheng #define SP_DP_PLL_CTRL_REG 0xc7 176ad9301a2SIcenowy Zheng #define SP_PLL_RST BIT(6) 177ad9301a2SIcenowy Zheng 178ad9301a2SIcenowy Zheng /* DP Analog Power Down Register */ 179ad9301a2SIcenowy Zheng #define SP_DP_ANALOG_POWER_DOWN_REG 0xc8 180ad9301a2SIcenowy Zheng #define SP_CH0_PD BIT(0) 181ad9301a2SIcenowy Zheng 182ad9301a2SIcenowy Zheng /* DP Misc Control Register */ 183ad9301a2SIcenowy Zheng #define SP_DP_MISC_CTRL_REG 0xcd 184ad9301a2SIcenowy Zheng #define SP_EQ_TRAINING_LOOP BIT(6) 185ad9301a2SIcenowy Zheng 186ad9301a2SIcenowy Zheng /* DP Extra I2C Device Address Register */ 187ad9301a2SIcenowy Zheng #define SP_DP_EXTRA_I2C_DEV_ADDR_REG 0xce 188ad9301a2SIcenowy Zheng #define SP_I2C_STRETCH_DISABLE BIT(7) 189ad9301a2SIcenowy Zheng 190ad9301a2SIcenowy Zheng #define SP_I2C_EXTRA_ADDR 0x50 191ad9301a2SIcenowy Zheng 192ad9301a2SIcenowy Zheng /* DP Downspread Control Register 1 */ 193ad9301a2SIcenowy Zheng #define SP_DP_DOWNSPREAD_CTRL1_REG 0xd0 194ad9301a2SIcenowy Zheng 195ad9301a2SIcenowy Zheng /* DP M Value Calculation Control Register */ 196ad9301a2SIcenowy Zheng #define SP_DP_M_CALCULATION_CTRL_REG 0xd9 197ad9301a2SIcenowy Zheng #define SP_M_GEN_CLK_SEL BIT(0) 198ad9301a2SIcenowy Zheng 199ad9301a2SIcenowy Zheng /* AUX Channel Access Status Register */ 200ad9301a2SIcenowy Zheng #define SP_AUX_CH_STATUS_REG 0xe0 201ad9301a2SIcenowy Zheng #define SP_AUX_STATUS 0x0f 202ad9301a2SIcenowy Zheng 203ad9301a2SIcenowy Zheng /* AUX Channel DEFER Control Register */ 204ad9301a2SIcenowy Zheng #define SP_AUX_DEFER_CTRL_REG 0xe2 205ad9301a2SIcenowy Zheng #define SP_DEFER_CTRL_EN BIT(7) 206ad9301a2SIcenowy Zheng 207ad9301a2SIcenowy Zheng /* DP Buffer Data Count Register */ 208ad9301a2SIcenowy Zheng #define SP_BUF_DATA_COUNT_REG 0xe4 209ad9301a2SIcenowy Zheng #define SP_BUF_DATA_COUNT_MASK 0x1f 210ad9301a2SIcenowy Zheng #define SP_BUF_CLR BIT(7) 211ad9301a2SIcenowy Zheng 212ad9301a2SIcenowy Zheng /* DP AUX Channel Control Register 1 */ 213ad9301a2SIcenowy Zheng #define SP_DP_AUX_CH_CTRL1_REG 0xe5 214ad9301a2SIcenowy Zheng #define SP_AUX_TX_COMM_MASK 0x0f 215ad9301a2SIcenowy Zheng #define SP_AUX_LENGTH_MASK 0xf0 216ad9301a2SIcenowy Zheng #define SP_AUX_LENGTH_SHIFT 4 217ad9301a2SIcenowy Zheng 218ad9301a2SIcenowy Zheng /* DP AUX CH Address Register 0 */ 219ad9301a2SIcenowy Zheng #define SP_AUX_ADDR_7_0_REG 0xe6 220ad9301a2SIcenowy Zheng 221ad9301a2SIcenowy Zheng /* DP AUX CH Address Register 1 */ 222ad9301a2SIcenowy Zheng #define SP_AUX_ADDR_15_8_REG 0xe7 223ad9301a2SIcenowy Zheng 224ad9301a2SIcenowy Zheng /* DP AUX CH Address Register 2 */ 225ad9301a2SIcenowy Zheng #define SP_AUX_ADDR_19_16_REG 0xe8 226ad9301a2SIcenowy Zheng #define SP_AUX_ADDR_19_16_MASK 0x0f 227ad9301a2SIcenowy Zheng 228ad9301a2SIcenowy Zheng /* DP AUX Channel Control Register 2 */ 229ad9301a2SIcenowy Zheng #define SP_DP_AUX_CH_CTRL2_REG 0xe9 230ad9301a2SIcenowy Zheng #define SP_AUX_SEL_RXCM BIT(6) 231ad9301a2SIcenowy Zheng #define SP_AUX_CHSEL BIT(3) 232ad9301a2SIcenowy Zheng #define SP_AUX_PN_INV BIT(2) 233ad9301a2SIcenowy Zheng #define SP_ADDR_ONLY BIT(1) 234ad9301a2SIcenowy Zheng #define SP_AUX_EN BIT(0) 235ad9301a2SIcenowy Zheng 236ad9301a2SIcenowy Zheng /* DP Video Stream Control InfoFrame Register */ 237ad9301a2SIcenowy Zheng #define SP_DP_3D_VSC_CTRL_REG 0xea 238ad9301a2SIcenowy Zheng #define SP_INFO_FRAME_VSC_EN BIT(0) 239ad9301a2SIcenowy Zheng 240ad9301a2SIcenowy Zheng /* DP Video Stream Data Byte 1 Register */ 241ad9301a2SIcenowy Zheng #define SP_DP_VSC_DB1_REG 0xeb 242ad9301a2SIcenowy Zheng 243ad9301a2SIcenowy Zheng /* DP AUX Channel Control Register 3 */ 244ad9301a2SIcenowy Zheng #define SP_DP_AUX_CH_CTRL3_REG 0xec 245ad9301a2SIcenowy Zheng #define SP_WAIT_COUNTER_7_0_MASK 0xff 246ad9301a2SIcenowy Zheng 247ad9301a2SIcenowy Zheng /* DP AUX Channel Control Register 4 */ 248ad9301a2SIcenowy Zheng #define SP_DP_AUX_CH_CTRL4_REG 0xed 249ad9301a2SIcenowy Zheng 250ad9301a2SIcenowy Zheng /* DP AUX Buffer Data Registers */ 251ad9301a2SIcenowy Zheng #define SP_DP_BUF_DATA0_REG 0xf0 252ad9301a2SIcenowy Zheng 2530712eca9SIcenowy Zheng ssize_t anx_dp_aux_transfer(struct regmap *map_dptx, 2540712eca9SIcenowy Zheng struct drm_dp_aux_msg *msg); 2550712eca9SIcenowy Zheng 256ad9301a2SIcenowy Zheng #endif 257