mdp3_hwio.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. /* Copyright (c) 2013-2014, 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. */
  13. #ifndef MDP3_HWIO_H
  14. #define MDP3_HWIO_H
  15. #include <linux/bitops.h>
  16. /*synchronization*/
  17. #define MDP3_REG_SYNC_CONFIG_0 0x0300
  18. #define MDP3_REG_SYNC_CONFIG_1 0x0304
  19. #define MDP3_REG_SYNC_CONFIG_2 0x0308
  20. #define MDP3_REG_SYNC_STATUS_0 0x030c
  21. #define MDP3_REG_SYNC_STATUS_1 0x0310
  22. #define MDP3_REG_SYNC_STATUS_2 0x0314
  23. #define MDP3_REG_PRIMARY_VSYNC_OUT_CTRL 0x0318
  24. #define MDP3_REG_SECONDARY_VSYNC_OUT_CTRL 0x031c
  25. #define MDP3_REG_EXTERNAL_VSYNC_OUT_CTRL 0x0320
  26. #define MDP3_REG_VSYNC_SEL 0x0324
  27. #define MDP3_REG_PRIMARY_VSYNC_INIT_VAL 0x0328
  28. #define MDP3_REG_SECONDARY_VSYNC_INIT_VAL 0x032c
  29. #define MDP3_REG_EXTERNAL_VSYNC_INIT_VAL 0x0330
  30. #define MDP3_REG_SYNC_THRESH_0 0x0200
  31. #define MDP3_REG_SYNC_THRESH_1 0x0204
  32. #define MDP3_REG_SYNC_THRESH_2 0x0208
  33. #define MDP3_REG_TEAR_CHECK_EN 0x020C
  34. #define MDP3_REG_PRIMARY_START_P0S 0x0210
  35. #define MDP3_REG_SECONDARY_START_POS 0x0214
  36. #define MDP3_REG_EXTERNAL_START_POS 0x0218
  37. /*interrupt*/
  38. #define MDP3_REG_INTR_ENABLE 0x0020
  39. #define MDP3_REG_INTR_STATUS 0x0024
  40. #define MDP3_REG_INTR_CLEAR 0x0028
  41. #define MDP3_REG_PRIMARY_RD_PTR_IRQ 0x021C
  42. #define MDP3_REG_SECONDARY_RD_PTR_IRQ 0x0220
  43. /*operation control*/
  44. #define MDP3_REG_DMA_P_START 0x0044
  45. #define MDP3_REG_DMA_S_START 0x0048
  46. #define MDP3_REG_DMA_E_START 0x004c
  47. #define MDP3_REG_DISPLAY_STATUS 0x0038
  48. #define MDP3_REG_HW_VERSION 0x0070
  49. #define MDP3_REG_SW_RESET 0x0074
  50. #define MDP3_REG_SEL_CLK_OR_HCLK_TEST_BUS 0x007C
  51. /*EBI*/
  52. #define MDP3_REG_EBI2_LCD0 0x003c
  53. #define MDP3_REG_EBI2_LCD0_YSTRIDE 0x0050
  54. /*clock control*/
  55. #define MDP3_REG_CGC_EN 0x0100
  56. /*DMA_P*/
  57. #define MDP3_REG_DMA_P_CONFIG 0x90000
  58. #define MDP3_REG_DMA_P_SIZE 0x90004
  59. #define MDP3_REG_DMA_P_IBUF_ADDR 0x90008
  60. #define MDP3_REG_DMA_P_IBUF_Y_STRIDE 0x9000C
  61. #define MDP3_REG_DMA_P_PROFILE_EN 0x90020
  62. #define MDP3_REG_DMA_P_OUT_XY 0x90010
  63. #define MDP3_REG_DMA_P_CURSOR_FORMAT 0x90040
  64. #define MDP3_REG_DMA_P_CURSOR_SIZE 0x90044
  65. #define MDP3_REG_DMA_P_CURSOR_BUF_ADDR 0x90048
  66. #define MDP3_REG_DMA_P_CURSOR_POS 0x9004c
  67. #define MDP3_REG_DMA_P_CURSOR_BLEND_CONFIG 0x90060
  68. #define MDP3_REG_DMA_P_CURSOR_BLEND_PARAM 0x90064
  69. #define MDP3_REG_DMA_P_CURSOR_BLEND_TRANS_MASK 0x90068
  70. #define MDP3_REG_DMA_P_COLOR_CORRECT_CONFIG 0x90070
  71. #define MDP3_REG_DMA_P_CSC_BYPASS 0X93004
  72. #define MDP3_REG_DMA_P_CSC_MV1 0x93400
  73. #define MDP3_REG_DMA_P_CSC_MV2 0x93440
  74. #define MDP3_REG_DMA_P_CSC_PRE_BV1 0x93500
  75. #define MDP3_REG_DMA_P_CSC_PRE_BV2 0x93540
  76. #define MDP3_REG_DMA_P_CSC_POST_BV1 0x93580
  77. #define MDP3_REG_DMA_P_CSC_POST_BV2 0x935c0
  78. #define MDP3_REG_DMA_P_CSC_PRE_LV1 0x93600
  79. #define MDP3_REG_DMA_P_CSC_PRE_LV2 0x93640
  80. #define MDP3_REG_DMA_P_CSC_POST_LV1 0x93680
  81. #define MDP3_REG_DMA_P_CSC_POST_LV2 0x936c0
  82. #define MDP3_REG_DMA_P_CSC_LUT1 0x93800
  83. #define MDP3_REG_DMA_P_CSC_LUT2 0x93c00
  84. #define MDP3_REG_DMA_P_HIST_START 0x94000
  85. #define MDP3_REG_DMA_P_HIST_FRAME_CNT 0x94004
  86. #define MDP3_REG_DMA_P_HIST_BIT_MASK 0x94008
  87. #define MDP3_REG_DMA_P_HIST_RESET_SEQ_START 0x9400c
  88. #define MDP3_REG_DMA_P_HIST_CONTROL 0x94010
  89. #define MDP3_REG_DMA_P_HIST_INTR_STATUS 0x94014
  90. #define MDP3_REG_DMA_P_HIST_INTR_CLEAR 0x94018
  91. #define MDP3_REG_DMA_P_HIST_INTR_ENABLE 0x9401c
  92. #define MDP3_REG_DMA_P_HIST_STOP_REQ 0x94020
  93. #define MDP3_REG_DMA_P_HIST_CANCEL_REQ 0x94024
  94. #define MDP3_REG_DMA_P_HIST_EXTRA_INFO_0 0x94028
  95. #define MDP3_REG_DMA_P_HIST_EXTRA_INFO_1 0x9402c
  96. #define MDP3_REG_DMA_P_HIST_R_DATA 0x94100
  97. #define MDP3_REG_DMA_P_HIST_G_DATA 0x94200
  98. #define MDP3_REG_DMA_P_HIST_B_DATA 0x94300
  99. #define MDP3_REG_DMA_P_FETCH_CFG 0x90074
  100. #define MDP3_REG_DMA_P_DCVS_CTRL 0x90080
  101. #define MDP3_REG_DMA_P_DCVS_STATUS 0x90084
  102. /*DMA_S*/
  103. #define MDP3_REG_DMA_S_CONFIG 0xA0000
  104. #define MDP3_REG_DMA_S_SIZE 0xA0004
  105. #define MDP3_REG_DMA_S_IBUF_ADDR 0xA0008
  106. #define MDP3_REG_DMA_S_IBUF_Y_STRIDE 0xA000C
  107. #define MDP3_REG_DMA_S_OUT_XY 0xA0010
  108. /*DMA MASK*/
  109. #define MDP3_DMA_IBUF_FORMAT_MASK 0x06000000
  110. #define MDP3_DMA_PACK_PATTERN_MASK 0x00003f00
  111. /*MISR*/
  112. #define MDP3_REG_MODE_CLK 0x000D0000
  113. #define MDP3_REG_MISR_RESET_CLK 0x000D0004
  114. #define MDP3_REG_EXPORT_MISR_CLK 0x000D0008
  115. #define MDP3_REG_MISR_CURR_VAL_CLK 0x000D000C
  116. #define MDP3_REG_MODE_HCLK 0x000D0100
  117. #define MDP3_REG_MISR_RESET_HCLK 0x000D0104
  118. #define MDP3_REG_EXPORT_MISR_HCLK 0x000D0108
  119. #define MDP3_REG_MISR_CURR_VAL_HCLK 0x000D010C
  120. #define MDP3_REG_MODE_DCLK 0x000D0200
  121. #define MDP3_REG_MISR_RESET_DCLK 0x000D0204
  122. #define MDP3_REG_EXPORT_MISR_DCLK 0x000D0208
  123. #define MDP3_REG_MISR_CURR_VAL_DCLK 0x000D020C
  124. #define MDP3_REG_CAPTURED_DCLK 0x000D0210
  125. #define MDP3_REG_MISR_CAPT_VAL_DCLK 0x000D0214
  126. #define MDP3_REG_MODE_TVCLK 0x000D0300
  127. #define MDP3_REG_MISR_RESET_TVCLK 0x000D0304
  128. #define MDP3_REG_EXPORT_MISR_TVCLK 0x000D0308
  129. #define MDP3_REG_MISR_CURR_VAL_TVCLK 0x000D030C
  130. #define MDP3_REG_CAPTURED_TVCLK 0x000D0310
  131. #define MDP3_REG_MISR_CAPT_VAL_TVCLK 0x000D0314
  132. /* Select DSI operation type(CMD/VIDEO) */
  133. #define MDP3_REG_MODE_DSI_PCLK 0x000D0400
  134. #define MDP3_REG_MODE_DSI_PCLK_BLOCK_DSI_CMD 0x10
  135. #define MDP3_REG_MODE_DSI_PCLK_BLOCK_DSI_VIDEO1 0x20
  136. #define MDP3_REG_MODE_DSI_PCLK_BLOCK_DSI_VIDEO2 0x30
  137. /* RESET DSI MISR STATE */
  138. #define MDP3_REG_MISR_RESET_DSI_PCLK 0x000D0404
  139. /* For reading MISR State(1) and driving data on test bus(0) */
  140. #define MDP3_REG_EXPORT_MISR_DSI_PCLK 0x000D0408
  141. /* Read MISR signature */
  142. #define MDP3_REG_MISR_CURR_VAL_DSI_PCLK 0x000D040C
  143. /* MISR status Bit0 (1) Capture Done */
  144. #define MDP3_REG_CAPTURED_DSI_PCLK 0x000D0410
  145. #define MDP3_REG_MISR_CAPT_VAL_DSI_PCLK 0x000D0414
  146. #define MDP3_REG_MISR_TESTBUS_CAPT_VAL 0x000D0600
  147. /*interface*/
  148. #define MDP3_REG_LCDC_EN 0xE0000
  149. #define MDP3_REG_LCDC_HSYNC_CTL 0xE0004
  150. #define MDP3_REG_LCDC_VSYNC_PERIOD 0xE0008
  151. #define MDP3_REG_LCDC_VSYNC_PULSE_WIDTH 0xE000C
  152. #define MDP3_REG_LCDC_DISPLAY_HCTL 0xE0010
  153. #define MDP3_REG_LCDC_DISPLAY_V_START 0xE0014
  154. #define MDP3_REG_LCDC_DISPLAY_V_END 0xE0018
  155. #define MDP3_REG_LCDC_ACTIVE_HCTL 0xE001C
  156. #define MDP3_REG_LCDC_ACTIVE_V_START 0xE0020
  157. #define MDP3_REG_LCDC_ACTIVE_V_END 0xE0024
  158. #define MDP3_REG_LCDC_BORDER_COLOR 0xE0028
  159. #define MDP3_REG_LCDC_UNDERFLOW_CTL 0xE002C
  160. #define MDP3_REG_LCDC_HSYNC_SKEW 0xE0030
  161. #define MDP3_REG_LCDC_TEST_CTL 0xE0034
  162. #define MDP3_REG_LCDC_CTL_POLARITY 0xE0038
  163. #define MDP3_REG_LCDC_TEST_COL_VAR1 0xE003C
  164. #define MDP3_REG_LCDC_TEST_COL_VAR2 0xE0040
  165. #define MDP3_REG_LCDC_UFLOW_HIDING_CTL 0xE0044
  166. #define MDP3_REG_LCDC_LOST_PIXEL_CNT_VALUE 0xE0048
  167. #define MDP3_REG_DSI_VIDEO_EN 0xF0000
  168. #define MDP3_REG_DSI_VIDEO_HSYNC_CTL 0xF0004
  169. #define MDP3_REG_DSI_VIDEO_VSYNC_PERIOD 0xF0008
  170. #define MDP3_REG_DSI_VIDEO_VSYNC_PULSE_WIDTH 0xF000C
  171. #define MDP3_REG_DSI_VIDEO_DISPLAY_HCTL 0xF0010
  172. #define MDP3_REG_DSI_VIDEO_DISPLAY_V_START 0xF0014
  173. #define MDP3_REG_DSI_VIDEO_DISPLAY_V_END 0xF0018
  174. #define MDP3_REG_DSI_VIDEO_ACTIVE_HCTL 0xF001C
  175. #define MDP3_REG_DSI_VIDEO_ACTIVE_V_START 0xF0020
  176. #define MDP3_REG_DSI_VIDEO_ACTIVE_V_END 0xF0024
  177. #define MDP3_REG_DSI_VIDEO_BORDER_COLOR 0xF0028
  178. #define MDP3_REG_DSI_VIDEO_UNDERFLOW_CTL 0xF002C
  179. #define MDP3_REG_DSI_VIDEO_HSYNC_SKEW 0xF0030
  180. #define MDP3_REG_DSI_VIDEO_TEST_CTL 0xF0034
  181. #define MDP3_REG_DSI_VIDEO_CTL_POLARITY 0xF0038
  182. #define MDP3_REG_DSI_VIDEO_TEST_COL_VAR1 0xF003C
  183. #define MDP3_REG_DSI_VIDEO_TEST_COL_VAR2 0xF0040
  184. #define MDP3_REG_DSI_VIDEO_UFLOW_HIDING_CTL 0xF0044
  185. #define MDP3_REG_DSI_VIDEO_LOST_PIXEL_CNT_VALUE 0xF0048
  186. #define MDP3_REG_DSI_CMD_MODE_ID_MAP 0xF1000
  187. #define MDP3_REG_DSI_CMD_MODE_TRIGGER_EN 0xF1004
  188. #define MDP3_PPP_CSC_PFMVn(n) (0x40400 + (4 * (n)))
  189. #define MDP3_PPP_CSC_PRMVn(n) (0x40440 + (4 * (n)))
  190. #define MDP3_PPP_CSC_PBVn(n) (0x40500 + (4 * (n)))
  191. #define MDP3_PPP_CSC_PLVn(n) (0x40580 + (4 * (n)))
  192. #define MDP3_PPP_CSC_SFMVn(n) (0x40480 + (4 * (n)))
  193. #define MDP3_PPP_CSC_SRMVn(n) (0x404C0 + (4 * (n)))
  194. #define MDP3_PPP_CSC_SBVn(n) (0x40540 + (4 * (n)))
  195. #define MDP3_PPP_CSC_SLVn(n) (0x405C0 + (4 * (n)))
  196. #define MDP3_PPP_SCALE_PHASEX_INIT 0x1013C
  197. #define MDP3_PPP_SCALE_PHASEY_INIT 0x10140
  198. #define MDP3_PPP_SCALE_PHASEX_STEP 0x10144
  199. #define MDP3_PPP_SCALE_PHASEY_STEP 0x10148
  200. #define MDP3_PPP_OP_MODE 0x10138
  201. #define MDP3_PPP_PRE_LUT 0x40800
  202. #define MDP3_PPP_POST_LUT 0x40C00
  203. #define MDP3_PPP_LUTn(n) ((4 * (n)))
  204. #define MDP3_PPP_BG_EDGE_REP 0x101BC
  205. #define MDP3_PPP_SRC_EDGE_REP 0x101B8
  206. #define MDP3_PPP_STRIDE_MASK 0x3FFF
  207. #define MDP3_PPP_STRIDE1_OFFSET 16
  208. #define MDP3_PPP_XY_MASK 0x0FFF
  209. #define MDP3_PPP_XY_OFFSET 16
  210. #define MDP3_PPP_SRC_SIZE 0x10108
  211. #define MDP3_PPP_SRCP0_ADDR 0x1010C
  212. #define MDP3_PPP_SRCP1_ADDR 0x10110
  213. #define MDP3_PPP_SRCP3_ADDR 0x10118
  214. #define MDP3_PPP_SRC_YSTRIDE1_ADDR 0x1011C
  215. #define MDP3_PPP_SRC_YSTRIDE2_ADDR 0x10120
  216. #define MDP3_PPP_SRC_FORMAT 0x10124
  217. #define MDP3_PPP_SRC_UNPACK_PATTERN1 0x10128
  218. #define MDP3_PPP_SRC_UNPACK_PATTERN2 0x1012C
  219. #define MDP3_PPP_OUT_FORMAT 0x10150
  220. #define MDP3_PPP_OUT_PACK_PATTERN1 0x10154
  221. #define MDP3_PPP_OUT_PACK_PATTERN2 0x10158
  222. #define MDP3_PPP_OUT_SIZE 0x10164
  223. #define MDP3_PPP_OUTP0_ADDR 0x10168
  224. #define MDP3_PPP_OUTP1_ADDR 0x1016C
  225. #define MDP3_PPP_OUTP3_ADDR 0x10174
  226. #define MDP3_PPP_OUT_YSTRIDE1_ADDR 0x10178
  227. #define MDP3_PPP_OUT_YSTRIDE2_ADDR 0x1017C
  228. #define MDP3_PPP_OUT_XY 0x1019C
  229. #define MDP3_PPP_BGP0_ADDR 0x101C0
  230. #define MDP3_PPP_BGP1_ADDR 0x101C4
  231. #define MDP3_PPP_BGP3_ADDR 0x101C8
  232. #define MDP3_PPP_BG_YSTRIDE1_ADDR 0x101CC
  233. #define MDP3_PPP_BG_YSTRIDE2_ADDR 0x101D0
  234. #define MDP3_PPP_BG_FORMAT 0x101D4
  235. #define MDP3_PPP_BG_UNPACK_PATTERN1 0x101D8
  236. #define MDP3_PPP_BG_UNPACK_PATTERN2 0x101DC
  237. #define MDP3_TFETCH_SOLID_FILL 0x20004
  238. #define MDP3_TFETCH_FILL_COLOR 0x20040
  239. #define MDP3_PPP_BLEND_PARAM 0x1014C
  240. #define MDP3_PPP_BLEND_BG_ALPHA_SEL 0x70010
  241. #define MDP3_PPP_ACTIVE BIT(0)
  242. /*interrupt mask*/
  243. #define MDP3_INTR_DP0_ROI_DONE_BIT BIT(0)
  244. #define MDP3_INTR_DP1_ROI_DONE_BIT BIT(1)
  245. #define MDP3_INTR_DMA_S_DONE_BIT BIT(2)
  246. #define MDP3_INTR_DMA_E_DONE_BIT BIT(3)
  247. #define MDP3_INTR_DP0_TERMINAL_FRAME_DONE_BIT BIT(4)
  248. #define MDP3_INTR_DP1_TERMINAL_FRAME_DONE_BIT BIT(5)
  249. #define MDP3_INTR_DMA_TV_DONE_BIT BIT(6)
  250. #define MDP3_INTR_TV_ENCODER_UNDER_RUN_BIT BIT(7)
  251. #define MDP3_INTR_SYNC_PRIMARY_LINE_BIT BIT(8)
  252. #define MDP3_INTR_SYNC_SECONDARY_LINE_BIT BIT(9)
  253. #define MDP3_INTR_SYNC_EXTERNAL_LINE_BIT BIT(10)
  254. #define MDP3_INTR_DP0_FETCH_DONE_BIT BIT(11)
  255. #define MDP3_INTR_DP1_FETCH_DONE_BIT BIT(12)
  256. #define MDP3_INTR_TV_OUT_FRAME_START_BIT BIT(13)
  257. #define MDP3_INTR_DMA_P_DONE_BIT BIT(14)
  258. #define MDP3_INTR_LCDC_START_OF_FRAME_BIT BIT(15)
  259. #define MDP3_INTR_LCDC_UNDERFLOW_BIT BIT(16)
  260. #define MDP3_INTR_DMA_P_LINE_BIT BIT(17)
  261. #define MDP3_INTR_DMA_S_LINE_BIT BIT(18)
  262. #define MDP3_INTR_DMA_E_LINE_BIT BIT(19)
  263. #define MDP3_INTR_DMA_P_HISTO_BIT BIT(20)
  264. #define MDP3_INTR_DTV_OUT_DONE_BIT BIT(21)
  265. #define MDP3_INTR_DTV_OUT_START_OF_FRAME_BIT BIT(22)
  266. #define MDP3_INTR_DTV_OUT_UNDERFLOW_BIT BIT(23)
  267. #define MDP3_INTR_DTV_OUT_LINE_BIT BIT(24)
  268. #define MDP3_INTR_DMA_P_AUTO_FREFRESH_START_BIT BIT(25)
  269. #define MDP3_INTR_DMA_S_AUTO_FREFRESH_START_BIT BIT(26)
  270. #define MDP3_INTR_QPIC_EOF_ENABLE_BIT BIT(27)
  271. enum {
  272. MDP3_INTR_DP0_ROI_DONE,
  273. MDP3_INTR_DP1_ROI_DONE,
  274. MDP3_INTR_DMA_S_DONE,
  275. MDP3_INTR_DMA_E_DONE,
  276. MDP3_INTR_DP0_TERMINAL_FRAME_DONE,
  277. MDP3_INTR_DP1_TERMINAL_FRAME_DONE,
  278. MDP3_INTR_DMA_TV_DONE,
  279. MDP3_INTR_TV_ENCODER_UNDER_RUN,
  280. MDP3_INTR_SYNC_PRIMARY_LINE,
  281. MDP3_INTR_SYNC_SECONDARY_LINE,
  282. MDP3_INTR_SYNC_EXTERNAL_LINE,
  283. MDP3_INTR_DP0_FETCH_DONE,
  284. MDP3_INTR_DP1_FETCH_DONE,
  285. MDP3_INTR_TV_OUT_FRAME_START,
  286. MDP3_INTR_DMA_P_DONE,
  287. MDP3_INTR_LCDC_START_OF_FRAME,
  288. MDP3_INTR_LCDC_UNDERFLOW,
  289. MDP3_INTR_DMA_P_LINE,
  290. MDP3_INTR_DMA_S_LINE,
  291. MDP3_INTR_DMA_E_LINE,
  292. MDP3_INTR_DMA_P_HISTO,
  293. MDP3_INTR_DTV_OUT_DONE,
  294. MDP3_INTR_DTV_OUT_START_OF_FRAME,
  295. MDP3_INTR_DTV_OUT_UNDERFLOW,
  296. MDP3_INTR_DTV_OUT_LINE,
  297. MDP3_INTR_DMA_P_AUTO_FREFRESH_START,
  298. MDP3_INTR_DMA_S_AUTO_FREFRESH_START,
  299. MDP3_INTR_QPIC_EOF_ENABLE,
  300. };
  301. #define MDP3_DMA_P_HIST_INTR_RESET_DONE_BIT BIT(0)
  302. #define MDP3_DMA_P_HIST_INTR_HIST_DONE_BIT BIT(1)
  303. #define MDP3_PPP_DONE MDP3_INTR_DP0_ROI_DONE
  304. #endif /* MDP3_HWIO_H */