tda1997x_regs.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2018 Gateworks Corporation
  4. */
  5. /* Page 0x00 - General Control */
  6. #define REG_VERSION 0x0000
  7. #define REG_INPUT_SEL 0x0001
  8. #define REG_SVC_MODE 0x0002
  9. #define REG_HPD_MAN_CTRL 0x0003
  10. #define REG_RT_MAN_CTRL 0x0004
  11. #define REG_STANDBY_SOFT_RST 0x000A
  12. #define REG_HDMI_SOFT_RST 0x000B
  13. #define REG_HDMI_INFO_RST 0x000C
  14. #define REG_INT_FLG_CLR_TOP 0x000E
  15. #define REG_INT_FLG_CLR_SUS 0x000F
  16. #define REG_INT_FLG_CLR_DDC 0x0010
  17. #define REG_INT_FLG_CLR_RATE 0x0011
  18. #define REG_INT_FLG_CLR_MODE 0x0012
  19. #define REG_INT_FLG_CLR_INFO 0x0013
  20. #define REG_INT_FLG_CLR_AUDIO 0x0014
  21. #define REG_INT_FLG_CLR_HDCP 0x0015
  22. #define REG_INT_FLG_CLR_AFE 0x0016
  23. #define REG_INT_MASK_TOP 0x0017
  24. #define REG_INT_MASK_SUS 0x0018
  25. #define REG_INT_MASK_DDC 0x0019
  26. #define REG_INT_MASK_RATE 0x001A
  27. #define REG_INT_MASK_MODE 0x001B
  28. #define REG_INT_MASK_INFO 0x001C
  29. #define REG_INT_MASK_AUDIO 0x001D
  30. #define REG_INT_MASK_HDCP 0x001E
  31. #define REG_INT_MASK_AFE 0x001F
  32. #define REG_DETECT_5V 0x0020
  33. #define REG_SUS_STATUS 0x0021
  34. #define REG_V_PER 0x0022
  35. #define REG_H_PER 0x0025
  36. #define REG_HS_WIDTH 0x0027
  37. #define REG_FMT_H_TOT 0x0029
  38. #define REG_FMT_H_ACT 0x002b
  39. #define REG_FMT_H_FRONT 0x002d
  40. #define REG_FMT_H_SYNC 0x002f
  41. #define REG_FMT_H_BACK 0x0031
  42. #define REG_FMT_V_TOT 0x0033
  43. #define REG_FMT_V_ACT 0x0035
  44. #define REG_FMT_V_FRONT_F1 0x0037
  45. #define REG_FMT_V_FRONT_F2 0x0038
  46. #define REG_FMT_V_SYNC 0x0039
  47. #define REG_FMT_V_BACK_F1 0x003a
  48. #define REG_FMT_V_BACK_F2 0x003b
  49. #define REG_FMT_DE_ACT 0x003c
  50. #define REG_RATE_CTRL 0x0040
  51. #define REG_CLK_MIN_RATE 0x0043
  52. #define REG_CLK_MAX_RATE 0x0046
  53. #define REG_CLK_A_STATUS 0x0049
  54. #define REG_CLK_A_RATE 0x004A
  55. #define REG_DRIFT_CLK_A_REG 0x004D
  56. #define REG_CLK_B_STATUS 0x004E
  57. #define REG_CLK_B_RATE 0x004F
  58. #define REG_DRIFT_CLK_B_REG 0x0052
  59. #define REG_HDCP_CTRL 0x0060
  60. #define REG_HDCP_KDS 0x0061
  61. #define REG_HDCP_BCAPS 0x0063
  62. #define REG_HDCP_KEY_CTRL 0x0064
  63. #define REG_INFO_CTRL 0x0076
  64. #define REG_INFO_EXCEED 0x0077
  65. #define REG_PIX_REPEAT 0x007B
  66. #define REG_AUDIO_PATH 0x007C
  67. #define REG_AUDCFG 0x007D
  68. #define REG_AUDIO_OUT_ENABLE 0x007E
  69. #define REG_AUDIO_OUT_HIZ 0x007F
  70. #define REG_VDP_CTRL 0x0080
  71. #define REG_VDP_MATRIX 0x0081
  72. #define REG_VHREF_CTRL 0x00A0
  73. #define REG_PXCNT_PR 0x00A2
  74. #define REG_PXCNT_NPIX 0x00A4
  75. #define REG_LCNT_PR 0x00A6
  76. #define REG_LCNT_NLIN 0x00A8
  77. #define REG_HREF_S 0x00AA
  78. #define REG_HREF_E 0x00AC
  79. #define REG_HS_S 0x00AE
  80. #define REG_HS_E 0x00B0
  81. #define REG_VREF_F1_S 0x00B2
  82. #define REG_VREF_F1_WIDTH 0x00B4
  83. #define REG_VREF_F2_S 0x00B5
  84. #define REG_VREF_F2_WIDTH 0x00B7
  85. #define REG_VS_F1_LINE_S 0x00B8
  86. #define REG_VS_F1_LINE_WIDTH 0x00BA
  87. #define REG_VS_F2_LINE_S 0x00BB
  88. #define REG_VS_F2_LINE_WIDTH 0x00BD
  89. #define REG_VS_F1_PIX_S 0x00BE
  90. #define REG_VS_F1_PIX_E 0x00C0
  91. #define REG_VS_F2_PIX_S 0x00C2
  92. #define REG_VS_F2_PIX_E 0x00C4
  93. #define REG_FREF_F1_S 0x00C6
  94. #define REG_FREF_F2_S 0x00C8
  95. #define REG_FDW_S 0x00ca
  96. #define REG_FDW_E 0x00cc
  97. #define REG_BLK_GY 0x00da
  98. #define REG_BLK_BU 0x00dc
  99. #define REG_BLK_RV 0x00de
  100. #define REG_FILTERS_CTRL 0x00e0
  101. #define REG_DITHERING_CTRL 0x00E9
  102. #define REG_OF 0x00EA
  103. #define REG_PCLK 0x00EB
  104. #define REG_HS_HREF 0x00EC
  105. #define REG_VS_VREF 0x00ED
  106. #define REG_DE_FREF 0x00EE
  107. #define REG_VP35_32_CTRL 0x00EF
  108. #define REG_VP31_28_CTRL 0x00F0
  109. #define REG_VP27_24_CTRL 0x00F1
  110. #define REG_VP23_20_CTRL 0x00F2
  111. #define REG_VP19_16_CTRL 0x00F3
  112. #define REG_VP15_12_CTRL 0x00F4
  113. #define REG_VP11_08_CTRL 0x00F5
  114. #define REG_VP07_04_CTRL 0x00F6
  115. #define REG_VP03_00_CTRL 0x00F7
  116. #define REG_CURPAGE_00H 0xFF
  117. #define MASK_VPER 0x3fffff
  118. #define MASK_VHREF 0x3fff
  119. #define MASK_HPER 0x0fff
  120. #define MASK_HSWIDTH 0x03ff
  121. /* HPD Detection */
  122. #define DETECT_UTIL BIT(7) /* utility of HDMI level */
  123. #define DETECT_HPD BIT(6) /* HPD of HDMI level */
  124. #define DETECT_5V_SEL BIT(2) /* 5V present on selected input */
  125. #define DETECT_5V_B BIT(1) /* 5V present on input B */
  126. #define DETECT_5V_A BIT(0) /* 5V present on input A */
  127. /* Input Select */
  128. #define INPUT_SEL_RST_FMT BIT(7) /* 1=reset format measurement */
  129. #define INPUT_SEL_RST_VDP BIT(2) /* 1=reset video data path */
  130. #define INPUT_SEL_OUT_MODE BIT(1) /* 0=loop 1=bypass */
  131. #define INPUT_SEL_B BIT(0) /* 0=inputA 1=inputB */
  132. /* Service Mode */
  133. #define SVC_MODE_CLK2_MASK 0xc0
  134. #define SVC_MODE_CLK2_SHIFT 6
  135. #define SVC_MODE_CLK2_XTL 0L
  136. #define SVC_MODE_CLK2_XTLDIV2 1L
  137. #define SVC_MODE_CLK2_HDMIX2 3L
  138. #define SVC_MODE_CLK1_MASK 0x30
  139. #define SVC_MODE_CLK1_SHIFT 4
  140. #define SVC_MODE_CLK1_XTAL 0L
  141. #define SVC_MODE_CLK1_XTLDIV2 1L
  142. #define SVC_MODE_CLK1_HDMI 3L
  143. #define SVC_MODE_RAMP BIT(3) /* 0=colorbar 1=ramp */
  144. #define SVC_MODE_PAL BIT(2) /* 0=NTSC(480i/p) 1=PAL(576i/p) */
  145. #define SVC_MODE_INT_PROG BIT(1) /* 0=interlaced 1=progressive */
  146. #define SVC_MODE_SM_ON BIT(0) /* Enable color bars and tone gen */
  147. /* HDP Manual Control */
  148. #define HPD_MAN_CTRL_HPD_PULSE BIT(7) /* HPD Pulse low 110ms */
  149. #define HPD_MAN_CTRL_5VEN BIT(2) /* Output 5V */
  150. #define HPD_MAN_CTRL_HPD_B BIT(1) /* Assert HPD High for Input A */
  151. #define HPD_MAN_CTRL_HPD_A BIT(0) /* Assert HPD High for Input A */
  152. /* RT_MAN_CTRL */
  153. #define RT_MAN_CTRL_RT_AUTO BIT(7)
  154. #define RT_MAN_CTRL_RT BIT(6)
  155. #define RT_MAN_CTRL_RT_B BIT(1) /* enable TMDS pull-up on Input B */
  156. #define RT_MAN_CTRL_RT_A BIT(0) /* enable TMDS pull-up on Input A */
  157. /* VDP_CTRL */
  158. #define VDP_CTRL_COMPDEL_BP BIT(5) /* bypass compdel */
  159. #define VDP_CTRL_FORMATTER_BP BIT(4) /* bypass formatter */
  160. #define VDP_CTRL_PREFILTER_BP BIT(1) /* bypass prefilter */
  161. #define VDP_CTRL_MATRIX_BP BIT(0) /* bypass matrix conversion */
  162. /* REG_VHREF_CTRL */
  163. #define VHREF_INT_DET BIT(7) /* interlace detect: 1=alt 0=frame */
  164. #define VHREF_VSYNC_MASK 0x60
  165. #define VHREF_VSYNC_SHIFT 6
  166. #define VHREF_VSYNC_AUTO 0L
  167. #define VHREF_VSYNC_FDW 1L
  168. #define VHREF_VSYNC_EVEN 2L
  169. #define VHREF_VSYNC_ODD 3L
  170. #define VHREF_STD_DET_MASK 0x18
  171. #define VHREF_STD_DET_SHIFT 3
  172. #define VHREF_STD_DET_PAL 0L
  173. #define VHREF_STD_DET_NTSC 1L
  174. #define VHREF_STD_DET_AUTO 2L
  175. #define VHREF_STD_DET_OFF 3L
  176. #define VHREF_VREF_SRC_STD BIT(2) /* 1=from standard 0=manual */
  177. #define VHREF_HREF_SRC_STD BIT(1) /* 1=from standard 0=manual */
  178. #define VHREF_HSYNC_SEL_HS BIT(0) /* 1=HS 0=VS */
  179. /* AUDIO_OUT_ENABLE */
  180. #define AUDIO_OUT_ENABLE_ACLK BIT(5)
  181. #define AUDIO_OUT_ENABLE_WS BIT(4)
  182. #define AUDIO_OUT_ENABLE_AP3 BIT(3)
  183. #define AUDIO_OUT_ENABLE_AP2 BIT(2)
  184. #define AUDIO_OUT_ENABLE_AP1 BIT(1)
  185. #define AUDIO_OUT_ENABLE_AP0 BIT(0)
  186. /* Prefilter Control */
  187. #define FILTERS_CTRL_BU_MASK 0x0c
  188. #define FILTERS_CTRL_BU_SHIFT 2
  189. #define FILTERS_CTRL_RV_MASK 0x03
  190. #define FILTERS_CTRL_RV_SHIFT 0
  191. #define FILTERS_CTRL_OFF 0L /* off */
  192. #define FILTERS_CTRL_2TAP 1L /* 2 Taps */
  193. #define FILTERS_CTRL_7TAP 2L /* 7 Taps */
  194. #define FILTERS_CTRL_2_7TAP 3L /* 2/7 Taps */
  195. /* PCLK Configuration */
  196. #define PCLK_DELAY_MASK 0x70
  197. #define PCLK_DELAY_SHIFT 4 /* Pixel delay (-8..+7) */
  198. #define PCLK_INV_SHIFT 2
  199. #define PCLK_SEL_MASK 0x03 /* clock scaler */
  200. #define PCLK_SEL_SHIFT 0
  201. #define PCLK_SEL_X1 0L
  202. #define PCLK_SEL_X2 1L
  203. #define PCLK_SEL_DIV2 2L
  204. #define PCLK_SEL_DIV4 3L
  205. /* Pixel Repeater */
  206. #define PIX_REPEAT_MASK_UP_SEL 0x30
  207. #define PIX_REPEAT_MASK_REP 0x0f
  208. #define PIX_REPEAT_SHIFT 4
  209. #define PIX_REPEAT_CHROMA 1
  210. /* Page 0x01 - HDMI info and packets */
  211. #define REG_HDMI_FLAGS 0x0100
  212. #define REG_DEEP_COLOR_MODE 0x0101
  213. #define REG_AUDIO_FLAGS 0x0108
  214. #define REG_AUDIO_FREQ 0x0109
  215. #define REG_ACP_PACKET_TYPE 0x0141
  216. #define REG_ISRC1_PACKET_TYPE 0x0161
  217. #define REG_ISRC2_PACKET_TYPE 0x0181
  218. #define REG_GBD_PACKET_TYPE 0x01a1
  219. /* HDMI_FLAGS */
  220. #define HDMI_FLAGS_AUDIO BIT(7) /* Audio packet in last videoframe */
  221. #define HDMI_FLAGS_HDMI BIT(6) /* HDMI detected */
  222. #define HDMI_FLAGS_EESS BIT(5) /* EESS detected */
  223. #define HDMI_FLAGS_HDCP BIT(4) /* HDCP detected */
  224. #define HDMI_FLAGS_AVMUTE BIT(3) /* AVMUTE */
  225. #define HDMI_FLAGS_AUD_LAYOUT BIT(2) /* Layout status Audio sample packet */
  226. #define HDMI_FLAGS_AUD_FIFO_OF BIT(1) /* FIFO read/write pointers crossed */
  227. #define HDMI_FLAGS_AUD_FIFO_LOW BIT(0) /* FIFO read ptr within 2 of write */
  228. /* Page 0x12 - HDMI Extra control and debug */
  229. #define REG_CLK_CFG 0x1200
  230. #define REG_CLK_OUT_CFG 0x1201
  231. #define REG_CFG1 0x1202
  232. #define REG_CFG2 0x1203
  233. #define REG_WDL_CFG 0x1210
  234. #define REG_DELOCK_DELAY 0x1212
  235. #define REG_PON_OVR_EN 0x12A0
  236. #define REG_PON_CBIAS 0x12A1
  237. #define REG_PON_RESCAL 0x12A2
  238. #define REG_PON_RES 0x12A3
  239. #define REG_PON_CLK 0x12A4
  240. #define REG_PON_PLL 0x12A5
  241. #define REG_PON_EQ 0x12A6
  242. #define REG_PON_DES 0x12A7
  243. #define REG_PON_OUT 0x12A8
  244. #define REG_PON_MUX 0x12A9
  245. #define REG_MODE_REC_CFG1 0x12F8
  246. #define REG_MODE_REC_CFG2 0x12F9
  247. #define REG_MODE_REC_STS 0x12FA
  248. #define REG_AUDIO_LAYOUT 0x12D0
  249. #define PON_EN 1
  250. #define PON_DIS 0
  251. /* CLK CFG */
  252. #define CLK_CFG_INV_OUT_CLK BIT(7)
  253. #define CLK_CFG_INV_BUS_CLK BIT(6)
  254. #define CLK_CFG_SEL_ACLK_EN BIT(1)
  255. #define CLK_CFG_SEL_ACLK BIT(0)
  256. #define CLK_CFG_DIS 0
  257. /* Page 0x13 - HDMI Extra control and debug */
  258. #define REG_DEEP_COLOR_CTRL 0x1300
  259. #define REG_CGU_DBG_SEL 0x1305
  260. #define REG_HDCP_DDC_ADDR 0x1310
  261. #define REG_HDCP_KIDX 0x1316
  262. #define REG_DEEP_PLL7_BYP 0x1347
  263. #define REG_HDCP_DE_CTRL 0x1370
  264. #define REG_HDCP_EP_FILT_CTRL 0x1371
  265. #define REG_HDMI_CTRL 0x1377
  266. #define REG_HMTP_CTRL 0x137a
  267. #define REG_TIMER_D 0x13CF
  268. #define REG_SUS_SET_RGB0 0x13E1
  269. #define REG_SUS_SET_RGB1 0x13E2
  270. #define REG_SUS_SET_RGB2 0x13E3
  271. #define REG_SUS_SET_RGB3 0x13E4
  272. #define REG_SUS_SET_RGB4 0x13E5
  273. #define REG_MAN_SUS_HDMI_SEL 0x13E8
  274. #define REG_MAN_HDMI_SET 0x13E9
  275. #define REG_SUS_CLOCK_GOOD 0x13EF
  276. /* HDCP DE Control */
  277. #define HDCP_DE_MODE_MASK 0xc0 /* DE Measurement mode */
  278. #define HDCP_DE_MODE_SHIFT 6
  279. #define HDCP_DE_REGEN_EN BIT(5) /* enable regen mode */
  280. #define HDCP_DE_FILTER_MASK 0x18 /* DE filter sensitivity */
  281. #define HDCP_DE_FILTER_SHIFT 3
  282. #define HDCP_DE_COMP_MASK 0x07 /* DE Composition mode */
  283. #define HDCP_DE_COMP_MIXED 6L
  284. #define HDCP_DE_COMP_OR 5L
  285. #define HDCP_DE_COMP_AND 4L
  286. #define HDCP_DE_COMP_CH3 3L
  287. #define HDCP_DE_COMP_CH2 2L
  288. #define HDCP_DE_COMP_CH1 1L
  289. #define HDCP_DE_COMP_CH0 0L
  290. /* HDCP EP Filter Control */
  291. #define HDCP_EP_FIL_CTL_MASK 0x30
  292. #define HDCP_EP_FIL_CTL_SHIFT 4
  293. #define HDCP_EP_FIL_VS_MASK 0x0c
  294. #define HDCP_EP_FIL_VS_SHIFT 2
  295. #define HDCP_EP_FIL_HS_MASK 0x03
  296. #define HDCP_EP_FIL_HS_SHIFT 0
  297. /* HDMI_CTRL */
  298. #define HDMI_CTRL_MUTE_MASK 0x0c
  299. #define HDMI_CTRL_MUTE_SHIFT 2
  300. #define HDMI_CTRL_MUTE_AUTO 0L
  301. #define HDMI_CTRL_MUTE_OFF 1L
  302. #define HDMI_CTRL_MUTE_ON 2L
  303. #define HDMI_CTRL_HDCP_MASK 0x03
  304. #define HDMI_CTRL_HDCP_SHIFT 0
  305. #define HDMI_CTRL_HDCP_EESS 2L
  306. #define HDMI_CTRL_HDCP_OESS 1L
  307. #define HDMI_CTRL_HDCP_AUTO 0L
  308. /* CGU_DBG_SEL bits */
  309. #define CGU_DBG_CLK_SEL_MASK 0x18
  310. #define CGU_DBG_CLK_SEL_SHIFT 3
  311. #define CGU_DBG_XO_FRO_SEL BIT(2)
  312. #define CGU_DBG_VDP_CLK_SEL BIT(1)
  313. #define CGU_DBG_PIX_CLK_SEL BIT(0)
  314. /* REG_MAN_SUS_HDMI_SEL / REG_MAN_HDMI_SET bits */
  315. #define MAN_DIS_OUT_BUF BIT(7)
  316. #define MAN_DIS_ANA_PATH BIT(6)
  317. #define MAN_DIS_HDCP BIT(5)
  318. #define MAN_DIS_TMDS_ENC BIT(4)
  319. #define MAN_DIS_TMDS_FLOW BIT(3)
  320. #define MAN_RST_HDCP BIT(2)
  321. #define MAN_RST_TMDS_ENC BIT(1)
  322. #define MAN_RST_TMDS_FLOW BIT(0)
  323. /* Page 0x14 - Audio Extra control and debug */
  324. #define REG_FIFO_LATENCY_VAL 0x1403
  325. #define REG_AUDIO_CLOCK 0x1411
  326. #define REG_TEST_NCTS_CTRL 0x1415
  327. #define REG_TEST_AUDIO_FREQ 0x1426
  328. #define REG_TEST_MODE 0x1437
  329. /* Audio Clock Configuration */
  330. #define AUDIO_CLOCK_PLL_PD BIT(7) /* powerdown PLL */
  331. #define AUDIO_CLOCK_SEL_MASK 0x7f
  332. #define AUDIO_CLOCK_SEL_16FS 0L /* 16*fs */
  333. #define AUDIO_CLOCK_SEL_32FS 1L /* 32*fs */
  334. #define AUDIO_CLOCK_SEL_64FS 2L /* 64*fs */
  335. #define AUDIO_CLOCK_SEL_128FS 3L /* 128*fs */
  336. #define AUDIO_CLOCK_SEL_256FS 4L /* 256*fs */
  337. #define AUDIO_CLOCK_SEL_512FS 5L /* 512*fs */
  338. /* Page 0x20: EDID and Hotplug Detect */
  339. #define REG_EDID_IN_BYTE0 0x2000 /* EDID base */
  340. #define REG_EDID_IN_VERSION 0x2080
  341. #define REG_EDID_ENABLE 0x2081
  342. #define REG_HPD_POWER 0x2084
  343. #define REG_HPD_AUTO_CTRL 0x2085
  344. #define REG_HPD_DURATION 0x2086
  345. #define REG_RX_HPD_HEAC 0x2087
  346. /* EDID_ENABLE */
  347. #define EDID_ENABLE_NACK_OFF BIT(7)
  348. #define EDID_ENABLE_EDID_ONLY BIT(6)
  349. #define EDID_ENABLE_B_EN BIT(1)
  350. #define EDID_ENABLE_A_EN BIT(0)
  351. /* HPD Power */
  352. #define HPD_POWER_BP_MASK 0x0c
  353. #define HPD_POWER_BP_SHIFT 2
  354. #define HPD_POWER_BP_LOW 0L
  355. #define HPD_POWER_BP_HIGH 1L
  356. #define HPD_POWER_EDID_ONLY BIT(1)
  357. /* HPD Auto control */
  358. #define HPD_AUTO_READ_EDID BIT(7)
  359. #define HPD_AUTO_HPD_F3TECH BIT(5)
  360. #define HPD_AUTO_HP_OTHER BIT(4)
  361. #define HPD_AUTO_HPD_UNSEL BIT(3)
  362. #define HPD_AUTO_HPD_ALL_CH BIT(2)
  363. #define HPD_AUTO_HPD_PRV_CH BIT(1)
  364. #define HPD_AUTO_HPD_NEW_CH BIT(0)
  365. /* Page 0x21 - EDID content */
  366. #define REG_EDID_IN_BYTE128 0x2100 /* CEA Extension block */
  367. #define REG_EDID_IN_SPA_SUB 0x2180
  368. #define REG_EDID_IN_SPA_AB_A 0x2181
  369. #define REG_EDID_IN_SPA_CD_A 0x2182
  370. #define REG_EDID_IN_CKSUM_A 0x2183
  371. #define REG_EDID_IN_SPA_AB_B 0x2184
  372. #define REG_EDID_IN_SPA_CD_B 0x2185
  373. #define REG_EDID_IN_CKSUM_B 0x2186
  374. /* Page 0x30 - NV Configuration */
  375. #define REG_RT_AUTO_CTRL 0x3000
  376. #define REG_EQ_MAN_CTRL0 0x3001
  377. #define REG_EQ_MAN_CTRL1 0x3002
  378. #define REG_OUTPUT_CFG 0x3003
  379. #define REG_MUTE_CTRL 0x3004
  380. #define REG_SLAVE_ADDR 0x3005
  381. #define REG_CMTP_REG6 0x3006
  382. #define REG_CMTP_REG7 0x3007
  383. #define REG_CMTP_REG8 0x3008
  384. #define REG_CMTP_REG9 0x3009
  385. #define REG_CMTP_REGA 0x300A
  386. #define REG_CMTP_REGB 0x300B
  387. #define REG_CMTP_REGC 0x300C
  388. #define REG_CMTP_REGD 0x300D
  389. #define REG_CMTP_REGE 0x300E
  390. #define REG_CMTP_REGF 0x300F
  391. #define REG_CMTP_REG10 0x3010
  392. #define REG_CMTP_REG11 0x3011
  393. /* Page 0x80 - CEC */
  394. #define REG_PWR_CONTROL 0x80F4
  395. #define REG_OSC_DIVIDER 0x80F5
  396. #define REG_EN_OSC_PERIOD_LSB 0x80F8
  397. #define REG_CONTROL 0x80FF
  398. /* global interrupt flags (INT_FLG_CRL_TOP) */
  399. #define INTERRUPT_AFE BIT(7) /* AFE module */
  400. #define INTERRUPT_HDCP BIT(6) /* HDCP module */
  401. #define INTERRUPT_AUDIO BIT(5) /* Audio module */
  402. #define INTERRUPT_INFO BIT(4) /* Infoframe module */
  403. #define INTERRUPT_MODE BIT(3) /* HDMI mode module */
  404. #define INTERRUPT_RATE BIT(2) /* rate module */
  405. #define INTERRUPT_DDC BIT(1) /* DDC module */
  406. #define INTERRUPT_SUS BIT(0) /* SUS module */
  407. /* INT_FLG_CLR_HDCP bits */
  408. #define MASK_HDCP_MTP BIT(7) /* HDCP MTP busy */
  409. #define MASK_HDCP_DLMTP BIT(4) /* HDCP end download MTP to SRAM */
  410. #define MASK_HDCP_DLRAM BIT(3) /* HDCP end download keys from SRAM */
  411. #define MASK_HDCP_ENC BIT(2) /* HDCP ENC */
  412. #define MASK_STATE_C5 BIT(1) /* HDCP State C5 reached */
  413. #define MASK_AKSV BIT(0) /* AKSV received (start of auth) */
  414. /* INT_FLG_CLR_RATE bits */
  415. #define MASK_RATE_B_DRIFT BIT(7) /* Rate measurement drifted */
  416. #define MASK_RATE_B_ST BIT(6) /* Rate measurement stability change */
  417. #define MASK_RATE_B_ACT BIT(5) /* Rate measurement activity change */
  418. #define MASK_RATE_B_PST BIT(4) /* Rate measreument presence change */
  419. #define MASK_RATE_A_DRIFT BIT(3) /* Rate measurement drifted */
  420. #define MASK_RATE_A_ST BIT(2) /* Rate measurement stability change */
  421. #define MASK_RATE_A_ACT BIT(1) /* Rate measurement presence change */
  422. #define MASK_RATE_A_PST BIT(0) /* Rate measreument presence change */
  423. /* INT_FLG_CLR_SUS (Start Up Sequencer) bits */
  424. #define MASK_MPT BIT(7) /* Config MTP end of process */
  425. #define MASK_FMT BIT(5) /* Video format changed */
  426. #define MASK_RT_PULSE BIT(4) /* End of termination resistance pulse */
  427. #define MASK_SUS_END BIT(3) /* SUS last state reached */
  428. #define MASK_SUS_ACT BIT(2) /* Activity of selected input changed */
  429. #define MASK_SUS_CH BIT(1) /* Selected input changed */
  430. #define MASK_SUS_ST BIT(0) /* SUS state changed */
  431. /* INT_FLG_CLR_DDC bits */
  432. #define MASK_EDID_MTP BIT(7) /* EDID MTP end of process */
  433. #define MASK_DDC_ERR BIT(6) /* master DDC error */
  434. #define MASK_DDC_CMD_DONE BIT(5) /* master DDC cmd send correct */
  435. #define MASK_READ_DONE BIT(4) /* End of down EDID read */
  436. #define MASK_RX_DDC_SW BIT(3) /* Output DDC switching finished */
  437. #define MASK_HDCP_DDC_SW BIT(2) /* HDCP DDC switching finished */
  438. #define MASK_HDP_PULSE_END BIT(1) /* End of Hot Plug Detect pulse */
  439. #define MASK_DET_5V BIT(0) /* Detection of +5V */
  440. /* INT_FLG_CLR_MODE bits */
  441. #define MASK_HDMI_FLG BIT(7) /* HDMI mode/avmute/encrypt/FIFO fail */
  442. #define MASK_GAMUT BIT(6) /* Gamut packet */
  443. #define MASK_ISRC2 BIT(5) /* ISRC2 packet */
  444. #define MASK_ISRC1 BIT(4) /* ISRC1 packet */
  445. #define MASK_ACP BIT(3) /* Audio Content Protection packet */
  446. #define MASK_DC_NO_GCP BIT(2) /* GCP not received in 5 frames */
  447. #define MASK_DC_PHASE BIT(1) /* deepcolor pixel phase needs update */
  448. #define MASK_DC_MODE BIT(0) /* deepcolor color depth changed */
  449. /* INT_FLG_CLR_INFO bits (Infoframe Change Status) */
  450. #define MASK_MPS_IF BIT(6) /* MPEG Source Product */
  451. #define MASK_AUD_IF BIT(5) /* Audio */
  452. #define MASK_SPD_IF BIT(4) /* Source Product Descriptor */
  453. #define MASK_AVI_IF BIT(3) /* Auxiliary Video IF */
  454. #define MASK_VS_IF_OTHER_BK2 BIT(2) /* Vendor Specific (bank2) */
  455. #define MASK_VS_IF_OTHER_BK1 BIT(1) /* Vendor Specific (bank1) */
  456. #define MASK_VS_IF_HDMI BIT(0) /* Vendor Specific (w/ HDMI LLC code) */
  457. /* INT_FLG_CLR_AUDIO bits */
  458. #define MASK_AUDIO_FREQ_FLG BIT(5) /* Audio freq change */
  459. #define MASK_AUDIO_FLG BIT(4) /* DST, OBA, HBR, ASP change */
  460. #define MASK_MUTE_FLG BIT(3) /* Audio Mute */
  461. #define MASK_CH_STATE BIT(2) /* Channel status */
  462. #define MASK_UNMUTE_FIFO BIT(1) /* Audio Unmute */
  463. #define MASK_ERROR_FIFO_PT BIT(0) /* Audio FIFO pointer error */
  464. /* INT_FLG_CLR_AFE bits */
  465. #define MASK_AFE_WDL_UNLOCKED BIT(7) /* Wordlocker was unlocked */
  466. #define MASK_AFE_GAIN_DONE BIT(6) /* Gain calibration done */
  467. #define MASK_AFE_OFFSET_DONE BIT(5) /* Offset calibration done */
  468. #define MASK_AFE_ACTIVITY_DET BIT(4) /* Activity detected on data */
  469. #define MASK_AFE_PLL_LOCK BIT(3) /* TMDS PLL is locked */
  470. #define MASK_AFE_TRMCAL_DONE BIT(2) /* Termination calibration done */
  471. #define MASK_AFE_ASU_STATE BIT(1) /* ASU state is reached */
  472. #define MASK_AFE_ASU_READY BIT(0) /* AFE calibration done: TMDS ready */
  473. /* Audio Output */
  474. #define AUDCFG_CLK_INVERT BIT(7) /* invert A_CLK polarity */
  475. #define AUDCFG_TEST_TONE BIT(6) /* enable test tone generator */
  476. #define AUDCFG_BUS_SHIFT 5
  477. #define AUDCFG_BUS_I2S 0L
  478. #define AUDCFG_BUS_SPDIF 1L
  479. #define AUDCFG_I2SW_SHIFT 4
  480. #define AUDCFG_I2SW_16 0L
  481. #define AUDCFG_I2SW_32 1L
  482. #define AUDCFG_AUTO_MUTE_EN BIT(3) /* Enable Automatic audio mute */
  483. #define AUDCFG_HBR_SHIFT 2
  484. #define AUDCFG_HBR_STRAIGHT 0L /* straight via AP0 */
  485. #define AUDCFG_HBR_DEMUX 1L /* demuxed via AP0:AP3 */
  486. #define AUDCFG_TYPE_MASK 0x03
  487. #define AUDCFG_TYPE_SHIFT 0
  488. #define AUDCFG_TYPE_DST 3L /* Direct Stream Transfer (DST) */
  489. #define AUDCFG_TYPE_OBA 2L /* One Bit Audio (OBA) */
  490. #define AUDCFG_TYPE_HBR 1L /* High Bit Rate (HBR) */
  491. #define AUDCFG_TYPE_PCM 0L /* Audio samples */
  492. /* Video Formatter */
  493. #define OF_VP_ENABLE BIT(7) /* VP[35:0]/HS/VS/DE/CLK */
  494. #define OF_BLK BIT(4) /* blanking codes */
  495. #define OF_TRC BIT(3) /* timing codes (SAV/EAV) */
  496. #define OF_FMT_MASK 0x3
  497. #define OF_FMT_444 0L /* RGB444/YUV444 */
  498. #define OF_FMT_422_SMPT 1L /* YUV422 semi-planar */
  499. #define OF_FMT_422_CCIR 2L /* YUV422 CCIR656 */
  500. /* HS/HREF output control */
  501. #define HS_HREF_DELAY_MASK 0xf0
  502. #define HS_HREF_DELAY_SHIFT 4 /* Pixel delay (-8..+7) */
  503. #define HS_HREF_PXQ_SHIFT 3 /* Timing codes from HREF */
  504. #define HS_HREF_INV_SHIFT 2 /* polarity (1=invert) */
  505. #define HS_HREF_SEL_MASK 0x03
  506. #define HS_HREF_SEL_SHIFT 0
  507. #define HS_HREF_SEL_HS_VHREF 0L /* HS from VHREF */
  508. #define HS_HREF_SEL_HREF_VHREF 1L /* HREF from VHREF */
  509. #define HS_HREF_SEL_HREF_HDMI 2L /* HREF from HDMI */
  510. #define HS_HREF_SEL_NONE 3L /* not generated */
  511. /* VS output control */
  512. #define VS_VREF_DELAY_MASK 0xf0
  513. #define VS_VREF_DELAY_SHIFT 4 /* Pixel delay (-8..+7) */
  514. #define VS_VREF_INV_SHIFT 2 /* polarity (1=invert) */
  515. #define VS_VREF_SEL_MASK 0x03
  516. #define VS_VREF_SEL_SHIFT 0
  517. #define VS_VREF_SEL_VS_VHREF 0L /* VS from VHREF */
  518. #define VS_VREF_SEL_VREF_VHREF 1L /* VREF from VHREF */
  519. #define VS_VREF_SEL_VREF_HDMI 2L /* VREF from HDMI */
  520. #define VS_VREF_SEL_NONE 3L /* not generated */
  521. /* DE/FREF output control */
  522. #define DE_FREF_DELAY_MASK 0xf0
  523. #define DE_FREF_DELAY_SHIFT 4 /* Pixel delay (-8..+7) */
  524. #define DE_FREF_DE_PXQ_SHIFT 3 /* Timing codes from DE */
  525. #define DE_FREF_INV_SHIFT 2 /* polarity (1=invert) */
  526. #define DE_FREF_SEL_MASK 0x03
  527. #define DE_FREF_SEL_SHIFT 0
  528. #define DE_FREF_SEL_DE_VHREF 0L /* DE from VHREF (HREF and not(VREF) */
  529. #define DE_FREF_SEL_FREF_VHREF 1L /* FREF from VHREF */
  530. #define DE_FREF_SEL_FREF_HDMI 2L /* FREF from HDMI */
  531. #define DE_FREF_SEL_NONE 3L /* not generated */
  532. /* HDMI_SOFT_RST bits */
  533. #define RESET_DC BIT(7) /* Reset deep color module */
  534. #define RESET_HDCP BIT(6) /* Reset HDCP module */
  535. #define RESET_KSV BIT(5) /* Reset KSV-FIFO */
  536. #define RESET_SCFG BIT(4) /* Reset HDCP and repeater function */
  537. #define RESET_HCFG BIT(3) /* Reset HDCP DDC part */
  538. #define RESET_PA BIT(2) /* Reset polarity adjust */
  539. #define RESET_EP BIT(1) /* Reset Error protection */
  540. #define RESET_TMDS BIT(0) /* Reset TMDS (calib, encoding, flow) */
  541. /* HDMI_INFO_RST bits */
  542. #define NACK_HDCP BIT(7) /* No ACK on HDCP request */
  543. #define RESET_FIFO BIT(4) /* Reset Audio FIFO control */
  544. #define RESET_GAMUT BIT(3) /* Clear Gamut packet */
  545. #define RESET_AI BIT(2) /* Clear ACP and ISRC packets */
  546. #define RESET_IF BIT(1) /* Clear all Audio infoframe packets */
  547. #define RESET_AUDIO BIT(0) /* Reset Audio FIFO control */
  548. /* HDCP_BCAPS bits */
  549. #define HDCP_HDMI BIT(7) /* HDCP suports HDMI (vs DVI only) */
  550. #define HDCP_REPEATER BIT(6) /* HDCP supports repeater function */
  551. #define HDCP_READY BIT(5) /* set by repeater function */
  552. #define HDCP_FAST BIT(4) /* Up to 400kHz */
  553. #define HDCP_11 BIT(1) /* HDCP 1.1 supported */
  554. #define HDCP_FAST_REAUTH BIT(0) /* fast reauthentication supported */
  555. /* Audio output formatter */
  556. #define AUDIO_LAYOUT_SP_FLAG BIT(2) /* sp flag used by FIFO */
  557. #define AUDIO_LAYOUT_MANUAL BIT(1) /* manual layout (vs per pkt) */
  558. #define AUDIO_LAYOUT_LAYOUT1 BIT(0) /* Layout1: AP0-3 vs Layout0:AP0 */
  559. /* masks for interrupt status registers */
  560. #define MASK_SUS_STATUS 0x1F
  561. #define LAST_STATE_REACHED 0x1B
  562. #define MASK_CLK_STABLE 0x04
  563. #define MASK_CLK_ACTIVE 0x02
  564. #define MASK_SUS_STATE 0x10
  565. #define MASK_SR_FIFO_FIFO_CTRL 0x30
  566. #define MASK_AUDIO_FLAG 0x10
  567. /* Rate measurement */
  568. #define RATE_REFTIM_ENABLE 0x01
  569. #define CLK_MIN_RATE 0x0057e4
  570. #define CLK_MAX_RATE 0x0395f8
  571. #define WDL_CFG_VAL 0x82
  572. #define DC_FILTER_VAL 0x31
  573. /* Infoframe */
  574. #define VS_HDMI_IF_UPDATE 0x0200
  575. #define VS_HDMI_IF 0x0201
  576. #define VS_BK1_IF_UPDATE 0x0220
  577. #define VS_BK1_IF 0x0221
  578. #define VS_BK2_IF_UPDATE 0x0240
  579. #define VS_BK2_IF 0x0241
  580. #define AVI_IF_UPDATE 0x0260
  581. #define AVI_IF 0x0261
  582. #define SPD_IF_UPDATE 0x0280
  583. #define SPD_IF 0x0281
  584. #define AUD_IF_UPDATE 0x02a0
  585. #define AUD_IF 0x02a1
  586. #define MPS_IF_UPDATE 0x02c0
  587. #define MPS_IF 0x02c1