fimc-is-param.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver
  4. *
  5. * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd.
  6. *
  7. * Authors: Younghwan Joo <yhwan.joo@samsung.com>
  8. * Sylwester Nawrocki <s.nawrocki@samsung.com>
  9. */
  10. #ifndef FIMC_IS_PARAM_H_
  11. #define FIMC_IS_PARAM_H_
  12. #include <linux/compiler.h>
  13. #define FIMC_IS_CONFIG_TIMEOUT 3000 /* ms */
  14. #define IS_DEFAULT_WIDTH 1280
  15. #define IS_DEFAULT_HEIGHT 720
  16. #define DEFAULT_PREVIEW_STILL_WIDTH IS_DEFAULT_WIDTH
  17. #define DEFAULT_PREVIEW_STILL_HEIGHT IS_DEFAULT_HEIGHT
  18. #define DEFAULT_CAPTURE_STILL_WIDTH IS_DEFAULT_WIDTH
  19. #define DEFAULT_CAPTURE_STILL_HEIGHT IS_DEFAULT_HEIGHT
  20. #define DEFAULT_PREVIEW_VIDEO_WIDTH IS_DEFAULT_WIDTH
  21. #define DEFAULT_PREVIEW_VIDEO_HEIGHT IS_DEFAULT_HEIGHT
  22. #define DEFAULT_CAPTURE_VIDEO_WIDTH IS_DEFAULT_WIDTH
  23. #define DEFAULT_CAPTURE_VIDEO_HEIGHT IS_DEFAULT_HEIGHT
  24. #define DEFAULT_PREVIEW_STILL_FRAMERATE 30
  25. #define DEFAULT_CAPTURE_STILL_FRAMERATE 15
  26. #define DEFAULT_PREVIEW_VIDEO_FRAMERATE 30
  27. #define DEFAULT_CAPTURE_VIDEO_FRAMERATE 30
  28. #define FIMC_IS_REGION_VER 124 /* IS REGION VERSION 1.24 */
  29. #define FIMC_IS_PARAM_SIZE (FIMC_IS_REGION_SIZE + 1)
  30. #define FIMC_IS_MAGIC_NUMBER 0x01020304
  31. #define FIMC_IS_PARAM_MAX_SIZE 64 /* in bytes */
  32. #define FIMC_IS_PARAM_MAX_ENTRIES (FIMC_IS_PARAM_MAX_SIZE / 4)
  33. /* The parameter bitmask bit definitions. */
  34. enum is_param_bit {
  35. PARAM_GLOBAL_SHOTMODE,
  36. PARAM_SENSOR_CONTROL,
  37. PARAM_SENSOR_OTF_OUTPUT,
  38. PARAM_SENSOR_FRAME_RATE,
  39. PARAM_BUFFER_CONTROL,
  40. PARAM_BUFFER_OTF_INPUT,
  41. PARAM_BUFFER_OTF_OUTPUT,
  42. PARAM_ISP_CONTROL,
  43. PARAM_ISP_OTF_INPUT,
  44. PARAM_ISP_DMA1_INPUT,
  45. /* 10 */
  46. PARAM_ISP_DMA2_INPUT,
  47. PARAM_ISP_AA,
  48. PARAM_ISP_FLASH,
  49. PARAM_ISP_AWB,
  50. PARAM_ISP_IMAGE_EFFECT,
  51. PARAM_ISP_ISO,
  52. PARAM_ISP_ADJUST,
  53. PARAM_ISP_METERING,
  54. PARAM_ISP_AFC,
  55. PARAM_ISP_OTF_OUTPUT,
  56. /* 20 */
  57. PARAM_ISP_DMA1_OUTPUT,
  58. PARAM_ISP_DMA2_OUTPUT,
  59. PARAM_DRC_CONTROL,
  60. PARAM_DRC_OTF_INPUT,
  61. PARAM_DRC_DMA_INPUT,
  62. PARAM_DRC_OTF_OUTPUT,
  63. PARAM_SCALERC_CONTROL,
  64. PARAM_SCALERC_OTF_INPUT,
  65. PARAM_SCALERC_IMAGE_EFFECT,
  66. PARAM_SCALERC_INPUT_CROP,
  67. /* 30 */
  68. PARAM_SCALERC_OUTPUT_CROP,
  69. PARAM_SCALERC_OTF_OUTPUT,
  70. PARAM_SCALERC_DMA_OUTPUT,
  71. PARAM_ODC_CONTROL,
  72. PARAM_ODC_OTF_INPUT,
  73. PARAM_ODC_OTF_OUTPUT,
  74. PARAM_DIS_CONTROL,
  75. PARAM_DIS_OTF_INPUT,
  76. PARAM_DIS_OTF_OUTPUT,
  77. PARAM_TDNR_CONTROL,
  78. /* 40 */
  79. PARAM_TDNR_OTF_INPUT,
  80. PARAM_TDNR_1ST_FRAME,
  81. PARAM_TDNR_OTF_OUTPUT,
  82. PARAM_TDNR_DMA_OUTPUT,
  83. PARAM_SCALERP_CONTROL,
  84. PARAM_SCALERP_OTF_INPUT,
  85. PARAM_SCALERP_IMAGE_EFFECT,
  86. PARAM_SCALERP_INPUT_CROP,
  87. PARAM_SCALERP_OUTPUT_CROP,
  88. PARAM_SCALERP_ROTATION,
  89. /* 50 */
  90. PARAM_SCALERP_FLIP,
  91. PARAM_SCALERP_OTF_OUTPUT,
  92. PARAM_SCALERP_DMA_OUTPUT,
  93. PARAM_FD_CONTROL,
  94. PARAM_FD_OTF_INPUT,
  95. PARAM_FD_DMA_INPUT,
  96. PARAM_FD_CONFIG,
  97. };
  98. /* Interrupt map */
  99. #define FIMC_IS_INT_GENERAL 0
  100. #define FIMC_IS_INT_FRAME_DONE_ISP 1
  101. /* Input */
  102. #define CONTROL_COMMAND_STOP 0
  103. #define CONTROL_COMMAND_START 1
  104. #define CONTROL_BYPASS_DISABLE 0
  105. #define CONTROL_BYPASS_ENABLE 1
  106. #define CONTROL_ERROR_NONE 0
  107. /* OTF (On-The-Fly) input interface commands */
  108. #define OTF_INPUT_COMMAND_DISABLE 0
  109. #define OTF_INPUT_COMMAND_ENABLE 1
  110. /* OTF input interface color formats */
  111. enum oft_input_fmt {
  112. OTF_INPUT_FORMAT_BAYER = 0, /* 1 channel */
  113. OTF_INPUT_FORMAT_YUV444 = 1, /* 3 channels */
  114. OTF_INPUT_FORMAT_YUV422 = 2, /* 3 channels */
  115. OTF_INPUT_FORMAT_YUV420 = 3, /* 3 channels */
  116. OTF_INPUT_FORMAT_STRGEN_COLORBAR_BAYER = 10,
  117. OTF_INPUT_FORMAT_BAYER_DMA = 11,
  118. };
  119. #define OTF_INPUT_ORDER_BAYER_GR_BG 0
  120. /* OTF input error codes */
  121. #define OTF_INPUT_ERROR_NONE 0 /* Input setting is done */
  122. /* DMA input commands */
  123. #define DMA_INPUT_COMMAND_DISABLE 0
  124. #define DMA_INPUT_COMMAND_ENABLE 1
  125. /* DMA input color formats */
  126. enum dma_input_fmt {
  127. DMA_INPUT_FORMAT_BAYER = 0,
  128. DMA_INPUT_FORMAT_YUV444 = 1,
  129. DMA_INPUT_FORMAT_YUV422 = 2,
  130. DMA_INPUT_FORMAT_YUV420 = 3,
  131. };
  132. enum dma_input_order {
  133. /* (for DMA_INPUT_PLANE_3) */
  134. DMA_INPUT_ORDER_NO = 0,
  135. /* (only valid at DMA_INPUT_PLANE_2) */
  136. DMA_INPUT_ORDER_CBCR = 1,
  137. /* (only valid at DMA_INPUT_PLANE_2) */
  138. DMA_INPUT_ORDER_CRCB = 2,
  139. /* (only valid at DMA_INPUT_PLANE_1 & DMA_INPUT_FORMAT_YUV444) */
  140. DMA_INPUT_ORDER_YCBCR = 3,
  141. /* (only valid at DMA_INPUT_FORMAT_YUV422 & DMA_INPUT_PLANE_1) */
  142. DMA_INPUT_ORDER_YYCBCR = 4,
  143. /* (only valid at DMA_INPUT_FORMAT_YUV422 & DMA_INPUT_PLANE_1) */
  144. DMA_INPUT_ORDER_YCBYCR = 5,
  145. /* (only valid at DMA_INPUT_FORMAT_YUV422 & DMA_INPUT_PLANE_1) */
  146. DMA_INPUT_ORDER_YCRYCB = 6,
  147. /* (only valid at DMA_INPUT_FORMAT_YUV422 & DMA_INPUT_PLANE_1) */
  148. DMA_INPUT_ORDER_CBYCRY = 7,
  149. /* (only valid at DMA_INPUT_FORMAT_YUV422 & DMA_INPUT_PLANE_1) */
  150. DMA_INPUT_ORDER_CRYCBY = 8,
  151. /* (only valid at DMA_INPUT_FORMAT_BAYER) */
  152. DMA_INPUT_ORDER_GR_BG = 9
  153. };
  154. #define DMA_INPUT_ERROR_NONE 0 /* DMA input setting
  155. is done */
  156. /*
  157. * Data output parameter definitions
  158. */
  159. #define OTF_OUTPUT_CROP_DISABLE 0
  160. #define OTF_OUTPUT_CROP_ENABLE 1
  161. #define OTF_OUTPUT_COMMAND_DISABLE 0
  162. #define OTF_OUTPUT_COMMAND_ENABLE 1
  163. enum otf_output_fmt {
  164. OTF_OUTPUT_FORMAT_YUV444 = 1,
  165. OTF_OUTPUT_FORMAT_YUV422 = 2,
  166. OTF_OUTPUT_FORMAT_YUV420 = 3,
  167. OTF_OUTPUT_FORMAT_RGB = 4,
  168. };
  169. #define OTF_OUTPUT_ORDER_BAYER_GR_BG 0
  170. #define OTF_OUTPUT_ERROR_NONE 0 /* Output Setting is done */
  171. #define DMA_OUTPUT_COMMAND_DISABLE 0
  172. #define DMA_OUTPUT_COMMAND_ENABLE 1
  173. enum dma_output_fmt {
  174. DMA_OUTPUT_FORMAT_BAYER = 0,
  175. DMA_OUTPUT_FORMAT_YUV444 = 1,
  176. DMA_OUTPUT_FORMAT_YUV422 = 2,
  177. DMA_OUTPUT_FORMAT_YUV420 = 3,
  178. DMA_OUTPUT_FORMAT_RGB = 4,
  179. };
  180. enum dma_output_order {
  181. DMA_OUTPUT_ORDER_NO = 0,
  182. /* for DMA_OUTPUT_PLANE_3 */
  183. DMA_OUTPUT_ORDER_CBCR = 1,
  184. /* only valid at DMA_INPUT_PLANE_2) */
  185. DMA_OUTPUT_ORDER_CRCB = 2,
  186. /* only valid at DMA_OUTPUT_PLANE_2) */
  187. DMA_OUTPUT_ORDER_YYCBCR = 3,
  188. /* only valid at DMA_OUTPUT_FORMAT_YUV422 & DMA_OUTPUT_PLANE_1 */
  189. DMA_OUTPUT_ORDER_YCBYCR = 4,
  190. /* only valid at DMA_OUTPUT_FORMAT_YUV422 & DMA_OUTPUT_PLANE_1 */
  191. DMA_OUTPUT_ORDER_YCRYCB = 5,
  192. /* only valid at DMA_OUTPUT_FORMAT_YUV422 & DMA_OUTPUT_PLANE_1 */
  193. DMA_OUTPUT_ORDER_CBYCRY = 6,
  194. /* only valid at DMA_OUTPUT_FORMAT_YUV422 & DMA_OUTPUT_PLANE_1 */
  195. DMA_OUTPUT_ORDER_CRYCBY = 7,
  196. /* only valid at DMA_OUTPUT_FORMAT_YUV422 & DMA_OUTPUT_PLANE_1 */
  197. DMA_OUTPUT_ORDER_YCBCR = 8,
  198. /* only valid at DMA_OUTPUT_FORMAT_YUV444 & DMA_OUPUT_PLANE_1 */
  199. DMA_OUTPUT_ORDER_CRYCB = 9,
  200. /* only valid at DMA_OUTPUT_FORMAT_YUV444 & DMA_OUPUT_PLANE_1 */
  201. DMA_OUTPUT_ORDER_CRCBY = 10,
  202. /* only valid at DMA_OUTPUT_FORMAT_YUV444 & DMA_OUPUT_PLANE_1 */
  203. DMA_OUTPUT_ORDER_CBYCR = 11,
  204. /* only valid at DMA_OUTPUT_FORMAT_YUV444 & DMA_OUPUT_PLANE_1 */
  205. DMA_OUTPUT_ORDER_YCRCB = 12,
  206. /* only valid at DMA_OUTPUT_FORMAT_YUV444 & DMA_OUPUT_PLANE_1 */
  207. DMA_OUTPUT_ORDER_CBCRY = 13,
  208. /* only valid at DMA_OUTPUT_FORMAT_YUV444 & DMA_OUPUT_PLANE_1 */
  209. DMA_OUTPUT_ORDER_BGR = 14,
  210. /* only valid at DMA_OUTPUT_FORMAT_RGB */
  211. DMA_OUTPUT_ORDER_GB_BG = 15
  212. /* only valid at DMA_OUTPUT_FORMAT_BAYER */
  213. };
  214. /* enum dma_output_notify_dma_done */
  215. #define DMA_OUTPUT_NOTIFY_DMA_DONE_DISABLE 0
  216. #define DMA_OUTPUT_NOTIFY_DMA_DONE_ENABLE 1
  217. /* DMA output error codes */
  218. #define DMA_OUTPUT_ERROR_NONE 0 /* DMA output setting
  219. is done */
  220. /* ---------------------- Global ----------------------------------- */
  221. #define GLOBAL_SHOTMODE_ERROR_NONE 0 /* shot-mode setting
  222. is done */
  223. /* 3A lock commands */
  224. #define ISP_AA_COMMAND_START 0
  225. #define ISP_AA_COMMAND_STOP 1
  226. /* 3A lock target */
  227. #define ISP_AA_TARGET_AF 1
  228. #define ISP_AA_TARGET_AE 2
  229. #define ISP_AA_TARGET_AWB 4
  230. enum isp_af_mode {
  231. ISP_AF_MODE_MANUAL = 0,
  232. ISP_AF_MODE_SINGLE = 1,
  233. ISP_AF_MODE_CONTINUOUS = 2,
  234. ISP_AF_MODE_TOUCH = 3,
  235. ISP_AF_MODE_SLEEP = 4,
  236. ISP_AF_MODE_INIT = 5,
  237. ISP_AF_MODE_SET_CENTER_WINDOW = 6,
  238. ISP_AF_MODE_SET_TOUCH_WINDOW = 7
  239. };
  240. /* Face AF commands */
  241. #define ISP_AF_FACE_DISABLE 0
  242. #define ISP_AF_FACE_ENABLE 1
  243. /* AF range */
  244. #define ISP_AF_RANGE_NORMAL 0
  245. #define ISP_AF_RANGE_MACRO 1
  246. /* AF sleep */
  247. #define ISP_AF_SLEEP_OFF 0
  248. #define ISP_AF_SLEEP_ON 1
  249. /* Continuous AF commands */
  250. #define ISP_AF_CONTINUOUS_DISABLE 0
  251. #define ISP_AF_CONTINUOUS_ENABLE 1
  252. /* ISP AF error codes */
  253. #define ISP_AF_ERROR_NONE 0 /* AF mode change is done */
  254. #define ISP_AF_ERROR_NONE_LOCK_DONE 1 /* AF lock is done */
  255. /* Flash commands */
  256. #define ISP_FLASH_COMMAND_DISABLE 0
  257. #define ISP_FLASH_COMMAND_MANUAL_ON 1 /* (forced flash) */
  258. #define ISP_FLASH_COMMAND_AUTO 2
  259. #define ISP_FLASH_COMMAND_TORCH 3 /* 3 sec */
  260. /* Flash red-eye commands */
  261. #define ISP_FLASH_REDEYE_DISABLE 0
  262. #define ISP_FLASH_REDEYE_ENABLE 1
  263. /* Flash error codes */
  264. #define ISP_FLASH_ERROR_NONE 0 /* Flash setting is done */
  265. /* -------------------------- AWB ------------------------------------ */
  266. enum isp_awb_command {
  267. ISP_AWB_COMMAND_AUTO = 0,
  268. ISP_AWB_COMMAND_ILLUMINATION = 1,
  269. ISP_AWB_COMMAND_MANUAL = 2
  270. };
  271. enum isp_awb_illumination {
  272. ISP_AWB_ILLUMINATION_DAYLIGHT = 0,
  273. ISP_AWB_ILLUMINATION_CLOUDY = 1,
  274. ISP_AWB_ILLUMINATION_TUNGSTEN = 2,
  275. ISP_AWB_ILLUMINATION_FLUORESCENT = 3
  276. };
  277. /* ISP AWN error codes */
  278. #define ISP_AWB_ERROR_NONE 0 /* AWB setting is done */
  279. /* -------------------------- Effect ----------------------------------- */
  280. enum isp_imageeffect_command {
  281. ISP_IMAGE_EFFECT_DISABLE = 0,
  282. ISP_IMAGE_EFFECT_MONOCHROME = 1,
  283. ISP_IMAGE_EFFECT_NEGATIVE_MONO = 2,
  284. ISP_IMAGE_EFFECT_NEGATIVE_COLOR = 3,
  285. ISP_IMAGE_EFFECT_SEPIA = 4
  286. };
  287. /* Image effect error codes */
  288. #define ISP_IMAGE_EFFECT_ERROR_NONE 0 /* Image effect setting
  289. is done */
  290. /* ISO commands */
  291. #define ISP_ISO_COMMAND_AUTO 0
  292. #define ISP_ISO_COMMAND_MANUAL 1
  293. /* ISO error codes */
  294. #define ISP_ISO_ERROR_NONE 0 /* ISO setting is done */
  295. /* ISP adjust commands */
  296. #define ISP_ADJUST_COMMAND_AUTO (0 << 0)
  297. #define ISP_ADJUST_COMMAND_MANUAL_CONTRAST (1 << 0)
  298. #define ISP_ADJUST_COMMAND_MANUAL_SATURATION (1 << 1)
  299. #define ISP_ADJUST_COMMAND_MANUAL_SHARPNESS (1 << 2)
  300. #define ISP_ADJUST_COMMAND_MANUAL_EXPOSURE (1 << 3)
  301. #define ISP_ADJUST_COMMAND_MANUAL_BRIGHTNESS (1 << 4)
  302. #define ISP_ADJUST_COMMAND_MANUAL_HUE (1 << 5)
  303. #define ISP_ADJUST_COMMAND_MANUAL_ALL 0x7f
  304. /* ISP adjustment error codes */
  305. #define ISP_ADJUST_ERROR_NONE 0 /* Adjust setting is done */
  306. /*
  307. * Exposure metering
  308. */
  309. enum isp_metering_command {
  310. ISP_METERING_COMMAND_AVERAGE = 0,
  311. ISP_METERING_COMMAND_SPOT = 1,
  312. ISP_METERING_COMMAND_MATRIX = 2,
  313. ISP_METERING_COMMAND_CENTER = 3
  314. };
  315. /* ISP metering error codes */
  316. #define ISP_METERING_ERROR_NONE 0 /* Metering setting is done */
  317. /*
  318. * AFC
  319. */
  320. enum isp_afc_command {
  321. ISP_AFC_COMMAND_DISABLE = 0,
  322. ISP_AFC_COMMAND_AUTO = 1,
  323. ISP_AFC_COMMAND_MANUAL = 2,
  324. };
  325. #define ISP_AFC_MANUAL_50HZ 50
  326. #define ISP_AFC_MANUAL_60HZ 60
  327. /* ------------------------ SCENE MODE--------------------------------- */
  328. enum isp_scene_mode {
  329. ISP_SCENE_NONE = 0,
  330. ISP_SCENE_PORTRAIT = 1,
  331. ISP_SCENE_LANDSCAPE = 2,
  332. ISP_SCENE_SPORTS = 3,
  333. ISP_SCENE_PARTYINDOOR = 4,
  334. ISP_SCENE_BEACHSNOW = 5,
  335. ISP_SCENE_SUNSET = 6,
  336. ISP_SCENE_DAWN = 7,
  337. ISP_SCENE_FALL = 8,
  338. ISP_SCENE_NIGHT = 9,
  339. ISP_SCENE_AGAINSTLIGHTWLIGHT = 10,
  340. ISP_SCENE_AGAINSTLIGHTWOLIGHT = 11,
  341. ISP_SCENE_FIRE = 12,
  342. ISP_SCENE_TEXT = 13,
  343. ISP_SCENE_CANDLE = 14
  344. };
  345. /* AFC error codes */
  346. #define ISP_AFC_ERROR_NONE 0 /* AFC setting is done */
  347. /* ---------------------------- FD ------------------------------------- */
  348. enum fd_config_command {
  349. FD_CONFIG_COMMAND_MAXIMUM_NUMBER = 0x1,
  350. FD_CONFIG_COMMAND_ROLL_ANGLE = 0x2,
  351. FD_CONFIG_COMMAND_YAW_ANGLE = 0x4,
  352. FD_CONFIG_COMMAND_SMILE_MODE = 0x8,
  353. FD_CONFIG_COMMAND_BLINK_MODE = 0x10,
  354. FD_CONFIG_COMMAND_EYES_DETECT = 0x20,
  355. FD_CONFIG_COMMAND_MOUTH_DETECT = 0x40,
  356. FD_CONFIG_COMMAND_ORIENTATION = 0x80,
  357. FD_CONFIG_COMMAND_ORIENTATION_VALUE = 0x100
  358. };
  359. enum fd_config_roll_angle {
  360. FD_CONFIG_ROLL_ANGLE_BASIC = 0,
  361. FD_CONFIG_ROLL_ANGLE_PRECISE_BASIC = 1,
  362. FD_CONFIG_ROLL_ANGLE_SIDES = 2,
  363. FD_CONFIG_ROLL_ANGLE_PRECISE_SIDES = 3,
  364. FD_CONFIG_ROLL_ANGLE_FULL = 4,
  365. FD_CONFIG_ROLL_ANGLE_PRECISE_FULL = 5,
  366. };
  367. enum fd_config_yaw_angle {
  368. FD_CONFIG_YAW_ANGLE_0 = 0,
  369. FD_CONFIG_YAW_ANGLE_45 = 1,
  370. FD_CONFIG_YAW_ANGLE_90 = 2,
  371. FD_CONFIG_YAW_ANGLE_45_90 = 3,
  372. };
  373. /* Smile mode configuration */
  374. #define FD_CONFIG_SMILE_MODE_DISABLE 0
  375. #define FD_CONFIG_SMILE_MODE_ENABLE 1
  376. /* Blink mode configuration */
  377. #define FD_CONFIG_BLINK_MODE_DISABLE 0
  378. #define FD_CONFIG_BLINK_MODE_ENABLE 1
  379. /* Eyes detection configuration */
  380. #define FD_CONFIG_EYES_DETECT_DISABLE 0
  381. #define FD_CONFIG_EYES_DETECT_ENABLE 1
  382. /* Mouth detection configuration */
  383. #define FD_CONFIG_MOUTH_DETECT_DISABLE 0
  384. #define FD_CONFIG_MOUTH_DETECT_ENABLE 1
  385. #define FD_CONFIG_ORIENTATION_DISABLE 0
  386. #define FD_CONFIG_ORIENTATION_ENABLE 1
  387. struct param_control {
  388. u32 cmd;
  389. u32 bypass;
  390. u32 buffer_address;
  391. u32 buffer_size;
  392. u32 skip_frames; /* only valid at ISP */
  393. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 6];
  394. u32 err;
  395. };
  396. struct param_otf_input {
  397. u32 cmd;
  398. u32 width;
  399. u32 height;
  400. u32 format;
  401. u32 bitwidth;
  402. u32 order;
  403. u32 crop_offset_x;
  404. u32 crop_offset_y;
  405. u32 crop_width;
  406. u32 crop_height;
  407. u32 frametime_min;
  408. u32 frametime_max;
  409. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 13];
  410. u32 err;
  411. };
  412. struct param_dma_input {
  413. u32 cmd;
  414. u32 width;
  415. u32 height;
  416. u32 format;
  417. u32 bitwidth;
  418. u32 plane;
  419. u32 order;
  420. u32 buffer_number;
  421. u32 buffer_address;
  422. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 10];
  423. u32 err;
  424. };
  425. struct param_otf_output {
  426. u32 cmd;
  427. u32 width;
  428. u32 height;
  429. u32 format;
  430. u32 bitwidth;
  431. u32 order;
  432. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 7];
  433. u32 err;
  434. };
  435. struct param_dma_output {
  436. u32 cmd;
  437. u32 width;
  438. u32 height;
  439. u32 format;
  440. u32 bitwidth;
  441. u32 plane;
  442. u32 order;
  443. u32 buffer_number;
  444. u32 buffer_address;
  445. u32 notify_dma_done;
  446. u32 dma_out_mask;
  447. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 12];
  448. u32 err;
  449. };
  450. struct param_global_shotmode {
  451. u32 cmd;
  452. u32 skip_frames;
  453. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 3];
  454. u32 err;
  455. };
  456. struct param_sensor_framerate {
  457. u32 frame_rate;
  458. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 2];
  459. u32 err;
  460. };
  461. struct param_isp_aa {
  462. u32 cmd;
  463. u32 target;
  464. u32 mode;
  465. u32 scene;
  466. u32 sleep;
  467. u32 face;
  468. u32 touch_x;
  469. u32 touch_y;
  470. u32 manual_af_setting;
  471. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 10];
  472. u32 err;
  473. };
  474. struct param_isp_flash {
  475. u32 cmd;
  476. u32 redeye;
  477. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 3];
  478. u32 err;
  479. };
  480. struct param_isp_awb {
  481. u32 cmd;
  482. u32 illumination;
  483. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 3];
  484. u32 err;
  485. };
  486. struct param_isp_imageeffect {
  487. u32 cmd;
  488. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 2];
  489. u32 err;
  490. };
  491. struct param_isp_iso {
  492. u32 cmd;
  493. u32 value;
  494. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 3];
  495. u32 err;
  496. };
  497. struct param_isp_adjust {
  498. u32 cmd;
  499. s32 contrast;
  500. s32 saturation;
  501. s32 sharpness;
  502. s32 exposure;
  503. s32 brightness;
  504. s32 hue;
  505. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 8];
  506. u32 err;
  507. };
  508. struct param_isp_metering {
  509. u32 cmd;
  510. u32 win_pos_x;
  511. u32 win_pos_y;
  512. u32 win_width;
  513. u32 win_height;
  514. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 6];
  515. u32 err;
  516. };
  517. struct param_isp_afc {
  518. u32 cmd;
  519. u32 manual;
  520. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 3];
  521. u32 err;
  522. };
  523. struct param_scaler_imageeffect {
  524. u32 cmd;
  525. u32 arbitrary_cb;
  526. u32 arbitrary_cr;
  527. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 4];
  528. u32 err;
  529. };
  530. struct param_scaler_input_crop {
  531. u32 cmd;
  532. u32 crop_offset_x;
  533. u32 crop_offset_y;
  534. u32 crop_width;
  535. u32 crop_height;
  536. u32 in_width;
  537. u32 in_height;
  538. u32 out_width;
  539. u32 out_height;
  540. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 10];
  541. u32 err;
  542. };
  543. struct param_scaler_output_crop {
  544. u32 cmd;
  545. u32 crop_offset_x;
  546. u32 crop_offset_y;
  547. u32 crop_width;
  548. u32 crop_height;
  549. u32 out_format;
  550. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 7];
  551. u32 err;
  552. };
  553. struct param_scaler_rotation {
  554. u32 cmd;
  555. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 2];
  556. u32 err;
  557. };
  558. struct param_scaler_flip {
  559. u32 cmd;
  560. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 2];
  561. u32 err;
  562. };
  563. struct param_3dnr_1stframe {
  564. u32 cmd;
  565. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 2];
  566. u32 err;
  567. };
  568. struct param_fd_config {
  569. u32 cmd;
  570. u32 max_number;
  571. u32 roll_angle;
  572. u32 yaw_angle;
  573. u32 smile_mode;
  574. u32 blink_mode;
  575. u32 eye_detect;
  576. u32 mouth_detect;
  577. u32 orientation;
  578. u32 orientation_value;
  579. u32 reserved[FIMC_IS_PARAM_MAX_ENTRIES - 11];
  580. u32 err;
  581. };
  582. struct global_param {
  583. struct param_global_shotmode shotmode;
  584. };
  585. struct sensor_param {
  586. struct param_control control;
  587. struct param_otf_output otf_output;
  588. struct param_sensor_framerate frame_rate;
  589. } __packed;
  590. struct buffer_param {
  591. struct param_control control;
  592. struct param_otf_input otf_input;
  593. struct param_otf_output otf_output;
  594. } __packed;
  595. struct isp_param {
  596. struct param_control control;
  597. struct param_otf_input otf_input;
  598. struct param_dma_input dma1_input;
  599. struct param_dma_input dma2_input;
  600. struct param_isp_aa aa;
  601. struct param_isp_flash flash;
  602. struct param_isp_awb awb;
  603. struct param_isp_imageeffect effect;
  604. struct param_isp_iso iso;
  605. struct param_isp_adjust adjust;
  606. struct param_isp_metering metering;
  607. struct param_isp_afc afc;
  608. struct param_otf_output otf_output;
  609. struct param_dma_output dma1_output;
  610. struct param_dma_output dma2_output;
  611. } __packed;
  612. struct drc_param {
  613. struct param_control control;
  614. struct param_otf_input otf_input;
  615. struct param_dma_input dma_input;
  616. struct param_otf_output otf_output;
  617. } __packed;
  618. struct scalerc_param {
  619. struct param_control control;
  620. struct param_otf_input otf_input;
  621. struct param_scaler_imageeffect effect;
  622. struct param_scaler_input_crop input_crop;
  623. struct param_scaler_output_crop output_crop;
  624. struct param_otf_output otf_output;
  625. struct param_dma_output dma_output;
  626. } __packed;
  627. struct odc_param {
  628. struct param_control control;
  629. struct param_otf_input otf_input;
  630. struct param_otf_output otf_output;
  631. } __packed;
  632. struct dis_param {
  633. struct param_control control;
  634. struct param_otf_output otf_input;
  635. struct param_otf_output otf_output;
  636. } __packed;
  637. struct tdnr_param {
  638. struct param_control control;
  639. struct param_otf_input otf_input;
  640. struct param_3dnr_1stframe frame;
  641. struct param_otf_output otf_output;
  642. struct param_dma_output dma_output;
  643. } __packed;
  644. struct scalerp_param {
  645. struct param_control control;
  646. struct param_otf_input otf_input;
  647. struct param_scaler_imageeffect effect;
  648. struct param_scaler_input_crop input_crop;
  649. struct param_scaler_output_crop output_crop;
  650. struct param_scaler_rotation rotation;
  651. struct param_scaler_flip flip;
  652. struct param_otf_output otf_output;
  653. struct param_dma_output dma_output;
  654. } __packed;
  655. struct fd_param {
  656. struct param_control control;
  657. struct param_otf_input otf_input;
  658. struct param_dma_input dma_input;
  659. struct param_fd_config config;
  660. } __packed;
  661. struct is_param_region {
  662. struct global_param global;
  663. struct sensor_param sensor;
  664. struct buffer_param buf;
  665. struct isp_param isp;
  666. struct drc_param drc;
  667. struct scalerc_param scalerc;
  668. struct odc_param odc;
  669. struct dis_param dis;
  670. struct tdnr_param tdnr;
  671. struct scalerp_param scalerp;
  672. struct fd_param fd;
  673. } __packed;
  674. #define NUMBER_OF_GAMMA_CURVE_POINTS 32
  675. struct is_tune_sensor {
  676. u32 exposure;
  677. u32 analog_gain;
  678. u32 frame_rate;
  679. u32 actuator_position;
  680. };
  681. struct is_tune_gammacurve {
  682. u32 num_pts_x[NUMBER_OF_GAMMA_CURVE_POINTS];
  683. u32 num_pts_y_r[NUMBER_OF_GAMMA_CURVE_POINTS];
  684. u32 num_pts_y_g[NUMBER_OF_GAMMA_CURVE_POINTS];
  685. u32 num_pts_y_b[NUMBER_OF_GAMMA_CURVE_POINTS];
  686. };
  687. struct is_tune_isp {
  688. /* Brightness level: range 0...100, default 7. */
  689. u32 brightness_level;
  690. /* Contrast level: range -127...127, default 0. */
  691. s32 contrast_level;
  692. /* Saturation level: range -127...127, default 0. */
  693. s32 saturation_level;
  694. s32 gamma_level;
  695. struct is_tune_gammacurve gamma_curve[4];
  696. /* Hue: range -127...127, default 0. */
  697. s32 hue;
  698. /* Sharpness blur: range -127...127, default 0. */
  699. s32 sharpness_blur;
  700. /* Despeckle : range -127~127, default : 0 */
  701. s32 despeckle;
  702. /* Edge color supression: range -127...127, default 0. */
  703. s32 edge_color_supression;
  704. /* Noise reduction: range -127...127, default 0. */
  705. s32 noise_reduction;
  706. /* (32 * 4 + 9) * 4 = 548 bytes */
  707. } __packed;
  708. struct is_tune_region {
  709. struct is_tune_sensor sensor;
  710. struct is_tune_isp isp;
  711. } __packed;
  712. struct rational {
  713. u32 num;
  714. u32 den;
  715. };
  716. struct srational {
  717. s32 num;
  718. s32 den;
  719. };
  720. #define FLASH_FIRED_SHIFT 0
  721. #define FLASH_NOT_FIRED 0
  722. #define FLASH_FIRED 1
  723. #define FLASH_STROBE_SHIFT 1
  724. #define FLASH_STROBE_NO_DETECTION 0
  725. #define FLASH_STROBE_RESERVED 1
  726. #define FLASH_STROBE_RETURN_LIGHT_NOT_DETECTED 2
  727. #define FLASH_STROBE_RETURN_LIGHT_DETECTED 3
  728. #define FLASH_MODE_SHIFT 3
  729. #define FLASH_MODE_UNKNOWN 0
  730. #define FLASH_MODE_COMPULSORY_FLASH_FIRING 1
  731. #define FLASH_MODE_COMPULSORY_FLASH_SUPPRESSION 2
  732. #define FLASH_MODE_AUTO_MODE 3
  733. #define FLASH_FUNCTION_SHIFT 5
  734. #define FLASH_FUNCTION_PRESENT 0
  735. #define FLASH_FUNCTION_NONE 1
  736. #define FLASH_RED_EYE_SHIFT 6
  737. #define FLASH_RED_EYE_DISABLED 0
  738. #define FLASH_RED_EYE_SUPPORTED 1
  739. enum apex_aperture_value {
  740. F1_0 = 0,
  741. F1_4 = 1,
  742. F2_0 = 2,
  743. F2_8 = 3,
  744. F4_0 = 4,
  745. F5_6 = 5,
  746. F8_9 = 6,
  747. F11_0 = 7,
  748. F16_0 = 8,
  749. F22_0 = 9,
  750. F32_0 = 10,
  751. };
  752. struct exif_attribute {
  753. struct rational exposure_time;
  754. struct srational shutter_speed;
  755. u32 iso_speed_rating;
  756. u32 flash;
  757. struct srational brightness;
  758. } __packed;
  759. struct is_frame_header {
  760. u32 valid;
  761. u32 bad_mark;
  762. u32 captured;
  763. u32 frame_number;
  764. struct exif_attribute exif;
  765. } __packed;
  766. struct is_fd_rect {
  767. u32 offset_x;
  768. u32 offset_y;
  769. u32 width;
  770. u32 height;
  771. };
  772. struct is_face_marker {
  773. u32 frame_number;
  774. struct is_fd_rect face;
  775. struct is_fd_rect left_eye;
  776. struct is_fd_rect right_eye;
  777. struct is_fd_rect mouth;
  778. u32 roll_angle;
  779. u32 yaw_angle;
  780. u32 confidence;
  781. s32 smile_level;
  782. s32 blink_level;
  783. } __packed;
  784. #define MAX_FRAME_COUNT 8
  785. #define MAX_FRAME_COUNT_PREVIEW 4
  786. #define MAX_FRAME_COUNT_CAPTURE 1
  787. #define MAX_FACE_COUNT 16
  788. #define MAX_SHARED_COUNT 500
  789. struct is_region {
  790. struct is_param_region parameter;
  791. struct is_tune_region tune;
  792. struct is_frame_header header[MAX_FRAME_COUNT];
  793. struct is_face_marker face[MAX_FACE_COUNT];
  794. u32 shared[MAX_SHARED_COUNT];
  795. } __packed;
  796. /* Offset to the ISP DMA2 output buffer address array. */
  797. #define DMA2_OUTPUT_ADDR_ARRAY_OFFS \
  798. (offsetof(struct is_region, shared) + 32 * sizeof(u32))
  799. struct is_debug_frame_descriptor {
  800. u32 sensor_frame_time;
  801. u32 sensor_exposure_time;
  802. s32 sensor_analog_gain;
  803. /* monitor for AA */
  804. u32 req_lei;
  805. u32 next_next_lei_exp;
  806. u32 next_next_lei_a_gain;
  807. u32 next_next_lei_d_gain;
  808. u32 next_next_lei_statlei;
  809. u32 next_next_lei_lei;
  810. u32 dummy0;
  811. };
  812. #define MAX_FRAMEDESCRIPTOR_CONTEXT_NUM (30*20) /* 600 frames */
  813. #define MAX_VERSION_DISPLAY_BUF 32
  814. struct is_share_region {
  815. u32 frame_time;
  816. u32 exposure_time;
  817. s32 analog_gain;
  818. u32 r_gain;
  819. u32 g_gain;
  820. u32 b_gain;
  821. u32 af_position;
  822. u32 af_status;
  823. /* 0 : SIRC_ISP_CAMERA_AUTOFOCUSMESSAGE_NOMESSAGE */
  824. /* 1 : SIRC_ISP_CAMERA_AUTOFOCUSMESSAGE_REACHED */
  825. /* 2 : SIRC_ISP_CAMERA_AUTOFOCUSMESSAGE_UNABLETOREACH */
  826. /* 3 : SIRC_ISP_CAMERA_AUTOFOCUSMESSAGE_LOST */
  827. /* default : unknown */
  828. u32 af_scene_type;
  829. u32 frame_descp_onoff_control;
  830. u32 frame_descp_update_done;
  831. u32 frame_descp_idx;
  832. u32 frame_descp_max_idx;
  833. struct is_debug_frame_descriptor
  834. dbg_frame_descp_ctx[MAX_FRAMEDESCRIPTOR_CONTEXT_NUM];
  835. u32 chip_id;
  836. u32 chip_rev_no;
  837. u8 isp_fw_ver_no[MAX_VERSION_DISPLAY_BUF];
  838. u8 isp_fw_ver_date[MAX_VERSION_DISPLAY_BUF];
  839. u8 sirc_sdk_ver_no[MAX_VERSION_DISPLAY_BUF];
  840. u8 sirc_sdk_rev_no[MAX_VERSION_DISPLAY_BUF];
  841. u8 sirc_sdk_rev_date[MAX_VERSION_DISPLAY_BUF];
  842. } __packed;
  843. struct is_debug_control {
  844. u32 write_point; /* 0~ 500KB boundary */
  845. u32 assert_flag; /* 0: Not invoked, 1: Invoked */
  846. u32 pabort_flag; /* 0: Not invoked, 1: Invoked */
  847. u32 dabort_flag; /* 0: Not invoked, 1: Invoked */
  848. };
  849. struct sensor_open_extended {
  850. u32 actuator_type;
  851. u32 mclk;
  852. u32 mipi_lane_num;
  853. u32 mipi_speed;
  854. /* Skip setfile loading when fast_open_sensor is not 0 */
  855. u32 fast_open_sensor;
  856. /* Activating sensor self calibration mode (6A3) */
  857. u32 self_calibration_mode;
  858. /* This field is to adjust I2c clock based on ACLK200 */
  859. /* This value is varied in case of rev 0.2 */
  860. u32 i2c_sclk;
  861. };
  862. struct fimc_is;
  863. int fimc_is_hw_get_sensor_max_framerate(struct fimc_is *is);
  864. int __fimc_is_hw_update_param(struct fimc_is *is, u32 offset);
  865. void fimc_is_set_initial_params(struct fimc_is *is);
  866. unsigned int __get_pending_param_count(struct fimc_is *is);
  867. int __is_hw_update_params(struct fimc_is *is);
  868. void __is_get_frame_size(struct fimc_is *is, struct v4l2_mbus_framefmt *mf);
  869. void __is_set_frame_size(struct fimc_is *is, struct v4l2_mbus_framefmt *mf);
  870. void __is_set_sensor(struct fimc_is *is, int fps);
  871. void __is_set_isp_aa_ae(struct fimc_is *is);
  872. void __is_set_isp_flash(struct fimc_is *is, u32 cmd, u32 redeye);
  873. void __is_set_isp_awb(struct fimc_is *is, u32 cmd, u32 val);
  874. void __is_set_isp_effect(struct fimc_is *is, u32 cmd);
  875. void __is_set_isp_iso(struct fimc_is *is, u32 cmd, u32 val);
  876. void __is_set_isp_adjust(struct fimc_is *is, u32 cmd, u32 val);
  877. void __is_set_isp_metering(struct fimc_is *is, u32 id, u32 val);
  878. void __is_set_isp_afc(struct fimc_is *is, u32 cmd, u32 val);
  879. void __is_set_drc_control(struct fimc_is *is, u32 val);
  880. void __is_set_fd_control(struct fimc_is *is, u32 val);
  881. void __is_set_fd_config_maxface(struct fimc_is *is, u32 val);
  882. void __is_set_fd_config_rollangle(struct fimc_is *is, u32 val);
  883. void __is_set_fd_config_yawangle(struct fimc_is *is, u32 val);
  884. void __is_set_fd_config_smilemode(struct fimc_is *is, u32 val);
  885. void __is_set_fd_config_blinkmode(struct fimc_is *is, u32 val);
  886. void __is_set_fd_config_eyedetect(struct fimc_is *is, u32 val);
  887. void __is_set_fd_config_mouthdetect(struct fimc_is *is, u32 val);
  888. void __is_set_fd_config_orientation(struct fimc_is *is, u32 val);
  889. void __is_set_fd_config_orientation_val(struct fimc_is *is, u32 val);
  890. void __is_set_isp_aa_af_mode(struct fimc_is *is, int cmd);
  891. void __is_set_isp_aa_af_start_stop(struct fimc_is *is, int cmd);
  892. #endif