samsung_fimd.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. /* include/video/samsung_fimd.h
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * http://armlinux.simtec.co.uk/
  6. * Ben Dooks <ben@simtec.co.uk>
  7. *
  8. * S3C Platform - new-style fimd and framebuffer register definitions
  9. *
  10. * This is the register set for the fimd and new style framebuffer interface
  11. * found from the S3C2443 onwards into the S3C2416, S3C2450 and the
  12. * S3C64XX series such as the S3C6400 and S3C6410.
  13. *
  14. * The file does not contain the cpu specific items which are based on
  15. * whichever architecture is selected, it only contains the core of the
  16. * register set. See <mach/regs-fb.h> to get the specifics.
  17. *
  18. * This program is free software; you can redistribute it and/or modify
  19. * it under the terms of the GNU General Public License version 2 as
  20. * published by the Free Software Foundation.
  21. */
  22. /* VIDCON0 */
  23. #define VIDCON0 (0x00)
  24. #define VIDCON0_INTERLACE (1 << 29)
  25. #define VIDCON0_VIDOUT_MASK (0x3 << 26)
  26. #define VIDCON0_VIDOUT_SHIFT (26)
  27. #define VIDCON0_VIDOUT_RGB (0x0 << 26)
  28. #define VIDCON0_VIDOUT_TV (0x1 << 26)
  29. #define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26)
  30. #define VIDCON0_VIDOUT_I80_LDI1 (0x3 << 26)
  31. #define VIDCON0_L1_DATA_MASK (0x7 << 23)
  32. #define VIDCON0_L1_DATA_SHIFT (23)
  33. #define VIDCON0_L1_DATA_16BPP (0x0 << 23)
  34. #define VIDCON0_L1_DATA_18BPP16 (0x1 << 23)
  35. #define VIDCON0_L1_DATA_18BPP9 (0x2 << 23)
  36. #define VIDCON0_L1_DATA_24BPP (0x3 << 23)
  37. #define VIDCON0_L1_DATA_18BPP (0x4 << 23)
  38. #define VIDCON0_L1_DATA_16BPP8 (0x5 << 23)
  39. #define VIDCON0_L0_DATA_MASK (0x7 << 20)
  40. #define VIDCON0_L0_DATA_SHIFT (20)
  41. #define VIDCON0_L0_DATA_16BPP (0x0 << 20)
  42. #define VIDCON0_L0_DATA_18BPP16 (0x1 << 20)
  43. #define VIDCON0_L0_DATA_18BPP9 (0x2 << 20)
  44. #define VIDCON0_L0_DATA_24BPP (0x3 << 20)
  45. #define VIDCON0_L0_DATA_18BPP (0x4 << 20)
  46. #define VIDCON0_L0_DATA_16BPP8 (0x5 << 20)
  47. #define VIDCON0_PNRMODE_MASK (0x3 << 17)
  48. #define VIDCON0_PNRMODE_SHIFT (17)
  49. #define VIDCON0_PNRMODE_RGB (0x0 << 17)
  50. #define VIDCON0_PNRMODE_BGR (0x1 << 17)
  51. #define VIDCON0_PNRMODE_SERIAL_RGB (0x2 << 17)
  52. #define VIDCON0_PNRMODE_SERIAL_BGR (0x3 << 17)
  53. #define VIDCON0_CLKVALUP (1 << 16)
  54. #define VIDCON0_CLKVAL_F_MASK (0xff << 6)
  55. #define VIDCON0_CLKVAL_F_SHIFT (6)
  56. #define VIDCON0_CLKVAL_F_LIMIT (0xff)
  57. #define VIDCON0_CLKVAL_F(_x) ((_x) << 6)
  58. #define VIDCON0_VLCKFREE (1 << 5)
  59. #define VIDCON0_CLKDIR (1 << 4)
  60. #define VIDCON0_CLKSEL_MASK (0x3 << 2)
  61. #define VIDCON0_CLKSEL_SHIFT (2)
  62. #define VIDCON0_CLKSEL_HCLK (0x0 << 2)
  63. #define VIDCON0_CLKSEL_LCD (0x1 << 2)
  64. #define VIDCON0_CLKSEL_27M (0x3 << 2)
  65. #define VIDCON0_ENVID (1 << 1)
  66. #define VIDCON0_ENVID_F (1 << 0)
  67. #define VIDCON1 (0x04)
  68. #define VIDCON1_LINECNT_MASK (0x7ff << 16)
  69. #define VIDCON1_LINECNT_SHIFT (16)
  70. #define VIDCON1_LINECNT_GET(_v) (((_v) >> 16) & 0x7ff)
  71. #define VIDCON1_VSTATUS_MASK (0x3 << 13)
  72. #define VIDCON1_VSTATUS_SHIFT (13)
  73. #define VIDCON1_VSTATUS_VSYNC (0x0 << 13)
  74. #define VIDCON1_VSTATUS_BACKPORCH (0x1 << 13)
  75. #define VIDCON1_VSTATUS_ACTIVE (0x2 << 13)
  76. #define VIDCON1_VSTATUS_FRONTPORCH (0x0 << 13)
  77. #define VIDCON1_VCLK_MASK (0x3 << 9)
  78. #define VIDCON1_VCLK_HOLD (0x0 << 9)
  79. #define VIDCON1_VCLK_RUN (0x1 << 9)
  80. #define VIDCON1_INV_VCLK (1 << 7)
  81. #define VIDCON1_INV_HSYNC (1 << 6)
  82. #define VIDCON1_INV_VSYNC (1 << 5)
  83. #define VIDCON1_INV_VDEN (1 << 4)
  84. /* VIDCON2 */
  85. #define VIDCON2 (0x08)
  86. #define VIDCON2_EN601 (1 << 23)
  87. #define VIDCON2_TVFMTSEL_SW (1 << 14)
  88. #define VIDCON2_TVFMTSEL1_MASK (0x3 << 12)
  89. #define VIDCON2_TVFMTSEL1_SHIFT (12)
  90. #define VIDCON2_TVFMTSEL1_RGB (0x0 << 12)
  91. #define VIDCON2_TVFMTSEL1_YUV422 (0x1 << 12)
  92. #define VIDCON2_TVFMTSEL1_YUV444 (0x2 << 12)
  93. #define VIDCON2_ORGYCbCr (1 << 8)
  94. #define VIDCON2_YUVORDCrCb (1 << 7)
  95. /* PRTCON (S3C6410, S5PC100)
  96. * Might not be present in the S3C6410 documentation,
  97. * but tests prove it's there almost for sure; shouldn't hurt in any case.
  98. */
  99. #define PRTCON (0x0c)
  100. #define PRTCON_PROTECT (1 << 11)
  101. /* VIDTCON0 */
  102. #define VIDTCON0_VBPDE_MASK (0xff << 24)
  103. #define VIDTCON0_VBPDE_SHIFT (24)
  104. #define VIDTCON0_VBPDE_LIMIT (0xff)
  105. #define VIDTCON0_VBPDE(_x) ((_x) << 24)
  106. #define VIDTCON0_VBPD_MASK (0xff << 16)
  107. #define VIDTCON0_VBPD_SHIFT (16)
  108. #define VIDTCON0_VBPD_LIMIT (0xff)
  109. #define VIDTCON0_VBPD(_x) ((_x) << 16)
  110. #define VIDTCON0_VFPD_MASK (0xff << 8)
  111. #define VIDTCON0_VFPD_SHIFT (8)
  112. #define VIDTCON0_VFPD_LIMIT (0xff)
  113. #define VIDTCON0_VFPD(_x) ((_x) << 8)
  114. #define VIDTCON0_VSPW_MASK (0xff << 0)
  115. #define VIDTCON0_VSPW_SHIFT (0)
  116. #define VIDTCON0_VSPW_LIMIT (0xff)
  117. #define VIDTCON0_VSPW(_x) ((_x) << 0)
  118. /* VIDTCON1 */
  119. #define VIDTCON1_VFPDE_MASK (0xff << 24)
  120. #define VIDTCON1_VFPDE_SHIFT (24)
  121. #define VIDTCON1_VFPDE_LIMIT (0xff)
  122. #define VIDTCON1_VFPDE(_x) ((_x) << 24)
  123. #define VIDTCON1_HBPD_MASK (0xff << 16)
  124. #define VIDTCON1_HBPD_SHIFT (16)
  125. #define VIDTCON1_HBPD_LIMIT (0xff)
  126. #define VIDTCON1_HBPD(_x) ((_x) << 16)
  127. #define VIDTCON1_HFPD_MASK (0xff << 8)
  128. #define VIDTCON1_HFPD_SHIFT (8)
  129. #define VIDTCON1_HFPD_LIMIT (0xff)
  130. #define VIDTCON1_HFPD(_x) ((_x) << 8)
  131. #define VIDTCON1_HSPW_MASK (0xff << 0)
  132. #define VIDTCON1_HSPW_SHIFT (0)
  133. #define VIDTCON1_HSPW_LIMIT (0xff)
  134. #define VIDTCON1_HSPW(_x) ((_x) << 0)
  135. #define VIDTCON2 (0x18)
  136. #define VIDTCON2_LINEVAL_E(_x) ((((_x) & 0x800) >> 11) << 23)
  137. #define VIDTCON2_LINEVAL_MASK (0x7ff << 11)
  138. #define VIDTCON2_LINEVAL_SHIFT (11)
  139. #define VIDTCON2_LINEVAL_LIMIT (0x7ff)
  140. #define VIDTCON2_LINEVAL(_x) (((_x) & 0x7ff) << 11)
  141. #define VIDTCON2_HOZVAL_E(_x) ((((_x) & 0x800) >> 11) << 22)
  142. #define VIDTCON2_HOZVAL_MASK (0x7ff << 0)
  143. #define VIDTCON2_HOZVAL_SHIFT (0)
  144. #define VIDTCON2_HOZVAL_LIMIT (0x7ff)
  145. #define VIDTCON2_HOZVAL(_x) (((_x) & 0x7ff) << 0)
  146. /* WINCONx */
  147. #define WINCONx_BITSWP (1 << 18)
  148. #define WINCONx_BYTSWP (1 << 17)
  149. #define WINCONx_HAWSWP (1 << 16)
  150. #define WINCONx_WSWP (1 << 15)
  151. #define WINCONx_BURSTLEN_MASK (0x3 << 9)
  152. #define WINCONx_BURSTLEN_SHIFT (9)
  153. #define WINCONx_BURSTLEN_16WORD (0x0 << 9)
  154. #define WINCONx_BURSTLEN_8WORD (0x1 << 9)
  155. #define WINCONx_BURSTLEN_4WORD (0x2 << 9)
  156. #define WINCONx_ENWIN (1 << 0)
  157. #define WINCON0_BPPMODE_MASK (0xf << 2)
  158. #define WINCON0_BPPMODE_SHIFT (2)
  159. #define WINCON0_BPPMODE_1BPP (0x0 << 2)
  160. #define WINCON0_BPPMODE_2BPP (0x1 << 2)
  161. #define WINCON0_BPPMODE_4BPP (0x2 << 2)
  162. #define WINCON0_BPPMODE_8BPP_PALETTE (0x3 << 2)
  163. #define WINCON0_BPPMODE_16BPP_565 (0x5 << 2)
  164. #define WINCON0_BPPMODE_16BPP_1555 (0x7 << 2)
  165. #define WINCON0_BPPMODE_18BPP_666 (0x8 << 2)
  166. #define WINCON0_BPPMODE_24BPP_888 (0xb << 2)
  167. #define WINCON1_BLD_PIX (1 << 6)
  168. #define WINCON1_ALPHA_SEL (1 << 1)
  169. #define WINCON1_BPPMODE_MASK (0xf << 2)
  170. #define WINCON1_BPPMODE_SHIFT (2)
  171. #define WINCON1_BPPMODE_1BPP (0x0 << 2)
  172. #define WINCON1_BPPMODE_2BPP (0x1 << 2)
  173. #define WINCON1_BPPMODE_4BPP (0x2 << 2)
  174. #define WINCON1_BPPMODE_8BPP_PALETTE (0x3 << 2)
  175. #define WINCON1_BPPMODE_8BPP_1232 (0x4 << 2)
  176. #define WINCON1_BPPMODE_16BPP_565 (0x5 << 2)
  177. #define WINCON1_BPPMODE_16BPP_A1555 (0x6 << 2)
  178. #define WINCON1_BPPMODE_16BPP_I1555 (0x7 << 2)
  179. #define WINCON1_BPPMODE_18BPP_666 (0x8 << 2)
  180. #define WINCON1_BPPMODE_18BPP_A1665 (0x9 << 2)
  181. #define WINCON1_BPPMODE_19BPP_A1666 (0xa << 2)
  182. #define WINCON1_BPPMODE_24BPP_888 (0xb << 2)
  183. #define WINCON1_BPPMODE_24BPP_A1887 (0xc << 2)
  184. #define WINCON1_BPPMODE_25BPP_A1888 (0xd << 2)
  185. #define WINCON1_BPPMODE_28BPP_A4888 (0xd << 2)
  186. /* S5PV210 */
  187. #define SHADOWCON (0x34)
  188. #define SHADOWCON_WINx_PROTECT(_win) (1 << (10 + (_win)))
  189. /* DMA channels (all windows) */
  190. #define SHADOWCON_CHx_ENABLE(_win) (1 << (_win))
  191. /* Local input channels (windows 0-2) */
  192. #define SHADOWCON_CHx_LOCAL_ENABLE(_win) (1 << (5 + (_win)))
  193. #define VIDOSDxA_TOPLEFT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
  194. #define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11)
  195. #define VIDOSDxA_TOPLEFT_X_SHIFT (11)
  196. #define VIDOSDxA_TOPLEFT_X_LIMIT (0x7ff)
  197. #define VIDOSDxA_TOPLEFT_X(_x) (((_x) & 0x7ff) << 11)
  198. #define VIDOSDxA_TOPLEFT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22)
  199. #define VIDOSDxA_TOPLEFT_Y_MASK (0x7ff << 0)
  200. #define VIDOSDxA_TOPLEFT_Y_SHIFT (0)
  201. #define VIDOSDxA_TOPLEFT_Y_LIMIT (0x7ff)
  202. #define VIDOSDxA_TOPLEFT_Y(_x) (((_x) & 0x7ff) << 0)
  203. #define VIDOSDxB_BOTRIGHT_X_E(_x) ((((_x) & 0x800) >> 11) << 23)
  204. #define VIDOSDxB_BOTRIGHT_X_MASK (0x7ff << 11)
  205. #define VIDOSDxB_BOTRIGHT_X_SHIFT (11)
  206. #define VIDOSDxB_BOTRIGHT_X_LIMIT (0x7ff)
  207. #define VIDOSDxB_BOTRIGHT_X(_x) (((_x) & 0x7ff) << 11)
  208. #define VIDOSDxB_BOTRIGHT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22)
  209. #define VIDOSDxB_BOTRIGHT_Y_MASK (0x7ff << 0)
  210. #define VIDOSDxB_BOTRIGHT_Y_SHIFT (0)
  211. #define VIDOSDxB_BOTRIGHT_Y_LIMIT (0x7ff)
  212. #define VIDOSDxB_BOTRIGHT_Y(_x) (((_x) & 0x7ff) << 0)
  213. /* For VIDOSD[1..4]C */
  214. #define VIDISD14C_ALPHA0_R(_x) ((_x) << 20)
  215. #define VIDISD14C_ALPHA0_G_MASK (0xf << 16)
  216. #define VIDISD14C_ALPHA0_G_SHIFT (16)
  217. #define VIDISD14C_ALPHA0_G_LIMIT (0xf)
  218. #define VIDISD14C_ALPHA0_G(_x) ((_x) << 16)
  219. #define VIDISD14C_ALPHA0_B_MASK (0xf << 12)
  220. #define VIDISD14C_ALPHA0_B_SHIFT (12)
  221. #define VIDISD14C_ALPHA0_B_LIMIT (0xf)
  222. #define VIDISD14C_ALPHA0_B(_x) ((_x) << 12)
  223. #define VIDISD14C_ALPHA1_R_MASK (0xf << 8)
  224. #define VIDISD14C_ALPHA1_R_SHIFT (8)
  225. #define VIDISD14C_ALPHA1_R_LIMIT (0xf)
  226. #define VIDISD14C_ALPHA1_R(_x) ((_x) << 8)
  227. #define VIDISD14C_ALPHA1_G_MASK (0xf << 4)
  228. #define VIDISD14C_ALPHA1_G_SHIFT (4)
  229. #define VIDISD14C_ALPHA1_G_LIMIT (0xf)
  230. #define VIDISD14C_ALPHA1_G(_x) ((_x) << 4)
  231. #define VIDISD14C_ALPHA1_B_MASK (0xf << 0)
  232. #define VIDISD14C_ALPHA1_B_SHIFT (0)
  233. #define VIDISD14C_ALPHA1_B_LIMIT (0xf)
  234. #define VIDISD14C_ALPHA1_B(_x) ((_x) << 0)
  235. /* Video buffer addresses */
  236. #define VIDW_BUF_START(_buff) (0xA0 + ((_buff) * 8))
  237. #define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8))
  238. #define VIDW_BUF_END(_buff) (0xD0 + ((_buff) * 8))
  239. #define VIDW_BUF_END1(_buff) (0xD4 + ((_buff) * 8))
  240. #define VIDW_BUF_SIZE(_buff) (0x100 + ((_buff) * 4))
  241. #define VIDW_BUF_SIZE_OFFSET_E(_x) ((((_x) & 0x2000) >> 13) << 27)
  242. #define VIDW_BUF_SIZE_OFFSET_MASK (0x1fff << 13)
  243. #define VIDW_BUF_SIZE_OFFSET_SHIFT (13)
  244. #define VIDW_BUF_SIZE_OFFSET_LIMIT (0x1fff)
  245. #define VIDW_BUF_SIZE_OFFSET(_x) (((_x) & 0x1fff) << 13)
  246. #define VIDW_BUF_SIZE_PAGEWIDTH_E(_x) ((((_x) & 0x2000) >> 13) << 26)
  247. #define VIDW_BUF_SIZE_PAGEWIDTH_MASK (0x1fff << 0)
  248. #define VIDW_BUF_SIZE_PAGEWIDTH_SHIFT (0)
  249. #define VIDW_BUF_SIZE_PAGEWIDTH_LIMIT (0x1fff)
  250. #define VIDW_BUF_SIZE_PAGEWIDTH(_x) (((_x) & 0x1fff) << 0)
  251. /* Interrupt controls and status */
  252. #define VIDINTCON0_FIFOINTERVAL_MASK (0x3f << 20)
  253. #define VIDINTCON0_FIFOINTERVAL_SHIFT (20)
  254. #define VIDINTCON0_FIFOINTERVAL_LIMIT (0x3f)
  255. #define VIDINTCON0_FIFOINTERVAL(_x) ((_x) << 20)
  256. #define VIDINTCON0_INT_SYSMAINCON (1 << 19)
  257. #define VIDINTCON0_INT_SYSSUBCON (1 << 18)
  258. #define VIDINTCON0_INT_I80IFDONE (1 << 17)
  259. #define VIDINTCON0_FRAMESEL0_MASK (0x3 << 15)
  260. #define VIDINTCON0_FRAMESEL0_SHIFT (15)
  261. #define VIDINTCON0_FRAMESEL0_BACKPORCH (0x0 << 15)
  262. #define VIDINTCON0_FRAMESEL0_VSYNC (0x1 << 15)
  263. #define VIDINTCON0_FRAMESEL0_ACTIVE (0x2 << 15)
  264. #define VIDINTCON0_FRAMESEL0_FRONTPORCH (0x3 << 15)
  265. #define VIDINTCON0_FRAMESEL1 (1 << 13)
  266. #define VIDINTCON0_FRAMESEL1_MASK (0x3 << 13)
  267. #define VIDINTCON0_FRAMESEL1_NONE (0x0 << 13)
  268. #define VIDINTCON0_FRAMESEL1_BACKPORCH (0x1 << 13)
  269. #define VIDINTCON0_FRAMESEL1_VSYNC (0x2 << 13)
  270. #define VIDINTCON0_FRAMESEL1_FRONTPORCH (0x3 << 13)
  271. #define VIDINTCON0_INT_FRAME (1 << 12)
  272. #define VIDINTCON0_FIFIOSEL_MASK (0x7f << 5)
  273. #define VIDINTCON0_FIFIOSEL_SHIFT (5)
  274. #define VIDINTCON0_FIFIOSEL_WINDOW0 (0x1 << 5)
  275. #define VIDINTCON0_FIFIOSEL_WINDOW1 (0x2 << 5)
  276. #define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 2)
  277. #define VIDINTCON0_FIFOLEVEL_SHIFT (2)
  278. #define VIDINTCON0_FIFOLEVEL_TO25PC (0x0 << 2)
  279. #define VIDINTCON0_FIFOLEVEL_TO50PC (0x1 << 2)
  280. #define VIDINTCON0_FIFOLEVEL_TO75PC (0x2 << 2)
  281. #define VIDINTCON0_FIFOLEVEL_EMPTY (0x3 << 2)
  282. #define VIDINTCON0_FIFOLEVEL_FULL (0x4 << 2)
  283. #define VIDINTCON0_INT_FIFO_MASK (0x3 << 0)
  284. #define VIDINTCON0_INT_FIFO_SHIFT (0)
  285. #define VIDINTCON0_INT_ENABLE (1 << 0)
  286. #define VIDINTCON1 (0x134)
  287. #define VIDINTCON1_INT_I180 (1 << 2)
  288. #define VIDINTCON1_INT_FRAME (1 << 1)
  289. #define VIDINTCON1_INT_FIFO (1 << 0)
  290. /* Window colour-key control registers */
  291. #define WKEYCON (0x140) /* 6410,V210 */
  292. #define WKEYCON0 (0x00)
  293. #define WKEYCON1 (0x04)
  294. #define WxKEYCON0_KEYBL_EN (1 << 26)
  295. #define WxKEYCON0_KEYEN_F (1 << 25)
  296. #define WxKEYCON0_DIRCON (1 << 24)
  297. #define WxKEYCON0_COMPKEY_MASK (0xffffff << 0)
  298. #define WxKEYCON0_COMPKEY_SHIFT (0)
  299. #define WxKEYCON0_COMPKEY_LIMIT (0xffffff)
  300. #define WxKEYCON0_COMPKEY(_x) ((_x) << 0)
  301. #define WxKEYCON1_COLVAL_MASK (0xffffff << 0)
  302. #define WxKEYCON1_COLVAL_SHIFT (0)
  303. #define WxKEYCON1_COLVAL_LIMIT (0xffffff)
  304. #define WxKEYCON1_COLVAL(_x) ((_x) << 0)
  305. /* Window blanking (MAP) */
  306. #define WINxMAP_MAP (1 << 24)
  307. #define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0)
  308. #define WINxMAP_MAP_COLOUR_SHIFT (0)
  309. #define WINxMAP_MAP_COLOUR_LIMIT (0xffffff)
  310. #define WINxMAP_MAP_COLOUR(_x) ((_x) << 0)
  311. #define WPALCON_PAL_UPDATE (1 << 9)
  312. #define WPALCON_W1PAL_MASK (0x7 << 3)
  313. #define WPALCON_W1PAL_SHIFT (3)
  314. #define WPALCON_W1PAL_25BPP_A888 (0x0 << 3)
  315. #define WPALCON_W1PAL_24BPP (0x1 << 3)
  316. #define WPALCON_W1PAL_19BPP_A666 (0x2 << 3)
  317. #define WPALCON_W1PAL_18BPP_A665 (0x3 << 3)
  318. #define WPALCON_W1PAL_18BPP (0x4 << 3)
  319. #define WPALCON_W1PAL_16BPP_A555 (0x5 << 3)
  320. #define WPALCON_W1PAL_16BPP_565 (0x6 << 3)
  321. #define WPALCON_W0PAL_MASK (0x7 << 0)
  322. #define WPALCON_W0PAL_SHIFT (0)
  323. #define WPALCON_W0PAL_25BPP_A888 (0x0 << 0)
  324. #define WPALCON_W0PAL_24BPP (0x1 << 0)
  325. #define WPALCON_W0PAL_19BPP_A666 (0x2 << 0)
  326. #define WPALCON_W0PAL_18BPP_A665 (0x3 << 0)
  327. #define WPALCON_W0PAL_18BPP (0x4 << 0)
  328. #define WPALCON_W0PAL_16BPP_A555 (0x5 << 0)
  329. #define WPALCON_W0PAL_16BPP_565 (0x6 << 0)
  330. /* Blending equation control */
  331. #define BLENDCON (0x260)
  332. #define BLENDCON_NEW_MASK (1 << 0)
  333. #define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0)
  334. #define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0)
  335. #define S3C_FB_MAX_WIN (5) /* number of hardware windows available. */
  336. #define VIDCON1_FSTATUS_EVEN (1 << 15)
  337. /* Video timing controls */
  338. #define VIDTCON0 (0x10)
  339. #define VIDTCON1 (0x14)
  340. #define VIDTCON2 (0x18)
  341. /* Window position controls */
  342. #define WINCON(_win) (0x20 + ((_win) * 4))
  343. /* OSD1 and OSD4 do not have register D */
  344. #define VIDOSD_BASE (0x40)
  345. #define VIDINTCON0 (0x130)
  346. /* WINCONx */
  347. #define WINCONx_CSCWIDTH_MASK (0x3 << 26)
  348. #define WINCONx_CSCWIDTH_SHIFT (26)
  349. #define WINCONx_CSCWIDTH_WIDE (0x0 << 26)
  350. #define WINCONx_CSCWIDTH_NARROW (0x3 << 26)
  351. #define WINCONx_ENLOCAL (1 << 22)
  352. #define WINCONx_BUFSTATUS (1 << 21)
  353. #define WINCONx_BUFSEL (1 << 20)
  354. #define WINCONx_BUFAUTOEN (1 << 19)
  355. #define WINCONx_YCbCr (1 << 13)
  356. #define WINCON1_LOCALSEL_CAMIF (1 << 23)
  357. #define WINCON2_LOCALSEL_CAMIF (1 << 23)
  358. #define WINCON2_BLD_PIX (1 << 6)
  359. #define WINCON2_ALPHA_SEL (1 << 1)
  360. #define WINCON2_BPPMODE_MASK (0xf << 2)
  361. #define WINCON2_BPPMODE_SHIFT (2)
  362. #define WINCON2_BPPMODE_1BPP (0x0 << 2)
  363. #define WINCON2_BPPMODE_2BPP (0x1 << 2)
  364. #define WINCON2_BPPMODE_4BPP (0x2 << 2)
  365. #define WINCON2_BPPMODE_8BPP_1232 (0x4 << 2)
  366. #define WINCON2_BPPMODE_16BPP_565 (0x5 << 2)
  367. #define WINCON2_BPPMODE_16BPP_A1555 (0x6 << 2)
  368. #define WINCON2_BPPMODE_16BPP_I1555 (0x7 << 2)
  369. #define WINCON2_BPPMODE_18BPP_666 (0x8 << 2)
  370. #define WINCON2_BPPMODE_18BPP_A1665 (0x9 << 2)
  371. #define WINCON2_BPPMODE_19BPP_A1666 (0xa << 2)
  372. #define WINCON2_BPPMODE_24BPP_888 (0xb << 2)
  373. #define WINCON2_BPPMODE_24BPP_A1887 (0xc << 2)
  374. #define WINCON2_BPPMODE_25BPP_A1888 (0xd << 2)
  375. #define WINCON2_BPPMODE_28BPP_A4888 (0xd << 2)
  376. #define WINCON3_BLD_PIX (1 << 6)
  377. #define WINCON3_ALPHA_SEL (1 << 1)
  378. #define WINCON3_BPPMODE_MASK (0xf << 2)
  379. #define WINCON3_BPPMODE_SHIFT (2)
  380. #define WINCON3_BPPMODE_1BPP (0x0 << 2)
  381. #define WINCON3_BPPMODE_2BPP (0x1 << 2)
  382. #define WINCON3_BPPMODE_4BPP (0x2 << 2)
  383. #define WINCON3_BPPMODE_16BPP_565 (0x5 << 2)
  384. #define WINCON3_BPPMODE_16BPP_A1555 (0x6 << 2)
  385. #define WINCON3_BPPMODE_16BPP_I1555 (0x7 << 2)
  386. #define WINCON3_BPPMODE_18BPP_666 (0x8 << 2)
  387. #define WINCON3_BPPMODE_18BPP_A1665 (0x9 << 2)
  388. #define WINCON3_BPPMODE_19BPP_A1666 (0xa << 2)
  389. #define WINCON3_BPPMODE_24BPP_888 (0xb << 2)
  390. #define WINCON3_BPPMODE_24BPP_A1887 (0xc << 2)
  391. #define WINCON3_BPPMODE_25BPP_A1888 (0xd << 2)
  392. #define WINCON3_BPPMODE_28BPP_A4888 (0xd << 2)
  393. #define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5)
  394. #define VIDINTCON0_FIFIOSEL_WINDOW3 (0x20 << 5)
  395. #define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5)
  396. #define DITHMODE (0x170)
  397. #define WINxMAP(_win) (0x180 + ((_win) * 4))
  398. #define DITHMODE_R_POS_MASK (0x3 << 5)
  399. #define DITHMODE_R_POS_SHIFT (5)
  400. #define DITHMODE_R_POS_8BIT (0x0 << 5)
  401. #define DITHMODE_R_POS_6BIT (0x1 << 5)
  402. #define DITHMODE_R_POS_5BIT (0x2 << 5)
  403. #define DITHMODE_G_POS_MASK (0x3 << 3)
  404. #define DITHMODE_G_POS_SHIFT (3)
  405. #define DITHMODE_G_POS_8BIT (0x0 << 3)
  406. #define DITHMODE_G_POS_6BIT (0x1 << 3)
  407. #define DITHMODE_G_POS_5BIT (0x2 << 3)
  408. #define DITHMODE_B_POS_MASK (0x3 << 1)
  409. #define DITHMODE_B_POS_SHIFT (1)
  410. #define DITHMODE_B_POS_8BIT (0x0 << 1)
  411. #define DITHMODE_B_POS_6BIT (0x1 << 1)
  412. #define DITHMODE_B_POS_5BIT (0x2 << 1)
  413. #define DITHMODE_DITH_EN (1 << 0)
  414. #define WPALCON (0x1A0)
  415. /* Palette control */
  416. /* Note for S5PC100: you can still use those macros on WPALCON (aka WPALCON_L),
  417. * but make sure that WPALCON_H W2PAL-W4PAL entries are zeroed out */
  418. #define WPALCON_W4PAL_16BPP_A555 (1 << 8)
  419. #define WPALCON_W3PAL_16BPP_A555 (1 << 7)
  420. #define WPALCON_W2PAL_16BPP_A555 (1 << 6)
  421. /* Notes on per-window bpp settings
  422. *
  423. * Value Win0 Win1 Win2 Win3 Win 4
  424. * 0000 1(P) 1(P) 1(P) 1(P) 1(P)
  425. * 0001 2(P) 2(P) 2(P) 2(P) 2(P)
  426. * 0010 4(P) 4(P) 4(P) 4(P) -none-
  427. * 0011 8(P) 8(P) -none- -none- -none-
  428. * 0100 -none- 8(A232) 8(A232) -none- -none-
  429. * 0101 16(565) 16(565) 16(565) 16(565) 16(565)
  430. * 0110 -none- 16(A555) 16(A555) 16(A555) 16(A555)
  431. * 0111 16(I555) 16(I565) 16(I555) 16(I555) 16(I555)
  432. * 1000 18(666) 18(666) 18(666) 18(666) 18(666)
  433. * 1001 -none- 18(A665) 18(A665) 18(A665) 16(A665)
  434. * 1010 -none- 19(A666) 19(A666) 19(A666) 19(A666)
  435. * 1011 24(888) 24(888) 24(888) 24(888) 24(888)
  436. * 1100 -none- 24(A887) 24(A887) 24(A887) 24(A887)
  437. * 1101 -none- 25(A888) 25(A888) 25(A888) 25(A888)
  438. * 1110 -none- -none- -none- -none- -none-
  439. * 1111 -none- -none- -none- -none- -none-
  440. */
  441. /* FIMD Version 8 register offset definitions */
  442. #define FIMD_V8_VIDTCON0 (0x20010)
  443. #define FIMD_V8_VIDTCON1 (0x20014)
  444. #define FIMD_V8_VIDTCON2 (0x20018)
  445. #define FIMD_V8_VIDTCON3 (0x2001C)
  446. #define FIMD_V8_VIDCON1 (0x20004)