omap3isp.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. /*
  2. * omap3isp.h
  3. *
  4. * TI OMAP3 ISP - User-space API
  5. *
  6. * Copyright (C) 2010 Nokia Corporation
  7. * Copyright (C) 2009 Texas Instruments, Inc.
  8. *
  9. * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
  10. * Sakari Ailus <sakari.ailus@iki.fi>
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  24. * 02110-1301 USA
  25. */
  26. #ifndef OMAP3_ISP_USER_H
  27. #define OMAP3_ISP_USER_H
  28. #include <linux/types.h>
  29. #include <linux/videodev2.h>
  30. /*
  31. * Private IOCTLs
  32. *
  33. * VIDIOC_OMAP3ISP_CCDC_CFG: Set CCDC configuration
  34. * VIDIOC_OMAP3ISP_PRV_CFG: Set preview engine configuration
  35. * VIDIOC_OMAP3ISP_AEWB_CFG: Set AEWB module configuration
  36. * VIDIOC_OMAP3ISP_HIST_CFG: Set histogram module configuration
  37. * VIDIOC_OMAP3ISP_AF_CFG: Set auto-focus module configuration
  38. * VIDIOC_OMAP3ISP_STAT_REQ: Read statistics (AEWB/AF/histogram) data
  39. * VIDIOC_OMAP3ISP_STAT_EN: Enable/disable a statistics module
  40. */
  41. #define VIDIOC_OMAP3ISP_CCDC_CFG \
  42. _IOWR('V', BASE_VIDIOC_PRIVATE + 1, struct omap3isp_ccdc_update_config)
  43. #define VIDIOC_OMAP3ISP_PRV_CFG \
  44. _IOWR('V', BASE_VIDIOC_PRIVATE + 2, struct omap3isp_prev_update_config)
  45. #define VIDIOC_OMAP3ISP_AEWB_CFG \
  46. _IOWR('V', BASE_VIDIOC_PRIVATE + 3, struct omap3isp_h3a_aewb_config)
  47. #define VIDIOC_OMAP3ISP_HIST_CFG \
  48. _IOWR('V', BASE_VIDIOC_PRIVATE + 4, struct omap3isp_hist_config)
  49. #define VIDIOC_OMAP3ISP_AF_CFG \
  50. _IOWR('V', BASE_VIDIOC_PRIVATE + 5, struct omap3isp_h3a_af_config)
  51. #define VIDIOC_OMAP3ISP_STAT_REQ \
  52. _IOWR('V', BASE_VIDIOC_PRIVATE + 6, struct omap3isp_stat_data)
  53. #define VIDIOC_OMAP3ISP_STAT_EN \
  54. _IOWR('V', BASE_VIDIOC_PRIVATE + 7, unsigned long)
  55. /*
  56. * Events
  57. *
  58. * V4L2_EVENT_OMAP3ISP_AEWB: AEWB statistics data ready
  59. * V4L2_EVENT_OMAP3ISP_AF: AF statistics data ready
  60. * V4L2_EVENT_OMAP3ISP_HIST: Histogram statistics data ready
  61. */
  62. #define V4L2_EVENT_OMAP3ISP_CLASS (V4L2_EVENT_PRIVATE_START | 0x100)
  63. #define V4L2_EVENT_OMAP3ISP_AEWB (V4L2_EVENT_OMAP3ISP_CLASS | 0x1)
  64. #define V4L2_EVENT_OMAP3ISP_AF (V4L2_EVENT_OMAP3ISP_CLASS | 0x2)
  65. #define V4L2_EVENT_OMAP3ISP_HIST (V4L2_EVENT_OMAP3ISP_CLASS | 0x3)
  66. struct omap3isp_stat_event_status {
  67. __u32 frame_number;
  68. __u16 config_counter;
  69. __u8 buf_err;
  70. };
  71. /* AE/AWB related structures and flags*/
  72. /* H3A Range Constants */
  73. #define OMAP3ISP_AEWB_MAX_SATURATION_LIM 1023
  74. #define OMAP3ISP_AEWB_MIN_WIN_H 2
  75. #define OMAP3ISP_AEWB_MAX_WIN_H 256
  76. #define OMAP3ISP_AEWB_MIN_WIN_W 6
  77. #define OMAP3ISP_AEWB_MAX_WIN_W 256
  78. #define OMAP3ISP_AEWB_MIN_WINVC 1
  79. #define OMAP3ISP_AEWB_MIN_WINHC 1
  80. #define OMAP3ISP_AEWB_MAX_WINVC 128
  81. #define OMAP3ISP_AEWB_MAX_WINHC 36
  82. #define OMAP3ISP_AEWB_MAX_WINSTART 4095
  83. #define OMAP3ISP_AEWB_MIN_SUB_INC 2
  84. #define OMAP3ISP_AEWB_MAX_SUB_INC 32
  85. #define OMAP3ISP_AEWB_MAX_BUF_SIZE 83600
  86. #define OMAP3ISP_AF_IIRSH_MIN 0
  87. #define OMAP3ISP_AF_IIRSH_MAX 4095
  88. #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MIN 1
  89. #define OMAP3ISP_AF_PAXEL_HORIZONTAL_COUNT_MAX 36
  90. #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MIN 1
  91. #define OMAP3ISP_AF_PAXEL_VERTICAL_COUNT_MAX 128
  92. #define OMAP3ISP_AF_PAXEL_INCREMENT_MIN 2
  93. #define OMAP3ISP_AF_PAXEL_INCREMENT_MAX 32
  94. #define OMAP3ISP_AF_PAXEL_HEIGHT_MIN 2
  95. #define OMAP3ISP_AF_PAXEL_HEIGHT_MAX 256
  96. #define OMAP3ISP_AF_PAXEL_WIDTH_MIN 16
  97. #define OMAP3ISP_AF_PAXEL_WIDTH_MAX 256
  98. #define OMAP3ISP_AF_PAXEL_HZSTART_MIN 1
  99. #define OMAP3ISP_AF_PAXEL_HZSTART_MAX 4095
  100. #define OMAP3ISP_AF_PAXEL_VTSTART_MIN 0
  101. #define OMAP3ISP_AF_PAXEL_VTSTART_MAX 4095
  102. #define OMAP3ISP_AF_THRESHOLD_MAX 255
  103. #define OMAP3ISP_AF_COEF_MAX 4095
  104. #define OMAP3ISP_AF_PAXEL_SIZE 48
  105. #define OMAP3ISP_AF_MAX_BUF_SIZE 221184
  106. /**
  107. * struct omap3isp_h3a_aewb_config - AE AWB configuration reset values
  108. * saturation_limit: Saturation limit.
  109. * @win_height: Window Height. Range 2 - 256, even values only.
  110. * @win_width: Window Width. Range 6 - 256, even values only.
  111. * @ver_win_count: Vertical Window Count. Range 1 - 128.
  112. * @hor_win_count: Horizontal Window Count. Range 1 - 36.
  113. * @ver_win_start: Vertical Window Start. Range 0 - 4095.
  114. * @hor_win_start: Horizontal Window Start. Range 0 - 4095.
  115. * @blk_ver_win_start: Black Vertical Windows Start. Range 0 - 4095.
  116. * @blk_win_height: Black Window Height. Range 2 - 256, even values only.
  117. * @subsample_ver_inc: Subsample Vertical points increment Range 2 - 32, even
  118. * values only.
  119. * @subsample_hor_inc: Subsample Horizontal points increment Range 2 - 32, even
  120. * values only.
  121. * @alaw_enable: AEW ALAW EN flag.
  122. */
  123. struct omap3isp_h3a_aewb_config {
  124. /*
  125. * Common fields.
  126. * They should be the first ones and must be in the same order as in
  127. * ispstat_generic_config struct.
  128. */
  129. __u32 buf_size;
  130. __u16 config_counter;
  131. /* Private fields */
  132. __u16 saturation_limit;
  133. __u16 win_height;
  134. __u16 win_width;
  135. __u16 ver_win_count;
  136. __u16 hor_win_count;
  137. __u16 ver_win_start;
  138. __u16 hor_win_start;
  139. __u16 blk_ver_win_start;
  140. __u16 blk_win_height;
  141. __u16 subsample_ver_inc;
  142. __u16 subsample_hor_inc;
  143. __u8 alaw_enable;
  144. };
  145. /**
  146. * struct omap3isp_stat_data - Statistic data sent to or received from user
  147. * @ts: Timestamp of returned framestats.
  148. * @buf: Pointer to pass to user.
  149. * @frame_number: Frame number of requested stats.
  150. * @cur_frame: Current frame number being processed.
  151. * @config_counter: Number of the configuration associated with the data.
  152. */
  153. struct omap3isp_stat_data {
  154. struct timeval ts;
  155. void __user *buf;
  156. __u32 buf_size;
  157. __u16 frame_number;
  158. __u16 cur_frame;
  159. __u16 config_counter;
  160. };
  161. /* Histogram related structs */
  162. /* Flags for number of bins */
  163. #define OMAP3ISP_HIST_BINS_32 0
  164. #define OMAP3ISP_HIST_BINS_64 1
  165. #define OMAP3ISP_HIST_BINS_128 2
  166. #define OMAP3ISP_HIST_BINS_256 3
  167. /* Number of bins * 4 colors * 4-bytes word */
  168. #define OMAP3ISP_HIST_MEM_SIZE_BINS(n) ((1 << ((n)+5))*4*4)
  169. #define OMAP3ISP_HIST_MEM_SIZE 1024
  170. #define OMAP3ISP_HIST_MIN_REGIONS 1
  171. #define OMAP3ISP_HIST_MAX_REGIONS 4
  172. #define OMAP3ISP_HIST_MAX_WB_GAIN 255
  173. #define OMAP3ISP_HIST_MIN_WB_GAIN 0
  174. #define OMAP3ISP_HIST_MAX_BIT_WIDTH 14
  175. #define OMAP3ISP_HIST_MIN_BIT_WIDTH 8
  176. #define OMAP3ISP_HIST_MAX_WG 4
  177. #define OMAP3ISP_HIST_MAX_BUF_SIZE 4096
  178. /* Source */
  179. #define OMAP3ISP_HIST_SOURCE_CCDC 0
  180. #define OMAP3ISP_HIST_SOURCE_MEM 1
  181. /* CFA pattern */
  182. #define OMAP3ISP_HIST_CFA_BAYER 0
  183. #define OMAP3ISP_HIST_CFA_FOVEONX3 1
  184. struct omap3isp_hist_region {
  185. __u16 h_start;
  186. __u16 h_end;
  187. __u16 v_start;
  188. __u16 v_end;
  189. };
  190. struct omap3isp_hist_config {
  191. /*
  192. * Common fields.
  193. * They should be the first ones and must be in the same order as in
  194. * ispstat_generic_config struct.
  195. */
  196. __u32 buf_size;
  197. __u16 config_counter;
  198. __u8 num_acc_frames; /* Num of image frames to be processed and
  199. accumulated for each histogram frame */
  200. __u16 hist_bins; /* number of bins: 32, 64, 128, or 256 */
  201. __u8 cfa; /* BAYER or FOVEON X3 */
  202. __u8 wg[OMAP3ISP_HIST_MAX_WG]; /* White Balance Gain */
  203. __u8 num_regions; /* number of regions to be configured */
  204. struct omap3isp_hist_region region[OMAP3ISP_HIST_MAX_REGIONS];
  205. };
  206. /* Auto Focus related structs */
  207. #define OMAP3ISP_AF_NUM_COEF 11
  208. enum omap3isp_h3a_af_fvmode {
  209. OMAP3ISP_AF_MODE_SUMMED = 0,
  210. OMAP3ISP_AF_MODE_PEAK = 1
  211. };
  212. /* Red, Green, and blue pixel location in the AF windows */
  213. enum omap3isp_h3a_af_rgbpos {
  214. OMAP3ISP_AF_GR_GB_BAYER = 0, /* GR and GB as Bayer pattern */
  215. OMAP3ISP_AF_RG_GB_BAYER = 1, /* RG and GB as Bayer pattern */
  216. OMAP3ISP_AF_GR_BG_BAYER = 2, /* GR and BG as Bayer pattern */
  217. OMAP3ISP_AF_RG_BG_BAYER = 3, /* RG and BG as Bayer pattern */
  218. OMAP3ISP_AF_GG_RB_CUSTOM = 4, /* GG and RB as custom pattern */
  219. OMAP3ISP_AF_RB_GG_CUSTOM = 5 /* RB and GG as custom pattern */
  220. };
  221. /* Contains the information regarding the Horizontal Median Filter */
  222. struct omap3isp_h3a_af_hmf {
  223. __u8 enable; /* Status of Horizontal Median Filter */
  224. __u8 threshold; /* Threshold Value for Horizontal Median Filter */
  225. };
  226. /* Contains the information regarding the IIR Filters */
  227. struct omap3isp_h3a_af_iir {
  228. __u16 h_start; /* IIR horizontal start */
  229. __u16 coeff_set0[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 0 */
  230. __u16 coeff_set1[OMAP3ISP_AF_NUM_COEF]; /* Filter coefficient, set 1 */
  231. };
  232. /* Contains the information regarding the Paxels Structure in AF Engine */
  233. struct omap3isp_h3a_af_paxel {
  234. __u16 h_start; /* Horizontal Start Position */
  235. __u16 v_start; /* Vertical Start Position */
  236. __u8 width; /* Width of the Paxel */
  237. __u8 height; /* Height of the Paxel */
  238. __u8 h_cnt; /* Horizontal Count */
  239. __u8 v_cnt; /* vertical Count */
  240. __u8 line_inc; /* Line Increment */
  241. };
  242. /* Contains the parameters required for hardware set up of AF Engine */
  243. struct omap3isp_h3a_af_config {
  244. /*
  245. * Common fields.
  246. * They should be the first ones and must be in the same order as in
  247. * ispstat_generic_config struct.
  248. */
  249. __u32 buf_size;
  250. __u16 config_counter;
  251. struct omap3isp_h3a_af_hmf hmf; /* HMF configurations */
  252. struct omap3isp_h3a_af_iir iir; /* IIR filter configurations */
  253. struct omap3isp_h3a_af_paxel paxel; /* Paxel parameters */
  254. enum omap3isp_h3a_af_rgbpos rgb_pos; /* RGB Positions */
  255. enum omap3isp_h3a_af_fvmode fvmode; /* Accumulator mode */
  256. __u8 alaw_enable; /* AF ALAW status */
  257. };
  258. /* ISP CCDC structs */
  259. /* Abstraction layer CCDC configurations */
  260. #define OMAP3ISP_CCDC_ALAW (1 << 0)
  261. #define OMAP3ISP_CCDC_LPF (1 << 1)
  262. #define OMAP3ISP_CCDC_BLCLAMP (1 << 2)
  263. #define OMAP3ISP_CCDC_BCOMP (1 << 3)
  264. #define OMAP3ISP_CCDC_FPC (1 << 4)
  265. #define OMAP3ISP_CCDC_CULL (1 << 5)
  266. #define OMAP3ISP_CCDC_CONFIG_LSC (1 << 7)
  267. #define OMAP3ISP_CCDC_TBL_LSC (1 << 8)
  268. #define OMAP3ISP_RGB_MAX 3
  269. /* Enumeration constants for Alaw input width */
  270. enum omap3isp_alaw_ipwidth {
  271. OMAP3ISP_ALAW_BIT12_3 = 0x3,
  272. OMAP3ISP_ALAW_BIT11_2 = 0x4,
  273. OMAP3ISP_ALAW_BIT10_1 = 0x5,
  274. OMAP3ISP_ALAW_BIT9_0 = 0x6
  275. };
  276. /**
  277. * struct omap3isp_ccdc_lsc_config - LSC configuration
  278. * @offset: Table Offset of the gain table.
  279. * @gain_mode_n: Vertical dimension of a paxel in LSC configuration.
  280. * @gain_mode_m: Horizontal dimension of a paxel in LSC configuration.
  281. * @gain_format: Gain table format.
  282. * @fmtsph: Start pixel horizontal from start of the HS sync pulse.
  283. * @fmtlnh: Number of pixels in horizontal direction to use for the data
  284. * reformatter.
  285. * @fmtslv: Start line from start of VS sync pulse for the data reformatter.
  286. * @fmtlnv: Number of lines in vertical direction for the data reformatter.
  287. * @initial_x: X position, in pixels, of the first active pixel in reference
  288. * to the first active paxel. Must be an even number.
  289. * @initial_y: Y position, in pixels, of the first active pixel in reference
  290. * to the first active paxel. Must be an even number.
  291. * @size: Size of LSC gain table. Filled when loaded from userspace.
  292. */
  293. struct omap3isp_ccdc_lsc_config {
  294. __u16 offset;
  295. __u8 gain_mode_n;
  296. __u8 gain_mode_m;
  297. __u8 gain_format;
  298. __u16 fmtsph;
  299. __u16 fmtlnh;
  300. __u16 fmtslv;
  301. __u16 fmtlnv;
  302. __u8 initial_x;
  303. __u8 initial_y;
  304. __u32 size;
  305. };
  306. /**
  307. * struct omap3isp_ccdc_bclamp - Optical & Digital black clamp subtract
  308. * @obgain: Optical black average gain.
  309. * @obstpixel: Start Pixel w.r.t. HS pulse in Optical black sample.
  310. * @oblines: Optical Black Sample lines.
  311. * @oblen: Optical Black Sample Length.
  312. * @dcsubval: Digital Black Clamp subtract value.
  313. */
  314. struct omap3isp_ccdc_bclamp {
  315. __u8 obgain;
  316. __u8 obstpixel;
  317. __u8 oblines;
  318. __u8 oblen;
  319. __u16 dcsubval;
  320. };
  321. /**
  322. * struct omap3isp_ccdc_fpc - Faulty Pixels Correction
  323. * @fpnum: Number of faulty pixels to be corrected in the frame.
  324. * @fpcaddr: Memory address of the FPC Table
  325. */
  326. struct omap3isp_ccdc_fpc {
  327. __u16 fpnum;
  328. __u32 fpcaddr;
  329. };
  330. /**
  331. * struct omap3isp_ccdc_blcomp - Black Level Compensation parameters
  332. * @b_mg: B/Mg pixels. 2's complement. -128 to +127.
  333. * @gb_g: Gb/G pixels. 2's complement. -128 to +127.
  334. * @gr_cy: Gr/Cy pixels. 2's complement. -128 to +127.
  335. * @r_ye: R/Ye pixels. 2's complement. -128 to +127.
  336. */
  337. struct omap3isp_ccdc_blcomp {
  338. __u8 b_mg;
  339. __u8 gb_g;
  340. __u8 gr_cy;
  341. __u8 r_ye;
  342. };
  343. /**
  344. * omap3isp_ccdc_culling - Culling parameters
  345. * @v_pattern: Vertical culling pattern.
  346. * @h_odd: Horizontal Culling pattern for odd lines.
  347. * @h_even: Horizontal Culling pattern for even lines.
  348. */
  349. struct omap3isp_ccdc_culling {
  350. __u8 v_pattern;
  351. __u16 h_odd;
  352. __u16 h_even;
  353. };
  354. /**
  355. * omap3isp_ccdc_update_config - CCDC configuration
  356. * @update: Specifies which CCDC registers should be updated.
  357. * @flag: Specifies which CCDC functions should be enabled.
  358. * @alawip: Enable/Disable A-Law compression.
  359. * @bclamp: Black clamp control register.
  360. * @blcomp: Black level compensation value for RGrGbB Pixels. 2's complement.
  361. * @fpc: Number of faulty pixels corrected in the frame, address of FPC table.
  362. * @cull: Cull control register.
  363. * @lsc: Pointer to LSC gain table.
  364. */
  365. struct omap3isp_ccdc_update_config {
  366. __u16 update;
  367. __u16 flag;
  368. enum omap3isp_alaw_ipwidth alawip;
  369. struct omap3isp_ccdc_bclamp __user *bclamp;
  370. struct omap3isp_ccdc_blcomp __user *blcomp;
  371. struct omap3isp_ccdc_fpc __user *fpc;
  372. struct omap3isp_ccdc_lsc_config __user *lsc_cfg;
  373. struct omap3isp_ccdc_culling __user *cull;
  374. __u8 __user *lsc;
  375. };
  376. /* Preview configurations */
  377. #define OMAP3ISP_PREV_LUMAENH (1 << 0)
  378. #define OMAP3ISP_PREV_INVALAW (1 << 1)
  379. #define OMAP3ISP_PREV_HRZ_MED (1 << 2)
  380. #define OMAP3ISP_PREV_CFA (1 << 3)
  381. #define OMAP3ISP_PREV_CHROMA_SUPP (1 << 4)
  382. #define OMAP3ISP_PREV_WB (1 << 5)
  383. #define OMAP3ISP_PREV_BLKADJ (1 << 6)
  384. #define OMAP3ISP_PREV_RGB2RGB (1 << 7)
  385. #define OMAP3ISP_PREV_COLOR_CONV (1 << 8)
  386. #define OMAP3ISP_PREV_YC_LIMIT (1 << 9)
  387. #define OMAP3ISP_PREV_DEFECT_COR (1 << 10)
  388. /* Bit 11 was OMAP3ISP_PREV_GAMMABYPASS, now merged with OMAP3ISP_PREV_GAMMA */
  389. #define OMAP3ISP_PREV_DRK_FRM_CAPTURE (1 << 12)
  390. #define OMAP3ISP_PREV_DRK_FRM_SUBTRACT (1 << 13)
  391. #define OMAP3ISP_PREV_LENS_SHADING (1 << 14)
  392. #define OMAP3ISP_PREV_NF (1 << 15)
  393. #define OMAP3ISP_PREV_GAMMA (1 << 16)
  394. #define OMAP3ISP_PREV_NF_TBL_SIZE 64
  395. #define OMAP3ISP_PREV_CFA_TBL_SIZE 576
  396. #define OMAP3ISP_PREV_CFA_BLK_SIZE (OMAP3ISP_PREV_CFA_TBL_SIZE / 4)
  397. #define OMAP3ISP_PREV_GAMMA_TBL_SIZE 1024
  398. #define OMAP3ISP_PREV_YENH_TBL_SIZE 128
  399. #define OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS 4
  400. /**
  401. * struct omap3isp_prev_hmed - Horizontal Median Filter
  402. * @odddist: Distance between consecutive pixels of same color in the odd line.
  403. * @evendist: Distance between consecutive pixels of same color in the even
  404. * line.
  405. * @thres: Horizontal median filter threshold.
  406. */
  407. struct omap3isp_prev_hmed {
  408. __u8 odddist;
  409. __u8 evendist;
  410. __u8 thres;
  411. };
  412. /*
  413. * Enumeration for CFA Formats supported by preview
  414. */
  415. enum omap3isp_cfa_fmt {
  416. OMAP3ISP_CFAFMT_BAYER,
  417. OMAP3ISP_CFAFMT_SONYVGA,
  418. OMAP3ISP_CFAFMT_RGBFOVEON,
  419. OMAP3ISP_CFAFMT_DNSPL,
  420. OMAP3ISP_CFAFMT_HONEYCOMB,
  421. OMAP3ISP_CFAFMT_RRGGBBFOVEON
  422. };
  423. /**
  424. * struct omap3isp_prev_cfa - CFA Interpolation
  425. * @format: CFA Format Enum value supported by preview.
  426. * @gradthrs_vert: CFA Gradient Threshold - Vertical.
  427. * @gradthrs_horz: CFA Gradient Threshold - Horizontal.
  428. * @table: Pointer to the CFA table.
  429. */
  430. struct omap3isp_prev_cfa {
  431. enum omap3isp_cfa_fmt format;
  432. __u8 gradthrs_vert;
  433. __u8 gradthrs_horz;
  434. __u32 table[4][OMAP3ISP_PREV_CFA_BLK_SIZE];
  435. };
  436. /**
  437. * struct omap3isp_prev_csup - Chrominance Suppression
  438. * @gain: Gain.
  439. * @thres: Threshold.
  440. * @hypf_en: Flag to enable/disable the High Pass Filter.
  441. */
  442. struct omap3isp_prev_csup {
  443. __u8 gain;
  444. __u8 thres;
  445. __u8 hypf_en;
  446. };
  447. /**
  448. * struct omap3isp_prev_wbal - White Balance
  449. * @dgain: Digital gain (U10Q8).
  450. * @coef3: White balance gain - COEF 3 (U8Q5).
  451. * @coef2: White balance gain - COEF 2 (U8Q5).
  452. * @coef1: White balance gain - COEF 1 (U8Q5).
  453. * @coef0: White balance gain - COEF 0 (U8Q5).
  454. */
  455. struct omap3isp_prev_wbal {
  456. __u16 dgain;
  457. __u8 coef3;
  458. __u8 coef2;
  459. __u8 coef1;
  460. __u8 coef0;
  461. };
  462. /**
  463. * struct omap3isp_prev_blkadj - Black Level Adjustment
  464. * @red: Black level offset adjustment for Red in 2's complement format
  465. * @green: Black level offset adjustment for Green in 2's complement format
  466. * @blue: Black level offset adjustment for Blue in 2's complement format
  467. */
  468. struct omap3isp_prev_blkadj {
  469. /*Black level offset adjustment for Red in 2's complement format */
  470. __u8 red;
  471. /*Black level offset adjustment for Green in 2's complement format */
  472. __u8 green;
  473. /* Black level offset adjustment for Blue in 2's complement format */
  474. __u8 blue;
  475. };
  476. /**
  477. * struct omap3isp_prev_rgbtorgb - RGB to RGB Blending
  478. * @matrix: Blending values(S12Q8 format)
  479. * [RR] [GR] [BR]
  480. * [RG] [GG] [BG]
  481. * [RB] [GB] [BB]
  482. * @offset: Blending offset value for R,G,B in 2's complement integer format.
  483. */
  484. struct omap3isp_prev_rgbtorgb {
  485. __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
  486. __u16 offset[OMAP3ISP_RGB_MAX];
  487. };
  488. /**
  489. * struct omap3isp_prev_csc - Color Space Conversion from RGB-YCbYCr
  490. * @matrix: Color space conversion coefficients(S10Q8)
  491. * [CSCRY] [CSCGY] [CSCBY]
  492. * [CSCRCB] [CSCGCB] [CSCBCB]
  493. * [CSCRCR] [CSCGCR] [CSCBCR]
  494. * @offset: CSC offset values for Y offset, CB offset and CR offset respectively
  495. */
  496. struct omap3isp_prev_csc {
  497. __u16 matrix[OMAP3ISP_RGB_MAX][OMAP3ISP_RGB_MAX];
  498. __s16 offset[OMAP3ISP_RGB_MAX];
  499. };
  500. /**
  501. * struct omap3isp_prev_yclimit - Y, C Value Limit
  502. * @minC: Minimum C value
  503. * @maxC: Maximum C value
  504. * @minY: Minimum Y value
  505. * @maxY: Maximum Y value
  506. */
  507. struct omap3isp_prev_yclimit {
  508. __u8 minC;
  509. __u8 maxC;
  510. __u8 minY;
  511. __u8 maxY;
  512. };
  513. /**
  514. * struct omap3isp_prev_dcor - Defect correction
  515. * @couplet_mode_en: Flag to enable or disable the couplet dc Correction in NF
  516. * @detect_correct: Thresholds for correction bit 0:10 detect 16:25 correct
  517. */
  518. struct omap3isp_prev_dcor {
  519. __u8 couplet_mode_en;
  520. __u32 detect_correct[OMAP3ISP_PREV_DETECT_CORRECT_CHANNELS];
  521. };
  522. /**
  523. * struct omap3isp_prev_nf - Noise Filter
  524. * @spread: Spread value to be used in Noise Filter
  525. * @table: Pointer to the Noise Filter table
  526. */
  527. struct omap3isp_prev_nf {
  528. __u8 spread;
  529. __u32 table[OMAP3ISP_PREV_NF_TBL_SIZE];
  530. };
  531. /**
  532. * struct omap3isp_prev_gtables - Gamma correction tables
  533. * @red: Array for red gamma table.
  534. * @green: Array for green gamma table.
  535. * @blue: Array for blue gamma table.
  536. */
  537. struct omap3isp_prev_gtables {
  538. __u32 red[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
  539. __u32 green[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
  540. __u32 blue[OMAP3ISP_PREV_GAMMA_TBL_SIZE];
  541. };
  542. /**
  543. * struct omap3isp_prev_luma - Luma enhancement
  544. * @table: Array for luma enhancement table.
  545. */
  546. struct omap3isp_prev_luma {
  547. __u32 table[OMAP3ISP_PREV_YENH_TBL_SIZE];
  548. };
  549. /**
  550. * struct omap3isp_prev_update_config - Preview engine configuration (user)
  551. * @update: Specifies which ISP Preview registers should be updated.
  552. * @flag: Specifies which ISP Preview functions should be enabled.
  553. * @shading_shift: 3bit value of shift used in shading compensation.
  554. * @luma: Pointer to luma enhancement structure.
  555. * @hmed: Pointer to structure containing the odd and even distance.
  556. * between the pixels in the image along with the filter threshold.
  557. * @cfa: Pointer to structure containing the CFA interpolation table, CFA.
  558. * format in the image, vertical and horizontal gradient threshold.
  559. * @csup: Pointer to Structure for Chrominance Suppression coefficients.
  560. * @wbal: Pointer to structure for White Balance.
  561. * @blkadj: Pointer to structure for Black Adjustment.
  562. * @rgb2rgb: Pointer to structure for RGB to RGB Blending.
  563. * @csc: Pointer to structure for Color Space Conversion from RGB-YCbYCr.
  564. * @yclimit: Pointer to structure for Y, C Value Limit.
  565. * @dcor: Pointer to structure for defect correction.
  566. * @nf: Pointer to structure for Noise Filter
  567. * @gamma: Pointer to gamma structure.
  568. */
  569. struct omap3isp_prev_update_config {
  570. __u32 update;
  571. __u32 flag;
  572. __u32 shading_shift;
  573. struct omap3isp_prev_luma __user *luma;
  574. struct omap3isp_prev_hmed __user *hmed;
  575. struct omap3isp_prev_cfa __user *cfa;
  576. struct omap3isp_prev_csup __user *csup;
  577. struct omap3isp_prev_wbal __user *wbal;
  578. struct omap3isp_prev_blkadj __user *blkadj;
  579. struct omap3isp_prev_rgbtorgb __user *rgb2rgb;
  580. struct omap3isp_prev_csc __user *csc;
  581. struct omap3isp_prev_yclimit __user *yclimit;
  582. struct omap3isp_prev_dcor __user *dcor;
  583. struct omap3isp_prev_nf __user *nf;
  584. struct omap3isp_prev_gtables __user *gamma;
  585. };
  586. #endif /* OMAP3_ISP_USER_H */