analogix-anx78xx.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
  4. */
  5. #ifndef __ANX78xx_H
  6. #define __ANX78xx_H
  7. #include "analogix-i2c-dptx.h"
  8. #include "analogix-i2c-txcommon.h"
  9. /***************************************************************/
  10. /* Register definitions for RX_PO */
  11. /***************************************************************/
  12. /*
  13. * System Control and Status
  14. */
  15. /* Software Reset Register 1 */
  16. #define SP_SOFTWARE_RESET1_REG 0x11
  17. #define SP_VIDEO_RST BIT(4)
  18. #define SP_HDCP_MAN_RST BIT(2)
  19. #define SP_TMDS_RST BIT(1)
  20. #define SP_SW_MAN_RST BIT(0)
  21. /* System Status Register */
  22. #define SP_SYSTEM_STATUS_REG 0x14
  23. #define SP_TMDS_CLOCK_DET BIT(1)
  24. #define SP_TMDS_DE_DET BIT(0)
  25. /* HDMI Status Register */
  26. #define SP_HDMI_STATUS_REG 0x15
  27. #define SP_HDMI_AUD_LAYOUT BIT(3)
  28. #define SP_HDMI_DET BIT(0)
  29. # define SP_DVI_MODE 0
  30. # define SP_HDMI_MODE 1
  31. /* HDMI Mute Control Register */
  32. #define SP_HDMI_MUTE_CTRL_REG 0x16
  33. #define SP_AUD_MUTE BIT(1)
  34. #define SP_VID_MUTE BIT(0)
  35. /* System Power Down Register 1 */
  36. #define SP_SYSTEM_POWER_DOWN1_REG 0x18
  37. #define SP_PWDN_CTRL BIT(0)
  38. /*
  39. * Audio and Video Auto Control
  40. */
  41. /* Auto Audio and Video Control register */
  42. #define SP_AUDVID_CTRL_REG 0x20
  43. #define SP_AVC_OE BIT(7)
  44. #define SP_AAC_OE BIT(6)
  45. #define SP_AVC_EN BIT(1)
  46. #define SP_AAC_EN BIT(0)
  47. /* Audio Exception Enable Registers */
  48. #define SP_AUD_EXCEPTION_ENABLE_BASE (0x24 - 1)
  49. /* Bits for Audio Exception Enable Register 3 */
  50. #define SP_AEC_EN21 BIT(5)
  51. /*
  52. * Interrupt
  53. */
  54. /* Interrupt Status Register 1 */
  55. #define SP_INT_STATUS1_REG 0x31
  56. /* Bits for Interrupt Status Register 1 */
  57. #define SP_HDMI_DVI BIT(7)
  58. #define SP_CKDT_CHG BIT(6)
  59. #define SP_SCDT_CHG BIT(5)
  60. #define SP_PCLK_CHG BIT(4)
  61. #define SP_PLL_UNLOCK BIT(3)
  62. #define SP_CABLE_PLUG_CHG BIT(2)
  63. #define SP_SET_MUTE BIT(1)
  64. #define SP_SW_INTR BIT(0)
  65. /* Bits for Interrupt Status Register 2 */
  66. #define SP_HDCP_ERR BIT(5)
  67. #define SP_AUDIO_SAMPLE_CHG BIT(0) /* undocumented */
  68. /* Bits for Interrupt Status Register 3 */
  69. #define SP_AUD_MODE_CHG BIT(0)
  70. /* Bits for Interrupt Status Register 5 */
  71. #define SP_AUDIO_RCV BIT(0)
  72. /* Bits for Interrupt Status Register 6 */
  73. #define SP_INT_STATUS6_REG 0x36
  74. #define SP_CTS_RCV BIT(7)
  75. #define SP_NEW_AUD_PKT BIT(4)
  76. #define SP_NEW_AVI_PKT BIT(1)
  77. #define SP_NEW_CP_PKT BIT(0)
  78. /* Bits for Interrupt Status Register 7 */
  79. #define SP_NO_VSI BIT(7)
  80. #define SP_NEW_VS BIT(4)
  81. /* Interrupt Mask 1 Status Registers */
  82. #define SP_INT_MASK1_REG 0x41
  83. /* HDMI US TIMER Control Register */
  84. #define SP_HDMI_US_TIMER_CTRL_REG 0x49
  85. #define SP_MS_TIMER_MARGIN_10_8_MASK 0x07
  86. /*
  87. * TMDS Control
  88. */
  89. /* TMDS Control Registers */
  90. #define SP_TMDS_CTRL_BASE (0x50 - 1)
  91. /* Bits for TMDS Control Register 7 */
  92. #define SP_PD_RT BIT(0)
  93. /*
  94. * Video Control
  95. */
  96. /* Video Status Register */
  97. #define SP_VIDEO_STATUS_REG 0x70
  98. #define SP_COLOR_DEPTH_MASK 0xf0
  99. #define SP_COLOR_DEPTH_SHIFT 4
  100. # define SP_COLOR_DEPTH_MODE_LEGACY 0x00
  101. # define SP_COLOR_DEPTH_MODE_24BIT 0x04
  102. # define SP_COLOR_DEPTH_MODE_30BIT 0x05
  103. # define SP_COLOR_DEPTH_MODE_36BIT 0x06
  104. # define SP_COLOR_DEPTH_MODE_48BIT 0x07
  105. /* Video Data Range Control Register */
  106. #define SP_VID_DATA_RANGE_CTRL_REG 0x83
  107. #define SP_R2Y_INPUT_LIMIT BIT(1)
  108. /* Pixel Clock High Resolution Counter Registers */
  109. #define SP_PCLK_HIGHRES_CNT_BASE (0x8c - 1)
  110. /*
  111. * Audio Control
  112. */
  113. /* Number of Audio Channels Status Registers */
  114. #define SP_AUD_CH_STATUS_REG_NUM 6
  115. /* Audio IN S/PDIF Channel Status Registers */
  116. #define SP_AUD_SPDIF_CH_STATUS_BASE 0xc7
  117. /* Audio IN S/PDIF Channel Status Register 4 */
  118. #define SP_FS_FREQ_MASK 0x0f
  119. # define SP_FS_FREQ_44100HZ 0x00
  120. # define SP_FS_FREQ_48000HZ 0x02
  121. # define SP_FS_FREQ_32000HZ 0x03
  122. # define SP_FS_FREQ_88200HZ 0x08
  123. # define SP_FS_FREQ_96000HZ 0x0a
  124. # define SP_FS_FREQ_176400HZ 0x0c
  125. # define SP_FS_FREQ_192000HZ 0x0e
  126. /*
  127. * Micellaneous Control Block
  128. */
  129. /* CHIP Control Register */
  130. #define SP_CHIP_CTRL_REG 0xe3
  131. #define SP_MAN_HDMI5V_DET BIT(3)
  132. #define SP_PLLLOCK_CKDT_EN BIT(2)
  133. #define SP_ANALOG_CKDT_EN BIT(1)
  134. #define SP_DIGITAL_CKDT_EN BIT(0)
  135. /* Packet Receiving Status Register */
  136. #define SP_PACKET_RECEIVING_STATUS_REG 0xf3
  137. #define SP_AVI_RCVD BIT(5)
  138. #define SP_VSI_RCVD BIT(1)
  139. /***************************************************************/
  140. /* Register definitions for RX_P1 */
  141. /***************************************************************/
  142. /* HDCP BCAPS Shadow Register */
  143. #define SP_HDCP_BCAPS_SHADOW_REG 0x2a
  144. #define SP_BCAPS_REPEATER BIT(5)
  145. /* HDCP Status Register */
  146. #define SP_RX_HDCP_STATUS_REG 0x3f
  147. #define SP_AUTH_EN BIT(4)
  148. /*
  149. * InfoFrame and Control Packet Registers
  150. */
  151. /* AVI InfoFrame packet checksum */
  152. #define SP_AVI_INFOFRAME_CHECKSUM 0xa3
  153. /* AVI InfoFrame Registers */
  154. #define SP_AVI_INFOFRAME_DATA_BASE 0xa4
  155. #define SP_AVI_COLOR_F_MASK 0x60
  156. #define SP_AVI_COLOR_F_SHIFT 5
  157. /* Audio InfoFrame Registers */
  158. #define SP_AUD_INFOFRAME_DATA_BASE 0xc4
  159. #define SP_AUD_INFOFRAME_LAYOUT_MASK 0x0f
  160. /* MPEG/HDMI Vendor Specific InfoFrame Packet type code */
  161. #define SP_MPEG_VS_INFOFRAME_TYPE_REG 0xe0
  162. /* MPEG/HDMI Vendor Specific InfoFrame Packet length */
  163. #define SP_MPEG_VS_INFOFRAME_LEN_REG 0xe2
  164. /* MPEG/HDMI Vendor Specific InfoFrame Packet version number */
  165. #define SP_MPEG_VS_INFOFRAME_VER_REG 0xe1
  166. /* MPEG/HDMI Vendor Specific InfoFrame Packet content */
  167. #define SP_MPEG_VS_INFOFRAME_DATA_BASE 0xe4
  168. /* General Control Packet Register */
  169. #define SP_GENERAL_CTRL_PACKET_REG 0x9f
  170. #define SP_CLEAR_AVMUTE BIT(4)
  171. #define SP_SET_AVMUTE BIT(0)
  172. /***************************************************************/
  173. /* Register definitions for TX_P1 */
  174. /***************************************************************/
  175. /* DP TX Link Training Control Register */
  176. #define SP_DP_TX_LT_CTRL0_REG 0x30
  177. /* PD 1.2 Lint Training 80bit Pattern Register */
  178. #define SP_DP_LT_80BIT_PATTERN0_REG 0x80
  179. #define SP_DP_LT_80BIT_PATTERN_REG_NUM 10
  180. /* Audio Interface Control Register 0 */
  181. #define SP_AUD_INTERFACE_CTRL0_REG 0x5f
  182. #define SP_AUD_INTERFACE_DISABLE 0x80
  183. /* Audio Interface Control Register 2 */
  184. #define SP_AUD_INTERFACE_CTRL2_REG 0x60
  185. #define SP_M_AUD_ADJUST_ST 0x04
  186. /* Audio Interface Control Register 3 */
  187. #define SP_AUD_INTERFACE_CTRL3_REG 0x62
  188. /* Audio Interface Control Register 4 */
  189. #define SP_AUD_INTERFACE_CTRL4_REG 0x67
  190. /* Audio Interface Control Register 5 */
  191. #define SP_AUD_INTERFACE_CTRL5_REG 0x68
  192. /* Audio Interface Control Register 6 */
  193. #define SP_AUD_INTERFACE_CTRL6_REG 0x69
  194. /* Firmware Version Register */
  195. #define SP_FW_VER_REG 0xb7
  196. #endif