PageRenderTime 25ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/drivers/video/msm/mdp_hw.h

https://github.com/mstsirkin/linux
C Header | 628 lines | 510 code | 82 blank | 36 comment | 19 complexity | fb3571a0548ad94fe89fd5ca4aef8890 MD5 | raw file
  1. /* drivers/video/msm_fb/mdp_hw.h
  2. *
  3. * Copyright (C) 2007 QUALCOMM Incorporated
  4. * Copyright (C) 2007 Google Incorporated
  5. *
  6. * This software is licensed under the terms of the GNU General Public
  7. * License version 2, as published by the Free Software Foundation, and
  8. * may be copied, distributed, and modified under those terms.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #ifndef _MDP_HW_H_
  16. #define _MDP_HW_H_
  17. #include <mach/msm_iomap.h>
  18. #include <mach/msm_fb.h>
  19. struct mdp_info {
  20. struct mdp_device mdp_dev;
  21. char * __iomem base;
  22. int irq;
  23. };
  24. struct mdp_blit_req;
  25. struct mdp_device;
  26. int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req,
  27. struct file *src_file, unsigned long src_start,
  28. unsigned long src_len, struct file *dst_file,
  29. unsigned long dst_start, unsigned long dst_len);
  30. #define mdp_writel(mdp, value, offset) writel(value, mdp->base + offset)
  31. #define mdp_readl(mdp, offset) readl(mdp->base + offset)
  32. #define MDP_SYNC_CONFIG_0 (0x00000)
  33. #define MDP_SYNC_CONFIG_1 (0x00004)
  34. #define MDP_SYNC_CONFIG_2 (0x00008)
  35. #define MDP_SYNC_STATUS_0 (0x0000c)
  36. #define MDP_SYNC_STATUS_1 (0x00010)
  37. #define MDP_SYNC_STATUS_2 (0x00014)
  38. #define MDP_SYNC_THRESH_0 (0x00018)
  39. #define MDP_SYNC_THRESH_1 (0x0001c)
  40. #define MDP_INTR_ENABLE (0x00020)
  41. #define MDP_INTR_STATUS (0x00024)
  42. #define MDP_INTR_CLEAR (0x00028)
  43. #define MDP_DISPLAY0_START (0x00030)
  44. #define MDP_DISPLAY1_START (0x00034)
  45. #define MDP_DISPLAY_STATUS (0x00038)
  46. #define MDP_EBI2_LCD0 (0x0003c)
  47. #define MDP_EBI2_LCD1 (0x00040)
  48. #define MDP_DISPLAY0_ADDR (0x00054)
  49. #define MDP_DISPLAY1_ADDR (0x00058)
  50. #define MDP_EBI2_PORTMAP_MODE (0x0005c)
  51. #define MDP_MODE (0x00060)
  52. #define MDP_TV_OUT_STATUS (0x00064)
  53. #define MDP_HW_VERSION (0x00070)
  54. #define MDP_SW_RESET (0x00074)
  55. #define MDP_AXI_ERROR_MASTER_STOP (0x00078)
  56. #define MDP_SEL_CLK_OR_HCLK_TEST_BUS (0x0007c)
  57. #define MDP_PRIMARY_VSYNC_OUT_CTRL (0x00080)
  58. #define MDP_SECONDARY_VSYNC_OUT_CTRL (0x00084)
  59. #define MDP_EXTERNAL_VSYNC_OUT_CTRL (0x00088)
  60. #define MDP_VSYNC_CTRL (0x0008c)
  61. #define MDP_CGC_EN (0x00100)
  62. #define MDP_CMD_STATUS (0x10008)
  63. #define MDP_PROFILE_EN (0x10010)
  64. #define MDP_PROFILE_COUNT (0x10014)
  65. #define MDP_DMA_START (0x10044)
  66. #define MDP_FULL_BYPASS_WORD0 (0x10100)
  67. #define MDP_FULL_BYPASS_WORD1 (0x10104)
  68. #define MDP_COMMAND_CONFIG (0x10104)
  69. #define MDP_FULL_BYPASS_WORD2 (0x10108)
  70. #define MDP_FULL_BYPASS_WORD3 (0x1010c)
  71. #define MDP_FULL_BYPASS_WORD4 (0x10110)
  72. #define MDP_FULL_BYPASS_WORD6 (0x10118)
  73. #define MDP_FULL_BYPASS_WORD7 (0x1011c)
  74. #define MDP_FULL_BYPASS_WORD8 (0x10120)
  75. #define MDP_FULL_BYPASS_WORD9 (0x10124)
  76. #define MDP_PPP_SOURCE_CONFIG (0x10124)
  77. #define MDP_FULL_BYPASS_WORD10 (0x10128)
  78. #define MDP_FULL_BYPASS_WORD11 (0x1012c)
  79. #define MDP_FULL_BYPASS_WORD12 (0x10130)
  80. #define MDP_FULL_BYPASS_WORD13 (0x10134)
  81. #define MDP_FULL_BYPASS_WORD14 (0x10138)
  82. #define MDP_PPP_OPERATION_CONFIG (0x10138)
  83. #define MDP_FULL_BYPASS_WORD15 (0x1013c)
  84. #define MDP_FULL_BYPASS_WORD16 (0x10140)
  85. #define MDP_FULL_BYPASS_WORD17 (0x10144)
  86. #define MDP_FULL_BYPASS_WORD18 (0x10148)
  87. #define MDP_FULL_BYPASS_WORD19 (0x1014c)
  88. #define MDP_FULL_BYPASS_WORD20 (0x10150)
  89. #define MDP_PPP_DESTINATION_CONFIG (0x10150)
  90. #define MDP_FULL_BYPASS_WORD21 (0x10154)
  91. #define MDP_FULL_BYPASS_WORD22 (0x10158)
  92. #define MDP_FULL_BYPASS_WORD23 (0x1015c)
  93. #define MDP_FULL_BYPASS_WORD24 (0x10160)
  94. #define MDP_FULL_BYPASS_WORD25 (0x10164)
  95. #define MDP_FULL_BYPASS_WORD26 (0x10168)
  96. #define MDP_FULL_BYPASS_WORD27 (0x1016c)
  97. #define MDP_FULL_BYPASS_WORD29 (0x10174)
  98. #define MDP_FULL_BYPASS_WORD30 (0x10178)
  99. #define MDP_FULL_BYPASS_WORD31 (0x1017c)
  100. #define MDP_FULL_BYPASS_WORD32 (0x10180)
  101. #define MDP_DMA_CONFIG (0x10180)
  102. #define MDP_FULL_BYPASS_WORD33 (0x10184)
  103. #define MDP_FULL_BYPASS_WORD34 (0x10188)
  104. #define MDP_FULL_BYPASS_WORD35 (0x1018c)
  105. #define MDP_FULL_BYPASS_WORD37 (0x10194)
  106. #define MDP_FULL_BYPASS_WORD39 (0x1019c)
  107. #define MDP_FULL_BYPASS_WORD40 (0x101a0)
  108. #define MDP_FULL_BYPASS_WORD41 (0x101a4)
  109. #define MDP_FULL_BYPASS_WORD43 (0x101ac)
  110. #define MDP_FULL_BYPASS_WORD46 (0x101b8)
  111. #define MDP_FULL_BYPASS_WORD47 (0x101bc)
  112. #define MDP_FULL_BYPASS_WORD48 (0x101c0)
  113. #define MDP_FULL_BYPASS_WORD49 (0x101c4)
  114. #define MDP_FULL_BYPASS_WORD50 (0x101c8)
  115. #define MDP_FULL_BYPASS_WORD51 (0x101cc)
  116. #define MDP_FULL_BYPASS_WORD52 (0x101d0)
  117. #define MDP_FULL_BYPASS_WORD53 (0x101d4)
  118. #define MDP_FULL_BYPASS_WORD54 (0x101d8)
  119. #define MDP_FULL_BYPASS_WORD55 (0x101dc)
  120. #define MDP_FULL_BYPASS_WORD56 (0x101e0)
  121. #define MDP_FULL_BYPASS_WORD57 (0x101e4)
  122. #define MDP_FULL_BYPASS_WORD58 (0x101e8)
  123. #define MDP_FULL_BYPASS_WORD59 (0x101ec)
  124. #define MDP_FULL_BYPASS_WORD60 (0x101f0)
  125. #define MDP_VSYNC_THRESHOLD (0x101f0)
  126. #define MDP_FULL_BYPASS_WORD61 (0x101f4)
  127. #define MDP_FULL_BYPASS_WORD62 (0x101f8)
  128. #define MDP_FULL_BYPASS_WORD63 (0x101fc)
  129. #define MDP_TFETCH_TEST_MODE (0x20004)
  130. #define MDP_TFETCH_STATUS (0x20008)
  131. #define MDP_TFETCH_TILE_COUNT (0x20010)
  132. #define MDP_TFETCH_FETCH_COUNT (0x20014)
  133. #define MDP_TFETCH_CONSTANT_COLOR (0x20040)
  134. #define MDP_CSC_BYPASS (0x40004)
  135. #define MDP_SCALE_COEFF_LSB (0x5fffc)
  136. #define MDP_TV_OUT_CTL (0xc0000)
  137. #define MDP_TV_OUT_FIR_COEFF (0xc0004)
  138. #define MDP_TV_OUT_BUF_ADDR (0xc0008)
  139. #define MDP_TV_OUT_CC_DATA (0xc000c)
  140. #define MDP_TV_OUT_SOBEL (0xc0010)
  141. #define MDP_TV_OUT_Y_CLAMP (0xc0018)
  142. #define MDP_TV_OUT_CB_CLAMP (0xc001c)
  143. #define MDP_TV_OUT_CR_CLAMP (0xc0020)
  144. #define MDP_TEST_MODE_CLK (0xd0000)
  145. #define MDP_TEST_MISR_RESET_CLK (0xd0004)
  146. #define MDP_TEST_EXPORT_MISR_CLK (0xd0008)
  147. #define MDP_TEST_MISR_CURR_VAL_CLK (0xd000c)
  148. #define MDP_TEST_MODE_HCLK (0xd0100)
  149. #define MDP_TEST_MISR_RESET_HCLK (0xd0104)
  150. #define MDP_TEST_EXPORT_MISR_HCLK (0xd0108)
  151. #define MDP_TEST_MISR_CURR_VAL_HCLK (0xd010c)
  152. #define MDP_TEST_MODE_DCLK (0xd0200)
  153. #define MDP_TEST_MISR_RESET_DCLK (0xd0204)
  154. #define MDP_TEST_EXPORT_MISR_DCLK (0xd0208)
  155. #define MDP_TEST_MISR_CURR_VAL_DCLK (0xd020c)
  156. #define MDP_TEST_CAPTURED_DCLK (0xd0210)
  157. #define MDP_TEST_MISR_CAPT_VAL_DCLK (0xd0214)
  158. #define MDP_LCDC_CTL (0xe0000)
  159. #define MDP_LCDC_HSYNC_CTL (0xe0004)
  160. #define MDP_LCDC_VSYNC_CTL (0xe0008)
  161. #define MDP_LCDC_ACTIVE_HCTL (0xe000c)
  162. #define MDP_LCDC_ACTIVE_VCTL (0xe0010)
  163. #define MDP_LCDC_BORDER_CLR (0xe0014)
  164. #define MDP_LCDC_H_BLANK (0xe0018)
  165. #define MDP_LCDC_V_BLANK (0xe001c)
  166. #define MDP_LCDC_UNDERFLOW_CLR (0xe0020)
  167. #define MDP_LCDC_HSYNC_SKEW (0xe0024)
  168. #define MDP_LCDC_TEST_CTL (0xe0028)
  169. #define MDP_LCDC_LINE_IRQ (0xe002c)
  170. #define MDP_LCDC_CTL_POLARITY (0xe0030)
  171. #define MDP_LCDC_DMA_CONFIG (0xe1000)
  172. #define MDP_LCDC_DMA_SIZE (0xe1004)
  173. #define MDP_LCDC_DMA_IBUF_ADDR (0xe1008)
  174. #define MDP_LCDC_DMA_IBUF_Y_STRIDE (0xe100c)
  175. #define MDP_DMA2_TERM 0x1
  176. #define MDP_DMA3_TERM 0x2
  177. #define MDP_PPP_TERM 0x3
  178. /* MDP_INTR_ENABLE */
  179. #define DL0_ROI_DONE (1<<0)
  180. #define DL1_ROI_DONE (1<<1)
  181. #define DL0_DMA2_TERM_DONE (1<<2)
  182. #define DL1_DMA2_TERM_DONE (1<<3)
  183. #define DL0_PPP_TERM_DONE (1<<4)
  184. #define DL1_PPP_TERM_DONE (1<<5)
  185. #define TV_OUT_DMA3_DONE (1<<6)
  186. #define TV_ENC_UNDERRUN (1<<7)
  187. #define DL0_FETCH_DONE (1<<11)
  188. #define DL1_FETCH_DONE (1<<12)
  189. #define MDP_PPP_BUSY_STATUS (DL0_ROI_DONE| \
  190. DL1_ROI_DONE| \
  191. DL0_PPP_TERM_DONE| \
  192. DL1_PPP_TERM_DONE)
  193. #define MDP_ANY_INTR_MASK (DL0_ROI_DONE| \
  194. DL1_ROI_DONE| \
  195. DL0_DMA2_TERM_DONE| \
  196. DL1_DMA2_TERM_DONE| \
  197. DL0_PPP_TERM_DONE| \
  198. DL1_PPP_TERM_DONE| \
  199. DL0_FETCH_DONE| \
  200. DL1_FETCH_DONE| \
  201. TV_ENC_UNDERRUN)
  202. #define MDP_TOP_LUMA 16
  203. #define MDP_TOP_CHROMA 0
  204. #define MDP_BOTTOM_LUMA 19
  205. #define MDP_BOTTOM_CHROMA 3
  206. #define MDP_LEFT_LUMA 22
  207. #define MDP_LEFT_CHROMA 6
  208. #define MDP_RIGHT_LUMA 25
  209. #define MDP_RIGHT_CHROMA 9
  210. #define CLR_G 0x0
  211. #define CLR_B 0x1
  212. #define CLR_R 0x2
  213. #define CLR_ALPHA 0x3
  214. #define CLR_Y CLR_G
  215. #define CLR_CB CLR_B
  216. #define CLR_CR CLR_R
  217. /* from lsb to msb */
  218. #define MDP_GET_PACK_PATTERN(a, x, y, z, bit) \
  219. (((a)<<(bit*3))|((x)<<(bit*2))|((y)<<bit)|(z))
  220. /* MDP_SYNC_CONFIG_0/1/2 */
  221. #define MDP_SYNCFG_HGT_LOC 22
  222. #define MDP_SYNCFG_VSYNC_EXT_EN (1<<21)
  223. #define MDP_SYNCFG_VSYNC_INT_EN (1<<20)
  224. /* MDP_SYNC_THRESH_0 */
  225. #define MDP_PRIM_BELOW_LOC 0
  226. #define MDP_PRIM_ABOVE_LOC 8
  227. /* MDP_{PRIMARY,SECONDARY,EXTERNAL}_VSYNC_OUT_CRL */
  228. #define VSYNC_PULSE_EN (1<<31)
  229. #define VSYNC_PULSE_INV (1<<30)
  230. /* MDP_VSYNC_CTRL */
  231. #define DISP0_VSYNC_MAP_VSYNC0 0
  232. #define DISP0_VSYNC_MAP_VSYNC1 (1<<0)
  233. #define DISP0_VSYNC_MAP_VSYNC2 ((1<<0)|(1<<1))
  234. #define DISP1_VSYNC_MAP_VSYNC0 0
  235. #define DISP1_VSYNC_MAP_VSYNC1 (1<<2)
  236. #define DISP1_VSYNC_MAP_VSYNC2 ((1<<2)|(1<<3))
  237. #define PRIMARY_LCD_SYNC_EN (1<<4)
  238. #define PRIMARY_LCD_SYNC_DISABLE 0
  239. #define SECONDARY_LCD_SYNC_EN (1<<5)
  240. #define SECONDARY_LCD_SYNC_DISABLE 0
  241. #define EXTERNAL_LCD_SYNC_EN (1<<6)
  242. #define EXTERNAL_LCD_SYNC_DISABLE 0
  243. /* MDP_VSYNC_THRESHOLD / MDP_FULL_BYPASS_WORD60 */
  244. #define VSYNC_THRESHOLD_ABOVE_LOC 0
  245. #define VSYNC_THRESHOLD_BELOW_LOC 16
  246. #define VSYNC_ANTI_TEAR_EN (1<<31)
  247. /* MDP_COMMAND_CONFIG / MDP_FULL_BYPASS_WORD1 */
  248. #define MDP_CMD_DBGBUS_EN (1<<0)
  249. /* MDP_PPP_SOURCE_CONFIG / MDP_FULL_BYPASS_WORD9&53 */
  250. #define PPP_SRC_C0G_8BIT ((1<<1)|(1<<0))
  251. #define PPP_SRC_C1B_8BIT ((1<<3)|(1<<2))
  252. #define PPP_SRC_C2R_8BIT ((1<<5)|(1<<4))
  253. #define PPP_SRC_C3A_8BIT ((1<<7)|(1<<6))
  254. #define PPP_SRC_C0G_6BIT (1<<1)
  255. #define PPP_SRC_C1B_6BIT (1<<3)
  256. #define PPP_SRC_C2R_6BIT (1<<5)
  257. #define PPP_SRC_C0G_5BIT (1<<0)
  258. #define PPP_SRC_C1B_5BIT (1<<2)
  259. #define PPP_SRC_C2R_5BIT (1<<4)
  260. #define PPP_SRC_C3ALPHA_EN (1<<8)
  261. #define PPP_SRC_BPP_1BYTES 0
  262. #define PPP_SRC_BPP_2BYTES (1<<9)
  263. #define PPP_SRC_BPP_3BYTES (1<<10)
  264. #define PPP_SRC_BPP_4BYTES ((1<<10)|(1<<9))
  265. #define PPP_SRC_BPP_ROI_ODD_X (1<<11)
  266. #define PPP_SRC_BPP_ROI_ODD_Y (1<<12)
  267. #define PPP_SRC_INTERLVD_2COMPONENTS (1<<13)
  268. #define PPP_SRC_INTERLVD_3COMPONENTS (1<<14)
  269. #define PPP_SRC_INTERLVD_4COMPONENTS ((1<<14)|(1<<13))
  270. /* RGB666 unpack format
  271. ** TIGHT means R6+G6+B6 together
  272. ** LOOSE means R6+2 +G6+2+ B6+2 (with MSB)
  273. ** or 2+R6 +2+G6 +2+B6 (with LSB)
  274. */
  275. #define PPP_SRC_PACK_TIGHT (1<<17)
  276. #define PPP_SRC_PACK_LOOSE 0
  277. #define PPP_SRC_PACK_ALIGN_LSB 0
  278. #define PPP_SRC_PACK_ALIGN_MSB (1<<18)
  279. #define PPP_SRC_PLANE_INTERLVD 0
  280. #define PPP_SRC_PLANE_PSEUDOPLNR (1<<20)
  281. #define PPP_SRC_WMV9_MODE (1<<21)
  282. /* MDP_PPP_OPERATION_CONFIG / MDP_FULL_BYPASS_WORD14 */
  283. #define PPP_OP_SCALE_X_ON (1<<0)
  284. #define PPP_OP_SCALE_Y_ON (1<<1)
  285. #define PPP_OP_CONVERT_RGB2YCBCR 0
  286. #define PPP_OP_CONVERT_YCBCR2RGB (1<<2)
  287. #define PPP_OP_CONVERT_ON (1<<3)
  288. #define PPP_OP_CONVERT_MATRIX_PRIMARY 0
  289. #define PPP_OP_CONVERT_MATRIX_SECONDARY (1<<4)
  290. #define PPP_OP_LUT_C0_ON (1<<5)
  291. #define PPP_OP_LUT_C1_ON (1<<6)
  292. #define PPP_OP_LUT_C2_ON (1<<7)
  293. /* rotate or blend enable */
  294. #define PPP_OP_ROT_ON (1<<8)
  295. #define PPP_OP_ROT_90 (1<<9)
  296. #define PPP_OP_FLIP_LR (1<<10)
  297. #define PPP_OP_FLIP_UD (1<<11)
  298. #define PPP_OP_BLEND_ON (1<<12)
  299. #define PPP_OP_BLEND_SRCPIXEL_ALPHA 0
  300. #define PPP_OP_BLEND_DSTPIXEL_ALPHA (1<<13)
  301. #define PPP_OP_BLEND_CONSTANT_ALPHA (1<<14)
  302. #define PPP_OP_BLEND_SRCPIXEL_TRANSP ((1<<13)|(1<<14))
  303. #define PPP_OP_BLEND_ALPHA_BLEND_NORMAL 0
  304. #define PPP_OP_BLEND_ALPHA_BLEND_REVERSE (1<<15)
  305. #define PPP_OP_DITHER_EN (1<<16)
  306. #define PPP_OP_COLOR_SPACE_RGB 0
  307. #define PPP_OP_COLOR_SPACE_YCBCR (1<<17)
  308. #define PPP_OP_SRC_CHROMA_RGB 0
  309. #define PPP_OP_SRC_CHROMA_H2V1 (1<<18)
  310. #define PPP_OP_SRC_CHROMA_H1V2 (1<<19)
  311. #define PPP_OP_SRC_CHROMA_420 ((1<<18)|(1<<19))
  312. #define PPP_OP_SRC_CHROMA_COSITE 0
  313. #define PPP_OP_SRC_CHROMA_OFFSITE (1<<20)
  314. #define PPP_OP_DST_CHROMA_RGB 0
  315. #define PPP_OP_DST_CHROMA_H2V1 (1<<21)
  316. #define PPP_OP_DST_CHROMA_H1V2 (1<<22)
  317. #define PPP_OP_DST_CHROMA_420 ((1<<21)|(1<<22))
  318. #define PPP_OP_DST_CHROMA_COSITE 0
  319. #define PPP_OP_DST_CHROMA_OFFSITE (1<<23)
  320. #define PPP_BLEND_ALPHA_TRANSP (1<<24)
  321. #define PPP_OP_BG_CHROMA_RGB 0
  322. #define PPP_OP_BG_CHROMA_H2V1 (1<<25)
  323. #define PPP_OP_BG_CHROMA_H1V2 (1<<26)
  324. #define PPP_OP_BG_CHROMA_420 ((1<<25)|(1<<26))
  325. #define PPP_OP_BG_CHROMA_SITE_COSITE 0
  326. #define PPP_OP_BG_CHROMA_SITE_OFFSITE (1<<27)
  327. /* MDP_PPP_DESTINATION_CONFIG / MDP_FULL_BYPASS_WORD20 */
  328. #define PPP_DST_C0G_8BIT ((1<<0)|(1<<1))
  329. #define PPP_DST_C1B_8BIT ((1<<3)|(1<<2))
  330. #define PPP_DST_C2R_8BIT ((1<<5)|(1<<4))
  331. #define PPP_DST_C3A_8BIT ((1<<7)|(1<<6))
  332. #define PPP_DST_C0G_6BIT (1<<1)
  333. #define PPP_DST_C1B_6BIT (1<<3)
  334. #define PPP_DST_C2R_6BIT (1<<5)
  335. #define PPP_DST_C0G_5BIT (1<<0)
  336. #define PPP_DST_C1B_5BIT (1<<2)
  337. #define PPP_DST_C2R_5BIT (1<<4)
  338. #define PPP_DST_C3A_8BIT ((1<<7)|(1<<6))
  339. #define PPP_DST_C3ALPHA_EN (1<<8)
  340. #define PPP_DST_INTERLVD_2COMPONENTS (1<<9)
  341. #define PPP_DST_INTERLVD_3COMPONENTS (1<<10)
  342. #define PPP_DST_INTERLVD_4COMPONENTS ((1<<10)|(1<<9))
  343. #define PPP_DST_INTERLVD_6COMPONENTS ((1<<11)|(1<<9))
  344. #define PPP_DST_PACK_LOOSE 0
  345. #define PPP_DST_PACK_TIGHT (1<<13)
  346. #define PPP_DST_PACK_ALIGN_LSB 0
  347. #define PPP_DST_PACK_ALIGN_MSB (1<<14)
  348. #define PPP_DST_OUT_SEL_AXI 0
  349. #define PPP_DST_OUT_SEL_MDDI (1<<15)
  350. #define PPP_DST_BPP_2BYTES (1<<16)
  351. #define PPP_DST_BPP_3BYTES (1<<17)
  352. #define PPP_DST_BPP_4BYTES ((1<<17)|(1<<16))
  353. #define PPP_DST_PLANE_INTERLVD 0
  354. #define PPP_DST_PLANE_PLANAR (1<<18)
  355. #define PPP_DST_PLANE_PSEUDOPLNR (1<<19)
  356. #define PPP_DST_TO_TV (1<<20)
  357. #define PPP_DST_MDDI_PRIMARY 0
  358. #define PPP_DST_MDDI_SECONDARY (1<<21)
  359. #define PPP_DST_MDDI_EXTERNAL (1<<22)
  360. /* image configurations by image type */
  361. #define PPP_CFG_MDP_RGB_565(dir) (PPP_##dir##_C2R_5BIT | \
  362. PPP_##dir##_C0G_6BIT | \
  363. PPP_##dir##_C1B_5BIT | \
  364. PPP_##dir##_BPP_2BYTES | \
  365. PPP_##dir##_INTERLVD_3COMPONENTS | \
  366. PPP_##dir##_PACK_TIGHT | \
  367. PPP_##dir##_PACK_ALIGN_LSB | \
  368. PPP_##dir##_PLANE_INTERLVD)
  369. #define PPP_CFG_MDP_RGB_888(dir) (PPP_##dir##_C2R_8BIT | \
  370. PPP_##dir##_C0G_8BIT | \
  371. PPP_##dir##_C1B_8BIT | \
  372. PPP_##dir##_BPP_3BYTES | \
  373. PPP_##dir##_INTERLVD_3COMPONENTS | \
  374. PPP_##dir##_PACK_TIGHT | \
  375. PPP_##dir##_PACK_ALIGN_LSB | \
  376. PPP_##dir##_PLANE_INTERLVD)
  377. #define PPP_CFG_MDP_ARGB_8888(dir) (PPP_##dir##_C2R_8BIT | \
  378. PPP_##dir##_C0G_8BIT | \
  379. PPP_##dir##_C1B_8BIT | \
  380. PPP_##dir##_C3A_8BIT | \
  381. PPP_##dir##_C3ALPHA_EN | \
  382. PPP_##dir##_BPP_4BYTES | \
  383. PPP_##dir##_INTERLVD_4COMPONENTS | \
  384. PPP_##dir##_PACK_TIGHT | \
  385. PPP_##dir##_PACK_ALIGN_LSB | \
  386. PPP_##dir##_PLANE_INTERLVD)
  387. #define PPP_CFG_MDP_XRGB_8888(dir) PPP_CFG_MDP_ARGB_8888(dir)
  388. #define PPP_CFG_MDP_RGBA_8888(dir) PPP_CFG_MDP_ARGB_8888(dir)
  389. #define PPP_CFG_MDP_BGRA_8888(dir) PPP_CFG_MDP_ARGB_8888(dir)
  390. #define PPP_CFG_MDP_RGBX_8888(dir) PPP_CFG_MDP_ARGB_8888(dir)
  391. #define PPP_CFG_MDP_Y_CBCR_H2V2(dir) (PPP_##dir##_C2R_8BIT | \
  392. PPP_##dir##_C0G_8BIT | \
  393. PPP_##dir##_C1B_8BIT | \
  394. PPP_##dir##_C3A_8BIT | \
  395. PPP_##dir##_BPP_2BYTES | \
  396. PPP_##dir##_INTERLVD_2COMPONENTS | \
  397. PPP_##dir##_PACK_TIGHT | \
  398. PPP_##dir##_PACK_ALIGN_LSB | \
  399. PPP_##dir##_PLANE_PSEUDOPLNR)
  400. #define PPP_CFG_MDP_Y_CRCB_H2V2(dir) PPP_CFG_MDP_Y_CBCR_H2V2(dir)
  401. #define PPP_CFG_MDP_YCRYCB_H2V1(dir) (PPP_##dir##_C2R_8BIT | \
  402. PPP_##dir##_C0G_8BIT | \
  403. PPP_##dir##_C1B_8BIT | \
  404. PPP_##dir##_C3A_8BIT | \
  405. PPP_##dir##_BPP_2BYTES | \
  406. PPP_##dir##_INTERLVD_4COMPONENTS | \
  407. PPP_##dir##_PACK_TIGHT | \
  408. PPP_##dir##_PACK_ALIGN_LSB |\
  409. PPP_##dir##_PLANE_INTERLVD)
  410. #define PPP_CFG_MDP_Y_CBCR_H2V1(dir) (PPP_##dir##_C2R_8BIT | \
  411. PPP_##dir##_C0G_8BIT | \
  412. PPP_##dir##_C1B_8BIT | \
  413. PPP_##dir##_C3A_8BIT | \
  414. PPP_##dir##_BPP_2BYTES | \
  415. PPP_##dir##_INTERLVD_2COMPONENTS | \
  416. PPP_##dir##_PACK_TIGHT | \
  417. PPP_##dir##_PACK_ALIGN_LSB | \
  418. PPP_##dir##_PLANE_PSEUDOPLNR)
  419. #define PPP_CFG_MDP_Y_CRCB_H2V1(dir) PPP_CFG_MDP_Y_CBCR_H2V1(dir)
  420. #define PPP_PACK_PATTERN_MDP_RGB_565 \
  421. MDP_GET_PACK_PATTERN(0, CLR_R, CLR_G, CLR_B, 8)
  422. #define PPP_PACK_PATTERN_MDP_RGB_888 PPP_PACK_PATTERN_MDP_RGB_565
  423. #define PPP_PACK_PATTERN_MDP_XRGB_8888 \
  424. MDP_GET_PACK_PATTERN(CLR_B, CLR_G, CLR_R, CLR_ALPHA, 8)
  425. #define PPP_PACK_PATTERN_MDP_ARGB_8888 PPP_PACK_PATTERN_MDP_XRGB_8888
  426. #define PPP_PACK_PATTERN_MDP_RGBA_8888 \
  427. MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_B, CLR_G, CLR_R, 8)
  428. #define PPP_PACK_PATTERN_MDP_BGRA_8888 \
  429. MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_R, CLR_G, CLR_B, 8)
  430. #define PPP_PACK_PATTERN_MDP_RGBX_8888 \
  431. MDP_GET_PACK_PATTERN(CLR_ALPHA, CLR_B, CLR_G, CLR_R, 8)
  432. #define PPP_PACK_PATTERN_MDP_Y_CBCR_H2V1 \
  433. MDP_GET_PACK_PATTERN(0, 0, CLR_CB, CLR_CR, 8)
  434. #define PPP_PACK_PATTERN_MDP_Y_CBCR_H2V2 PPP_PACK_PATTERN_MDP_Y_CBCR_H2V1
  435. #define PPP_PACK_PATTERN_MDP_Y_CRCB_H2V1 \
  436. MDP_GET_PACK_PATTERN(0, 0, CLR_CR, CLR_CB, 8)
  437. #define PPP_PACK_PATTERN_MDP_Y_CRCB_H2V2 PPP_PACK_PATTERN_MDP_Y_CRCB_H2V1
  438. #define PPP_PACK_PATTERN_MDP_YCRYCB_H2V1 \
  439. MDP_GET_PACK_PATTERN(CLR_Y, CLR_R, CLR_Y, CLR_B, 8)
  440. #define PPP_CHROMA_SAMP_MDP_RGB_565(dir) PPP_OP_##dir##_CHROMA_RGB
  441. #define PPP_CHROMA_SAMP_MDP_RGB_888(dir) PPP_OP_##dir##_CHROMA_RGB
  442. #define PPP_CHROMA_SAMP_MDP_XRGB_8888(dir) PPP_OP_##dir##_CHROMA_RGB
  443. #define PPP_CHROMA_SAMP_MDP_ARGB_8888(dir) PPP_OP_##dir##_CHROMA_RGB
  444. #define PPP_CHROMA_SAMP_MDP_RGBA_8888(dir) PPP_OP_##dir##_CHROMA_RGB
  445. #define PPP_CHROMA_SAMP_MDP_BGRA_8888(dir) PPP_OP_##dir##_CHROMA_RGB
  446. #define PPP_CHROMA_SAMP_MDP_RGBX_8888(dir) PPP_OP_##dir##_CHROMA_RGB
  447. #define PPP_CHROMA_SAMP_MDP_Y_CBCR_H2V1(dir) PPP_OP_##dir##_CHROMA_H2V1
  448. #define PPP_CHROMA_SAMP_MDP_Y_CBCR_H2V2(dir) PPP_OP_##dir##_CHROMA_420
  449. #define PPP_CHROMA_SAMP_MDP_Y_CRCB_H2V1(dir) PPP_OP_##dir##_CHROMA_H2V1
  450. #define PPP_CHROMA_SAMP_MDP_Y_CRCB_H2V2(dir) PPP_OP_##dir##_CHROMA_420
  451. #define PPP_CHROMA_SAMP_MDP_YCRYCB_H2V1(dir) PPP_OP_##dir##_CHROMA_H2V1
  452. /* Helpful array generation macros */
  453. #define PPP_ARRAY0(name) \
  454. [MDP_RGB_565] = PPP_##name##_MDP_RGB_565,\
  455. [MDP_RGB_888] = PPP_##name##_MDP_RGB_888,\
  456. [MDP_XRGB_8888] = PPP_##name##_MDP_XRGB_8888,\
  457. [MDP_ARGB_8888] = PPP_##name##_MDP_ARGB_8888,\
  458. [MDP_RGBA_8888] = PPP_##name##_MDP_RGBA_8888,\
  459. [MDP_BGRA_8888] = PPP_##name##_MDP_BGRA_8888,\
  460. [MDP_RGBX_8888] = PPP_##name##_MDP_RGBX_8888,\
  461. [MDP_Y_CBCR_H2V1] = PPP_##name##_MDP_Y_CBCR_H2V1,\
  462. [MDP_Y_CBCR_H2V2] = PPP_##name##_MDP_Y_CBCR_H2V2,\
  463. [MDP_Y_CRCB_H2V1] = PPP_##name##_MDP_Y_CRCB_H2V1,\
  464. [MDP_Y_CRCB_H2V2] = PPP_##name##_MDP_Y_CRCB_H2V2,\
  465. [MDP_YCRYCB_H2V1] = PPP_##name##_MDP_YCRYCB_H2V1
  466. #define PPP_ARRAY1(name, dir) \
  467. [MDP_RGB_565] = PPP_##name##_MDP_RGB_565(dir),\
  468. [MDP_RGB_888] = PPP_##name##_MDP_RGB_888(dir),\
  469. [MDP_XRGB_8888] = PPP_##name##_MDP_XRGB_8888(dir),\
  470. [MDP_ARGB_8888] = PPP_##name##_MDP_ARGB_8888(dir),\
  471. [MDP_RGBA_8888] = PPP_##name##_MDP_RGBA_8888(dir),\
  472. [MDP_BGRA_8888] = PPP_##name##_MDP_BGRA_8888(dir),\
  473. [MDP_RGBX_8888] = PPP_##name##_MDP_RGBX_8888(dir),\
  474. [MDP_Y_CBCR_H2V1] = PPP_##name##_MDP_Y_CBCR_H2V1(dir),\
  475. [MDP_Y_CBCR_H2V2] = PPP_##name##_MDP_Y_CBCR_H2V2(dir),\
  476. [MDP_Y_CRCB_H2V1] = PPP_##name##_MDP_Y_CRCB_H2V1(dir),\
  477. [MDP_Y_CRCB_H2V2] = PPP_##name##_MDP_Y_CRCB_H2V2(dir),\
  478. [MDP_YCRYCB_H2V1] = PPP_##name##_MDP_YCRYCB_H2V1(dir)
  479. #define IS_YCRCB(img) ((img == MDP_Y_CRCB_H2V2) | (img == MDP_Y_CBCR_H2V2) | \
  480. (img == MDP_Y_CRCB_H2V1) | (img == MDP_Y_CBCR_H2V1) | \
  481. (img == MDP_YCRYCB_H2V1))
  482. #define IS_RGB(img) ((img == MDP_RGB_565) | (img == MDP_RGB_888) | \
  483. (img == MDP_ARGB_8888) | (img == MDP_RGBA_8888) | \
  484. (img == MDP_XRGB_8888) | (img == MDP_BGRA_8888) | \
  485. (img == MDP_RGBX_8888))
  486. #define HAS_ALPHA(img) ((img == MDP_ARGB_8888) | (img == MDP_RGBA_8888) | \
  487. (img == MDP_BGRA_8888))
  488. #define IS_PSEUDOPLNR(img) ((img == MDP_Y_CRCB_H2V2) | \
  489. (img == MDP_Y_CBCR_H2V2) | \
  490. (img == MDP_Y_CRCB_H2V1) | \
  491. (img == MDP_Y_CBCR_H2V1))
  492. /* Mappings from addr to purpose */
  493. #define PPP_ADDR_SRC_ROI MDP_FULL_BYPASS_WORD2
  494. #define PPP_ADDR_SRC0 MDP_FULL_BYPASS_WORD3
  495. #define PPP_ADDR_SRC1 MDP_FULL_BYPASS_WORD4
  496. #define PPP_ADDR_SRC_YSTRIDE MDP_FULL_BYPASS_WORD7
  497. #define PPP_ADDR_SRC_CFG MDP_FULL_BYPASS_WORD9
  498. #define PPP_ADDR_SRC_PACK_PATTERN MDP_FULL_BYPASS_WORD10
  499. #define PPP_ADDR_OPERATION MDP_FULL_BYPASS_WORD14
  500. #define PPP_ADDR_PHASEX_INIT MDP_FULL_BYPASS_WORD15
  501. #define PPP_ADDR_PHASEY_INIT MDP_FULL_BYPASS_WORD16
  502. #define PPP_ADDR_PHASEX_STEP MDP_FULL_BYPASS_WORD17
  503. #define PPP_ADDR_PHASEY_STEP MDP_FULL_BYPASS_WORD18
  504. #define PPP_ADDR_ALPHA_TRANSP MDP_FULL_BYPASS_WORD19
  505. #define PPP_ADDR_DST_CFG MDP_FULL_BYPASS_WORD20
  506. #define PPP_ADDR_DST_PACK_PATTERN MDP_FULL_BYPASS_WORD21
  507. #define PPP_ADDR_DST_ROI MDP_FULL_BYPASS_WORD25
  508. #define PPP_ADDR_DST0 MDP_FULL_BYPASS_WORD26
  509. #define PPP_ADDR_DST1 MDP_FULL_BYPASS_WORD27
  510. #define PPP_ADDR_DST_YSTRIDE MDP_FULL_BYPASS_WORD30
  511. #define PPP_ADDR_EDGE MDP_FULL_BYPASS_WORD46
  512. #define PPP_ADDR_BG0 MDP_FULL_BYPASS_WORD48
  513. #define PPP_ADDR_BG1 MDP_FULL_BYPASS_WORD49
  514. #define PPP_ADDR_BG_YSTRIDE MDP_FULL_BYPASS_WORD51
  515. #define PPP_ADDR_BG_CFG MDP_FULL_BYPASS_WORD53
  516. #define PPP_ADDR_BG_PACK_PATTERN MDP_FULL_BYPASS_WORD54
  517. /* MDP_DMA_CONFIG / MDP_FULL_BYPASS_WORD32 */
  518. #define DMA_DSTC0G_6BITS (1<<1)
  519. #define DMA_DSTC1B_6BITS (1<<3)
  520. #define DMA_DSTC2R_6BITS (1<<5)
  521. #define DMA_DSTC0G_5BITS (1<<0)
  522. #define DMA_DSTC1B_5BITS (1<<2)
  523. #define DMA_DSTC2R_5BITS (1<<4)
  524. #define DMA_PACK_TIGHT (1<<6)
  525. #define DMA_PACK_LOOSE 0
  526. #define DMA_PACK_ALIGN_LSB 0
  527. #define DMA_PACK_ALIGN_MSB (1<<7)
  528. #define DMA_PACK_PATTERN_RGB \
  529. (MDP_GET_PACK_PATTERN(0, CLR_R, CLR_G, CLR_B, 2)<<8)
  530. #define DMA_OUT_SEL_AHB 0
  531. #define DMA_OUT_SEL_MDDI (1<<14)
  532. #define DMA_AHBM_LCD_SEL_PRIMARY 0
  533. #define DMA_AHBM_LCD_SEL_SECONDARY (1<<15)
  534. #define DMA_IBUF_C3ALPHA_EN (1<<16)
  535. #define DMA_DITHER_EN (1<<17)
  536. #define DMA_MDDI_DMAOUT_LCD_SEL_PRIMARY 0
  537. #define DMA_MDDI_DMAOUT_LCD_SEL_SECONDARY (1<<18)
  538. #define DMA_MDDI_DMAOUT_LCD_SEL_EXTERNAL (1<<19)
  539. #define DMA_IBUF_FORMAT_RGB565 (1<<20)
  540. #define DMA_IBUF_FORMAT_RGB888_OR_ARGB8888 0
  541. #define DMA_IBUF_NONCONTIGUOUS (1<<21)
  542. /* MDDI REGISTER ? */
  543. #define MDDI_VDO_PACKET_DESC 0x5666
  544. #define MDDI_VDO_PACKET_PRIM 0xC3
  545. #define MDDI_VDO_PACKET_SECD 0xC0
  546. #endif