tda19988.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. /******************************************************************************************************
  2. * drivers/lcd/tda19988.h
  3. * Definitions for the TDA19988. The TDA19988 is a very low power and very small
  4. * size High-Definition Multimedia Interface (HDMI) 1.4a transmitter
  5. *
  6. * Copyright (C) 2018 Gregory Nutt. All rights reserved.
  7. * Author: Gregory Nutt <gnutt@nuttx.org>
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. * 3. Neither the name NuttX nor the names of its contributors may be
  20. * used to endorse or promote products derived from this software
  21. * without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  26. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  27. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  28. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  29. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  30. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  31. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  33. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. * POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. ******************************************************************************************************/
  37. #ifndef __DRIVERS_LCD_TDA19988_H
  38. #define __DRIVERS_LCD_TDA19988_H
  39. /******************************************************************************************************
  40. * Included Files
  41. ******************************************************************************************************/
  42. /******************************************************************************************************
  43. * Pre-processor Definitions
  44. ******************************************************************************************************/
  45. /* CEC Registers **************************************************************************************/
  46. /* The device has two I2C interfaces CEC (0x34) and HDMI (0x70). */
  47. #define CEC_FRO_IM_CLK_CTRL_REG 0xfb
  48. # define CEC_FRO_IM_CLK_CTRL_GHOST_DIS (1 << 7)
  49. # define CEC_FRO_IM_CLK_CTRL_IMCLK_SEL (1 << 1)
  50. #define CEC_STATUS_REG 0xfe
  51. # define CEC_STATUS_CONNECTED (1 << 1)
  52. #define CEC_ENAMODS_REG 0xff
  53. # define CEC_ENAMODS_HDMI (1 << 1)
  54. # define CEC_ENAMODS_RXSENS (1 << 2)
  55. # define CEC_ENABLE_ALL 0x87
  56. /* HDMI Memory Pages **********************************************************************************/
  57. /* HDMI Memory is accessed via page and address. The page must first be selected, then
  58. * only the address is sent in order accessing memory locations within the selected
  59. * page.
  60. */
  61. #define HDMI_CTRL_PAGE 0x00 /* General control page */
  62. #define HDMI_PLL_PAGE 0x02 /* PLL settings page */
  63. #define HDMI_EDID_PAGE 0x09 /* EDID control page */
  64. #define HDMI_INFO_PAGE 0x10 /* Information frames and packets page */
  65. #define HDMI_AUDIO_PAGE 0x11 /* Audio settings and content info packets page */
  66. #define HDMI_HDCPOTP_PAGE 0x12 /* HDCP (TDA19988AHN and TDA19988AET only) and OTP */
  67. #define HDMI_GAMUT_PAGE 0x13 /* Gamut-related metadata packets page */
  68. /* The page select register does not lie within the above pages. The value of 0xff is
  69. * used for this access.
  70. */
  71. #define HDMI_NO_PAGE 0xff
  72. /* Page-related macros */
  73. #define MKREG(page, addr) (((page) << 8) | (addr))
  74. #define REGPAGE(reg) (((reg) >> 8) & 0xff)
  75. #define REGADDR(reg) ((reg) & 0xff)
  76. /* General Control Page Registers and Bit Definitions */
  77. #define HDMI_CTRL_REV_LO_REG MKREG(HDMI_CTRL_PAGE, 0x00)
  78. #define HDMI_CTRL_MAIN_CNTRL0_REG MKREG(HDMI_CTRL_PAGE, 0x01)
  79. # define HDMI_CTRL_MAIN_CNTRL0_SR (1 << 0)
  80. #define HDMI_CTRL_REV_HI_REG MKREG(HDMI_CTRL_PAGE, 0x02)
  81. # define HDMI_CTRL_REV_TDA9989N2 0x0101 /* Masking out bits 4-5 */
  82. # define HDMI_CTRL_REV_TDA19989 0x0201
  83. # define HDMI_CTRL_REV_TDA19989N2 0x0202
  84. # define HDMI_CTRL_REV_TDA19988 0x0301
  85. #define HDMI_CTRL_RESET_REG MKREG(HDMI_CTRL_PAGE, 0x0a)
  86. # define HDMI_CTRL_RESET_AUDIO (1 << 0)
  87. # define HDMI_CTRL_RESET_I2C (1 << 1)
  88. #define HDMI_CTRL_DDC_CTRL_REG MKREG(HDMI_CTRL_PAGE, 0x0b)
  89. # define HDMI_CTRL_DDC_EN 0x00
  90. #define HDMI_CTRL_DDC_CLK_REG MKREG(HDMI_CTRL_PAGE, 0x0c)
  91. # define HDMI_CTRL_DDC_CLK_EN (1 << 0)
  92. #define HDMI_CTRL_INTR_CTRL_REG MKREG(HDMI_CTRL_PAGE, 0x0f)
  93. # define HDMI_CTRL_INTR_EN_GLO (1 << 2)
  94. #define HDMI_CTRL_INT_REG MKREG(HDMI_CTRL_PAGE, 0x11)
  95. # define HDMI_CTRL_INT_EDID (1 << 1)
  96. #define HDMI_CTRL_VIPCTRL_0_REG MKREG(HDMI_CTRL_PAGE, 0x20)
  97. #define HDMI_CTRL_VIPCTRL_1_REG MKREG(HDMI_CTRL_PAGE, 0x21)
  98. #define HDMI_CTRL_VIPCTRL_2_REG MKREG(HDMI_CTRL_PAGE, 0x22)
  99. #define HDMI_CTRL_VIPCTRL_3_REG MKREG(HDMI_CTRL_PAGE, 0x23)
  100. # define HDMI_CTRL_VIPCTRL_3_SYNC_HS (2 << 4)
  101. # define HDMI_CTRL_VIPCTRL_3_V_TGL (1 << 2)
  102. # define HDMI_CTRL_VIPCTRL_3_H_TGL (1 << 1)
  103. #define HDMI_CTRL_VIPCTRL_4_REG MKREG(HDMI_CTRL_PAGE, 0x24)
  104. # define HDMI_CTRL_VIPCTRL_4_BLANKIT_NDE (0 << 2)
  105. # define HDMI_CTRL_VIPCTRL_4_BLANKIT_HS_VS (1 << 2)
  106. # define HDMI_CTRL_VIPCTRL_4_BLANKIT_NHS_VS (2 << 2)
  107. # define HDMI_CTRL_VIPCTRL_4_BLANKIT_HE_VE (3 << 2)
  108. # define HDMI_CTRL_VIPCTRL_4_BLC_NONE (0 << 0)
  109. # define HDMI_CTRL_VIPCTRL_4_BLC_RGB444 (1 << 0)
  110. # define HDMI_CTRL_VIPCTRL_4_BLC_YUV444 (2 << 0)
  111. # define HDMI_CTRL_VIPCTRL_4_BLC_YUV422 (3 << 0)
  112. #define HDMI_CTRL_VIPCTRL_5_REG MKREG(HDMI_CTRL_PAGE, 0x25)
  113. # define HDMI_CTRL_VIPCTRL_5_SP_CNT(n) (((n) & 3) << 1)
  114. #define HDMI_CTRL_MUX_VP_VIP_OUT_REG MKREG(HDMI_CTRL_PAGE, 0x27)
  115. #define HDMI_CTRL_MATCTRL_REG MKREG(HDMI_CTRL_PAGE, 0x80)
  116. # define HDMI_CTRL_MAT_CONTRL_MAT_BP (1 << 2)
  117. #define HDMI_CTRL_MUX_VIDFORMAT_REG MKREG(HDMI_CTRL_PAGE, 0xa0)
  118. #define HDMI_CTRL_MUX_REFPIX_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xa1)
  119. #define HDMI_CTRL_MUX_REFPIX_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xa2)
  120. #define HDMI_CTRL_MUX_REFLINE_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xa3)
  121. #define HDMI_CTRL_MUX_REFLINE_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xa4)
  122. #define HDMI_CTRL_MUX_NPIX_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xa5)
  123. #define HDMI_CTRL_MUX_NPIX_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xa6)
  124. #define HDMI_CTRL_MUX_NLINE_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xa7)
  125. #define HDMI_CTRL_MUX_NLINE_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xa8)
  126. #define HDMI_CTRL_MUX_VS_LINE_STRT_1_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xa9)
  127. #define HDMI_CTRL_MUX_VS_LINE_STRT_1_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xaa)
  128. #define HDMI_CTRL_MUX_VS_PIX_STRT_1_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xab)
  129. #define HDMI_CTRL_VS_PIX_STRT_1_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xac)
  130. #define HDMI_CTRL_VS_LINE_END_1_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xad)
  131. #define HDMI_CTRL_VS_LINE_END_1_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xae)
  132. #define HDMI_CTRL_VS_PIX_END_1_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xaf)
  133. #define HDMI_CTRL_VS_PIX_END_1_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xb0)
  134. #define HDMI_CTRL_VS_LINE_STRT_2_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xb1)
  135. #define HDMI_CTRL_VS_LINE_STRT_2_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xb2)
  136. #define HDMI_CTRL_VS_PIX_STRT_2_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xb3)
  137. #define HDMI_CTRL_VS_PIX_STRT_2_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xb4)
  138. #define HDMI_CTRL_VS_LINE_END_2_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xb5)
  139. #define HDMI_CTRL_VS_LINE_END_2_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xb6)
  140. #define HDMI_CTRL_VS_PIX_END_2_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xb7)
  141. #define HDMI_CTRL_VS_PIX_END_2_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xb8)
  142. #define HDMI_CTRL_HS_PIX_START_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xb9)
  143. #define HDMI_CTRL_HS_PIX_START_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xba)
  144. #define HDMI_CTRL_HS_PIX_STOP_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xbb)
  145. #define HDMI_CTRL_HS_PIX_STOP_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xbc)
  146. #define HDMI_CTRL_VWIN_START_1_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xbd)
  147. #define HDMI_CTRL_VWIN_START_1_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xbe)
  148. #define HDMI_CTRL_VWIN_END_1_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xbf)
  149. #define HDMI_CTRL_VWIN_END_1_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xc0)
  150. #define HDMI_CTRL_VWIN_START_2_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xc1)
  151. #define HDMI_CTRL_VWIN_START_2_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xc2)
  152. #define HDMI_CTRL_VWIN_END_2_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xc3)
  153. #define HDMI_CTRL_VWIN_END_2_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xc4)
  154. #define HDMI_CTRL_DE_START_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xc5)
  155. #define HDMI_CTRL_DE_START_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xc6)
  156. #define HDMI_CTRL_DE_STOP_MSB_REG MKREG(HDMI_CTRL_PAGE, 0xc7)
  157. #define HDMI_CTRL_DE_STOP_LSB_REG MKREG(HDMI_CTRL_PAGE, 0xc8)
  158. #define HDMI_CTRL_TBG_CNTRL_0_REG MKREG(HDMI_CTRL_PAGE, 0xca)
  159. # define HDMI_CTRL_TBG_CNTRL_0_SYNC_MTHD (1 << 6)
  160. # define HDMI_CTRL_TBG_CNTRL_0_SYNC_ONCE (1 << 7)
  161. #define HDMI_CTRL_TBG_CNTRL_1_REG MKREG(HDMI_CTRL_PAGE, 0xcb)
  162. # define HDMI_CTRL_TBG_CNTRL_1_H_TGL (1 << 0)
  163. # define HDMI_CTRL_TBG_CNTRL_1_V_TGL (1 << 1)
  164. # define HDMI_CTRL_TBG_CNTRL_1_TGL_EN (1 << 2)
  165. # define HDMI_CTRL_TBG_CNTRL_1_DWIN_DIS (1 << 6)
  166. #define HDMI_CTRL_HVF_CNTRL_0_REG MKREG(HDMI_CTRL_PAGE, 0xe4)
  167. # define HDMI_CTRL_HVF_CNTRL_0_INTPOL_BYPASS (0 << 0)
  168. # define HDMI_CTRL_HVF_CNTRL_0_PREFIL_NONE (0 << 2)
  169. #define HDMI_CTRL_HVF_CNTRL_1_REG MKREG(HDMI_CTRL_PAGE, 0xe5)
  170. # define HDMI_CTRL_HVF_CNTRL_1_VQR(x) (((x) & 3) << 2)
  171. # define HDMI_CTRL_HVF_CNTRL_1_VQR_FULL HDMI_CTRL_HVF_CNTRL_1_VQR(0)
  172. #define HDMI_CTRL_ENABLE_SPACE_REG MKREG(HDMI_CTRL_PAGE, 0xd6)
  173. #define HDMI_CTRL_RPT_CNTRL_REG MKREG(HDMI_CTRL_PAGE, 0xf0)
  174. /* PLL Page Registers */
  175. #define HDMI_PLL_SERIAL_1_REG MKREG(HDMI_PLL_PAGE, 0x00)
  176. # define HDMI_PLL_SERIAL_1_SRL_MAN_IP (1 << 6)
  177. #define HDMI_PLL_SERIAL_2_REG MKREG(HDMI_PLL_PAGE, 0x01)
  178. # define HDMI_PLL_SERIAL_2_SRL_NOSC(x) (((x) & 0x3) << 0)
  179. # define HDMI_PLL_SERIAL_2_SRL_PR(x) (((x) & 0xf) << 4)
  180. #define HDMI_PLL_SERIAL_3_REG MKREG(HDMI_PLL_PAGE, 0x02)
  181. # define HDMI_PLL_SERIAL_3_SRL_CCIR (1 << 0)
  182. # define HDMI_PLL_SERIAL_3_SRL_DE (1 << 2)
  183. # define HDMI_PLL_SERIAL_3_SRL_PXIN_SEL (1 << 4)
  184. #define HDMI_PLL_SERIALIZER_REG MKREG(HDMI_PLL_PAGE, 0x03)
  185. #define HDMI_PLL_BUFFER_OUT_REG MKREG(HDMI_PLL_PAGE, 0x04)
  186. #define HDMI_PLL_SCG1_REG MKREG(HDMI_PLL_PAGE, 0x05)
  187. #define HDMI_PLL_SCG2_REG MKREG(HDMI_PLL_PAGE, 0x06)
  188. #define HDMI_PLL_SCGN1_REG MKREG(HDMI_PLL_PAGE, 0x07)
  189. #define HDMI_PLL_SCGN2_REG MKREG(HDMI_PLL_PAGE, 0x08)
  190. #define HDMI_PLL_SCGR1_REG MKREG(HDMI_PLL_PAGE, 0x09)
  191. #define HDMI_PLL_SCGR2_REG MKREG(HDMI_PLL_PAGE, 0x0a)
  192. #define HDMI_PLL_SEL_CLK_REG MKREG(HDMI_PLL_PAGE, 0x11)
  193. # define HDMI_PLL_SEL_CLK_ENA_SC_CLK (1 << 3)
  194. # define HDMI_PLL_SEL_CLK_SEL_VRF_CLK(x) (((x) & 3) << 1)
  195. # define HDMI_PLL_SEL_CLK_SEL_CLK1 (1 << 0)
  196. #define HDMI_PLL_ANA_GENERAL_REG MKREG(HDMI_PLL_PAGE, 0x12)
  197. /* EDID Control Page Registers and Bit Definitions */
  198. #define HDMI_EDID_DATA_REG MKREG(HDMI_EDID_PAGE, 0x00)
  199. #define HDMI_EDID_REQ_REG MKREG(HDMI_EDID_PAGE, 0xfa)
  200. # define HDMI_EDID_REQ_READ (1 << 0)
  201. #define HDMI_EDID_DEV_ADDR_REG MKREG(HDMI_EDID_PAGE, 0xfb)
  202. # define HDMI_EDID_DEV_ADDR 0xa0
  203. #define HDMI_EDID_OFFSET_REG MKREG(HDMI_EDID_PAGE, 0xfc)
  204. # define HDMI_EDID_OFFSET 0x00
  205. #define HDMI_EDID_SEGM_ADDR_REG MKREG(HDMI_EDID_PAGE, 0xfd)
  206. #define HDMI_EDID_SEGM_ADDR 0x00
  207. #define HDMI_EDID_DDC_SEGM_REG MKREG(HDMI_EDID_PAGE, 0xfe)
  208. # define HDMI_EDID_SEG_ADDR 0x00
  209. /* HDCP (TDA19988AHN and TDA19988AET only) and OTP Page Registers and Bit
  210. * Definitions.
  211. */
  212. #define HDMI_HDCPOTP_TX3_REG MKREG(HDMI_HDCPOTP_PAGE, 0x9a)
  213. #define HDMI_HDCPOTP_TX4_REG MKREG(HDMI_HDCPOTP_PAGE, 0x9b)
  214. # define HDMI_HDCPOTP_TX4_PDRAM (1 << 1)
  215. #define HDMI_HDCPOTP_TX33_REG MKREG(HDMI_HDCPOTP_PAGE, 0x9b)
  216. # define HDMI_HDCPOTP_TX33_HDMI (1 << 1)
  217. /* Information Frames and Packets Page Registers and Bit Definitions */
  218. #define HDMI_INFO_VSP MKREG(HDMI_INFO_PAGE, 0x20)
  219. #define HDMI_INFO_AVI MKREG(HDMI_INFO_PAGE, 0x40)
  220. #define HDMI_INFO_SPD MKREG(HDMI_INFO_PAGE, 0x60)
  221. #define HDMI_INFO_AUD MKREG(HDMI_INFO_PAGE, 0x80)
  222. #define HDMI_INFO_MPS MKREG(HDMI_INFO_PAGE, 0xa0)
  223. /* Audio settings and content info packets page Registers and Bit Definitions */
  224. #define HDMI_AUDIO_ENC_CTRL_REG MKREG(HDMI_AUDIO_PAGE, 0x0d)
  225. # define HDMI_AUDIO_ENC_CNTRL_DVI_MODE (0 << 2)
  226. # define HDMI_AUDIO_ENC_CNTRL_HDMI_MODE (1 << 2)
  227. #define HDMI_AUDIO_DIP_IF_FLAGS_REG MKREG(HDMI_AUDIO_PAGE, 0x0f)
  228. # define HDMI_AUDIO_DIP_IF_FLAGS_IF1 (1 << 1)
  229. # define HDMI_AUDIO_DIP_IF_FLAGS_IF2 (1 << 2) /* AVI IF on page 10h */
  230. # define HDMI_AUDIO_DIP_IF_FLAGS_IF3 (1 << 3)
  231. # define HDMI_AUDIO_DIP_IF_FLAGS_IF4 (1 << 4)
  232. # define HDMI_AUDIO_DIP_IF_FLAGS_IF5 (1 << 5)
  233. /* Page Select Register (no page) */
  234. #define HDMI_PAGE_SELECT_REG MKREG(HDMI_NO_PAGE, 0xff)
  235. #endif /* __DRIVERS_LCD_TDA19988_H */