mtk_dpi_regs.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. /*
  2. * Copyright (c) 2014 MediaTek Inc.
  3. * Author: Jie Qiu <jie.qiu@mediatek.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #ifndef __MTK_DPI_REGS_H
  15. #define __MTK_DPI_REGS_H
  16. #define DPI_EN 0x00
  17. #define EN BIT(0)
  18. #define DPI_RET 0x04
  19. #define RST BIT(0)
  20. #define DPI_INTEN 0x08
  21. #define INT_VSYNC_EN BIT(0)
  22. #define INT_VDE_EN BIT(1)
  23. #define INT_UNDERFLOW_EN BIT(2)
  24. #define DPI_INTSTA 0x0C
  25. #define INT_VSYNC_STA BIT(0)
  26. #define INT_VDE_STA BIT(1)
  27. #define INT_UNDERFLOW_STA BIT(2)
  28. #define DPI_CON 0x10
  29. #define BG_ENABLE BIT(0)
  30. #define IN_RB_SWAP BIT(1)
  31. #define INTL_EN BIT(2)
  32. #define TDFP_EN BIT(3)
  33. #define CLPF_EN BIT(4)
  34. #define YUV422_EN BIT(5)
  35. #define CSC_ENABLE BIT(6)
  36. #define R601_SEL BIT(7)
  37. #define EMBSYNC_EN BIT(8)
  38. #define VS_LODD_EN BIT(16)
  39. #define VS_LEVEN_EN BIT(17)
  40. #define VS_RODD_EN BIT(18)
  41. #define VS_REVEN BIT(19)
  42. #define FAKE_DE_LODD BIT(20)
  43. #define FAKE_DE_LEVEN BIT(21)
  44. #define FAKE_DE_RODD BIT(22)
  45. #define FAKE_DE_REVEN BIT(23)
  46. #define DPI_OUTPUT_SETTING 0x14
  47. #define CH_SWAP 0
  48. #define CH_SWAP_MASK (0x7 << 0)
  49. #define SWAP_RGB 0x00
  50. #define SWAP_GBR 0x01
  51. #define SWAP_BRG 0x02
  52. #define SWAP_RBG 0x03
  53. #define SWAP_GRB 0x04
  54. #define SWAP_BGR 0x05
  55. #define BIT_SWAP BIT(3)
  56. #define B_MASK BIT(4)
  57. #define G_MASK BIT(5)
  58. #define R_MASK BIT(6)
  59. #define DE_MASK BIT(8)
  60. #define HS_MASK BIT(9)
  61. #define VS_MASK BIT(10)
  62. #define DE_POL BIT(12)
  63. #define HSYNC_POL BIT(13)
  64. #define VSYNC_POL BIT(14)
  65. #define CK_POL BIT(15)
  66. #define OEN_OFF BIT(16)
  67. #define EDGE_SEL BIT(17)
  68. #define OUT_BIT 18
  69. #define OUT_BIT_MASK (0x3 << 18)
  70. #define OUT_BIT_8 0x00
  71. #define OUT_BIT_10 0x01
  72. #define OUT_BIT_12 0x02
  73. #define OUT_BIT_16 0x03
  74. #define YC_MAP 20
  75. #define YC_MAP_MASK (0x7 << 20)
  76. #define YC_MAP_RGB 0x00
  77. #define YC_MAP_CYCY 0x04
  78. #define YC_MAP_YCYC 0x05
  79. #define YC_MAP_CY 0x06
  80. #define YC_MAP_YC 0x07
  81. #define DPI_SIZE 0x18
  82. #define HSIZE 0
  83. #define HSIZE_MASK (0x1FFF << 0)
  84. #define VSIZE 16
  85. #define VSIZE_MASK (0x1FFF << 16)
  86. #define DPI_DDR_SETTING 0x1C
  87. #define DDR_EN BIT(0)
  88. #define DDDR_SEL BIT(1)
  89. #define DDR_4PHASE BIT(2)
  90. #define DDR_WIDTH (0x3 << 4)
  91. #define DDR_PAD_MODE (0x1 << 8)
  92. #define DPI_TGEN_HWIDTH 0x20
  93. #define HPW 0
  94. #define HPW_MASK (0xFFF << 0)
  95. #define DPI_TGEN_HPORCH 0x24
  96. #define HBP 0
  97. #define HBP_MASK (0xFFF << 0)
  98. #define HFP 16
  99. #define HFP_MASK (0xFFF << 16)
  100. #define DPI_TGEN_VWIDTH 0x28
  101. #define DPI_TGEN_VPORCH 0x2C
  102. #define VSYNC_WIDTH_SHIFT 0
  103. #define VSYNC_WIDTH_MASK (0xFFF << 0)
  104. #define VSYNC_HALF_LINE_SHIFT 16
  105. #define VSYNC_HALF_LINE_MASK BIT(16)
  106. #define VSYNC_BACK_PORCH_SHIFT 0
  107. #define VSYNC_BACK_PORCH_MASK (0xFFF << 0)
  108. #define VSYNC_FRONT_PORCH_SHIFT 16
  109. #define VSYNC_FRONT_PORCH_MASK (0xFFF << 16)
  110. #define DPI_BG_HCNTL 0x30
  111. #define BG_RIGHT (0x1FFF << 0)
  112. #define BG_LEFT (0x1FFF << 16)
  113. #define DPI_BG_VCNTL 0x34
  114. #define BG_BOT (0x1FFF << 0)
  115. #define BG_TOP (0x1FFF << 16)
  116. #define DPI_BG_COLOR 0x38
  117. #define BG_B (0xF << 0)
  118. #define BG_G (0xF << 8)
  119. #define BG_R (0xF << 16)
  120. #define DPI_FIFO_CTL 0x3C
  121. #define FIFO_VALID_SET (0x1F << 0)
  122. #define FIFO_RST_SEL (0x1 << 8)
  123. #define DPI_STATUS 0x40
  124. #define VCOUNTER (0x1FFF << 0)
  125. #define DPI_BUSY BIT(16)
  126. #define OUTEN BIT(17)
  127. #define FIELD BIT(20)
  128. #define TDLR BIT(21)
  129. #define DPI_TMODE 0x44
  130. #define DPI_OEN_ON BIT(0)
  131. #define DPI_CHECKSUM 0x48
  132. #define DPI_CHECKSUM_MASK (0xFFFFFF << 0)
  133. #define DPI_CHECKSUM_READY BIT(30)
  134. #define DPI_CHECKSUM_EN BIT(31)
  135. #define DPI_DUMMY 0x50
  136. #define DPI_DUMMY_MASK (0xFFFFFFFF << 0)
  137. #define DPI_TGEN_VWIDTH_LEVEN 0x68
  138. #define DPI_TGEN_VPORCH_LEVEN 0x6C
  139. #define DPI_TGEN_VWIDTH_RODD 0x70
  140. #define DPI_TGEN_VPORCH_RODD 0x74
  141. #define DPI_TGEN_VWIDTH_REVEN 0x78
  142. #define DPI_TGEN_VPORCH_REVEN 0x7C
  143. #define DPI_ESAV_VTIMING_LODD 0x80
  144. #define ESAV_VOFST_LODD (0xFFF << 0)
  145. #define ESAV_VWID_LODD (0xFFF << 16)
  146. #define DPI_ESAV_VTIMING_LEVEN 0x84
  147. #define ESAV_VOFST_LEVEN (0xFFF << 0)
  148. #define ESAV_VWID_LEVEN (0xFFF << 16)
  149. #define DPI_ESAV_VTIMING_RODD 0x88
  150. #define ESAV_VOFST_RODD (0xFFF << 0)
  151. #define ESAV_VWID_RODD (0xFFF << 16)
  152. #define DPI_ESAV_VTIMING_REVEN 0x8C
  153. #define ESAV_VOFST_REVEN (0xFFF << 0)
  154. #define ESAV_VWID_REVEN (0xFFF << 16)
  155. #define DPI_ESAV_FTIMING 0x90
  156. #define ESAV_FOFST_ODD (0xFFF << 0)
  157. #define ESAV_FOFST_EVEN (0xFFF << 16)
  158. #define DPI_CLPF_SETTING 0x94
  159. #define CLPF_TYPE (0x3 << 0)
  160. #define ROUND_EN BIT(4)
  161. #define DPI_Y_LIMIT 0x98
  162. #define Y_LIMINT_BOT 0
  163. #define Y_LIMINT_BOT_MASK (0xFFF << 0)
  164. #define Y_LIMINT_TOP 16
  165. #define Y_LIMINT_TOP_MASK (0xFFF << 16)
  166. #define DPI_C_LIMIT 0x9C
  167. #define C_LIMIT_BOT 0
  168. #define C_LIMIT_BOT_MASK (0xFFF << 0)
  169. #define C_LIMIT_TOP 16
  170. #define C_LIMIT_TOP_MASK (0xFFF << 16)
  171. #define DPI_YUV422_SETTING 0xA0
  172. #define UV_SWAP BIT(0)
  173. #define CR_DELSEL BIT(4)
  174. #define CB_DELSEL BIT(5)
  175. #define Y_DELSEL BIT(6)
  176. #define DE_DELSEL BIT(7)
  177. #define DPI_EMBSYNC_SETTING 0xA4
  178. #define EMBSYNC_R_CR_EN BIT(0)
  179. #define EMPSYNC_G_Y_EN BIT(1)
  180. #define EMPSYNC_B_CB_EN BIT(2)
  181. #define ESAV_F_INV BIT(4)
  182. #define ESAV_V_INV BIT(5)
  183. #define ESAV_H_INV BIT(6)
  184. #define ESAV_CODE_MAN BIT(8)
  185. #define VS_OUT_SEL (0x7 << 12)
  186. #define DPI_ESAV_CODE_SET0 0xA8
  187. #define ESAV_CODE0 (0xFFF << 0)
  188. #define ESAV_CODE1 (0xFFF << 16)
  189. #define DPI_ESAV_CODE_SET1 0xAC
  190. #define ESAV_CODE2 (0xFFF << 0)
  191. #define ESAV_CODE3_MSB BIT(16)
  192. #define DPI_H_FRE_CON 0xE0
  193. #define H_FRE_2N BIT(25)
  194. #endif /* __MTK_DPI_REGS_H */