regs-fimc.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* drivers/gpu/drm/exynos/regs-fimc.h
  3. *
  4. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
  5. * http://www.samsung.com/
  6. *
  7. * Register definition file for Samsung Camera Interface (FIMC) driver
  8. */
  9. #ifndef EXYNOS_REGS_FIMC_H
  10. #define EXYNOS_REGS_FIMC_H
  11. /*
  12. * Register part
  13. */
  14. /* Input source format */
  15. #define EXYNOS_CISRCFMT (0x00)
  16. /* Window offset */
  17. #define EXYNOS_CIWDOFST (0x04)
  18. /* Global control */
  19. #define EXYNOS_CIGCTRL (0x08)
  20. /* Window offset 2 */
  21. #define EXYNOS_CIWDOFST2 (0x14)
  22. /* Y 1st frame start address for output DMA */
  23. #define EXYNOS_CIOYSA1 (0x18)
  24. /* Y 2nd frame start address for output DMA */
  25. #define EXYNOS_CIOYSA2 (0x1c)
  26. /* Y 3rd frame start address for output DMA */
  27. #define EXYNOS_CIOYSA3 (0x20)
  28. /* Y 4th frame start address for output DMA */
  29. #define EXYNOS_CIOYSA4 (0x24)
  30. /* Cb 1st frame start address for output DMA */
  31. #define EXYNOS_CIOCBSA1 (0x28)
  32. /* Cb 2nd frame start address for output DMA */
  33. #define EXYNOS_CIOCBSA2 (0x2c)
  34. /* Cb 3rd frame start address for output DMA */
  35. #define EXYNOS_CIOCBSA3 (0x30)
  36. /* Cb 4th frame start address for output DMA */
  37. #define EXYNOS_CIOCBSA4 (0x34)
  38. /* Cr 1st frame start address for output DMA */
  39. #define EXYNOS_CIOCRSA1 (0x38)
  40. /* Cr 2nd frame start address for output DMA */
  41. #define EXYNOS_CIOCRSA2 (0x3c)
  42. /* Cr 3rd frame start address for output DMA */
  43. #define EXYNOS_CIOCRSA3 (0x40)
  44. /* Cr 4th frame start address for output DMA */
  45. #define EXYNOS_CIOCRSA4 (0x44)
  46. /* Target image format */
  47. #define EXYNOS_CITRGFMT (0x48)
  48. /* Output DMA control */
  49. #define EXYNOS_CIOCTRL (0x4c)
  50. /* Pre-scaler control 1 */
  51. #define EXYNOS_CISCPRERATIO (0x50)
  52. /* Pre-scaler control 2 */
  53. #define EXYNOS_CISCPREDST (0x54)
  54. /* Main scaler control */
  55. #define EXYNOS_CISCCTRL (0x58)
  56. /* Target area */
  57. #define EXYNOS_CITAREA (0x5c)
  58. /* Status */
  59. #define EXYNOS_CISTATUS (0x64)
  60. /* Status2 */
  61. #define EXYNOS_CISTATUS2 (0x68)
  62. /* Image capture enable command */
  63. #define EXYNOS_CIIMGCPT (0xc0)
  64. /* Capture sequence */
  65. #define EXYNOS_CICPTSEQ (0xc4)
  66. /* Image effects */
  67. #define EXYNOS_CIIMGEFF (0xd0)
  68. /* Y frame start address for input DMA */
  69. #define EXYNOS_CIIYSA0 (0xd4)
  70. /* Cb frame start address for input DMA */
  71. #define EXYNOS_CIICBSA0 (0xd8)
  72. /* Cr frame start address for input DMA */
  73. #define EXYNOS_CIICRSA0 (0xdc)
  74. /* Input DMA Y Line Skip */
  75. #define EXYNOS_CIILINESKIP_Y (0xec)
  76. /* Input DMA Cb Line Skip */
  77. #define EXYNOS_CIILINESKIP_CB (0xf0)
  78. /* Input DMA Cr Line Skip */
  79. #define EXYNOS_CIILINESKIP_CR (0xf4)
  80. /* Real input DMA image size */
  81. #define EXYNOS_CIREAL_ISIZE (0xf8)
  82. /* Input DMA control */
  83. #define EXYNOS_MSCTRL (0xfc)
  84. /* Y frame start address for input DMA */
  85. #define EXYNOS_CIIYSA1 (0x144)
  86. /* Cb frame start address for input DMA */
  87. #define EXYNOS_CIICBSA1 (0x148)
  88. /* Cr frame start address for input DMA */
  89. #define EXYNOS_CIICRSA1 (0x14c)
  90. /* Output DMA Y offset */
  91. #define EXYNOS_CIOYOFF (0x168)
  92. /* Output DMA CB offset */
  93. #define EXYNOS_CIOCBOFF (0x16c)
  94. /* Output DMA CR offset */
  95. #define EXYNOS_CIOCROFF (0x170)
  96. /* Input DMA Y offset */
  97. #define EXYNOS_CIIYOFF (0x174)
  98. /* Input DMA CB offset */
  99. #define EXYNOS_CIICBOFF (0x178)
  100. /* Input DMA CR offset */
  101. #define EXYNOS_CIICROFF (0x17c)
  102. /* Input DMA original image size */
  103. #define EXYNOS_ORGISIZE (0x180)
  104. /* Output DMA original image size */
  105. #define EXYNOS_ORGOSIZE (0x184)
  106. /* Real output DMA image size */
  107. #define EXYNOS_CIEXTEN (0x188)
  108. /* DMA parameter */
  109. #define EXYNOS_CIDMAPARAM (0x18c)
  110. /* MIPI CSI image format */
  111. #define EXYNOS_CSIIMGFMT (0x194)
  112. /* FIMC Clock Source Select */
  113. #define EXYNOS_MISC_FIMC (0x198)
  114. /* Add for FIMC v5.1 */
  115. /* Output Frame Buffer Sequence */
  116. #define EXYNOS_CIFCNTSEQ (0x1fc)
  117. /* Y 5th frame start address for output DMA */
  118. #define EXYNOS_CIOYSA5 (0x200)
  119. /* Y 6th frame start address for output DMA */
  120. #define EXYNOS_CIOYSA6 (0x204)
  121. /* Y 7th frame start address for output DMA */
  122. #define EXYNOS_CIOYSA7 (0x208)
  123. /* Y 8th frame start address for output DMA */
  124. #define EXYNOS_CIOYSA8 (0x20c)
  125. /* Y 9th frame start address for output DMA */
  126. #define EXYNOS_CIOYSA9 (0x210)
  127. /* Y 10th frame start address for output DMA */
  128. #define EXYNOS_CIOYSA10 (0x214)
  129. /* Y 11th frame start address for output DMA */
  130. #define EXYNOS_CIOYSA11 (0x218)
  131. /* Y 12th frame start address for output DMA */
  132. #define EXYNOS_CIOYSA12 (0x21c)
  133. /* Y 13th frame start address for output DMA */
  134. #define EXYNOS_CIOYSA13 (0x220)
  135. /* Y 14th frame start address for output DMA */
  136. #define EXYNOS_CIOYSA14 (0x224)
  137. /* Y 15th frame start address for output DMA */
  138. #define EXYNOS_CIOYSA15 (0x228)
  139. /* Y 16th frame start address for output DMA */
  140. #define EXYNOS_CIOYSA16 (0x22c)
  141. /* Y 17th frame start address for output DMA */
  142. #define EXYNOS_CIOYSA17 (0x230)
  143. /* Y 18th frame start address for output DMA */
  144. #define EXYNOS_CIOYSA18 (0x234)
  145. /* Y 19th frame start address for output DMA */
  146. #define EXYNOS_CIOYSA19 (0x238)
  147. /* Y 20th frame start address for output DMA */
  148. #define EXYNOS_CIOYSA20 (0x23c)
  149. /* Y 21th frame start address for output DMA */
  150. #define EXYNOS_CIOYSA21 (0x240)
  151. /* Y 22th frame start address for output DMA */
  152. #define EXYNOS_CIOYSA22 (0x244)
  153. /* Y 23th frame start address for output DMA */
  154. #define EXYNOS_CIOYSA23 (0x248)
  155. /* Y 24th frame start address for output DMA */
  156. #define EXYNOS_CIOYSA24 (0x24c)
  157. /* Y 25th frame start address for output DMA */
  158. #define EXYNOS_CIOYSA25 (0x250)
  159. /* Y 26th frame start address for output DMA */
  160. #define EXYNOS_CIOYSA26 (0x254)
  161. /* Y 27th frame start address for output DMA */
  162. #define EXYNOS_CIOYSA27 (0x258)
  163. /* Y 28th frame start address for output DMA */
  164. #define EXYNOS_CIOYSA28 (0x25c)
  165. /* Y 29th frame start address for output DMA */
  166. #define EXYNOS_CIOYSA29 (0x260)
  167. /* Y 30th frame start address for output DMA */
  168. #define EXYNOS_CIOYSA30 (0x264)
  169. /* Y 31th frame start address for output DMA */
  170. #define EXYNOS_CIOYSA31 (0x268)
  171. /* Y 32th frame start address for output DMA */
  172. #define EXYNOS_CIOYSA32 (0x26c)
  173. /* CB 5th frame start address for output DMA */
  174. #define EXYNOS_CIOCBSA5 (0x270)
  175. /* CB 6th frame start address for output DMA */
  176. #define EXYNOS_CIOCBSA6 (0x274)
  177. /* CB 7th frame start address for output DMA */
  178. #define EXYNOS_CIOCBSA7 (0x278)
  179. /* CB 8th frame start address for output DMA */
  180. #define EXYNOS_CIOCBSA8 (0x27c)
  181. /* CB 9th frame start address for output DMA */
  182. #define EXYNOS_CIOCBSA9 (0x280)
  183. /* CB 10th frame start address for output DMA */
  184. #define EXYNOS_CIOCBSA10 (0x284)
  185. /* CB 11th frame start address for output DMA */
  186. #define EXYNOS_CIOCBSA11 (0x288)
  187. /* CB 12th frame start address for output DMA */
  188. #define EXYNOS_CIOCBSA12 (0x28c)
  189. /* CB 13th frame start address for output DMA */
  190. #define EXYNOS_CIOCBSA13 (0x290)
  191. /* CB 14th frame start address for output DMA */
  192. #define EXYNOS_CIOCBSA14 (0x294)
  193. /* CB 15th frame start address for output DMA */
  194. #define EXYNOS_CIOCBSA15 (0x298)
  195. /* CB 16th frame start address for output DMA */
  196. #define EXYNOS_CIOCBSA16 (0x29c)
  197. /* CB 17th frame start address for output DMA */
  198. #define EXYNOS_CIOCBSA17 (0x2a0)
  199. /* CB 18th frame start address for output DMA */
  200. #define EXYNOS_CIOCBSA18 (0x2a4)
  201. /* CB 19th frame start address for output DMA */
  202. #define EXYNOS_CIOCBSA19 (0x2a8)
  203. /* CB 20th frame start address for output DMA */
  204. #define EXYNOS_CIOCBSA20 (0x2ac)
  205. /* CB 21th frame start address for output DMA */
  206. #define EXYNOS_CIOCBSA21 (0x2b0)
  207. /* CB 22th frame start address for output DMA */
  208. #define EXYNOS_CIOCBSA22 (0x2b4)
  209. /* CB 23th frame start address for output DMA */
  210. #define EXYNOS_CIOCBSA23 (0x2b8)
  211. /* CB 24th frame start address for output DMA */
  212. #define EXYNOS_CIOCBSA24 (0x2bc)
  213. /* CB 25th frame start address for output DMA */
  214. #define EXYNOS_CIOCBSA25 (0x2c0)
  215. /* CB 26th frame start address for output DMA */
  216. #define EXYNOS_CIOCBSA26 (0x2c4)
  217. /* CB 27th frame start address for output DMA */
  218. #define EXYNOS_CIOCBSA27 (0x2c8)
  219. /* CB 28th frame start address for output DMA */
  220. #define EXYNOS_CIOCBSA28 (0x2cc)
  221. /* CB 29th frame start address for output DMA */
  222. #define EXYNOS_CIOCBSA29 (0x2d0)
  223. /* CB 30th frame start address for output DMA */
  224. #define EXYNOS_CIOCBSA30 (0x2d4)
  225. /* CB 31th frame start address for output DMA */
  226. #define EXYNOS_CIOCBSA31 (0x2d8)
  227. /* CB 32th frame start address for output DMA */
  228. #define EXYNOS_CIOCBSA32 (0x2dc)
  229. /* CR 5th frame start address for output DMA */
  230. #define EXYNOS_CIOCRSA5 (0x2e0)
  231. /* CR 6th frame start address for output DMA */
  232. #define EXYNOS_CIOCRSA6 (0x2e4)
  233. /* CR 7th frame start address for output DMA */
  234. #define EXYNOS_CIOCRSA7 (0x2e8)
  235. /* CR 8th frame start address for output DMA */
  236. #define EXYNOS_CIOCRSA8 (0x2ec)
  237. /* CR 9th frame start address for output DMA */
  238. #define EXYNOS_CIOCRSA9 (0x2f0)
  239. /* CR 10th frame start address for output DMA */
  240. #define EXYNOS_CIOCRSA10 (0x2f4)
  241. /* CR 11th frame start address for output DMA */
  242. #define EXYNOS_CIOCRSA11 (0x2f8)
  243. /* CR 12th frame start address for output DMA */
  244. #define EXYNOS_CIOCRSA12 (0x2fc)
  245. /* CR 13th frame start address for output DMA */
  246. #define EXYNOS_CIOCRSA13 (0x300)
  247. /* CR 14th frame start address for output DMA */
  248. #define EXYNOS_CIOCRSA14 (0x304)
  249. /* CR 15th frame start address for output DMA */
  250. #define EXYNOS_CIOCRSA15 (0x308)
  251. /* CR 16th frame start address for output DMA */
  252. #define EXYNOS_CIOCRSA16 (0x30c)
  253. /* CR 17th frame start address for output DMA */
  254. #define EXYNOS_CIOCRSA17 (0x310)
  255. /* CR 18th frame start address for output DMA */
  256. #define EXYNOS_CIOCRSA18 (0x314)
  257. /* CR 19th frame start address for output DMA */
  258. #define EXYNOS_CIOCRSA19 (0x318)
  259. /* CR 20th frame start address for output DMA */
  260. #define EXYNOS_CIOCRSA20 (0x31c)
  261. /* CR 21th frame start address for output DMA */
  262. #define EXYNOS_CIOCRSA21 (0x320)
  263. /* CR 22th frame start address for output DMA */
  264. #define EXYNOS_CIOCRSA22 (0x324)
  265. /* CR 23th frame start address for output DMA */
  266. #define EXYNOS_CIOCRSA23 (0x328)
  267. /* CR 24th frame start address for output DMA */
  268. #define EXYNOS_CIOCRSA24 (0x32c)
  269. /* CR 25th frame start address for output DMA */
  270. #define EXYNOS_CIOCRSA25 (0x330)
  271. /* CR 26th frame start address for output DMA */
  272. #define EXYNOS_CIOCRSA26 (0x334)
  273. /* CR 27th frame start address for output DMA */
  274. #define EXYNOS_CIOCRSA27 (0x338)
  275. /* CR 28th frame start address for output DMA */
  276. #define EXYNOS_CIOCRSA28 (0x33c)
  277. /* CR 29th frame start address for output DMA */
  278. #define EXYNOS_CIOCRSA29 (0x340)
  279. /* CR 30th frame start address for output DMA */
  280. #define EXYNOS_CIOCRSA30 (0x344)
  281. /* CR 31th frame start address for output DMA */
  282. #define EXYNOS_CIOCRSA31 (0x348)
  283. /* CR 32th frame start address for output DMA */
  284. #define EXYNOS_CIOCRSA32 (0x34c)
  285. /*
  286. * Macro part
  287. */
  288. /* frame start address 1 ~ 4, 5 ~ 32 */
  289. /* Number of Default PingPong Memory */
  290. #define DEF_PP 4
  291. #define EXYNOS_CIOYSA(__x) \
  292. (((__x) < DEF_PP) ? \
  293. (EXYNOS_CIOYSA1 + (__x) * 4) : \
  294. (EXYNOS_CIOYSA5 + ((__x) - DEF_PP) * 4))
  295. #define EXYNOS_CIOCBSA(__x) \
  296. (((__x) < DEF_PP) ? \
  297. (EXYNOS_CIOCBSA1 + (__x) * 4) : \
  298. (EXYNOS_CIOCBSA5 + ((__x) - DEF_PP) * 4))
  299. #define EXYNOS_CIOCRSA(__x) \
  300. (((__x) < DEF_PP) ? \
  301. (EXYNOS_CIOCRSA1 + (__x) * 4) : \
  302. (EXYNOS_CIOCRSA5 + ((__x) - DEF_PP) * 4))
  303. /* Number of Default PingPong Memory */
  304. #define DEF_IPP 1
  305. #define EXYNOS_CIIYSA(__x) \
  306. (((__x) < DEF_IPP) ? \
  307. (EXYNOS_CIIYSA0) : (EXYNOS_CIIYSA1))
  308. #define EXYNOS_CIICBSA(__x) \
  309. (((__x) < DEF_IPP) ? \
  310. (EXYNOS_CIICBSA0) : (EXYNOS_CIICBSA1))
  311. #define EXYNOS_CIICRSA(__x) \
  312. (((__x) < DEF_IPP) ? \
  313. (EXYNOS_CIICRSA0) : (EXYNOS_CIICRSA1))
  314. #define EXYNOS_CISRCFMT_SOURCEHSIZE(x) ((x) << 16)
  315. #define EXYNOS_CISRCFMT_SOURCEVSIZE(x) ((x) << 0)
  316. #define EXYNOS_CIWDOFST_WINHOROFST(x) ((x) << 16)
  317. #define EXYNOS_CIWDOFST_WINVEROFST(x) ((x) << 0)
  318. #define EXYNOS_CIWDOFST2_WINHOROFST2(x) ((x) << 16)
  319. #define EXYNOS_CIWDOFST2_WINVEROFST2(x) ((x) << 0)
  320. #define EXYNOS_CITRGFMT_TARGETHSIZE(x) (((x) & 0x1fff) << 16)
  321. #define EXYNOS_CITRGFMT_TARGETVSIZE(x) (((x) & 0x1fff) << 0)
  322. #define EXYNOS_CISCPRERATIO_SHFACTOR(x) ((x) << 28)
  323. #define EXYNOS_CISCPRERATIO_PREHORRATIO(x) ((x) << 16)
  324. #define EXYNOS_CISCPRERATIO_PREVERRATIO(x) ((x) << 0)
  325. #define EXYNOS_CISCPREDST_PREDSTWIDTH(x) ((x) << 16)
  326. #define EXYNOS_CISCPREDST_PREDSTHEIGHT(x) ((x) << 0)
  327. #define EXYNOS_CISCCTRL_MAINHORRATIO(x) ((x) << 16)
  328. #define EXYNOS_CISCCTRL_MAINVERRATIO(x) ((x) << 0)
  329. #define EXYNOS_CITAREA_TARGET_AREA(x) ((x) << 0)
  330. #define EXYNOS_CISTATUS_GET_FRAME_COUNT(x) (((x) >> 26) & 0x3)
  331. #define EXYNOS_CISTATUS_GET_FRAME_END(x) (((x) >> 17) & 0x1)
  332. #define EXYNOS_CISTATUS_GET_LAST_CAPTURE_END(x) (((x) >> 16) & 0x1)
  333. #define EXYNOS_CISTATUS_GET_LCD_STATUS(x) (((x) >> 9) & 0x1)
  334. #define EXYNOS_CISTATUS_GET_ENVID_STATUS(x) (((x) >> 8) & 0x1)
  335. #define EXYNOS_CISTATUS2_GET_FRAMECOUNT_BEFORE(x) (((x) >> 7) & 0x3f)
  336. #define EXYNOS_CISTATUS2_GET_FRAMECOUNT_PRESENT(x) ((x) & 0x3f)
  337. #define EXYNOS_CIIMGEFF_FIN(x) ((x & 0x7) << 26)
  338. #define EXYNOS_CIIMGEFF_PAT_CB(x) ((x) << 13)
  339. #define EXYNOS_CIIMGEFF_PAT_CR(x) ((x) << 0)
  340. #define EXYNOS_CIILINESKIP(x) (((x) & 0xf) << 24)
  341. #define EXYNOS_CIREAL_ISIZE_HEIGHT(x) ((x) << 16)
  342. #define EXYNOS_CIREAL_ISIZE_WIDTH(x) ((x) << 0)
  343. #define EXYNOS_MSCTRL_SUCCESSIVE_COUNT(x) ((x) << 24)
  344. #define EXYNOS_MSCTRL_GET_INDMA_STATUS(x) ((x) & 0x1)
  345. #define EXYNOS_CIOYOFF_VERTICAL(x) ((x) << 16)
  346. #define EXYNOS_CIOYOFF_HORIZONTAL(x) ((x) << 0)
  347. #define EXYNOS_CIOCBOFF_VERTICAL(x) ((x) << 16)
  348. #define EXYNOS_CIOCBOFF_HORIZONTAL(x) ((x) << 0)
  349. #define EXYNOS_CIOCROFF_VERTICAL(x) ((x) << 16)
  350. #define EXYNOS_CIOCROFF_HORIZONTAL(x) ((x) << 0)
  351. #define EXYNOS_CIIYOFF_VERTICAL(x) ((x) << 16)
  352. #define EXYNOS_CIIYOFF_HORIZONTAL(x) ((x) << 0)
  353. #define EXYNOS_CIICBOFF_VERTICAL(x) ((x) << 16)
  354. #define EXYNOS_CIICBOFF_HORIZONTAL(x) ((x) << 0)
  355. #define EXYNOS_CIICROFF_VERTICAL(x) ((x) << 16)
  356. #define EXYNOS_CIICROFF_HORIZONTAL(x) ((x) << 0)
  357. #define EXYNOS_ORGISIZE_VERTICAL(x) ((x) << 16)
  358. #define EXYNOS_ORGISIZE_HORIZONTAL(x) ((x) << 0)
  359. #define EXYNOS_ORGOSIZE_VERTICAL(x) ((x) << 16)
  360. #define EXYNOS_ORGOSIZE_HORIZONTAL(x) ((x) << 0)
  361. #define EXYNOS_CIEXTEN_TARGETH_EXT(x) ((((x) & 0x2000) >> 13) << 26)
  362. #define EXYNOS_CIEXTEN_TARGETV_EXT(x) ((((x) & 0x2000) >> 13) << 24)
  363. #define EXYNOS_CIEXTEN_MAINHORRATIO_EXT(x) (((x) & 0x3F) << 10)
  364. #define EXYNOS_CIEXTEN_MAINVERRATIO_EXT(x) ((x) & 0x3F)
  365. /*
  366. * Bit definition part
  367. */
  368. /* Source format register */
  369. #define EXYNOS_CISRCFMT_ITU601_8BIT (1 << 31)
  370. #define EXYNOS_CISRCFMT_ITU656_8BIT (0 << 31)
  371. #define EXYNOS_CISRCFMT_ITU601_16BIT (1 << 29)
  372. #define EXYNOS_CISRCFMT_ORDER422_YCBYCR (0 << 14)
  373. #define EXYNOS_CISRCFMT_ORDER422_YCRYCB (1 << 14)
  374. #define EXYNOS_CISRCFMT_ORDER422_CBYCRY (2 << 14)
  375. #define EXYNOS_CISRCFMT_ORDER422_CRYCBY (3 << 14)
  376. /* ITU601 16bit only */
  377. #define EXYNOS_CISRCFMT_ORDER422_Y4CBCRCBCR (0 << 14)
  378. /* ITU601 16bit only */
  379. #define EXYNOS_CISRCFMT_ORDER422_Y4CRCBCRCB (1 << 14)
  380. /* Window offset register */
  381. #define EXYNOS_CIWDOFST_WINOFSEN (1 << 31)
  382. #define EXYNOS_CIWDOFST_CLROVFIY (1 << 30)
  383. #define EXYNOS_CIWDOFST_CLROVRLB (1 << 29)
  384. #define EXYNOS_CIWDOFST_WINHOROFST_MASK (0x7ff << 16)
  385. #define EXYNOS_CIWDOFST_CLROVFICB (1 << 15)
  386. #define EXYNOS_CIWDOFST_CLROVFICR (1 << 14)
  387. #define EXYNOS_CIWDOFST_WINVEROFST_MASK (0xfff << 0)
  388. /* Global control register */
  389. #define EXYNOS_CIGCTRL_SWRST (1 << 31)
  390. #define EXYNOS_CIGCTRL_CAMRST_A (1 << 30)
  391. #define EXYNOS_CIGCTRL_SELCAM_ITU_B (0 << 29)
  392. #define EXYNOS_CIGCTRL_SELCAM_ITU_A (1 << 29)
  393. #define EXYNOS_CIGCTRL_SELCAM_ITU_MASK (1 << 29)
  394. #define EXYNOS_CIGCTRL_TESTPATTERN_NORMAL (0 << 27)
  395. #define EXYNOS_CIGCTRL_TESTPATTERN_COLOR_BAR (1 << 27)
  396. #define EXYNOS_CIGCTRL_TESTPATTERN_HOR_INC (2 << 27)
  397. #define EXYNOS_CIGCTRL_TESTPATTERN_VER_INC (3 << 27)
  398. #define EXYNOS_CIGCTRL_TESTPATTERN_MASK (3 << 27)
  399. #define EXYNOS_CIGCTRL_TESTPATTERN_SHIFT (27)
  400. #define EXYNOS_CIGCTRL_INVPOLPCLK (1 << 26)
  401. #define EXYNOS_CIGCTRL_INVPOLVSYNC (1 << 25)
  402. #define EXYNOS_CIGCTRL_INVPOLHREF (1 << 24)
  403. #define EXYNOS_CIGCTRL_IRQ_OVFEN (1 << 22)
  404. #define EXYNOS_CIGCTRL_HREF_MASK (1 << 21)
  405. #define EXYNOS_CIGCTRL_IRQ_EDGE (0 << 20)
  406. #define EXYNOS_CIGCTRL_IRQ_LEVEL (1 << 20)
  407. #define EXYNOS_CIGCTRL_IRQ_CLR (1 << 19)
  408. #define EXYNOS_CIGCTRL_IRQ_END_DISABLE (1 << 18)
  409. #define EXYNOS_CIGCTRL_IRQ_DISABLE (0 << 16)
  410. #define EXYNOS_CIGCTRL_IRQ_ENABLE (1 << 16)
  411. #define EXYNOS_CIGCTRL_SHADOW_DISABLE (1 << 12)
  412. #define EXYNOS_CIGCTRL_CAM_JPEG (1 << 8)
  413. #define EXYNOS_CIGCTRL_SELCAM_MIPI_B (0 << 7)
  414. #define EXYNOS_CIGCTRL_SELCAM_MIPI_A (1 << 7)
  415. #define EXYNOS_CIGCTRL_SELCAM_MIPI_MASK (1 << 7)
  416. #define EXYNOS_CIGCTRL_SELWB_CAMIF_CAMERA (0 << 6)
  417. #define EXYNOS_CIGCTRL_SELWB_CAMIF_WRITEBACK (1 << 6)
  418. #define EXYNOS_CIGCTRL_SELWRITEBACK_MASK (1 << 10)
  419. #define EXYNOS_CIGCTRL_SELWRITEBACK_A (1 << 10)
  420. #define EXYNOS_CIGCTRL_SELWRITEBACK_B (0 << 10)
  421. #define EXYNOS_CIGCTRL_SELWB_CAMIF_MASK (1 << 6)
  422. #define EXYNOS_CIGCTRL_CSC_ITU601 (0 << 5)
  423. #define EXYNOS_CIGCTRL_CSC_ITU709 (1 << 5)
  424. #define EXYNOS_CIGCTRL_CSC_MASK (1 << 5)
  425. #define EXYNOS_CIGCTRL_INVPOLHSYNC (1 << 4)
  426. #define EXYNOS_CIGCTRL_SELCAM_FIMC_ITU (0 << 3)
  427. #define EXYNOS_CIGCTRL_SELCAM_FIMC_MIPI (1 << 3)
  428. #define EXYNOS_CIGCTRL_SELCAM_FIMC_MASK (1 << 3)
  429. #define EXYNOS_CIGCTRL_PROGRESSIVE (0 << 0)
  430. #define EXYNOS_CIGCTRL_INTERLACE (1 << 0)
  431. /* Window offset2 register */
  432. #define EXYNOS_CIWDOFST_WINHOROFST2_MASK (0xfff << 16)
  433. #define EXYNOS_CIWDOFST_WINVEROFST2_MASK (0xfff << 16)
  434. /* Target format register */
  435. #define EXYNOS_CITRGFMT_INROT90_CLOCKWISE (1 << 31)
  436. #define EXYNOS_CITRGFMT_OUTFORMAT_YCBCR420 (0 << 29)
  437. #define EXYNOS_CITRGFMT_OUTFORMAT_YCBCR422 (1 << 29)
  438. #define EXYNOS_CITRGFMT_OUTFORMAT_YCBCR422_1PLANE (2 << 29)
  439. #define EXYNOS_CITRGFMT_OUTFORMAT_RGB (3 << 29)
  440. #define EXYNOS_CITRGFMT_OUTFORMAT_MASK (3 << 29)
  441. #define EXYNOS_CITRGFMT_FLIP_SHIFT (14)
  442. #define EXYNOS_CITRGFMT_FLIP_NORMAL (0 << 14)
  443. #define EXYNOS_CITRGFMT_FLIP_X_MIRROR (1 << 14)
  444. #define EXYNOS_CITRGFMT_FLIP_Y_MIRROR (2 << 14)
  445. #define EXYNOS_CITRGFMT_FLIP_180 (3 << 14)
  446. #define EXYNOS_CITRGFMT_FLIP_MASK (3 << 14)
  447. #define EXYNOS_CITRGFMT_OUTROT90_CLOCKWISE (1 << 13)
  448. #define EXYNOS_CITRGFMT_TARGETV_MASK (0x1fff << 0)
  449. #define EXYNOS_CITRGFMT_TARGETH_MASK (0x1fff << 16)
  450. /* Output DMA control register */
  451. #define EXYNOS_CIOCTRL_WEAVE_OUT (1 << 31)
  452. #define EXYNOS_CIOCTRL_WEAVE_MASK (1 << 31)
  453. #define EXYNOS_CIOCTRL_LASTENDEN (1 << 30)
  454. #define EXYNOS_CIOCTRL_ORDER2P_LSB_CBCR (0 << 24)
  455. #define EXYNOS_CIOCTRL_ORDER2P_LSB_CRCB (1 << 24)
  456. #define EXYNOS_CIOCTRL_ORDER2P_MSB_CRCB (2 << 24)
  457. #define EXYNOS_CIOCTRL_ORDER2P_MSB_CBCR (3 << 24)
  458. #define EXYNOS_CIOCTRL_ORDER2P_SHIFT (24)
  459. #define EXYNOS_CIOCTRL_ORDER2P_MASK (3 << 24)
  460. #define EXYNOS_CIOCTRL_YCBCR_3PLANE (0 << 3)
  461. #define EXYNOS_CIOCTRL_YCBCR_2PLANE (1 << 3)
  462. #define EXYNOS_CIOCTRL_YCBCR_PLANE_MASK (1 << 3)
  463. #define EXYNOS_CIOCTRL_LASTIRQ_ENABLE (1 << 2)
  464. #define EXYNOS_CIOCTRL_ALPHA_OUT (0xff << 4)
  465. #define EXYNOS_CIOCTRL_ORDER422_YCBYCR (0 << 0)
  466. #define EXYNOS_CIOCTRL_ORDER422_YCRYCB (1 << 0)
  467. #define EXYNOS_CIOCTRL_ORDER422_CBYCRY (2 << 0)
  468. #define EXYNOS_CIOCTRL_ORDER422_CRYCBY (3 << 0)
  469. #define EXYNOS_CIOCTRL_ORDER422_MASK (3 << 0)
  470. /* Main scaler control register */
  471. #define EXYNOS_CISCCTRL_SCALERBYPASS (1 << 31)
  472. #define EXYNOS_CISCCTRL_SCALEUP_H (1 << 30)
  473. #define EXYNOS_CISCCTRL_SCALEUP_V (1 << 29)
  474. #define EXYNOS_CISCCTRL_CSCR2Y_NARROW (0 << 28)
  475. #define EXYNOS_CISCCTRL_CSCR2Y_WIDE (1 << 28)
  476. #define EXYNOS_CISCCTRL_CSCY2R_NARROW (0 << 27)
  477. #define EXYNOS_CISCCTRL_CSCY2R_WIDE (1 << 27)
  478. #define EXYNOS_CISCCTRL_LCDPATHEN_FIFO (1 << 26)
  479. #define EXYNOS_CISCCTRL_PROGRESSIVE (0 << 25)
  480. #define EXYNOS_CISCCTRL_INTERLACE (1 << 25)
  481. #define EXYNOS_CISCCTRL_SCAN_MASK (1 << 25)
  482. #define EXYNOS_CISCCTRL_SCALERSTART (1 << 15)
  483. #define EXYNOS_CISCCTRL_INRGB_FMT_RGB565 (0 << 13)
  484. #define EXYNOS_CISCCTRL_INRGB_FMT_RGB666 (1 << 13)
  485. #define EXYNOS_CISCCTRL_INRGB_FMT_RGB888 (2 << 13)
  486. #define EXYNOS_CISCCTRL_INRGB_FMT_RGB_MASK (3 << 13)
  487. #define EXYNOS_CISCCTRL_OUTRGB_FMT_RGB565 (0 << 11)
  488. #define EXYNOS_CISCCTRL_OUTRGB_FMT_RGB666 (1 << 11)
  489. #define EXYNOS_CISCCTRL_OUTRGB_FMT_RGB888 (2 << 11)
  490. #define EXYNOS_CISCCTRL_OUTRGB_FMT_RGB_MASK (3 << 11)
  491. #define EXYNOS_CISCCTRL_EXTRGB_NORMAL (0 << 10)
  492. #define EXYNOS_CISCCTRL_EXTRGB_EXTENSION (1 << 10)
  493. #define EXYNOS_CISCCTRL_ONE2ONE (1 << 9)
  494. #define EXYNOS_CISCCTRL_MAIN_V_RATIO_MASK (0x1ff << 0)
  495. #define EXYNOS_CISCCTRL_MAIN_H_RATIO_MASK (0x1ff << 16)
  496. /* Status register */
  497. #define EXYNOS_CISTATUS_OVFIY (1 << 31)
  498. #define EXYNOS_CISTATUS_OVFICB (1 << 30)
  499. #define EXYNOS_CISTATUS_OVFICR (1 << 29)
  500. #define EXYNOS_CISTATUS_VSYNC (1 << 28)
  501. #define EXYNOS_CISTATUS_SCALERSTART (1 << 26)
  502. #define EXYNOS_CISTATUS_WINOFSTEN (1 << 25)
  503. #define EXYNOS_CISTATUS_IMGCPTEN (1 << 22)
  504. #define EXYNOS_CISTATUS_IMGCPTENSC (1 << 21)
  505. #define EXYNOS_CISTATUS_VSYNC_A (1 << 20)
  506. #define EXYNOS_CISTATUS_VSYNC_B (1 << 19)
  507. #define EXYNOS_CISTATUS_OVRLB (1 << 18)
  508. #define EXYNOS_CISTATUS_FRAMEEND (1 << 17)
  509. #define EXYNOS_CISTATUS_LASTCAPTUREEND (1 << 16)
  510. #define EXYNOS_CISTATUS_VVALID_A (1 << 15)
  511. #define EXYNOS_CISTATUS_VVALID_B (1 << 14)
  512. /* Image capture enable register */
  513. #define EXYNOS_CIIMGCPT_IMGCPTEN (1 << 31)
  514. #define EXYNOS_CIIMGCPT_IMGCPTEN_SC (1 << 30)
  515. #define EXYNOS_CIIMGCPT_CPT_FREN_ENABLE (1 << 25)
  516. #define EXYNOS_CIIMGCPT_CPT_FRMOD_EN (0 << 18)
  517. #define EXYNOS_CIIMGCPT_CPT_FRMOD_CNT (1 << 18)
  518. /* Image effects register */
  519. #define EXYNOS_CIIMGEFF_IE_DISABLE (0 << 30)
  520. #define EXYNOS_CIIMGEFF_IE_ENABLE (1 << 30)
  521. #define EXYNOS_CIIMGEFF_IE_SC_BEFORE (0 << 29)
  522. #define EXYNOS_CIIMGEFF_IE_SC_AFTER (1 << 29)
  523. #define EXYNOS_CIIMGEFF_FIN_BYPASS (0 << 26)
  524. #define EXYNOS_CIIMGEFF_FIN_ARBITRARY (1 << 26)
  525. #define EXYNOS_CIIMGEFF_FIN_NEGATIVE (2 << 26)
  526. #define EXYNOS_CIIMGEFF_FIN_ARTFREEZE (3 << 26)
  527. #define EXYNOS_CIIMGEFF_FIN_EMBOSSING (4 << 26)
  528. #define EXYNOS_CIIMGEFF_FIN_SILHOUETTE (5 << 26)
  529. #define EXYNOS_CIIMGEFF_FIN_MASK (7 << 26)
  530. #define EXYNOS_CIIMGEFF_PAT_CBCR_MASK ((0xff << 13) | (0xff << 0))
  531. /* Real input DMA size register */
  532. #define EXYNOS_CIREAL_ISIZE_AUTOLOAD_ENABLE (1 << 31)
  533. #define EXYNOS_CIREAL_ISIZE_ADDR_CH_DISABLE (1 << 30)
  534. #define EXYNOS_CIREAL_ISIZE_HEIGHT_MASK (0x3FFF << 16)
  535. #define EXYNOS_CIREAL_ISIZE_WIDTH_MASK (0x3FFF << 0)
  536. /* Input DMA control register */
  537. #define EXYNOS_MSCTRL_FIELD_MASK (1 << 31)
  538. #define EXYNOS_MSCTRL_FIELD_WEAVE (1 << 31)
  539. #define EXYNOS_MSCTRL_FIELD_NORMAL (0 << 31)
  540. #define EXYNOS_MSCTRL_BURST_CNT (24)
  541. #define EXYNOS_MSCTRL_BURST_CNT_MASK (0xf << 24)
  542. #define EXYNOS_MSCTRL_ORDER2P_LSB_CBCR (0 << 16)
  543. #define EXYNOS_MSCTRL_ORDER2P_LSB_CRCB (1 << 16)
  544. #define EXYNOS_MSCTRL_ORDER2P_MSB_CRCB (2 << 16)
  545. #define EXYNOS_MSCTRL_ORDER2P_MSB_CBCR (3 << 16)
  546. #define EXYNOS_MSCTRL_ORDER2P_SHIFT (16)
  547. #define EXYNOS_MSCTRL_ORDER2P_SHIFT_MASK (0x3 << 16)
  548. #define EXYNOS_MSCTRL_C_INT_IN_3PLANE (0 << 15)
  549. #define EXYNOS_MSCTRL_C_INT_IN_2PLANE (1 << 15)
  550. #define EXYNOS_MSCTRL_FLIP_SHIFT (13)
  551. #define EXYNOS_MSCTRL_FLIP_NORMAL (0 << 13)
  552. #define EXYNOS_MSCTRL_FLIP_X_MIRROR (1 << 13)
  553. #define EXYNOS_MSCTRL_FLIP_Y_MIRROR (2 << 13)
  554. #define EXYNOS_MSCTRL_FLIP_180 (3 << 13)
  555. #define EXYNOS_MSCTRL_FLIP_MASK (3 << 13)
  556. #define EXYNOS_MSCTRL_ORDER422_CRYCBY (0 << 4)
  557. #define EXYNOS_MSCTRL_ORDER422_YCRYCB (1 << 4)
  558. #define EXYNOS_MSCTRL_ORDER422_CBYCRY (2 << 4)
  559. #define EXYNOS_MSCTRL_ORDER422_YCBYCR (3 << 4)
  560. #define EXYNOS_MSCTRL_INPUT_EXTCAM (0 << 3)
  561. #define EXYNOS_MSCTRL_INPUT_MEMORY (1 << 3)
  562. #define EXYNOS_MSCTRL_INPUT_MASK (1 << 3)
  563. #define EXYNOS_MSCTRL_INFORMAT_YCBCR420 (0 << 1)
  564. #define EXYNOS_MSCTRL_INFORMAT_YCBCR422 (1 << 1)
  565. #define EXYNOS_MSCTRL_INFORMAT_YCBCR422_1PLANE (2 << 1)
  566. #define EXYNOS_MSCTRL_INFORMAT_RGB (3 << 1)
  567. #define EXYNOS_MSCTRL_ENVID (1 << 0)
  568. /* DMA parameter register */
  569. #define EXYNOS_CIDMAPARAM_R_MODE_LINEAR (0 << 29)
  570. #define EXYNOS_CIDMAPARAM_R_MODE_CONFTILE (1 << 29)
  571. #define EXYNOS_CIDMAPARAM_R_MODE_16X16 (2 << 29)
  572. #define EXYNOS_CIDMAPARAM_R_MODE_64X32 (3 << 29)
  573. #define EXYNOS_CIDMAPARAM_R_MODE_MASK (3 << 29)
  574. #define EXYNOS_CIDMAPARAM_R_TILE_HSIZE_64 (0 << 24)
  575. #define EXYNOS_CIDMAPARAM_R_TILE_HSIZE_128 (1 << 24)
  576. #define EXYNOS_CIDMAPARAM_R_TILE_HSIZE_256 (2 << 24)
  577. #define EXYNOS_CIDMAPARAM_R_TILE_HSIZE_512 (3 << 24)
  578. #define EXYNOS_CIDMAPARAM_R_TILE_HSIZE_1024 (4 << 24)
  579. #define EXYNOS_CIDMAPARAM_R_TILE_HSIZE_2048 (5 << 24)
  580. #define EXYNOS_CIDMAPARAM_R_TILE_HSIZE_4096 (6 << 24)
  581. #define EXYNOS_CIDMAPARAM_R_TILE_VSIZE_1 (0 << 20)
  582. #define EXYNOS_CIDMAPARAM_R_TILE_VSIZE_2 (1 << 20)
  583. #define EXYNOS_CIDMAPARAM_R_TILE_VSIZE_4 (2 << 20)
  584. #define EXYNOS_CIDMAPARAM_R_TILE_VSIZE_8 (3 << 20)
  585. #define EXYNOS_CIDMAPARAM_R_TILE_VSIZE_16 (4 << 20)
  586. #define EXYNOS_CIDMAPARAM_R_TILE_VSIZE_32 (5 << 20)
  587. #define EXYNOS_CIDMAPARAM_W_MODE_LINEAR (0 << 13)
  588. #define EXYNOS_CIDMAPARAM_W_MODE_CONFTILE (1 << 13)
  589. #define EXYNOS_CIDMAPARAM_W_MODE_16X16 (2 << 13)
  590. #define EXYNOS_CIDMAPARAM_W_MODE_64X32 (3 << 13)
  591. #define EXYNOS_CIDMAPARAM_W_MODE_MASK (3 << 13)
  592. #define EXYNOS_CIDMAPARAM_W_TILE_HSIZE_64 (0 << 8)
  593. #define EXYNOS_CIDMAPARAM_W_TILE_HSIZE_128 (1 << 8)
  594. #define EXYNOS_CIDMAPARAM_W_TILE_HSIZE_256 (2 << 8)
  595. #define EXYNOS_CIDMAPARAM_W_TILE_HSIZE_512 (3 << 8)
  596. #define EXYNOS_CIDMAPARAM_W_TILE_HSIZE_1024 (4 << 8)
  597. #define EXYNOS_CIDMAPARAM_W_TILE_HSIZE_2048 (5 << 8)
  598. #define EXYNOS_CIDMAPARAM_W_TILE_HSIZE_4096 (6 << 8)
  599. #define EXYNOS_CIDMAPARAM_W_TILE_VSIZE_1 (0 << 4)
  600. #define EXYNOS_CIDMAPARAM_W_TILE_VSIZE_2 (1 << 4)
  601. #define EXYNOS_CIDMAPARAM_W_TILE_VSIZE_4 (2 << 4)
  602. #define EXYNOS_CIDMAPARAM_W_TILE_VSIZE_8 (3 << 4)
  603. #define EXYNOS_CIDMAPARAM_W_TILE_VSIZE_16 (4 << 4)
  604. #define EXYNOS_CIDMAPARAM_W_TILE_VSIZE_32 (5 << 4)
  605. /* Gathering Extension register */
  606. #define EXYNOS_CIEXTEN_TARGETH_EXT_MASK (1 << 26)
  607. #define EXYNOS_CIEXTEN_TARGETV_EXT_MASK (1 << 24)
  608. #define EXYNOS_CIEXTEN_MAINHORRATIO_EXT_MASK (0x3F << 10)
  609. #define EXYNOS_CIEXTEN_MAINVERRATIO_EXT_MASK (0x3F)
  610. #define EXYNOS_CIEXTEN_YUV444_OUT (1 << 22)
  611. /* FIMC Clock Source Select register */
  612. #define EXYNOS_CLKSRC_HCLK (0 << 1)
  613. #define EXYNOS_CLKSRC_HCLK_MASK (1 << 1)
  614. #define EXYNOS_CLKSRC_SCLK (1 << 1)
  615. /* SYSREG for FIMC writeback */
  616. #define SYSREG_CAMERA_BLK (0x0218)
  617. #define SYSREG_FIMD0WB_DEST_MASK (0x3 << 23)
  618. #define SYSREG_FIMD0WB_DEST_SHIFT 23
  619. #endif /* EXYNOS_REGS_FIMC_H */