exynos7_decon.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. /* include/video/exynos7_decon.h
  2. *
  3. * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  4. * Author: Ajay Kumar <ajaykumar.rs@samsung.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of the GNU General Public License as published by the
  8. * Free Software Foundation; either version 2 of the License, or (at your
  9. * option) any later version.
  10. */
  11. /* VIDCON0 */
  12. #define VIDCON0 0x00
  13. #define VIDCON0_SWRESET (1 << 28)
  14. #define VIDCON0_DECON_STOP_STATUS (1 << 2)
  15. #define VIDCON0_ENVID (1 << 1)
  16. #define VIDCON0_ENVID_F (1 << 0)
  17. /* VIDOUTCON0 */
  18. #define VIDOUTCON0 0x4
  19. #define VIDOUTCON0_DUAL_MASK (0x3 << 24)
  20. #define VIDOUTCON0_DUAL_ON (0x3 << 24)
  21. #define VIDOUTCON0_DISP_IF_1_ON (0x2 << 24)
  22. #define VIDOUTCON0_DISP_IF_0_ON (0x1 << 24)
  23. #define VIDOUTCON0_DUAL_OFF (0x0 << 24)
  24. #define VIDOUTCON0_IF_SHIFT 23
  25. #define VIDOUTCON0_IF_MASK (0x1 << 23)
  26. #define VIDOUTCON0_RGBIF (0x0 << 23)
  27. #define VIDOUTCON0_I80IF (0x1 << 23)
  28. /* VIDCON3 */
  29. #define VIDCON3 0x8
  30. /* VIDCON4 */
  31. #define VIDCON4 0xC
  32. #define VIDCON4_FIFOCNT_START_EN (1 << 0)
  33. /* VCLKCON0 */
  34. #define VCLKCON0 0x10
  35. #define VCLKCON0_CLKVALUP (1 << 8)
  36. #define VCLKCON0_VCLKFREE (1 << 0)
  37. /* VCLKCON */
  38. #define VCLKCON1 0x14
  39. #define VCLKCON1_CLKVAL_NUM_VCLK(val) (((val) & 0xff) << 0)
  40. #define VCLKCON2 0x18
  41. /* SHADOWCON */
  42. #define SHADOWCON 0x30
  43. #define SHADOWCON_WINx_PROTECT(_win) (1 << (10 + (_win)))
  44. /* WINCONx */
  45. #define WINCON(_win) (0x50 + ((_win) * 4))
  46. #define WINCONx_BUFSTATUS (0x3 << 30)
  47. #define WINCONx_BUFSEL_MASK (0x3 << 28)
  48. #define WINCONx_BUFSEL_SHIFT 28
  49. #define WINCONx_TRIPLE_BUF_MODE (0x1 << 18)
  50. #define WINCONx_DOUBLE_BUF_MODE (0x0 << 18)
  51. #define WINCONx_BURSTLEN_16WORD (0x0 << 11)
  52. #define WINCONx_BURSTLEN_8WORD (0x1 << 11)
  53. #define WINCONx_BURSTLEN_MASK (0x1 << 11)
  54. #define WINCONx_BURSTLEN_SHIFT 11
  55. #define WINCONx_BLD_PLANE (0 << 8)
  56. #define WINCONx_BLD_PIX (1 << 8)
  57. #define WINCONx_ALPHA_MUL (1 << 7)
  58. #define WINCONx_BPPMODE_MASK (0xf << 2)
  59. #define WINCONx_BPPMODE_SHIFT 2
  60. #define WINCONx_BPPMODE_16BPP_565 (0x8 << 2)
  61. #define WINCONx_BPPMODE_24BPP_BGRx (0x7 << 2)
  62. #define WINCONx_BPPMODE_24BPP_RGBx (0x6 << 2)
  63. #define WINCONx_BPPMODE_24BPP_xBGR (0x5 << 2)
  64. #define WINCONx_BPPMODE_24BPP_xRGB (0x4 << 2)
  65. #define WINCONx_BPPMODE_32BPP_BGRA (0x3 << 2)
  66. #define WINCONx_BPPMODE_32BPP_RGBA (0x2 << 2)
  67. #define WINCONx_BPPMODE_32BPP_ABGR (0x1 << 2)
  68. #define WINCONx_BPPMODE_32BPP_ARGB (0x0 << 2)
  69. #define WINCONx_ALPHA_SEL (1 << 1)
  70. #define WINCONx_ENWIN (1 << 0)
  71. #define WINCON1_ALPHA_MUL_F (1 << 7)
  72. #define WINCON2_ALPHA_MUL_F (1 << 7)
  73. #define WINCON3_ALPHA_MUL_F (1 << 7)
  74. #define WINCON4_ALPHA_MUL_F (1 << 7)
  75. /* VIDOSDxH: The height for the OSD image(READ ONLY)*/
  76. #define VIDOSD_H(_x) (0x80 + ((_x) * 4))
  77. /* Frame buffer start addresses: VIDWxxADD0n */
  78. #define VIDW_BUF_START(_win) (0x80 + ((_win) * 0x10))
  79. #define VIDW_BUF_START1(_win) (0x84 + ((_win) * 0x10))
  80. #define VIDW_BUF_START2(_win) (0x88 + ((_win) * 0x10))
  81. #define VIDW_WHOLE_X(_win) (0x0130 + ((_win) * 8))
  82. #define VIDW_WHOLE_Y(_win) (0x0134 + ((_win) * 8))
  83. #define VIDW_OFFSET_X(_win) (0x0170 + ((_win) * 8))
  84. #define VIDW_OFFSET_Y(_win) (0x0174 + ((_win) * 8))
  85. #define VIDW_BLKOFFSET(_win) (0x01B0 + ((_win) * 4))
  86. #define VIDW_BLKSIZE(win) (0x0200 + ((_win) * 4))
  87. /* Interrupt controls register */
  88. #define VIDINTCON2 0x228
  89. #define VIDINTCON1_INTEXTRA1_EN (1 << 1)
  90. #define VIDINTCON1_INTEXTRA0_EN (1 << 0)
  91. /* Interrupt controls and status register */
  92. #define VIDINTCON3 0x22C
  93. #define VIDINTCON1_INTEXTRA1_PEND (1 << 1)
  94. #define VIDINTCON1_INTEXTRA0_PEND (1 << 0)
  95. /* VIDOSDxA ~ VIDOSDxE */
  96. #define VIDOSD_BASE 0x230
  97. #define OSD_STRIDE 0x20
  98. #define VIDOSD_A(_win) (VIDOSD_BASE + \
  99. ((_win) * OSD_STRIDE) + 0x00)
  100. #define VIDOSD_B(_win) (VIDOSD_BASE + \
  101. ((_win) * OSD_STRIDE) + 0x04)
  102. #define VIDOSD_C(_win) (VIDOSD_BASE + \
  103. ((_win) * OSD_STRIDE) + 0x08)
  104. #define VIDOSD_D(_win) (VIDOSD_BASE + \
  105. ((_win) * OSD_STRIDE) + 0x0C)
  106. #define VIDOSD_E(_win) (VIDOSD_BASE + \
  107. ((_win) * OSD_STRIDE) + 0x10)
  108. #define VIDOSDxA_TOPLEFT_X_MASK (0x1fff << 13)
  109. #define VIDOSDxA_TOPLEFT_X_SHIFT 13
  110. #define VIDOSDxA_TOPLEFT_X_LIMIT 0x1fff
  111. #define VIDOSDxA_TOPLEFT_X(_x) (((_x) & 0x1fff) << 13)
  112. #define VIDOSDxA_TOPLEFT_Y_MASK (0x1fff << 0)
  113. #define VIDOSDxA_TOPLEFT_Y_SHIFT 0
  114. #define VIDOSDxA_TOPLEFT_Y_LIMIT 0x1fff
  115. #define VIDOSDxA_TOPLEFT_Y(_x) (((_x) & 0x1fff) << 0)
  116. #define VIDOSDxB_BOTRIGHT_X_MASK (0x1fff << 13)
  117. #define VIDOSDxB_BOTRIGHT_X_SHIFT 13
  118. #define VIDOSDxB_BOTRIGHT_X_LIMIT 0x1fff
  119. #define VIDOSDxB_BOTRIGHT_X(_x) (((_x) & 0x1fff) << 13)
  120. #define VIDOSDxB_BOTRIGHT_Y_MASK (0x1fff << 0)
  121. #define VIDOSDxB_BOTRIGHT_Y_SHIFT 0
  122. #define VIDOSDxB_BOTRIGHT_Y_LIMIT 0x1fff
  123. #define VIDOSDxB_BOTRIGHT_Y(_x) (((_x) & 0x1fff) << 0)
  124. #define VIDOSDxC_ALPHA0_R_F(_x) (((_x) & 0xFF) << 16)
  125. #define VIDOSDxC_ALPHA0_G_F(_x) (((_x) & 0xFF) << 8)
  126. #define VIDOSDxC_ALPHA0_B_F(_x) (((_x) & 0xFF) << 0)
  127. #define VIDOSDxD_ALPHA1_R_F(_x) (((_x) & 0xFF) << 16)
  128. #define VIDOSDxD_ALPHA1_G_F(_x) (((_x) & 0xFF) << 8)
  129. #define VIDOSDxD_ALPHA1_B_F(_x) (((_x) & 0xFF) >> 0)
  130. /* Window MAP (Color map) */
  131. #define WINxMAP(_win) (0x340 + ((_win) * 4))
  132. #define WINxMAP_MAP (1 << 24)
  133. #define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0)
  134. #define WINxMAP_MAP_COLOUR_SHIFT 0
  135. #define WINxMAP_MAP_COLOUR_LIMIT 0xffffff
  136. #define WINxMAP_MAP_COLOUR(_x) ((_x) << 0)
  137. /* Window colour-key control registers */
  138. #define WKEYCON 0x370
  139. #define WKEYCON0 0x00
  140. #define WKEYCON1 0x04
  141. #define WxKEYCON0_KEYBL_EN (1 << 26)
  142. #define WxKEYCON0_KEYEN_F (1 << 25)
  143. #define WxKEYCON0_DIRCON (1 << 24)
  144. #define WxKEYCON0_COMPKEY_MASK (0xffffff << 0)
  145. #define WxKEYCON0_COMPKEY_SHIFT 0
  146. #define WxKEYCON0_COMPKEY_LIMIT 0xffffff
  147. #define WxKEYCON0_COMPKEY(_x) ((_x) << 0)
  148. #define WxKEYCON1_COLVAL_MASK (0xffffff << 0)
  149. #define WxKEYCON1_COLVAL_SHIFT 0
  150. #define WxKEYCON1_COLVAL_LIMIT 0xffffff
  151. #define WxKEYCON1_COLVAL(_x) ((_x) << 0)
  152. /* color key control register for hardware window 1 ~ 4. */
  153. #define WKEYCON0_BASE(x) ((WKEYCON + WKEYCON0) + ((x - 1) * 8))
  154. /* color key value register for hardware window 1 ~ 4. */
  155. #define WKEYCON1_BASE(x) ((WKEYCON + WKEYCON1) + ((x - 1) * 8))
  156. /* Window KEY Alpha value */
  157. #define WxKEYALPHA(_win) (0x3A0 + (((_win) - 1) * 0x4))
  158. #define Wx_KEYALPHA_R_F_SHIFT 16
  159. #define Wx_KEYALPHA_G_F_SHIFT 8
  160. #define Wx_KEYALPHA_B_F_SHIFT 0
  161. /* Blending equation */
  162. #define BLENDE(_win) (0x03C0 + ((_win) * 4))
  163. #define BLENDE_COEF_ZERO 0x0
  164. #define BLENDE_COEF_ONE 0x1
  165. #define BLENDE_COEF_ALPHA_A 0x2
  166. #define BLENDE_COEF_ONE_MINUS_ALPHA_A 0x3
  167. #define BLENDE_COEF_ALPHA_B 0x4
  168. #define BLENDE_COEF_ONE_MINUS_ALPHA_B 0x5
  169. #define BLENDE_COEF_ALPHA0 0x6
  170. #define BLENDE_COEF_A 0xA
  171. #define BLENDE_COEF_ONE_MINUS_A 0xB
  172. #define BLENDE_COEF_B 0xC
  173. #define BLENDE_COEF_ONE_MINUS_B 0xD
  174. #define BLENDE_Q_FUNC(_v) ((_v) << 18)
  175. #define BLENDE_P_FUNC(_v) ((_v) << 12)
  176. #define BLENDE_B_FUNC(_v) ((_v) << 6)
  177. #define BLENDE_A_FUNC(_v) ((_v) << 0)
  178. /* Blending equation control */
  179. #define BLENDCON 0x3D8
  180. #define BLENDCON_NEW_MASK (1 << 0)
  181. #define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0)
  182. #define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
  183. /* Interrupt control register */
  184. #define VIDINTCON0 0x500
  185. #define VIDINTCON0_WAKEUP_MASK (0x3f << 26)
  186. #define VIDINTCON0_INTEXTRAEN (1 << 21)
  187. #define VIDINTCON0_FRAMESEL0_SHIFT 15
  188. #define VIDINTCON0_FRAMESEL0_MASK (0x3 << 15)
  189. #define VIDINTCON0_FRAMESEL0_BACKPORCH (0x0 << 15)
  190. #define VIDINTCON0_FRAMESEL0_VSYNC (0x1 << 15)
  191. #define VIDINTCON0_FRAMESEL0_ACTIVE (0x2 << 15)
  192. #define VIDINTCON0_FRAMESEL0_FRONTPORCH (0x3 << 15)
  193. #define VIDINTCON0_INT_FRAME (1 << 11)
  194. #define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 3)
  195. #define VIDINTCON0_FIFOLEVEL_SHIFT 3
  196. #define VIDINTCON0_FIFOLEVEL_EMPTY (0x0 << 3)
  197. #define VIDINTCON0_FIFOLEVEL_TO25PC (0x1 << 3)
  198. #define VIDINTCON0_FIFOLEVEL_TO50PC (0x2 << 3)
  199. #define VIDINTCON0_FIFOLEVEL_FULL (0x4 << 3)
  200. #define VIDINTCON0_FIFOSEL_MAIN_EN (1 << 1)
  201. #define VIDINTCON0_INT_FIFO (1 << 1)
  202. #define VIDINTCON0_INT_ENABLE (1 << 0)
  203. /* Interrupt controls and status register */
  204. #define VIDINTCON1 0x504
  205. #define VIDINTCON1_INT_EXTRA (1 << 3)
  206. #define VIDINTCON1_INT_I80 (1 << 2)
  207. #define VIDINTCON1_INT_FRAME (1 << 1)
  208. #define VIDINTCON1_INT_FIFO (1 << 0)
  209. /* VIDCON1 */
  210. #define VIDCON1(_x) (0x0600 + ((_x) * 0x50))
  211. #define VIDCON1_LINECNT_GET(_v) (((_v) >> 17) & 0x1fff)
  212. #define VIDCON1_VCLK_MASK (0x3 << 9)
  213. #define VIDCON1_VCLK_HOLD (0x0 << 9)
  214. #define VIDCON1_VCLK_RUN (0x1 << 9)
  215. #define VIDCON1_VCLK_RUN_VDEN_DISABLE (0x3 << 9)
  216. #define VIDCON1_RGB_ORDER_O_MASK (0x7 << 4)
  217. #define VIDCON1_RGB_ORDER_O_RGB (0x0 << 4)
  218. #define VIDCON1_RGB_ORDER_O_GBR (0x1 << 4)
  219. #define VIDCON1_RGB_ORDER_O_BRG (0x2 << 4)
  220. #define VIDCON1_RGB_ORDER_O_BGR (0x4 << 4)
  221. #define VIDCON1_RGB_ORDER_O_RBG (0x5 << 4)
  222. #define VIDCON1_RGB_ORDER_O_GRB (0x6 << 4)
  223. /* VIDTCON0 */
  224. #define VIDTCON0 0x610
  225. #define VIDTCON0_VBPD_MASK (0xffff << 16)
  226. #define VIDTCON0_VBPD_SHIFT 16
  227. #define VIDTCON0_VBPD_LIMIT 0xffff
  228. #define VIDTCON0_VBPD(_x) ((_x) << 16)
  229. #define VIDTCON0_VFPD_MASK (0xffff << 0)
  230. #define VIDTCON0_VFPD_SHIFT 0
  231. #define VIDTCON0_VFPD_LIMIT 0xffff
  232. #define VIDTCON0_VFPD(_x) ((_x) << 0)
  233. /* VIDTCON1 */
  234. #define VIDTCON1 0x614
  235. #define VIDTCON1_VSPW_MASK (0xffff << 16)
  236. #define VIDTCON1_VSPW_SHIFT 16
  237. #define VIDTCON1_VSPW_LIMIT 0xffff
  238. #define VIDTCON1_VSPW(_x) ((_x) << 16)
  239. /* VIDTCON2 */
  240. #define VIDTCON2 0x618
  241. #define VIDTCON2_HBPD_MASK (0xffff << 16)
  242. #define VIDTCON2_HBPD_SHIFT 16
  243. #define VIDTCON2_HBPD_LIMIT 0xffff
  244. #define VIDTCON2_HBPD(_x) ((_x) << 16)
  245. #define VIDTCON2_HFPD_MASK (0xffff << 0)
  246. #define VIDTCON2_HFPD_SHIFT 0
  247. #define VIDTCON2_HFPD_LIMIT 0xffff
  248. #define VIDTCON2_HFPD(_x) ((_x) << 0)
  249. /* VIDTCON3 */
  250. #define VIDTCON3 0x61C
  251. #define VIDTCON3_HSPW_MASK (0xffff << 16)
  252. #define VIDTCON3_HSPW_SHIFT 16
  253. #define VIDTCON3_HSPW_LIMIT 0xffff
  254. #define VIDTCON3_HSPW(_x) ((_x) << 16)
  255. /* VIDTCON4 */
  256. #define VIDTCON4 0x620
  257. #define VIDTCON4_LINEVAL_MASK (0xfff << 16)
  258. #define VIDTCON4_LINEVAL_SHIFT 16
  259. #define VIDTCON4_LINEVAL_LIMIT 0xfff
  260. #define VIDTCON4_LINEVAL(_x) (((_x) & 0xfff) << 16)
  261. #define VIDTCON4_HOZVAL_MASK (0xfff << 0)
  262. #define VIDTCON4_HOZVAL_SHIFT 0
  263. #define VIDTCON4_HOZVAL_LIMIT 0xfff
  264. #define VIDTCON4_HOZVAL(_x) (((_x) & 0xfff) << 0)
  265. /* LINECNT OP THRSHOLD*/
  266. #define LINECNT_OP_THRESHOLD 0x630
  267. /* CRCCTRL */
  268. #define CRCCTRL 0x6C8
  269. #define CRCCTRL_CRCCLKEN (0x1 << 2)
  270. #define CRCCTRL_CRCSTART_F (0x1 << 1)
  271. #define CRCCTRL_CRCEN (0x1 << 0)
  272. /* DECON_CMU */
  273. #define DECON_CMU 0x704
  274. #define DECON_CMU_ALL_CLKGATE_ENABLE 0x3
  275. #define DECON_CMU_SE_CLKGATE_ENABLE (0x1 << 2)
  276. #define DECON_CMU_SFR_CLKGATE_ENABLE (0x1 << 1)
  277. #define DECON_CMU_MEM_CLKGATE_ENABLE (0x1 << 0)
  278. /* DECON_UPDATE */
  279. #define DECON_UPDATE 0x710
  280. #define DECON_UPDATE_SLAVE_SYNC (1 << 4)
  281. #define DECON_UPDATE_STANDALONE_F (1 << 0)