mdss_hdmi_util.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. /* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #ifndef __HDMI_UTIL_H__
  13. #define __HDMI_UTIL_H__
  14. #include "mdss_io_util.h"
  15. #include "video/msm_hdmi_modes.h"
  16. /* HDMI_TX Registers */
  17. #define HDMI_CTRL (0x00000000)
  18. #define HDMI_TEST_PATTERN (0x00000010)
  19. #define HDMI_RANDOM_PATTERN (0x00000014)
  20. #define HDMI_PKT_BLK_CTRL (0x00000018)
  21. #define HDMI_STATUS (0x0000001C)
  22. #define HDMI_AUDIO_PKT_CTRL (0x00000020)
  23. #define HDMI_ACR_PKT_CTRL (0x00000024)
  24. #define HDMI_VBI_PKT_CTRL (0x00000028)
  25. #define HDMI_INFOFRAME_CTRL0 (0x0000002C)
  26. #define HDMI_INFOFRAME_CTRL1 (0x00000030)
  27. #define HDMI_GEN_PKT_CTRL (0x00000034)
  28. #define HDMI_ACP (0x0000003C)
  29. #define HDMI_GC (0x00000040)
  30. #define HDMI_AUDIO_PKT_CTRL2 (0x00000044)
  31. #define HDMI_ISRC1_0 (0x00000048)
  32. #define HDMI_ISRC1_1 (0x0000004C)
  33. #define HDMI_ISRC1_2 (0x00000050)
  34. #define HDMI_ISRC1_3 (0x00000054)
  35. #define HDMI_ISRC1_4 (0x00000058)
  36. #define HDMI_ISRC2_0 (0x0000005C)
  37. #define HDMI_ISRC2_1 (0x00000060)
  38. #define HDMI_ISRC2_2 (0x00000064)
  39. #define HDMI_ISRC2_3 (0x00000068)
  40. #define HDMI_AVI_INFO0 (0x0000006C)
  41. #define HDMI_AVI_INFO1 (0x00000070)
  42. #define HDMI_AVI_INFO2 (0x00000074)
  43. #define HDMI_AVI_INFO3 (0x00000078)
  44. #define HDMI_MPEG_INFO0 (0x0000007C)
  45. #define HDMI_MPEG_INFO1 (0x00000080)
  46. #define HDMI_GENERIC0_HDR (0x00000084)
  47. #define HDMI_GENERIC0_0 (0x00000088)
  48. #define HDMI_GENERIC0_1 (0x0000008C)
  49. #define HDMI_GENERIC0_2 (0x00000090)
  50. #define HDMI_GENERIC0_3 (0x00000094)
  51. #define HDMI_GENERIC0_4 (0x00000098)
  52. #define HDMI_GENERIC0_5 (0x0000009C)
  53. #define HDMI_GENERIC0_6 (0x000000A0)
  54. #define HDMI_GENERIC1_HDR (0x000000A4)
  55. #define HDMI_GENERIC1_0 (0x000000A8)
  56. #define HDMI_GENERIC1_1 (0x000000AC)
  57. #define HDMI_GENERIC1_2 (0x000000B0)
  58. #define HDMI_GENERIC1_3 (0x000000B4)
  59. #define HDMI_GENERIC1_4 (0x000000B8)
  60. #define HDMI_GENERIC1_5 (0x000000BC)
  61. #define HDMI_GENERIC1_6 (0x000000C0)
  62. #define HDMI_ACR_32_0 (0x000000C4)
  63. #define HDMI_ACR_32_1 (0x000000C8)
  64. #define HDMI_ACR_44_0 (0x000000CC)
  65. #define HDMI_ACR_44_1 (0x000000D0)
  66. #define HDMI_ACR_48_0 (0x000000D4)
  67. #define HDMI_ACR_48_1 (0x000000D8)
  68. #define HDMI_ACR_STATUS_0 (0x000000DC)
  69. #define HDMI_ACR_STATUS_1 (0x000000E0)
  70. #define HDMI_AUDIO_INFO0 (0x000000E4)
  71. #define HDMI_AUDIO_INFO1 (0x000000E8)
  72. #define HDMI_CS_60958_0 (0x000000EC)
  73. #define HDMI_CS_60958_1 (0x000000F0)
  74. #define HDMI_RAMP_CTRL0 (0x000000F8)
  75. #define HDMI_RAMP_CTRL1 (0x000000FC)
  76. #define HDMI_RAMP_CTRL2 (0x00000100)
  77. #define HDMI_RAMP_CTRL3 (0x00000104)
  78. #define HDMI_CS_60958_2 (0x00000108)
  79. #define HDMI_HDCP_CTRL (0x00000110)
  80. #define HDMI_HDCP_DEBUG_CTRL (0x00000114)
  81. #define HDMI_HDCP_INT_CTRL (0x00000118)
  82. #define HDMI_HDCP_LINK0_STATUS (0x0000011C)
  83. #define HDMI_HDCP_DDC_CTRL_0 (0x00000120)
  84. #define HDMI_HDCP_DDC_CTRL_1 (0x00000124)
  85. #define HDMI_HDCP_DDC_STATUS (0x00000128)
  86. #define HDMI_HDCP_ENTROPY_CTRL0 (0x0000012C)
  87. #define HDMI_HDCP_RESET (0x00000130)
  88. #define HDMI_HDCP_RCVPORT_DATA0 (0x00000134)
  89. #define HDMI_HDCP_RCVPORT_DATA1 (0x00000138)
  90. #define HDMI_HDCP_RCVPORT_DATA2_0 (0x0000013C)
  91. #define HDMI_HDCP_RCVPORT_DATA2_1 (0x00000140)
  92. #define HDMI_HDCP_RCVPORT_DATA3 (0x00000144)
  93. #define HDMI_HDCP_RCVPORT_DATA4 (0x00000148)
  94. #define HDMI_HDCP_RCVPORT_DATA5 (0x0000014C)
  95. #define HDMI_HDCP_RCVPORT_DATA6 (0x00000150)
  96. #define HDMI_HDCP_RCVPORT_DATA7 (0x00000154)
  97. #define HDMI_HDCP_RCVPORT_DATA8 (0x00000158)
  98. #define HDMI_HDCP_RCVPORT_DATA9 (0x0000015C)
  99. #define HDMI_HDCP_RCVPORT_DATA10 (0x00000160)
  100. #define HDMI_HDCP_RCVPORT_DATA11 (0x00000164)
  101. #define HDMI_HDCP_RCVPORT_DATA12 (0x00000168)
  102. #define HDMI_VENSPEC_INFO0 (0x0000016C)
  103. #define HDMI_VENSPEC_INFO1 (0x00000170)
  104. #define HDMI_VENSPEC_INFO2 (0x00000174)
  105. #define HDMI_VENSPEC_INFO3 (0x00000178)
  106. #define HDMI_VENSPEC_INFO4 (0x0000017C)
  107. #define HDMI_VENSPEC_INFO5 (0x00000180)
  108. #define HDMI_VENSPEC_INFO6 (0x00000184)
  109. #define HDMI_HDCP_DEBUG (0x00000194)
  110. #define HDMI_TMDS_CTRL_CHAR (0x0000019C)
  111. #define HDMI_TMDS_CTRL_SEL (0x000001A4)
  112. #define HDMI_TMDS_SYNCCHAR01 (0x000001A8)
  113. #define HDMI_TMDS_SYNCCHAR23 (0x000001AC)
  114. #define HDMI_TMDS_DEBUG (0x000001B4)
  115. #define HDMI_TMDS_CTL_BITS (0x000001B8)
  116. #define HDMI_TMDS_DCBAL_CTRL (0x000001BC)
  117. #define HDMI_TMDS_DCBAL_CHAR (0x000001C0)
  118. #define HDMI_TMDS_CTL01_GEN (0x000001C8)
  119. #define HDMI_TMDS_CTL23_GEN (0x000001CC)
  120. #define HDMI_AUDIO_CFG (0x000001D0)
  121. #define HDMI_DEBUG (0x00000204)
  122. #define HDMI_USEC_REFTIMER (0x00000208)
  123. #define HDMI_DDC_CTRL (0x0000020C)
  124. #define HDMI_DDC_ARBITRATION (0x00000210)
  125. #define HDMI_DDC_INT_CTRL (0x00000214)
  126. #define HDMI_DDC_SW_STATUS (0x00000218)
  127. #define HDMI_DDC_HW_STATUS (0x0000021C)
  128. #define HDMI_DDC_SPEED (0x00000220)
  129. #define HDMI_DDC_SETUP (0x00000224)
  130. #define HDMI_DDC_TRANS0 (0x00000228)
  131. #define HDMI_DDC_TRANS1 (0x0000022C)
  132. #define HDMI_DDC_TRANS2 (0x00000230)
  133. #define HDMI_DDC_TRANS3 (0x00000234)
  134. #define HDMI_DDC_DATA (0x00000238)
  135. #define HDMI_HDCP_SHA_CTRL (0x0000023C)
  136. #define HDMI_HDCP_SHA_STATUS (0x00000240)
  137. #define HDMI_HDCP_SHA_DATA (0x00000244)
  138. #define HDMI_HDCP_SHA_DBG_M0_0 (0x00000248)
  139. #define HDMI_HDCP_SHA_DBG_M0_1 (0x0000024C)
  140. #define HDMI_HPD_INT_STATUS (0x00000250)
  141. #define HDMI_HPD_INT_CTRL (0x00000254)
  142. #define HDMI_HPD_CTRL (0x00000258)
  143. #define HDMI_HDCP_ENTROPY_CTRL1 (0x0000025C)
  144. #define HDMI_HDCP_SW_UPPER_AN (0x00000260)
  145. #define HDMI_HDCP_SW_LOWER_AN (0x00000264)
  146. #define HDMI_CRC_CTRL (0x00000268)
  147. #define HDMI_VID_CRC (0x0000026C)
  148. #define HDMI_AUD_CRC (0x00000270)
  149. #define HDMI_VBI_CRC (0x00000274)
  150. #define HDMI_DDC_REF (0x0000027C)
  151. #define HDMI_HDCP_SW_UPPER_AKSV (0x00000284)
  152. #define HDMI_HDCP_SW_LOWER_AKSV (0x00000288)
  153. #define HDMI_CEC_CTRL (0x0000028C)
  154. #define HDMI_CEC_WR_DATA (0x00000290)
  155. #define HDMI_CEC_RETRANSMIT (0x00000294)
  156. #define HDMI_CEC_STATUS (0x00000298)
  157. #define HDMI_CEC_INT (0x0000029C)
  158. #define HDMI_CEC_ADDR (0x000002A0)
  159. #define HDMI_CEC_TIME (0x000002A4)
  160. #define HDMI_CEC_REFTIMER (0x000002A8)
  161. #define HDMI_CEC_RD_DATA (0x000002AC)
  162. #define HDMI_CEC_RD_FILTER (0x000002B0)
  163. #define HDMI_ACTIVE_H (0x000002B4)
  164. #define HDMI_ACTIVE_V (0x000002B8)
  165. #define HDMI_ACTIVE_V_F2 (0x000002BC)
  166. #define HDMI_TOTAL (0x000002C0)
  167. #define HDMI_V_TOTAL_F2 (0x000002C4)
  168. #define HDMI_FRAME_CTRL (0x000002C8)
  169. #define HDMI_AUD_INT (0x000002CC)
  170. #define HDMI_DEBUG_BUS_CTRL (0x000002D0)
  171. #define HDMI_PHY_CTRL (0x000002D4)
  172. #define HDMI_CEC_WR_RANGE (0x000002DC)
  173. #define HDMI_CEC_RD_RANGE (0x000002E0)
  174. #define HDMI_VERSION (0x000002E4)
  175. #define HDMI_BIST_ENABLE (0x000002F4)
  176. #define HDMI_TIMING_ENGINE_EN (0x000002F8)
  177. #define HDMI_INTF_CONFIG (0x000002FC)
  178. #define HDMI_HSYNC_CTL (0x00000300)
  179. #define HDMI_VSYNC_PERIOD_F0 (0x00000304)
  180. #define HDMI_VSYNC_PERIOD_F1 (0x00000308)
  181. #define HDMI_VSYNC_PULSE_WIDTH_F0 (0x0000030C)
  182. #define HDMI_VSYNC_PULSE_WIDTH_F1 (0x00000310)
  183. #define HDMI_DISPLAY_V_START_F0 (0x00000314)
  184. #define HDMI_DISPLAY_V_START_F1 (0x00000318)
  185. #define HDMI_DISPLAY_V_END_F0 (0x0000031C)
  186. #define HDMI_DISPLAY_V_END_F1 (0x00000320)
  187. #define HDMI_ACTIVE_V_START_F0 (0x00000324)
  188. #define HDMI_ACTIVE_V_START_F1 (0x00000328)
  189. #define HDMI_ACTIVE_V_END_F0 (0x0000032C)
  190. #define HDMI_ACTIVE_V_END_F1 (0x00000330)
  191. #define HDMI_DISPLAY_HCTL (0x00000334)
  192. #define HDMI_ACTIVE_HCTL (0x00000338)
  193. #define HDMI_HSYNC_SKEW (0x0000033C)
  194. #define HDMI_POLARITY_CTL (0x00000340)
  195. #define HDMI_TPG_MAIN_CONTROL (0x00000344)
  196. #define HDMI_TPG_VIDEO_CONFIG (0x00000348)
  197. #define HDMI_TPG_COMPONENT_LIMITS (0x0000034C)
  198. #define HDMI_TPG_RECTANGLE (0x00000350)
  199. #define HDMI_TPG_INITIAL_VALUE (0x00000354)
  200. #define HDMI_TPG_BLK_WHT_PATTERN_FRAMES (0x00000358)
  201. #define HDMI_TPG_RGB_MAPPING (0x0000035C)
  202. #define HDMI_CEC_COMPL_CTL (0x00000360)
  203. #define HDMI_CEC_RD_START_RANGE (0x00000364)
  204. #define HDMI_CEC_RD_TOTAL_RANGE (0x00000368)
  205. #define HDMI_CEC_RD_ERR_RESP_LO (0x0000036C)
  206. #define HDMI_CEC_WR_CHECK_CONFIG (0x00000370)
  207. /* HDMI PHY Registers */
  208. #define HDMI_PHY_ANA_CFG0 (0x00000000)
  209. #define HDMI_PHY_ANA_CFG1 (0x00000004)
  210. #define HDMI_PHY_PD_CTRL0 (0x00000010)
  211. #define HDMI_PHY_PD_CTRL1 (0x00000014)
  212. #define HDMI_PHY_BIST_CFG0 (0x00000034)
  213. #define HDMI_PHY_BIST_PATN0 (0x0000003C)
  214. #define HDMI_PHY_BIST_PATN1 (0x00000040)
  215. #define HDMI_PHY_BIST_PATN2 (0x00000044)
  216. #define HDMI_PHY_BIST_PATN3 (0x00000048)
  217. /* QFPROM Registers for HDMI/HDCP */
  218. #define QFPROM_RAW_FEAT_CONFIG_ROW0_LSB (0x000000F8)
  219. #define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB (0x000000FC)
  220. #define HDCP_KSV_LSB (0x000060D8)
  221. #define HDCP_KSV_MSB (0x000060DC)
  222. #define TOP_AND_BOTTOM 0x10
  223. #define FRAME_PACKING 0x20
  224. #define SIDE_BY_SIDE_HALF 0x40
  225. enum hdmi_tx_feature_type {
  226. HDMI_TX_FEAT_EDID,
  227. HDMI_TX_FEAT_HDCP,
  228. HDMI_TX_FEAT_CEC,
  229. HDMI_TX_FEAT_MAX,
  230. };
  231. struct hdmi_tx_ddc_ctrl {
  232. struct dss_io_data *io;
  233. struct completion ddc_sw_done;
  234. };
  235. struct hdmi_tx_ddc_data {
  236. char *what;
  237. u8 *data_buf;
  238. u32 data_len;
  239. u32 dev_addr;
  240. u32 offset;
  241. u32 request_len;
  242. u32 no_align;
  243. int retry;
  244. };
  245. /* video timing related utility routines */
  246. void hdmi_setup_video_mode_lut(void);
  247. int hdmi_get_video_id_code(struct msm_hdmi_mode_timing_info *timing_in);
  248. const struct msm_hdmi_mode_timing_info *hdmi_get_supported_mode(u32 mode);
  249. void hdmi_del_supported_mode(u32 mode);
  250. ssize_t hdmi_get_video_3d_fmt_2string(u32 format, char *buf, u32 size);
  251. #if defined (CONFIG_VIDEO_MHL_V2) || defined (CONFIG_VIDEO_MHL_SII8246)
  252. const struct msm_hdmi_mode_timing_info *hdmi_mhl_get_supported_mode(u32 mode);
  253. #endif
  254. /* todo: Fix this. Right now this is defined in mdss_hdmi_tx.c */
  255. void *hdmi_get_featuredata_from_sysfs_dev(struct device *device, u32 type);
  256. /* DDC */
  257. void hdmi_ddc_config(struct hdmi_tx_ddc_ctrl *);
  258. int hdmi_ddc_isr(struct hdmi_tx_ddc_ctrl *);
  259. int hdmi_ddc_write(struct hdmi_tx_ddc_ctrl *, struct hdmi_tx_ddc_data *);
  260. int hdmi_ddc_read_seg(struct hdmi_tx_ddc_ctrl *, struct hdmi_tx_ddc_data *);
  261. int hdmi_ddc_read(struct hdmi_tx_ddc_ctrl *, struct hdmi_tx_ddc_data *);
  262. #endif /* __HDMI_UTIL_H__ */