regs-fimc.h 26 KB

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