fimc-is-param.h 26 KB

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