1 /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  */
29 
30 #ifndef __QCAMERA_TYPES_H__
31 #define __QCAMERA_TYPES_H__
32 
33 // System dependencies
34 #include <stdint.h>
35 #include <media/msmb_camera.h>
36 
37 #define CAM_MAX_NUM_BUFS_PER_STREAM 64
38 #define MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES 11224
39 #define AWB_DEBUG_DATA_SIZE               (45000)
40 #define AEC_DEBUG_DATA_SIZE               (5000)
41 #define AF_DEBUG_DATA_SIZE                (60000)
42 #define ASD_DEBUG_DATA_SIZE               (100)
43 #define STATS_BUFFER_DEBUG_DATA_SIZE      (75000)
44 #define BESTATS_BUFFER_DEBUG_DATA_SIZE    (150000)
45 #define BHIST_STATS_DEBUG_DATA_SIZE       (70000)
46 #define TUNING_INFO_DEBUG_DATA_SIZE       (4)
47 #define OIS_DATA_MAX_SIZE                 (32)
48 #define MAX_OIS_SAMPLE_NUM_PER_FRAME      (20)
49 #define MAX_MAKERNOTE_LENGTH              (65535)
50 
51 #define PD_DATA_SIZE                      (4032*2*758)
52 
53 #define MAX_PDAF_CALIB_GAINS              (25*19)
54 #define MAX_PDAF_CALIB_COEFF              (200)
55 
56 #define MAX_WB_CALIB_LIGHTS               (16)
57 
58 #define CEILING64(X) (((X) + 0x0003F) & 0xFFFFFFC0)
59 #define CEILING32(X) (((X) + 0x0001F) & 0xFFFFFFE0)
60 #define CEILING16(X) (((X) + 0x000F) & 0xFFF0)
61 #define CEILING4(X)  (((X) + 0x0003) & 0xFFFC)
62 #define CEILING2(X)  (((X) + 0x0001) & 0xFFFE)
63 
64 #define MAX_ZOOMS_CNT 91
65 #define MAX_SIZES_CNT 40
66 #define MAX_EXP_BRACKETING_LENGTH 32
67 #define MAX_ROI 10
68 #define MAX_STREAM_NUM_IN_BUNDLE 8
69 #define MAX_NUM_STREAMS          8
70 #define CHROMATIX_SIZE 60000
71 #define COMMONCHROMATIX_SIZE 45000
72 #define CPPCHROMATIX_SIZE 36000
73 #define SWPOSTPROCCHROMATIX_SIZE 36000
74 #define AFTUNE_SIZE  32768
75 #define A3CHROMATIX_SIZE 30000
76 #define MAX_SCALE_SIZES_CNT 8
77 #define MAX_SAMP_DECISION_CNT     64
78 #define SENSOR_PHYSICAL_SIZE_CNT  2
79 #define EXPOSURE_TIME_RANGE_CNT   2
80 #define BLACK_LEVEL_PATTERN_CNT   4
81 #define FORWARD_MATRIX_COLS       3
82 #define FORWARD_MATRIX_ROWS       3
83 #define COLOR_TRANSFORM_COLS      3
84 #define COLOR_TRANSFORM_ROWS      3
85 #define CAL_TRANSFORM_COLS        3
86 #define CAL_TRANSFORM_ROWS        3
87 
88 #define MAX_ISP_DATA_SIZE (20*1024)
89 #define MAX_PP_DATA_SIZE  16384
90 #define MAX_AE_STATS_DATA_SIZE  1000
91 #define MAX_AWB_STATS_DATA_SIZE 1000
92 #define MAX_AF_STATS_DATA_SIZE  1000
93 #define MAX_ASD_STATS_DATA_SIZE 1000
94 
95 #define MAX_CAPTURE_BATCH_NUM 32
96 
97 #define TUNING_DATA_VERSION        6
98 #define TUNING_SENSOR_DATA_MAX     0x10000 /*(need value from sensor team)*/
99 #define TUNING_VFE_DATA_MAX        0x10000 /*(need value from vfe team)*/
100 #define TUNING_CPP_DATA_MAX        0x10000 /*(need value from pproc team)*/
101 #define TUNING_CAC_DATA_MAX        0x10000 /*(need value from imglib team)*/
102 #define TUNING_MOD1_AEC_DATA_MAX   ((16*(sizeof(int))) + (16*(sizeof(float))))
103 #define TUNING_MOD1_AWB_DATA_MAX   ((16*(sizeof(int))) + (16*(sizeof(float))))
104 #define TUNING_MOD1_AF_DATA_MAX    ((16*(sizeof(int))) + (16*(sizeof(float))))
105 #define TUNING_MOD1_STATS_DATA_MAX (TUNING_MOD1_AEC_DATA_MAX + \
106                                    TUNING_MOD1_AEC_DATA_MAX + \
107                                    TUNING_MOD1_AEC_DATA_MAX)
108 
109 #define TUNING_DATA_MAX            (TUNING_SENSOR_DATA_MAX + \
110                                    TUNING_VFE_DATA_MAX + \
111                                    TUNING_MOD1_STATS_DATA_MAX + \
112                                    TUNING_CPP_DATA_MAX + \
113                                    TUNING_CAC_DATA_MAX)
114 
115 #define TUNING_SENSOR_DATA_OFFSET  0
116 #define TUNING_VFE_DATA_OFFSET     TUNING_SENSOR_DATA_MAX
117 #define TUNING_MOD1_AEC_DATA_OFFSET  (TUNING_SENSOR_DATA_MAX + \
118                                      TUNING_VFE_DATA_MAX)
119 
120 #define TUNING_MOD1_AWB_DATA_OFFSET  (TUNING_SENSOR_DATA_MAX + \
121                                       TUNING_VFE_DATA_MAX + \
122                                       TUNING_MOD1_AEC_DATA_MAX)
123 
124 #define TUNING_MOD1_AF_DATA_OFFSET  (TUNING_SENSOR_DATA_MAX + \
125                                      TUNING_VFE_DATA_MAX + \
126                                      TUNING_MOD1_AEC_DATA_MAX + \
127                                      TUNING_MOD1_AWB_DATA_MAX)
128 
129 #define TUNING_CPP_DATA_OFFSET     (TUNING_SENSOR_DATA_MAX + \
130                                     TUNING_VFE_DATA_MAX + \
131                                     TUNING_MOD1_AEC_DATA_MAX + \
132                                     TUNING_MOD1_AWB_DATA_MAX + \
133                                     TUNING_MOD1_AF_DATA_MAX)
134 #define TUNING_CAC_DATA_OFFSET     (TUNING_SENSOR_DATA_MAX + \
135                                     TUNING_VFE_DATA_MAX + \
136                                     TUNING_MOD1_AEC_DATA_MAX + \
137                                     TUNING_MOD1_AWB_DATA_MAX + \
138                                     TUNING_MOD1_AF_DATA_MAX + \
139                                     TUNING_CPP_DATA_MAX)
140 
141 #define MAX_STATS_DATA_SIZE 4000
142 
143 #define MAX_AF_BRACKETING_VALUES 5
144 #define MAX_TEST_PATTERN_CNT     8
145 
146 #define GPS_PROCESSING_METHOD_SIZE 33
147 #define EXIF_IMAGE_DESCRIPTION_SIZE 100
148 
149 #define MAX_INFLIGHT_REQUESTS  6
150 #define MAX_INFLIGHT_BLOB      3
151 #define MIN_INFLIGHT_REQUESTS  3
152 #define MIN_INFLIGHT_60FPS_REQUESTS (6)
153 #define MAX_INFLIGHT_REPROCESS_REQUESTS 1
154 #define MAX_INFLIGHT_HFR_REQUESTS (48)
155 #define MIN_INFLIGHT_HFR_REQUESTS (40)
156 
157 // Max allowed video buffer count for all cases
158 #define MAX_VIDEO_BUFFERS 24
159 // Max allowed video buffer count for 30fps
160 #define MAX_30FPS_VIDEO_BUFFERS 18
161 
162 #define QCAMERA_DUMP_FRM_LOCATION "/data/vendor/camera/"
163 #define QCAMERA_MAX_FILEPATH_LENGTH 64
164 
165 #define LIKELY(x)       __builtin_expect((x), true)
166 #define UNLIKELY(x)     __builtin_expect((x), false)
167 
168 #define RELCAM_CALIB_ROT_MATRIX_MAX 9
169 #define RELCAM_CALIB_SURFACE_PARMS_MAX 32
170 #define RELCAM_CALIB_RESERVED_MAX 50
171 
172 #define MAX_NUM_CAMERA_PER_BUNDLE    2 /* Max number of cameras per bundle */
173 #define EXTRA_FRAME_SYNC_BUFFERS     4 /* Extra frame sync buffers in dc mode*/
174 #define MM_CAMERA_FRAME_SYNC_NODES   EXTRA_FRAME_SYNC_BUFFERS
175 
176 #define MAX_REPROCESS_STALL 2
177 
178 #define QCAMERA_MAX_FILEPATH_LENGTH 64
179 
180 #define MAX_EEPROM_VERSION_INFO_LEN 128
181 
182 #define MAX_OPTICAL_BLACK_REGIONS 5
183 
184 /*reprocess pipeline stages are pproc and jpeg */
185 #define MAX_REPROCESS_PIPELINE_STAGES 2
186 
187 /* Defines the number of rows in the color correction matrix (CCM) */
188 #define AWB_NUM_CCM_ROWS (3)
189 
190 /* Defines the number of columns in the color correction matrix (CCM) */
191 #define AWB_NUM_CCM_COLS (3)
192 
193 #define CPU_HAS_READ  (1 << 0)
194 #define CPU_HAS_WRITTEN  (1 << 1)
195 #define CPU_HAS_READ_WRITTEN (CPU_HAS_READ |CPU_HAS_WRITTEN)
196 
197 /* Index to switch H/W to consume to free-run Q*/
198 #define CAM_FREERUN_IDX 0xFFFFFFFF
199 
200 typedef uint64_t cam_feature_mask_t;
201 
202 typedef enum {
203     CAM_HAL_V1 = 1,
204     CAM_HAL_V3 = 3
205 } cam_hal_version_t;
206 
207  typedef enum {
208     CAM_STATUS_INVALID_PARM  = -4, /* Inavlid parameter provided */
209     CAM_STATUS_NOT_SUPPORTED = -3, /* Parameter/operation not supported */
210     CAM_STATUS_BUSY          = -2, /* operation busy */
211     CAM_STATUS_FAILED        = -1, /* Failure in doing operation */
212     CAM_STATUS_SUCCESS       =  0, /* Operation Succeded */
213     CAM_STATUS_ACCEPTED      =  1, /* Parameter accepted */
214     CAM_STATUS_MAX           =  2,
215 } cam_status_t;
216 
217 typedef enum {
218     /*back main camera*/
219     CAM_POSITION_BACK,
220     /*front main camera*/
221     CAM_POSITION_FRONT,
222     /*back aux camera*/
223     CAM_POSITION_BACK_AUX,
224     /*front aux camera*/
225     CAM_POSITION_FRONT_AUX
226 } cam_position_t;
227 
228 // Counter clock wise
229 typedef enum {
230     ROTATE_0 = 1<<0,
231     ROTATE_90 = 1<<1,
232     ROTATE_180 = 1<<2,
233     ROTATE_270 = 1<<3,
234 } cam_rotation_t;
235 
236 typedef enum {
237     CAM_LENS_NORMAL,
238     CAM_LENS_WIDE,
239     CAM_LENS_TELE
240 } cam_lens_type_t;
241 
242 typedef enum {
243     CAM_FLICKER_NONE,
244     CAM_FLICKER_50_HZ,
245     CAM_FLICKER_60_HZ
246 } cam_flicker_t;
247 
248 typedef enum {
249     CAM_PD_DATA_DISABLED = 0,
250     CAM_PD_DATA_ENABLED = 1,
251     CAM_PD_DATA_SKIP = 2,
252 } cam_sensor_pd_data_t;
253 
254 typedef enum {
255     CAM_FORMAT_JPEG = 0,
256     CAM_FORMAT_YUV_420_NV12 = 1,
257     CAM_FORMAT_YUV_420_NV21,
258     CAM_FORMAT_YUV_420_NV21_ADRENO,
259     CAM_FORMAT_YUV_420_YV12,
260     CAM_FORMAT_YUV_422_NV16,
261     CAM_FORMAT_YUV_422_NV61,
262     CAM_FORMAT_YUV_420_NV12_VENUS,
263     /* Note: For all raw formats, each scanline needs to be 16 bytes aligned */
264 
265     /* Packed YUV/YVU raw format, 16 bpp: 8 bits Y and 8 bits UV.
266      * U and V are interleaved with Y: YUYV or YVYV */
267     CAM_FORMAT_YUV_RAW_8BIT_YUYV,
268     CAM_FORMAT_YUV_RAW_8BIT_YVYU,
269     CAM_FORMAT_YUV_RAW_8BIT_UYVY, //10
270     CAM_FORMAT_YUV_RAW_8BIT_VYUY,
271 
272     /* QCOM RAW formats where data is packed into 64bit word.
273      * 8BPP: 1 64-bit word contains 8 pixels p0 - p7, where p0 is
274      *       stored at LSB.
275      * 10BPP: 1 64-bit word contains 6 pixels p0 - p5, where most
276      *       significant 4 bits are set to 0. P0 is stored at LSB.
277      * 12BPP: 1 64-bit word contains 5 pixels p0 - p4, where most
278      *       significant 4 bits are set to 0. P0 is stored at LSB. */
279     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GBRG,
280     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GRBG,
281     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_RGGB,
282     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_BGGR,
283     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GBRG,
284     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GRBG,
285     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_RGGB,
286     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_BGGR,
287     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GBRG,  //20
288     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GRBG,
289     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_RGGB,
290     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_BGGR,
291     /* MIPI RAW formats based on MIPI CSI-2 specifiction.
292      * 8BPP: Each pixel occupies one bytes, starting at LSB.
293      *       Output with of image has no restrictons.
294      * 10BPP: Four pixels are held in every 5 bytes. The output
295      *       with of image must be a multiple of 4 pixels.
296      * 12BPP: Two pixels are held in every 3 bytes. The output
297      *       width of image must be a multiple of 2 pixels. */
298     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GBRG,
299     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GRBG,
300     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_RGGB,
301     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_BGGR,
302     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GBRG,
303     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GRBG,
304     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_RGGB, //30
305     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_BGGR,
306     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GBRG,
307     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GRBG,
308     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_RGGB,
309     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_BGGR,
310     /* Ideal raw formats where image data has gone through black
311      * correction, lens rolloff, demux/channel gain, bad pixel
312      * correction, and ABF.
313      * Ideal raw formats could output any of QCOM_RAW and MIPI_RAW
314      * formats, plus plain8 8bbp, plain16 800, plain16 10bpp, and
315      * plain 16 12bpp */
316     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GBRG,
317     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GRBG,
318     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_RGGB,
319     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_BGGR,
320     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GBRG, //40
321     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GRBG,
322     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_RGGB,
323     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_BGGR,
324     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GBRG,
325     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GRBG,
326     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_RGGB,
327     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_BGGR,
328     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GBRG,
329     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GRBG,
330     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_RGGB, //50
331     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_BGGR,
332     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GBRG,
333     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GRBG,
334     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_RGGB,
335     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_BGGR,
336     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GBRG,
337     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GRBG,
338     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_RGGB,
339     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_BGGR,
340     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GBRG, //60
341     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_GRBG,
342     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_RGGB,
343     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN8_8BPP_BGGR,
344     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GBRG,
345     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_GRBG,
346     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_RGGB,
347     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_8BPP_BGGR,
348     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GBRG,
349     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_GRBG,
350     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_RGGB, //70
351     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_10BPP_BGGR,
352     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GBRG,
353     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_GRBG,
354     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_RGGB,
355     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_12BPP_BGGR,
356 
357     /* generic 8-bit raw */
358     CAM_FORMAT_JPEG_RAW_8BIT,
359     CAM_FORMAT_META_RAW_8BIT,
360 
361     /* generic 10-bit raw */
362     CAM_FORMAT_META_RAW_10BIT,
363 
364     /* QCOM RAW formats where data is packed into 64bit word.
365      * 14BPP: 1 64-bit word contains 4 pixels p0 - p3, where most
366      *       significant 4 bits are set to 0. P0 is stored at LSB.
367      */
368     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GBRG,
369     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GRBG,
370     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_RGGB, //80
371     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_BGGR,
372     /* MIPI RAW formats based on MIPI CSI-2 specifiction.
373      * 14 BPPP: 1st byte: P0 [13:6]
374      *          2nd byte: P1 [13:6]
375      *          3rd byte: P2 [13:6]
376      *          4th byte: P3 [13:6]
377      *          5th byte: P0 [5:0]
378      *          7th byte: P1 [5:0]
379      *          8th byte: P2 [5:0]
380      *          9th byte: P3 [5:0]
381      */
382     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GBRG,
383     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GRBG,
384     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_RGGB,
385     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_BGGR,
386     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GBRG,
387     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GRBG,
388     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_RGGB,
389     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_BGGR,
390     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GBRG, //90
391     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GRBG,
392     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_RGGB,
393     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_BGGR,
394     /* 14BPP: 1st byte: P0 [8:0]
395      *        2nd byte: P0 [13:9]
396      *        3rd byte: P1 [8:0]
397      *        4th byte: P1 [13:9]
398      */
399     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_GBRG,
400     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_GRBG,
401     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_RGGB,
402     CAM_FORMAT_BAYER_IDEAL_RAW_PLAIN16_14BPP_BGGR,
403 
404     CAM_FORMAT_YUV_444_NV24,
405     CAM_FORMAT_YUV_444_NV42,
406 
407     /* Y plane only, used for FD, 8BPP */
408     CAM_FORMAT_Y_ONLY, //100
409 
410     /* UBWC format */
411     CAM_FORMAT_YUV_420_NV12_UBWC,
412 
413     CAM_FORMAT_YUV_420_NV21_VENUS,
414 
415     /* RGB formats */
416     CAM_FORMAT_8888_ARGB,
417 
418     /* Y plane only */
419     CAM_FORMAT_Y_ONLY_10_BPP,
420     CAM_FORMAT_Y_ONLY_12_BPP,
421     CAM_FORMAT_Y_ONLY_14_BPP,
422     CAM_FORMAT_BAYER_QCOM_RAW_8BPP_GREY,
423     CAM_FORMAT_BAYER_QCOM_RAW_10BPP_GREY,
424     CAM_FORMAT_BAYER_QCOM_RAW_12BPP_GREY,
425     CAM_FORMAT_BAYER_QCOM_RAW_14BPP_GREY,
426     CAM_FORMAT_BAYER_MIPI_RAW_8BPP_GREY,
427     CAM_FORMAT_BAYER_MIPI_RAW_10BPP_GREY,
428     CAM_FORMAT_BAYER_MIPI_RAW_12BPP_GREY,
429     CAM_FORMAT_BAYER_MIPI_RAW_14BPP_GREY,
430     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_8BPP_GREY,
431     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_10BPP_GREY,
432     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_12BPP_GREY,
433     CAM_FORMAT_BAYER_IDEAL_RAW_QCOM_14BPP_GREY,
434     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_8BPP_GREY,
435     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_10BPP_GREY,
436     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_12BPP_GREY,
437     CAM_FORMAT_BAYER_IDEAL_RAW_MIPI_14BPP_GREY,
438 
439     CAM_FORMAT_MAX
440 } cam_format_t;
441 
442 typedef enum {
443     CAM_FORMAT_SUBTYPE_HDR_STATS,
444     CAM_FORMAT_SUBTYPE_PDAF_STATS,
445     CAM_FORMAT_SUBTYPE_MAX
446 } cam_sub_format_type_t;
447 
448 typedef enum {
449     CAM_STREAM_TYPE_DEFAULT,       /* default stream type */
450     CAM_STREAM_TYPE_PREVIEW,       /* preview */
451     CAM_STREAM_TYPE_POSTVIEW,      /* postview */
452     CAM_STREAM_TYPE_SNAPSHOT,      /* snapshot */
453     CAM_STREAM_TYPE_VIDEO,         /* video */
454     CAM_STREAM_TYPE_CALLBACK,      /* app requested callback */
455     CAM_STREAM_TYPE_IMPL_DEFINED, /* opaque format: could be display, video enc, ZSL YUV */
456     CAM_STREAM_TYPE_METADATA,      /* meta data */
457     CAM_STREAM_TYPE_RAW,           /* raw dump from camif */
458     CAM_STREAM_TYPE_OFFLINE_PROC,  /* offline process */
459     CAM_STREAM_TYPE_PARM,         /* mct internal stream */
460     CAM_STREAM_TYPE_ANALYSIS,     /* analysis stream */
461     CAM_STREAM_TYPE_MAX,
462 } cam_stream_type_t;
463 
464 typedef enum {
465     CAM_PAD_NONE = 1,
466     CAM_PAD_TO_2 = 2,
467     CAM_PAD_TO_4 = 4,
468     CAM_PAD_TO_WORD = CAM_PAD_TO_4,
469     CAM_PAD_TO_8 = 8,
470     CAM_PAD_TO_16 = 16,
471     CAM_PAD_TO_32 = 32,
472     CAM_PAD_TO_64 = 64,
473     CAM_PAD_TO_128 = 128,
474     CAM_PAD_TO_256 = 256,
475     CAM_PAD_TO_512 = 512,
476     CAM_PAD_TO_1K = 1024,
477     CAM_PAD_TO_2K = 2048,
478     CAM_PAD_TO_4K = 4096,
479     CAM_PAD_TO_8K = 8192
480 } cam_pad_format_t;
481 
482 typedef enum {
483     /* followings are per camera */
484     CAM_MAPPING_BUF_TYPE_CAPABILITY,  /* mapping camera capability buffer */
485     CAM_MAPPING_BUF_TYPE_PARM_BUF,    /* mapping parameters buffer */
486     /* this buffer is needed for the payload to be sent with bundling related cameras cmd */
487     CAM_MAPPING_BUF_TYPE_SYNC_RELATED_SENSORS_BUF, /* mapping sync buffer.*/
488     CAM_MAPPING_BUF_TYPE_DUAL_CAM_CMD_BUF, /*Dual camera cmd ion memory*/
489 
490     /* followings are per stream */
491     CAM_MAPPING_BUF_TYPE_STREAM_BUF,        /* mapping stream buffers */
492     CAM_MAPPING_BUF_TYPE_STREAM_INFO,       /* mapping stream information buffer */
493     CAM_MAPPING_BUF_TYPE_OFFLINE_INPUT_BUF, /* mapping offline process input buffer */
494     CAM_MAPPING_BUF_TYPE_OFFLINE_META_BUF,  /* mapping offline meta buffer */
495     CAM_MAPPING_BUF_TYPE_MISC_BUF,          /* mapping offline miscellaneous buffer */
496     CAM_MAPPING_BUF_TYPE_STREAM_USER_BUF,   /* mapping user ptr stream buffers */
497     CAM_MAPPING_BUF_TYPE_MAX
498 } cam_mapping_buf_type;
499 
500 typedef enum {
501     CAM_STREAM_BUF_TYPE_MPLANE,  /* Multiplanar Buffer type */
502     CAM_STREAM_BUF_TYPE_USERPTR, /* User specific structure pointer*/
503     CAM_STREAM_BUF_TYPE_MAX
504 } cam_stream_buf_type;
505 
506 typedef struct {
507     cam_mapping_buf_type type;
508     uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
509     uint32_t frame_idx;   /* frame index: valid if type is STREAM_BUF */
510     int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
511                            * -1 means all planners shanre the same fd;
512                            * otherwise, each planner has its own fd */
513     uint32_t cookie;      /* could be job_id(uint32_t) to identify mapping job */
514     int32_t fd;           /* origin fd */
515     size_t size;          /* size of the buffer */
516     void *buffer;         /* Buffer pointer */
517 } cam_buf_map_type;
518 
519 typedef struct {
520     uint32_t length;
521     cam_buf_map_type buf_maps[CAM_MAX_NUM_BUFS_PER_STREAM];
522 } cam_buf_map_type_list;
523 
524 typedef struct {
525     cam_mapping_buf_type type;
526     uint32_t stream_id;   /* stream id: valid if STREAM_BUF */
527     uint32_t frame_idx;   /* frame index: valid if STREAM_BUF or HIST_BUF */
528     int32_t plane_idx;    /* planner index. valid if type is STREAM_BUF.
529                            * -1 means all planners shanre the same fd;
530                            * otherwise, each planner has its own fd */
531     uint32_t cookie;      /* could be job_id(uint32_t) to identify unmapping job */
532 } cam_buf_unmap_type;
533 
534 typedef struct {
535     uint32_t length;
536     cam_buf_unmap_type buf_unmaps[CAM_MAX_NUM_BUFS_PER_STREAM];
537 } cam_buf_unmap_type_list;
538 
539 typedef enum {
540     CAM_MAPPING_TYPE_FD_MAPPING,
541     CAM_MAPPING_TYPE_FD_UNMAPPING,
542     CAM_MAPPING_TYPE_FD_BUNDLED_MAPPING,
543     CAM_MAPPING_TYPE_FD_BUNDLED_UNMAPPING,
544     CAM_MAPPING_TYPE_MAX
545 } cam_mapping_type;
546 
547 typedef struct {
548     cam_mapping_type msg_type;
549     union {
550         cam_buf_map_type buf_map;
551         cam_buf_unmap_type buf_unmap;
552         cam_buf_map_type_list buf_map_list;
553         cam_buf_unmap_type_list buf_unmap_list;
554     } payload;
555 } cam_sock_packet_t;
556 typedef cam_sock_packet_t cam_reg_buf_t;
557 
558 typedef enum {
559     CAM_MODE_2D = (1<<0),
560     CAM_MODE_3D = (1<<1)
561 } cam_mode_t;
562 
563 typedef struct {
564     uint32_t len;
565     uint32_t y_offset;
566     uint32_t cbcr_offset;
567 } cam_sp_len_offset_t;
568 
569 typedef struct{
570     uint32_t len;
571     uint32_t offset;
572     int32_t offset_x;
573     int32_t offset_y;
574     int32_t stride;
575     int32_t stride_in_bytes;
576     int32_t scanline;
577     int32_t width;    /* width without padding */
578     int32_t height;   /* height without padding */
579     int32_t meta_stride;   /*Meta stride*/
580     int32_t meta_scanline; /*Meta Scanline*/
581     int32_t meta_len;   /*Meta plane length including 4k padding*/
582 } cam_mp_len_offset_t;
583 
584 typedef struct {
585     uint32_t offset_x;
586     uint32_t offset_y;
587 } cam_offset_info_t;
588 
589 typedef struct {
590     uint32_t width_padding;
591     uint32_t height_padding;
592     uint32_t plane_padding;
593     uint32_t min_stride;
594     uint32_t min_scanline;
595     cam_offset_info_t offset_info;
596 } cam_padding_info_t;
597 
598 typedef struct {
599     uint32_t num_planes;    /*Number of planes in planar buffer*/
600     union {
601         cam_sp_len_offset_t sp;
602         cam_mp_len_offset_t mp[VIDEO_MAX_PLANES];
603     };
604     uint32_t frame_len;
605 } cam_frame_len_offset_t;
606 
607 typedef struct {
608     uint8_t frame_buf_cnt;  /*Total plane frames present in 1 batch*/
609     uint32_t size;          /*Size of 1 batch buffer. Kernel structure size*/
610     long frameInterval;     /*frame interval between each frame*/
611 } cam_stream_user_buf_info_t;
612 
613 typedef struct {
614     int32_t width;
615     int32_t height;
616 } cam_dimension_t;
617 
618 typedef struct {
619     cam_dimension_t active_array_size; // Size of the active array.
620     cam_dimension_t pixel_array_size;  // Size of the pixel array.
621     uint32_t op_pixel_clk;             // Sensor output rate.
622     uint32_t num_raw_bits;             // Number of bits for RAW. 0 if not RAW.
623     int64_t  timestamp_offset;         // Timestamp offset with gyro sensor. 0 if uncalibrated.
624     int64_t  timestamp_crop_offset;    // Timestamp offset due to crop on top of active array.
625 } cam_sensor_mode_info_t;
626 
627 typedef struct {
628     uint16_t left_gain_map[MAX_PDAF_CALIB_GAINS];
629     uint16_t right_gain_map[MAX_PDAF_CALIB_GAINS];
630     int16_t conversion_coeff[MAX_PDAF_CALIB_COEFF];
631 } cam_pd_calibration_t;
632 
633 typedef struct {
634   int32_t num_lights;
635   float r_over_g[MAX_WB_CALIB_LIGHTS];
636   float b_over_g[MAX_WB_CALIB_LIGHTS];
637   float gr_over_gb;
638 } cam_wb_calibration_t;
639 
640 typedef struct {
641     cam_frame_len_offset_t plane_info;
642 } cam_stream_buf_plane_info_t;
643 
644 typedef struct {
645     float min_fps;
646     float max_fps;
647     float video_min_fps;
648     float video_max_fps;
649 } cam_fps_range_t;
650 
651 typedef struct {
652     int32_t min_sensitivity;
653     int32_t max_sensitivity;
654 } cam_sensitivity_range_t;
655 
656 typedef enum {
657     CAM_ISO_PRIORITY,
658     CAM_EXP_PRIORITY,
659     CAM_DEFAULT_OFF,
660 } cam_priority_mode_t;
661 
662 typedef enum {
663     CAM_HFR_MODE_OFF,
664     CAM_HFR_MODE_60FPS,
665     CAM_HFR_MODE_90FPS,
666     CAM_HFR_MODE_120FPS,
667     CAM_HFR_MODE_150FPS,
668     CAM_HFR_MODE_180FPS,
669     CAM_HFR_MODE_210FPS,
670     CAM_HFR_MODE_240FPS,
671     CAM_HFR_MODE_480FPS,
672     CAM_HFR_MODE_MAX
673 } cam_hfr_mode_t;
674 
675 typedef struct {
676     cam_hfr_mode_t mode;
677     uint8_t dim_cnt;                                        /* hfr sizes table count */
678     cam_dimension_t dim[MAX_SIZES_CNT];                     /* hfr sizes table */
679     uint8_t livesnapshot_sizes_tbl_cnt;                     /* livesnapshot sizes table count */
680     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
681 } cam_hfr_info_t;
682 
683 typedef enum {
684     CAM_WB_MODE_AUTO,
685     CAM_WB_MODE_CUSTOM,
686     CAM_WB_MODE_INCANDESCENT,
687     CAM_WB_MODE_FLUORESCENT,
688     CAM_WB_MODE_WARM_FLUORESCENT,
689     CAM_WB_MODE_DAYLIGHT,
690     CAM_WB_MODE_CLOUDY_DAYLIGHT,
691     CAM_WB_MODE_TWILIGHT,
692     CAM_WB_MODE_SHADE,
693     CAM_WB_MODE_MANUAL,
694     CAM_WB_MODE_OFF,
695     CAM_WB_MODE_MAX
696 } cam_wb_mode_type;
697 
698 typedef enum {
699     CAM_ANTIBANDING_MODE_OFF,
700     CAM_ANTIBANDING_MODE_60HZ,
701     CAM_ANTIBANDING_MODE_50HZ,
702     CAM_ANTIBANDING_MODE_AUTO,
703     CAM_ANTIBANDING_MODE_AUTO_50HZ,
704     CAM_ANTIBANDING_MODE_AUTO_60HZ,
705     CAM_ANTIBANDING_MODE_MAX,
706 } cam_antibanding_mode_type;
707 
708 /* Enum Type for different ISO Mode supported */
709 typedef enum {
710     CAM_ISO_MODE_AUTO,
711     CAM_ISO_MODE_DEBLUR,
712     CAM_ISO_MODE_100,
713     CAM_ISO_MODE_200,
714     CAM_ISO_MODE_400,
715     CAM_ISO_MODE_800,
716     CAM_ISO_MODE_1600,
717     CAM_ISO_MODE_3200,
718     CAM_ISO_MODE_MAX
719 } cam_iso_mode_type;
720 
721 typedef enum {
722     CAM_AEC_MODE_FRAME_AVERAGE,
723     CAM_AEC_MODE_CENTER_WEIGHTED,
724     CAM_AEC_MODE_SPOT_METERING,
725     CAM_AEC_MODE_SMART_METERING,
726     CAM_AEC_MODE_USER_METERING,
727     CAM_AEC_MODE_SPOT_METERING_ADV,
728     CAM_AEC_MODE_CENTER_WEIGHTED_ADV,
729     CAM_AEC_MODE_MAX
730 } cam_auto_exposure_mode_type;
731 
732 /* enum to select AEC convergence type */
733 typedef enum {
734     /* Normal AEC connvergence */
735     CAM_AEC_NORMAL_CONVERGENCE = 0,
736     /* Aggressive AEC connvergence */
737     CAM_AEC_AGGRESSIVE_CONVERGENCE,
738     /* Fast AEC convergence */
739     CAM_AEC_FAST_CONVERGENCE,
740     CAM_AEC_CONVERGENCE_MAX
741 } cam_aec_convergence_type;
742 
743 typedef enum {
744     CAM_AE_MODE_OFF,
745     CAM_AE_MODE_ON,
746     CAM_AE_MODE_ON_EXTERNAL_FLASH,
747     CAM_AE_MODE_MAX
748 } cam_ae_mode_type;
749 
750 typedef enum {
751     CAM_FOCUS_ALGO_AUTO,
752     CAM_FOCUS_ALGO_SPOT,
753     CAM_FOCUS_ALGO_CENTER_WEIGHTED,
754     CAM_FOCUS_ALGO_AVERAGE,
755     CAM_FOCUS_ALGO_MAX
756 } cam_focus_algorithm_type;
757 
758 /* Auto focus mode */
759 typedef enum {
760     CAM_FOCUS_MODE_OFF,
761     CAM_FOCUS_MODE_AUTO,
762     CAM_FOCUS_MODE_INFINITY,
763     CAM_FOCUS_MODE_MACRO,
764     CAM_FOCUS_MODE_FIXED,
765     CAM_FOCUS_MODE_EDOF,
766     CAM_FOCUS_MODE_CONTINOUS_VIDEO,
767     CAM_FOCUS_MODE_CONTINOUS_PICTURE,
768     CAM_FOCUS_MODE_MANUAL,
769     CAM_FOCUS_MODE_MAX
770 } cam_focus_mode_type;
771 
772 typedef enum {
773     CAM_MANUAL_FOCUS_MODE_INDEX,
774     CAM_MANUAL_FOCUS_MODE_DAC_CODE,
775     CAM_MANUAL_FOCUS_MODE_RATIO,
776     CAM_MANUAL_FOCUS_MODE_DIOPTER,
777     CAM_MANUAL_FOCUS_MODE_MAX
778 } cam_manual_focus_mode_type;
779 
780 typedef struct {
781     cam_manual_focus_mode_type flag;
782     union{
783         int32_t af_manual_lens_position_index;
784         int32_t af_manual_lens_position_dac;
785         int32_t af_manual_lens_position_ratio;
786         float af_manual_diopter;
787     };
788 } cam_manual_focus_parm_t;
789 
790 typedef enum {
791     CAM_MANUAL_WB_MODE_CCT,
792     CAM_MANUAL_WB_MODE_GAIN,
793     CAM_MANUAL_WB_MODE_MAX
794 } cam_manual_wb_mode_type;
795 
796 typedef struct {
797     float r_gain;
798     float g_gain;
799     float b_gain;
800 } cam_awb_gain_t;
801 
802 typedef struct {
803     cam_manual_wb_mode_type type;
804     union{
805         int32_t cct;
806         cam_awb_gain_t gains;
807     };
808 } cam_manual_wb_parm_t;
809 
810 typedef enum {
811     CAM_SCENE_MODE_OFF,
812     CAM_SCENE_MODE_AUTO,
813     CAM_SCENE_MODE_LANDSCAPE,
814     CAM_SCENE_MODE_SNOW,
815     CAM_SCENE_MODE_BEACH,
816     CAM_SCENE_MODE_SUNSET,
817     CAM_SCENE_MODE_NIGHT,
818     CAM_SCENE_MODE_PORTRAIT,
819     CAM_SCENE_MODE_BACKLIGHT,
820     CAM_SCENE_MODE_SPORTS,
821     CAM_SCENE_MODE_ANTISHAKE,
822     CAM_SCENE_MODE_FLOWERS,
823     CAM_SCENE_MODE_CANDLELIGHT,
824     CAM_SCENE_MODE_FIREWORKS,
825     CAM_SCENE_MODE_PARTY,
826     CAM_SCENE_MODE_NIGHT_PORTRAIT,
827     CAM_SCENE_MODE_THEATRE,
828     CAM_SCENE_MODE_ACTION,
829     CAM_SCENE_MODE_AR,
830     CAM_SCENE_MODE_FACE_PRIORITY,
831     CAM_SCENE_MODE_BARCODE,
832     CAM_SCENE_MODE_HDR,
833     CAM_SCENE_MODE_AQUA,
834     CAM_SCENE_MODE_MAX
835 } cam_scene_mode_type;
836 
837 typedef enum {
838     CAM_EFFECT_MODE_OFF,
839     CAM_EFFECT_MODE_MONO,
840     CAM_EFFECT_MODE_NEGATIVE,
841     CAM_EFFECT_MODE_SOLARIZE,
842     CAM_EFFECT_MODE_SEPIA,
843     CAM_EFFECT_MODE_POSTERIZE,
844     CAM_EFFECT_MODE_WHITEBOARD,
845     CAM_EFFECT_MODE_BLACKBOARD,
846     CAM_EFFECT_MODE_AQUA,
847     CAM_EFFECT_MODE_EMBOSS,
848     CAM_EFFECT_MODE_SKETCH,
849     CAM_EFFECT_MODE_NEON,
850     CAM_EFFECT_MODE_BEAUTY,
851     CAM_EFFECT_MODE_MAX
852 } cam_effect_mode_type;
853 
854 typedef enum {
855     CAM_FLASH_MODE_OFF,
856     CAM_FLASH_MODE_AUTO,
857     CAM_FLASH_MODE_ON,
858     CAM_FLASH_MODE_TORCH,
859     CAM_FLASH_MODE_SINGLE,
860     CAM_FLASH_MODE_MAX
861 } cam_flash_mode_t;
862 
863 // Flash States
864 typedef enum {
865     CAM_FLASH_STATE_UNAVAILABLE,
866     CAM_FLASH_STATE_CHARGING,
867     CAM_FLASH_STATE_READY,
868     CAM_FLASH_STATE_FIRED,
869     CAM_FLASH_STATE_PARTIAL,
870     CAM_FLASH_STATE_MAX
871 } cam_flash_state_t;
872 
873 typedef enum {
874     CAM_FLASH_FIRING_LEVEL_0,
875     CAM_FLASH_FIRING_LEVEL_1,
876     CAM_FLASH_FIRING_LEVEL_2,
877     CAM_FLASH_FIRING_LEVEL_3,
878     CAM_FLASH_FIRING_LEVEL_4,
879     CAM_FLASH_FIRING_LEVEL_5,
880     CAM_FLASH_FIRING_LEVEL_6,
881     CAM_FLASH_FIRING_LEVEL_7,
882     CAM_FLASH_FIRING_LEVEL_8,
883     CAM_FLASH_FIRING_LEVEL_9,
884     CAM_FLASH_FIRING_LEVEL_10,
885     CAM_FLASH_FIRING_LEVEL_MAX
886 } cam_flash_firing_level_t;
887 
888 
889 typedef enum {
890     CAM_AEC_TRIGGER_IDLE,
891     CAM_AEC_TRIGGER_START
892 } cam_aec_trigger_type_t;
893 
894 typedef enum {
895     CAM_AF_TRIGGER_IDLE,
896     CAM_AF_TRIGGER_START,
897     CAM_AF_TRIGGER_CANCEL
898 } cam_af_trigger_type_t;
899 
900 // This enum must match nexus_experimental_2017_tracking_af_trigger
901 typedef enum {
902     CAM_TRACKING_AF_TRIGGER_IDLE,
903     CAM_TRACKING_AF_TRIGGER_START,
904     CAM_TRACKING_AF_TRIGGER_STOP,
905 } cam_tracking_af_trigger_t;
906 
907 typedef enum {
908     CAM_AE_STATE_INACTIVE,
909     CAM_AE_STATE_SEARCHING,
910     CAM_AE_STATE_CONVERGED,
911     CAM_AE_STATE_LOCKED,
912     CAM_AE_STATE_FLASH_REQUIRED,
913     CAM_AE_STATE_PRECAPTURE
914 } cam_ae_state_t;
915 
916 typedef enum {
917     CAM_NOISE_REDUCTION_MODE_OFF,
918     CAM_NOISE_REDUCTION_MODE_FAST,
919     CAM_NOISE_REDUCTION_MODE_HIGH_QUALITY,
920     CAM_NOISE_REDUCTION_MODE_MINIMAL,
921     CAM_NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG
922 } cam_noise_reduction_mode_t;
923 
924 typedef enum {
925     CAM_EDGE_MODE_OFF,
926     CAM_EDGE_MODE_FAST,
927     CAM_EDGE_MODE_HIGH_QUALITY,
928     CAM_EDGE_MODE_ZERO_SHUTTER_LAG,
929 } cam_edge_mode_t;
930 
931 typedef struct {
932    uint8_t edge_mode;
933    int32_t sharpness;
934 } cam_edge_application_t;
935 
936 typedef enum {
937     CAM_BLACK_LEVEL_LOCK_OFF,
938     CAM_BLACK_LEVEL_LOCK_ON,
939 } cam_black_level_lock_t;
940 
941 typedef enum {
942     CAM_HOTPIXEL_MODE_OFF,
943     CAM_HOTPIXEL_MODE_FAST,
944     CAM_HOTPIXEL_MODE_HIGH_QUALITY,
945 } cam_hotpixel_mode_t;
946 
947 typedef enum {
948     CAM_LENS_SHADING_MAP_MODE_OFF,
949     CAM_LENS_SHADING_MAP_MODE_ON,
950 } cam_lens_shading_map_mode_t;
951 
952 typedef enum {
953     CAM_LENS_SHADING_MODE_OFF,
954     CAM_LENS_SHADING_MODE_FAST,
955     CAM_LENS_SHADING_MODE_HIGH_QUALITY,
956 } cam_lens_shading_mode_t;
957 
958 typedef enum {
959     CAM_FACE_DETECT_MODE_OFF,
960     CAM_FACE_DETECT_MODE_SIMPLE,
961     CAM_FACE_DETECT_MODE_FULL,
962 } cam_face_detect_mode_t;
963 
964 typedef enum {
965     CAM_TONEMAP_MODE_CONTRAST_CURVE,
966     CAM_TONEMAP_MODE_FAST,
967     CAM_TONEMAP_MODE_HIGH_QUALITY,
968 } cam_tonemap_mode_t;
969 
970 typedef enum {
971     CAM_CDS_MODE_OFF,
972     CAM_CDS_MODE_ON,
973     CAM_CDS_MODE_AUTO,
974     CAM_CDS_MODE_LOCK,
975     CAM_CDS_MODE_MAX
976 } cam_cds_mode_type_t;
977 
978 typedef enum {
979     CAM_IR_MODE_OFF,
980     CAM_IR_MODE_ON,
981     CAM_IR_MODE_AUTO,
982     CAM_IR_MODE_MAX
983 } cam_ir_mode_type_t;
984 
985 typedef enum {
986     CAM_SENSOR_HDR_OFF,
987     CAM_SENSOR_HDR_IN_SENSOR = 1,
988     CAM_SENSOR_HDR_ZIGZAG,
989     CAM_SENSOR_HDR_STAGGERED,
990     CAM_SENSOR_HDR_MAX,
991 } cam_sensor_hdr_type_t;
992 
993 typedef enum {
994     CAM_VIDEO_HDR_MODE_OFF,
995     CAM_VIDEO_HDR_MODE_ON,
996     CAM_VIDEO_HDR_MODE_MAX,
997 } cam_video_hdr_mode_t;
998 
999 typedef enum {
1000     CAM_BINNING_CORRECTION_MODE_OFF,
1001     CAM_BINNING_CORRECTION_MODE_ON,
1002     CAM_BINNING_CORRECTION_MODE_MAX,
1003 } cam_binning_correction_mode_t;
1004 
1005 typedef struct {
1006     uint32_t size;
1007     uint8_t data[OIS_DATA_MAX_SIZE];
1008 } cam_ois_data_t;
1009 
1010 typedef struct {
1011     int64_t frame_sof_timestamp_boottime;
1012     int32_t num_ois_sample;
1013     int64_t ois_sample_timestamp_boottime[MAX_OIS_SAMPLE_NUM_PER_FRAME];
1014     float ois_sample_shift_pixel_x[MAX_OIS_SAMPLE_NUM_PER_FRAME];
1015     float ois_sample_shift_pixel_y[MAX_OIS_SAMPLE_NUM_PER_FRAME];
1016 } cam_frame_ois_info_t;
1017 
1018 typedef struct  {
1019     int32_t left;
1020     int32_t top;
1021     int32_t width;
1022     int32_t height;
1023 } cam_rect_t;
1024 
1025 typedef struct  {
1026     cam_rect_t rect;
1027     int32_t weight; /* weight of the area, valid for focusing/metering areas */
1028 } cam_area_t;
1029 
1030 typedef enum {
1031     CAM_STREAMING_MODE_CONTINUOUS, /* continous streaming */
1032     CAM_STREAMING_MODE_BURST,      /* burst streaming */
1033     CAM_STREAMING_MODE_BATCH,      /* stream frames in batches */
1034     CAM_STREAMING_MODE_MAX
1035 } cam_streaming_mode_t;
1036 
1037 typedef enum {
1038     IS_TYPE_NONE,
1039     IS_TYPE_CROP,
1040     IS_TYPE_DIS,
1041     IS_TYPE_GA_DIS,
1042     IS_TYPE_EIS_2_0,
1043     IS_TYPE_EIS_3_0,
1044     IS_TYPE_MAX
1045 } cam_is_type_t;
1046 
1047 typedef enum {
1048     DIS_DISABLE,
1049     DIS_ENABLE
1050 } cam_dis_mode_t;
1051 
1052 typedef enum {
1053   NON_SECURE,
1054   SECURE
1055 } cam_stream_secure_t;
1056 
1057 #define CAM_REPROCESS_MASK_TYPE_WNR (1<<0)
1058 
1059 /* event from server */
1060 typedef enum {
1061     CAM_EVENT_TYPE_MAP_UNMAP_DONE  = (1<<0),
1062     CAM_EVENT_TYPE_AUTO_FOCUS_DONE = (1<<1),
1063     CAM_EVENT_TYPE_ZOOM_DONE       = (1<<2),
1064     CAM_EVENT_TYPE_DAEMON_DIED     = (1<<3),
1065     CAM_EVENT_TYPE_INT_TAKE_JPEG   = (1<<4),
1066     CAM_EVENT_TYPE_INT_TAKE_RAW    = (1<<5),
1067     CAM_EVENT_TYPE_DAEMON_PULL_REQ = (1<<6),
1068     CAM_EVENT_TYPE_CAC_DONE        = (1<<7),
1069     CAM_EVENT_TYPE_MAX
1070 } cam_event_type_t;
1071 
1072 typedef enum {
1073     CAM_EXP_BRACKETING_OFF,
1074     CAM_EXP_BRACKETING_ON
1075 } cam_bracket_mode;
1076 
1077 typedef enum {
1078     CAM_LOW_LIGHT_OFF = 0,
1079     CAM_LOW_LIGHT_ON,
1080 } cam_low_light_mode_t;
1081 
1082 typedef struct {
1083     cam_bracket_mode mode;
1084     char values[MAX_EXP_BRACKETING_LENGTH];  /* user defined values */
1085 } cam_exp_bracketing_t;
1086 
1087 typedef struct {
1088   uint32_t num_frames;
1089   cam_exp_bracketing_t exp_val;
1090 } cam_hdr_bracketing_info_t;
1091 
1092  typedef struct {
1093     cam_bracket_mode mode;
1094     int32_t values;  /* user defined values */
1095 } cam_capture_bracketing_t;
1096 
1097 typedef enum {
1098     CAM_SETTINGS_TYPE_OFF,
1099     CAM_SETTINGS_TYPE_ON,
1100     CAM_SETTINGS_TYPE_AUTO
1101 } cam_manual_setting_mode;
1102 
1103 typedef struct {
1104     cam_manual_setting_mode exp_mode;
1105     int64_t exp_time;
1106     cam_manual_setting_mode iso_mode;
1107     int32_t iso_value;
1108 } cam_capture_manual_3A_t;
1109 
1110 typedef enum {
1111     CAM_CAPTURE_NORMAL,
1112     CAM_CAPTURE_FLASH,
1113     CAM_CAPTURE_BRACKETING,
1114     CAM_CAPTURE_LOW_LIGHT,
1115     CAM_CAPTURE_RESET,
1116     CAM_CAPTURE_MANUAL_3A,
1117     CAM_CAPTURE_LED_CAL,
1118     CAM_CAPTURE_MAX
1119 } cam_capture_type;
1120 
1121 typedef struct {
1122     int32_t num_frames;     /*Num of frames requested on this quality*/
1123     cam_capture_type type;  /*type of the capture request*/
1124 
1125     /*union to strore values of capture type*/
1126     union {
1127         cam_flash_mode_t flash_mode;
1128         cam_capture_bracketing_t hdr_mode;
1129         cam_low_light_mode_t low_light_mode;
1130         cam_capture_manual_3A_t manual_3A_mode;
1131     };
1132 } cam_capture_settings_t;
1133 
1134 typedef struct {
1135     uint32_t num_batch;  /*Number of frames batch requested*/
1136     cam_capture_settings_t configs[MAX_CAPTURE_BATCH_NUM];
1137 } cam_capture_frame_config_t;
1138 
1139 typedef struct {
1140     uint8_t stepsize;
1141     uint8_t direction;
1142     int32_t num_steps;
1143     uint8_t ttype;
1144 } tune_actuator_t;
1145 
1146 typedef struct {
1147     uint8_t module;
1148     uint8_t type;
1149     int32_t value;
1150 } tune_cmd_t;
1151 
1152 typedef enum {
1153     CAM_AEC_ROI_OFF,
1154     CAM_AEC_ROI_ON
1155 } cam_aec_roi_ctrl_t;
1156 
1157 typedef enum {
1158     CAM_AEC_ROI_BY_INDEX,
1159     CAM_AEC_ROI_BY_COORDINATE,
1160 } cam_aec_roi_type_t;
1161 
1162 typedef struct {
1163     uint32_t x;
1164     uint32_t y;
1165 } cam_coordinate_type_t;
1166 
1167 typedef struct {
1168     int32_t numerator;
1169     int32_t denominator;
1170 } cam_rational_type_t;
1171 
1172 typedef struct {
1173     cam_aec_roi_ctrl_t aec_roi_enable;
1174     cam_aec_roi_type_t aec_roi_type;
1175     uint8_t num_roi;
1176     union {
1177         cam_coordinate_type_t coordinate[MAX_ROI];
1178         uint32_t aec_roi_idx[MAX_ROI];
1179     } cam_aec_roi_position;
1180 } cam_set_aec_roi_t;
1181 
1182 typedef struct {
1183     uint32_t frm_id;
1184     uint8_t num_roi;
1185     cam_rect_t roi[MAX_ROI];
1186     int32_t weight[MAX_ROI];
1187     uint8_t is_multiwindow;
1188 } cam_roi_info_t;
1189 
1190 typedef enum {
1191     CAM_WAVELET_DENOISE_YCBCR_PLANE,
1192     CAM_WAVELET_DENOISE_CBCR_ONLY,
1193     CAM_WAVELET_DENOISE_STREAMLINE_YCBCR,
1194     CAM_WAVELET_DENOISE_STREAMLINED_CBCR
1195 } cam_denoise_process_type_t;
1196 
1197 typedef struct {
1198     uint8_t denoise_enable;
1199     cam_denoise_process_type_t process_plates;
1200 } cam_denoise_param_t;
1201 
1202 #define CAM_FACE_PROCESS_MASK_DETECTION     (1U<<0)
1203 #define CAM_FACE_PROCESS_MASK_RECOGNITION   (1U<<1)
1204 #define CAM_FACE_PROCESS_MASK_FOCUS         (1U<<2)
1205 #define CAM_FACE_PROCESS_MASK_BLINK         (1U<<3)
1206 #define CAM_FACE_PROCESS_MASK_SMILE         (1U<<4)
1207 #define CAM_FACE_PROCESS_MASK_GAZE          (1U<<5)
1208 
1209 /* Keep this in sync with invalid landmark value : system/core/include/system/camera.h */
1210 #define FACE_INVALID_POINT -2000
1211 
1212 typedef struct {
1213     uint32_t fd_mode;          /* mask of face process */
1214     uint32_t num_fd;
1215 } cam_fd_set_parm_t;
1216 
1217 typedef enum {
1218     QCAMERA_FD_PREVIEW,
1219     QCAMERA_FD_SNAPSHOT
1220 }qcamera_face_detect_type_t;
1221 
1222 typedef enum {
1223     CAM_FACE_CT_POINT_EYE_L_PUPIL,
1224     CAM_FACE_CT_POINT_EYE_L_IN,
1225     CAM_FACE_CT_POINT_EYE_L_OUT,
1226     CAM_FACE_CT_POINT_EYE_L_UP,
1227     CAM_FACE_CT_POINT_EYE_L_DOWN,
1228     CAM_FACE_CT_POINT_EYE_R_PUPIL,
1229     CAM_FACE_CT_POINT_EYE_R_IN,
1230     CAM_FACE_CT_POINT_EYE_R_OUT,
1231     CAM_FACE_CT_POINT_EYE_R_UP,
1232     CAM_FACE_CT_POINT_EYE_R_DOWN,
1233     CAM_FACE_CT_POINT_EYE_MAX
1234 } cam_face_ct_point_eye_t;
1235 
1236 typedef enum {
1237     CAM_FACE_CT_POINT_FOREHEAD,
1238     CAM_FACE_CT_POINT_FOREHEAD_MAX
1239 } cam_face_ct_point_forh_t;
1240 
1241 typedef enum {
1242     CAM_FACE_CT_POINT_NOSE,
1243     CAM_FACE_CT_POINT_NOSE_TIP,
1244     CAM_FACE_CT_POINT_NOSE_L,
1245     CAM_FACE_CT_POINT_NOSE_R,
1246     CAM_FACE_CT_POINT_NOSE_L_0,
1247     CAM_FACE_CT_POINT_NOSE_R_0,
1248     CAM_FACE_CT_POINT_NOSE_L_1,
1249     CAM_FACE_CT_POINT_NOSE_R_1,
1250     CAM_FACE_CT_POINT_NOSE_MAX
1251 } cam_face_ct_point_nose_t;
1252 
1253 typedef enum {
1254     CAM_FACE_CT_POINT_MOUTH_L,
1255     CAM_FACE_CT_POINT_MOUTH_R,
1256     CAM_FACE_CT_POINT_MOUTH_UP,
1257     CAM_FACE_CT_POINT_MOUTH_DOWN,
1258     CAM_FACE_CT_POINT_MOUTH_MAX
1259 } cam_face_ct_point_mouth_t;
1260 
1261 typedef enum {
1262     CAM_FACE_CT_POINT_LIP_UP,
1263     CAM_FACE_CT_POINT_LIP_DOWN,
1264     CAM_FACE_CT_POINT_LIP_MAX
1265 } cam_face_ct_point_lip_t;
1266 
1267 typedef enum {
1268     CAM_FACE_CT_POINT_BROW_L_UP,
1269     CAM_FACE_CT_POINT_BROW_L_DOWN,
1270     CAM_FACE_CT_POINT_BROW_L_IN,
1271     CAM_FACE_CT_POINT_BROW_L_OUT,
1272     CAM_FACE_CT_POINT_BROW_R_UP,
1273     CAM_FACE_CT_POINT_BROW_R_DOWN,
1274     CAM_FACE_CT_POINT_BROW_R_IN,
1275     CAM_FACE_CT_POINT_BROW_R_OUT,
1276     CAM_FACE_CT_POINT_BROW_MAX
1277 } cam_face_ct_point_brow_t;
1278 
1279 typedef enum {
1280     CAM_FACE_CT_POINT_CHIN,
1281     CAM_FACE_CT_POINT_CHIN_L,
1282     CAM_FACE_CT_POINT_CHIN_R,
1283     CAM_FACE_CT_POINT_CHIN_MAX
1284 } cam_face_ct_point_chin_t;
1285 
1286 typedef enum {
1287     CAM_FACE_CT_POINT_EAR_L_DOWN,
1288     CAM_FACE_CT_POINT_EAR_R_DOWN,
1289     CAM_FACE_CT_POINT_EAR_L_UP,
1290     CAM_FACE_CT_POINT_EAR_R_UP,
1291     CAM_FACE_CT_POINT_EAR_MAX
1292 } cam_face_ct_point_ear_t;
1293 
1294 typedef struct {
1295   uint8_t is_eye_valid;
1296   cam_coordinate_type_t contour_eye_pt[CAM_FACE_CT_POINT_EYE_MAX];
1297   uint8_t is_forehead_valid;
1298   cam_coordinate_type_t contour_forh_pt[CAM_FACE_CT_POINT_FOREHEAD_MAX];
1299   uint8_t is_nose_valid;
1300   cam_coordinate_type_t contour_nose_pt[CAM_FACE_CT_POINT_NOSE_MAX];
1301   uint8_t is_mouth_valid;
1302   cam_coordinate_type_t contour_mouth_pt[CAM_FACE_CT_POINT_MOUTH_MAX];
1303   uint8_t is_lip_valid;
1304   cam_coordinate_type_t contour_lip_pt[CAM_FACE_CT_POINT_LIP_MAX];
1305   uint8_t is_brow_valid;
1306   cam_coordinate_type_t contour_brow_pt[CAM_FACE_CT_POINT_BROW_MAX];
1307   uint8_t is_chin_valid;
1308   cam_coordinate_type_t contour_chin_pt[CAM_FACE_CT_POINT_CHIN_MAX];
1309   uint8_t is_ear_valid;
1310   cam_coordinate_type_t contour_ear_pt[CAM_FACE_CT_POINT_EAR_MAX];
1311 } cam_face_contour_info_t;
1312 
1313 typedef struct {
1314     cam_face_contour_info_t face_contour[MAX_ROI];
1315 } cam_face_contour_data_t;
1316 
1317 typedef struct {
1318     uint8_t is_left_eye_valid;
1319     cam_coordinate_type_t left_eye_center;  /* coordinate of center of left eye */
1320     uint8_t is_right_eye_valid;
1321     cam_coordinate_type_t right_eye_center; /* coordinate of center of right eye */
1322     uint8_t is_mouth_valid;
1323     cam_coordinate_type_t mouth_center;     /* coordinate of center of mouth */
1324 } cam_face_landmarks_info_t;
1325 
1326 typedef struct {
1327     cam_face_landmarks_info_t face_landmarks[MAX_ROI];
1328 } cam_face_landmarks_data_t;
1329 
1330 typedef struct {
1331     uint8_t smile_degree;      /* smile degree (0, -100) */
1332     uint8_t smile_confidence;  /* smile confidence (0, 100) */
1333 } cam_face_smile_info_t;
1334 
1335 typedef struct {
1336     cam_face_smile_info_t smile[MAX_ROI];
1337 } cam_face_smile_data_t;
1338 
1339 typedef struct {
1340     int8_t gaze_angle;         /* -90 -45 0 45 90 for head left to rigth tilt */
1341     int32_t updown_dir;        /* up down direction (-180, 179) */
1342     int32_t leftright_dir;     /* left right direction (-180, 179) */
1343     int32_t roll_dir;          /* roll direction (-180, 179) */
1344     int8_t left_right_gaze;    /* left right gaze degree (-50, 50) */
1345     int8_t top_bottom_gaze;    /* up down gaze degree (-50, 50) */
1346 } cam_face_gaze_info_t;
1347 
1348 typedef struct {
1349     cam_face_gaze_info_t gaze[MAX_ROI];
1350 } cam_face_gaze_data_t;
1351 
1352 typedef struct {
1353     uint8_t blink_detected;    /* if blink is detected */
1354     uint8_t left_blink;        /* left eye blink degeree (0, -100) */
1355     uint8_t right_blink;       /* right eye blink degree (0, - 100) */
1356 } cam_face_blink_info_t;
1357 
1358 typedef struct {
1359     cam_face_blink_info_t blink[MAX_ROI];
1360 } cam_face_blink_data_t;
1361 
1362 typedef struct {
1363     uint8_t face_recognised;   /* if face is recognised */
1364     uint32_t unique_id;   /* if face is recognised */
1365 } cam_face_recog_info_t;
1366 
1367 typedef struct {
1368     cam_face_recog_info_t face_rec[MAX_ROI];
1369 } cam_face_recog_data_t;
1370 
1371 typedef struct {
1372     int32_t face_id;            /* unique id for face tracking within view unless view changes */
1373     int8_t score;              /* score of confidence (0, -100) */
1374     cam_rect_t face_boundary;  /* boundary of face detected */
1375 } cam_face_detection_info_t;
1376 
1377 typedef struct {
1378     uint32_t frame_id;                         /* frame index of which faces are detected */
1379     uint8_t num_faces_detected;                /* number of faces detected */
1380     cam_face_detection_info_t faces[MAX_ROI];  /* detailed information of faces detected */
1381     qcamera_face_detect_type_t fd_type;        /* face detect for preview or snapshot frame*/
1382     cam_dimension_t fd_frame_dim;              /* frame dims on which fd is applied */
1383     uint8_t update_flag;                       /* flag to inform whether HAL needs to send cb
1384                                                 * to app or not */
1385 } cam_face_detection_data_t;
1386 
1387 // definition of composite face detection data
1388 typedef struct {
1389     cam_face_detection_data_t detection_data;
1390 
1391     int8_t recog_valid;
1392     cam_face_recog_data_t recog_data;
1393 
1394     int8_t blink_valid;
1395     cam_face_blink_data_t blink_data;
1396 
1397     int8_t gaze_valid;
1398     cam_face_gaze_data_t gaze_data;
1399 
1400     int8_t smile_valid;
1401     cam_face_smile_data_t smile_data;
1402 
1403     int8_t landmark_valid;
1404     cam_face_landmarks_data_t landmark_data;
1405 
1406     int8_t contour_valid;
1407     cam_face_contour_data_t contour_data;
1408 } cam_faces_data_t;
1409 
1410 #define CAM_HISTOGRAM_STATS_SIZE 256
1411 #define MIN_CAM_HISTOGRAM_STATS_SIZE 16
1412 
1413 typedef enum {
1414   CAM_STATS_CHANNEL_Y,
1415   CAM_STATS_CHANNEL_GR,
1416   CAM_STATS_CHANNEL_GB,
1417   CAM_STATS_CHANNEL_R,
1418   CAM_STATS_CHANNEL_B,
1419   CAM_STATS_CHANNEL_ALL,
1420   CAM_STATS_CHANNEL_MAX
1421 } cam_histogram_data_type;
1422 
1423 typedef struct {
1424     uint32_t hist_buf[CAM_HISTOGRAM_STATS_SIZE]; /* buf holding histogram stats data */
1425 } cam_histogram_data_t;
1426 
1427 typedef struct {
1428     cam_histogram_data_type data_type;
1429     cam_histogram_data_t r_stats;
1430     cam_histogram_data_t b_stats;
1431     cam_histogram_data_t gr_stats;
1432     cam_histogram_data_t gb_stats;
1433 } cam_bayer_hist_stats_t;
1434 
1435 typedef enum {
1436     CAM_HISTOGRAM_TYPE_BAYER,
1437     CAM_HISTOGRAM_TYPE_YUV
1438 } cam_histogram_type_t;
1439 
1440 typedef struct {
1441     cam_histogram_type_t type;
1442     union {
1443         cam_bayer_hist_stats_t bayer_stats;
1444         cam_histogram_data_t yuv_stats;
1445     };
1446 } cam_hist_stats_t;
1447 
1448 enum cam_focus_distance_index{
1449   CAM_FOCUS_DISTANCE_NEAR_INDEX,  /* 0 */
1450   CAM_FOCUS_DISTANCE_OPTIMAL_INDEX,
1451   CAM_FOCUS_DISTANCE_FAR_INDEX,
1452   CAM_FOCUS_DISTANCE_MAX_INDEX
1453 };
1454 
1455 typedef struct {
1456   float focus_distance[CAM_FOCUS_DISTANCE_MAX_INDEX];
1457 } cam_focus_distances_info_t;
1458 
1459 typedef struct {
1460     uint32_t scale;
1461     float diopter;
1462 } cam_focus_pos_info_t ;
1463 
1464 typedef struct {
1465     float lens_shift_um;
1466     uint32_t object_distance_cm;
1467     uint32_t near_field_cm;
1468     uint32_t far_field_cm;
1469 } cam_af_focus_pos_t ;
1470 
1471 typedef struct {
1472     float focalLengthRatio;
1473 } cam_focal_length_ratio_t;
1474 
1475 typedef struct {
1476     uint8_t needFlush;
1477     uint32_t focused_frame_idx;
1478 } cam_af_flush_info_t;
1479 
1480 /* Different autofocus cycle when calling do_autoFocus
1481  * CAM_AF_COMPLETE_EXISTING_SWEEP: Complete existing sweep
1482  * if one is ongoing, and lock.
1483  * CAM_AF_DO_ONE_FULL_SWEEP: Do one full sweep, regardless
1484  * of the current state, and lock.
1485  * CAM_AF_START_CONTINUOUS_SWEEP: Start continous sweep.
1486  * After do_autoFocus, HAL receives an event: CAM_AF_FOCUSED,
1487  * or CAM_AF_NOT_FOCUSED.
1488  * cancel_autoFocus stops any lens movement.
1489  * Each do_autoFocus call only produces 1 FOCUSED/NOT_FOCUSED
1490  * event, not both.
1491  */
1492 typedef enum {
1493     CAM_AF_COMPLETE_EXISTING_SWEEP,
1494     CAM_AF_DO_ONE_FULL_SWEEP,
1495     CAM_AF_START_CONTINUOUS_SWEEP
1496 } cam_autofocus_cycle_t;
1497 
1498 typedef enum {
1499     CAM_AF_SCANNING,
1500     CAM_AF_FOCUSED,
1501     CAM_AF_NOT_FOCUSED,
1502     CAM_CAF_SCANNING,
1503     CAM_CAF_FOCUSED,
1504     CAM_CAF_NOT_FOCUSED,
1505     CAM_AF_INACTIVE
1506 } cam_autofocus_state_t;
1507 
1508 //Don't change the order of the AF states below. It should match
1509 //with the corresponding enum in frameworks (camera3.h and
1510 //CameraMetadata.java)
1511 typedef enum {
1512     CAM_AF_STATE_INACTIVE,
1513     CAM_AF_STATE_PASSIVE_SCAN,
1514     CAM_AF_STATE_PASSIVE_FOCUSED,
1515     CAM_AF_STATE_ACTIVE_SCAN,
1516     CAM_AF_STATE_FOCUSED_LOCKED,
1517     CAM_AF_STATE_NOT_FOCUSED_LOCKED,
1518     CAM_AF_STATE_PASSIVE_UNFOCUSED
1519 } cam_af_state_t;
1520 
1521 typedef struct {
1522     cam_af_state_t focus_state;           /* state of focus */
1523     cam_focus_distances_info_t focus_dist;       /* focus distance */
1524     cam_focus_mode_type focus_mode;        /* focus mode from backend */
1525     int32_t focus_pos;
1526     cam_af_flush_info_t flush_info;
1527     uint8_t isDepth;
1528     float focus_value;
1529     uint8_t spot_light_detected;
1530 } cam_auto_focus_data_t;
1531 
1532 typedef struct {
1533     uint32_t stream_id;
1534     cam_rect_t crop;
1535     cam_rect_t roi_map;
1536 } cam_stream_crop_info_t;
1537 
1538 typedef struct {
1539     float widthMargins;  /*Width margin in %*/
1540     float heightMargins; /*Height margin in %*/
1541 } cam_frame_margins_t;
1542 
1543 typedef struct {
1544     uint8_t num_of_streams;
1545     uint8_t ignore_crop; // CPP ignores the CROP in this special mode
1546     cam_stream_crop_info_t crop_info[MAX_NUM_STREAMS];
1547     cam_frame_margins_t margins; // Margins used by dual camera with spatial alignment block
1548 } cam_crop_data_t;
1549 
1550 typedef struct {
1551     uint32_t stream_id;
1552     uint32_t cds_enable;
1553 } cam_stream_cds_info_t;
1554 
1555 typedef struct {
1556     uint8_t session_cds_enable;
1557     uint8_t num_of_streams;
1558     cam_stream_cds_info_t cds_info[MAX_NUM_STREAMS];
1559 } cam_cds_data_t;
1560 
1561 typedef enum {
1562     DO_NOT_NEED_FUTURE_FRAME,
1563     NEED_FUTURE_FRAME,
1564 } cam_prep_snapshot_state_t;
1565 
1566 typedef enum {
1567     CC_RED_GAIN,
1568     CC_GREEN_RED_GAIN,
1569     CC_GREEN_BLUE_GAIN,
1570     CC_BLUE_GAIN,
1571     CC_GAIN_MAX
1572 } cam_cc_gains_type_t;
1573 
1574 typedef struct {
1575     float gains[CC_GAIN_MAX];
1576 } cam_color_correct_gains_t;
1577 
1578 typedef struct {
1579     // If LED is ON and Burst Num > 1, this is first LED ON frame
1580     uint32_t min_frame_idx;
1581     // If LED is ON and Burst Num > 1, this is first LED Off frame after ON
1582     uint32_t max_frame_idx;
1583     // Used only when LED Is ON and burst num > 1
1584     uint32_t num_led_on_frames;
1585     // Skip count after LED is turned OFF
1586     uint32_t frame_skip_count;
1587     // Batch id for each picture request
1588     uint32_t config_batch_idx;
1589 } cam_frame_idx_range_t;
1590 
1591 typedef enum {
1592   S_NORMAL = 0,
1593   S_SCENERY,
1594   S_PORTRAIT,
1595   S_PORTRAIT_BACKLIGHT,
1596   S_SCENERY_BACKLIGHT,
1597   S_BACKLIGHT,
1598   S_HDR,
1599   S_MAX_DEFAULT,
1600   S_CUSTOM0 = S_MAX_DEFAULT,
1601   S_CUSTOM1,
1602   S_CUSTOM2,
1603   S_CUSTOM3,
1604   S_CUSTOM4,
1605   S_CUSTOM5,
1606   S_CUSTOM6,
1607   S_CUSTOM7,
1608   S_CUSTOM8,
1609   S_CUSTOM9,
1610   S_MAX,
1611 } cam_auto_scene_t;
1612 
1613 typedef struct {
1614   uint32_t is_hdr_scene;
1615   float    hdr_confidence;
1616 } cam_asd_hdr_scene_data_t;
1617 
1618 typedef struct {
1619   uint32_t          detected;
1620   float             confidence;
1621   uint32_t          auto_compensation;
1622 } cam_asd_scene_info_t;
1623 
1624 typedef struct {
1625   cam_auto_scene_t      detected_scene;
1626   uint8_t               max_n_scenes;
1627   cam_asd_scene_info_t  scene_info[S_MAX];
1628 } cam_asd_decision_t;
1629 
1630 
1631 typedef struct {
1632    uint32_t meta_frame_id;
1633 } cam_meta_valid_t;
1634 
1635 typedef enum {
1636     CAM_SENSOR_RAW,
1637     CAM_SENSOR_YUV,
1638     CAM_SENSOR_MONO
1639 } cam_sensor_t;
1640 
1641 typedef struct {
1642     cam_flash_mode_t flash_mode;
1643     float            aperture_value;
1644     cam_flash_state_t        flash_state;
1645     float            focal_length;
1646     float            f_number;
1647     int32_t          sensing_method;
1648     float            crop_factor;
1649     cam_sensor_t sens_type;
1650 } cam_sensor_params_t;
1651 
1652 typedef enum {
1653     CAM_METERING_MODE_UNKNOWN = 0,
1654     CAM_METERING_MODE_AVERAGE = 1,
1655     CAM_METERING_MODE_CENTER_WEIGHTED_AVERAGE = 2,
1656     CAM_METERING_MODE_SPOT = 3,
1657     CAM_METERING_MODE_MULTI_SPOT = 4,
1658     CAM_METERING_MODE_PATTERN = 5,
1659     CAM_METERING_MODE_PARTIAL = 6,
1660     CAM_METERING_MODE_OTHER = 255,
1661 } cam_metering_mode_t;
1662 
1663 typedef struct {
1664     float exp_time;
1665     int32_t iso_value;
1666     uint32_t flash_needed;
1667     uint32_t settled;
1668     cam_wb_mode_type wb_mode;
1669     uint32_t metering_mode;
1670     uint32_t exposure_program;
1671     uint32_t exposure_mode;
1672     uint32_t scenetype;
1673     float brightness;
1674     float est_snap_exp_time;
1675     int32_t est_snap_iso_value;
1676     uint32_t est_snap_luma;
1677     uint32_t est_snap_target;
1678 } cam_3a_params_t;
1679 
1680 typedef struct {
1681     uint64_t sw_version_number;
1682     int32_t aec_debug_data_size;
1683     char aec_private_debug_data[AEC_DEBUG_DATA_SIZE];
1684 } cam_ae_exif_debug_t;
1685 
1686 typedef struct {
1687     int8_t awb_ccm_enable;
1688     int8_t hard_awb_ccm_flag;
1689     int8_t ccm_update_flag;
1690     float  ccm[AWB_NUM_CCM_ROWS][AWB_NUM_CCM_COLS];
1691     float  ccm_offset[AWB_NUM_CCM_ROWS];
1692 } cam_awb_ccm_update_t;
1693 
1694 typedef struct {
1695     int32_t cct_value;
1696     cam_awb_gain_t rgb_gains;
1697     cam_awb_ccm_update_t ccm_update;
1698 } cam_awb_params_t;
1699 
1700 typedef struct {
1701     int32_t awb_debug_data_size;
1702     char awb_private_debug_data[AWB_DEBUG_DATA_SIZE];
1703 } cam_awb_exif_debug_t;
1704 
1705 /* AF debug data for exif*/
1706 typedef struct {
1707     int32_t af_debug_data_size;
1708     char af_private_debug_data[AF_DEBUG_DATA_SIZE];
1709 } cam_af_exif_debug_t;
1710 
1711 typedef struct {
1712     int32_t asd_debug_data_size;
1713     char asd_private_debug_data[ASD_DEBUG_DATA_SIZE];
1714 } cam_asd_exif_debug_t;
1715 
1716 typedef struct {
1717     int32_t bg_stats_buffer_size;
1718     int32_t bg_config_buffer_size;
1719     char stats_buffer_private_debug_data[STATS_BUFFER_DEBUG_DATA_SIZE];
1720 } cam_stats_buffer_exif_debug_t;
1721 
1722 typedef struct {
1723     int32_t be_stats_buffer_size;
1724     int32_t be_config_buffer_size;
1725     char bestats_buffer_private_debug_data[BESTATS_BUFFER_DEBUG_DATA_SIZE];
1726 } cam_bestats_buffer_exif_debug_t;
1727 
1728 typedef struct {
1729     int32_t bhist_stats_buffer_size;
1730     char bhist_private_debug_data[BHIST_STATS_DEBUG_DATA_SIZE];
1731 } cam_bhist_buffer_exif_debug_t;
1732 
1733 /* 3A version*/
1734 typedef struct {
1735     uint16_t major_version;
1736     uint16_t minor_version;
1737     uint16_t patch_version;
1738     uint16_t new_feature_des;
1739 } cam_q3a_version_t;
1740 
1741 typedef struct {
1742     int32_t tuning_info_buffer_size;
1743     char tuning_info_private_debug_data[TUNING_INFO_DEBUG_DATA_SIZE];
1744 } cam_q3a_tuning_info_t;
1745 
1746 typedef struct {
1747     uint32_t tuning_data_version;
1748     size_t tuning_sensor_data_size;
1749     size_t tuning_vfe_data_size;
1750     size_t tuning_mod1_stats_data_size; //Stats data
1751     size_t tuning_cpp_data_size;
1752     size_t tuning_cac_data_size;
1753     size_t tuning_cac_data_size2;
1754     size_t tuning_mod3_data_size;
1755     uint8_t  data[TUNING_DATA_MAX];
1756 }tuning_params_t;
1757 
1758 typedef struct {
1759     int32_t event_type;
1760     cam_dimension_t dim;
1761     size_t size;
1762     char path[QCAMERA_MAX_FILEPATH_LENGTH];
1763     cam_format_t picture_format;
1764 } cam_int_evt_params_t;
1765 
1766 typedef struct {
1767   uint8_t private_isp_data[MAX_ISP_DATA_SIZE];
1768 } cam_chromatix_lite_isp_t;
1769 
1770 typedef struct {
1771   uint8_t private_pp_data[MAX_PP_DATA_SIZE];
1772 } cam_chromatix_lite_pp_t;
1773 
1774 typedef struct {
1775   uint8_t private_stats_data[MAX_AE_STATS_DATA_SIZE];
1776 } cam_chromatix_lite_ae_stats_t;
1777 
1778 typedef struct {
1779   uint8_t private_stats_data[MAX_AWB_STATS_DATA_SIZE];
1780 } cam_chromatix_lite_awb_stats_t;
1781 
1782 typedef struct {
1783   uint8_t private_stats_data[MAX_AF_STATS_DATA_SIZE];
1784 } cam_chromatix_lite_af_stats_t;
1785 
1786 typedef struct {
1787   uint8_t private_stats_data[MAX_ASD_STATS_DATA_SIZE];
1788 } cam_chromatix_lite_asd_stats_t;
1789 
1790 typedef struct {
1791    uint32_t min_buffers;
1792    uint32_t max_buffers;
1793 } cam_buffer_info_t;
1794 
1795 typedef struct {
1796     uint32_t frame_id;
1797     size_t length;
1798     uint8_t *depth_data;
1799 } cam_depth_data_t;
1800 
1801 typedef enum {
1802     /* cmd to bundle cameras*/
1803     CAM_DUAL_CAMERA_BUNDLE_INFO,
1804     /*cmd to suspend or resume cameras*/
1805     CAM_DUAL_CAMERA_LOW_POWER_MODE,
1806     /*cmd to send information about role switch*/
1807     CAM_DUAL_CAMERA_MASTER_INFO,
1808     /*Command to Defer dual camera session*/
1809     CAM_DUAL_CAMERA_DEFER_INFO,
1810 } cam_dual_camera_cmd_type;
1811 
1812 typedef enum {
1813     /* Standalone camera (won't be linked) */
1814     CAM_TYPE_STANDALONE=0,
1815 
1816     /* Main camera of the related cam subsystem which controls
1817        HW sync at sensor level*/
1818     CAM_TYPE_MAIN = (1 << 0),
1819 
1820     /* Aux camera of the related cam subsystem */
1821     CAM_TYPE_AUX = (1 << 1),
1822 
1823     /*Secure camera. Is not published*/
1824     CAM_TYPE_SECURE = (1 << 2),
1825 } cam_sync_type_t;
1826 
1827 typedef enum {
1828     CAM_3A_SYNC_NONE,     /* Default for single camera, not link */
1829     CAM_3A_SYNC_FOLLOW,   /* Master->Slave: Master updates slave */
1830     CAM_3A_SYNC_ALGO_CTRL,/* Algorithm updated cameras directly */
1831 } cam_3a_sync_mode_t;
1832 
1833 typedef struct {
1834     cam_dimension_t stream_sizes[MAX_NUM_STREAMS];
1835     uint32_t num_streams;
1836     cam_stream_type_t type[MAX_NUM_STREAMS];
1837     cam_feature_mask_t postprocess_mask[MAX_NUM_STREAMS];
1838     cam_buffer_info_t buffer_info;
1839     cam_is_type_t is_type[MAX_NUM_STREAMS];
1840     cam_hfr_mode_t hfr_mode;
1841     cam_format_t format[MAX_NUM_STREAMS];
1842     cam_rotation_t rotation[MAX_NUM_STREAMS];
1843     uint32_t buf_alignment;
1844     uint32_t min_stride;
1845     uint32_t min_scanline;
1846     uint8_t batch_size;
1847     cam_sync_type_t sync_type;
1848     uint32_t dt[MAX_NUM_STREAMS];
1849     uint32_t vc[MAX_NUM_STREAMS];
1850     cam_sub_format_type_t sub_format_type[MAX_NUM_STREAMS];
1851     cam_frame_margins_t margins[MAX_NUM_STREAMS];
1852     cam_dimension_t stream_sz_plus_margin[MAX_NUM_STREAMS]; /*stream sizes + margin*/
1853     uint8_t is_secure;
1854 } cam_stream_size_info_t;
1855 
1856 typedef enum {
1857     CAM_INTF_OVERWRITE_MINI_CHROMATIX_OFFLINE,
1858     CAM_INTF_OVERWRITE_ISP_HW_DATA_OFFLINE,
1859     CAM_INTF_OVERWRITE_MINI_CHROMATIX_ONLINE,
1860     CAM_INTF_OVERWRITE_ISP_HW_DATA_ONLINE,
1861     CAM_INTF_OVERWRITE_MAX,
1862 } cam_intf_overwrite_type_t;
1863 
1864 typedef struct {
1865   uint8_t lds_enabled;
1866   float rnr_sampling_factor;
1867 } cam_img_hysterisis_info_t;
1868 
1869 typedef struct {
1870   /* dynamic feature enablement */
1871   uint64_t dyn_feature_mask;
1872   /* input frame count for stacking */
1873   uint32_t input_count;
1874   /* reserved for future use */
1875   uint8_t  reserved[32];
1876 } cam_dyn_img_data_t;
1877 
1878 typedef struct {
1879   cam_intf_overwrite_type_t overwrite_type;
1880   char isp_hw_data_list[4096];     /*add upper bound memory, customer to fill*/
1881   char chromatix_data_overwrite[4096]; /*add bound memory, customer fill*/
1882 } cam_hw_data_overwrite_t;
1883 
1884 typedef struct {
1885     uint32_t streamID;
1886     uint32_t buf_index;
1887 } cam_stream_request_t;
1888 
1889 typedef struct {
1890     uint32_t num_streams;
1891     cam_stream_request_t stream_request[MAX_NUM_STREAMS];
1892 } cam_stream_ID_t;
1893 
1894 /*CAC Message posted during pipeline*/
1895 typedef struct {
1896     uint32_t frame_id;
1897     int32_t buf_idx;
1898 } cam_cac_info_t;
1899 
1900 typedef struct
1901 {
1902   uint32_t id;            /* Frame ID */
1903   uint64_t timestamp;    /* Time stamp */
1904   uint32_t distance_in_mm; /* Distance of object in ROI's in milimeters */
1905   uint32_t confidence;     /* Confidence on distance from 0(No confidence)to 1024(max) */
1906   uint32_t status;        /* Status of DCRF library execution call */
1907   cam_rect_t focused_roi; /* ROI's for which distance is estimated */
1908   uint32_t focused_x;     /* Focus location X inside ROI with distance estimation */
1909   uint32_t focused_y;     /* Focus location Y inside ROI with distance estimation */
1910 } cam_dcrf_result_t;
1911 
1912 typedef struct {
1913     uint32_t frame_id;
1914     uint32_t num_streams;
1915     uint32_t stream_id[MAX_NUM_STREAMS];
1916 } cam_buf_divert_info_t;
1917 
1918 typedef enum {
1919     CAM_SPATIAL_ALIGN_QTI  = 1 << 0,
1920     CAM_SPATIAL_ALIGN_OEM  = 1 << 1
1921 } cam_spatial_align_type_t;
1922 
1923 typedef struct {
1924     int32_t shift_horz;
1925     int32_t shift_vert;
1926 } cam_sac_output_shift_t;
1927 
1928 typedef struct {
1929     uint8_t                is_master_hint_valid;
1930     uint8_t                master_hint;
1931     uint8_t                is_master_preview_valid;
1932     uint8_t                master_preview;
1933     uint8_t                is_master_3A_valid;
1934     uint8_t                master_3A;
1935     uint8_t                is_ready_status_valid;
1936     uint8_t                ready_status;
1937     uint8_t                is_output_shift_valid;
1938     cam_sac_output_shift_t output_shift;
1939     cam_dimension_t        reference_res_for_output_shift;
1940     uint8_t                is_focus_roi_shift_valid;
1941     cam_sac_output_shift_t focus_roi_shift;
1942     cam_dimension_t        reference_res_for_focus_roi_shift;
1943 } cam_sac_output_info_t;
1944 
1945 
1946 typedef  struct {
1947     uint8_t is_stats_valid;               /* if histgram data is valid */
1948     cam_hist_stats_t stats_data;          /* histogram data */
1949 
1950     uint8_t is_faces_valid;               /* if face detection data is valid */
1951     cam_face_detection_data_t faces_data; /* face detection result */
1952 
1953     uint8_t is_focus_valid;               /* if focus data is valid */
1954     cam_auto_focus_data_t focus_data;     /* focus data */
1955 
1956     uint8_t is_crop_valid;                /* if crop data is valid */
1957     cam_crop_data_t crop_data;            /* crop data */
1958 
1959     uint8_t is_prep_snapshot_done_valid;  /* if prep snapshot done is valid */
1960     cam_prep_snapshot_state_t prep_snapshot_done_state;  /* prepare snapshot done state */
1961 
1962     uint8_t is_cac_valid;                 /* if cac info is valid */
1963     cam_cac_info_t cac_info;              /* cac info */
1964 
1965     /* Hysterisis data from Img modules */
1966     uint8_t is_hyst_info_valid;           /* if hyst info is valid */
1967     cam_img_hysterisis_info_t img_hyst_info; /* hyst info */
1968 
1969     /* if good frame idx range is valid */
1970     uint8_t is_good_frame_idx_range_valid;
1971     /* good frame idx range, make sure:
1972      * 1. good_frame_idx_range.min_frame_idx > current_frame_idx
1973      * 2. good_frame_idx_range.min_frame_idx - current_frame_idx < 100 */
1974     cam_frame_idx_range_t good_frame_idx_range;
1975 
1976     cam_asd_decision_t cam_asd_info;
1977 
1978     char private_metadata[MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES];
1979 
1980     /* AE parameters */
1981     uint8_t is_3a_params_valid;
1982     cam_3a_params_t cam_3a_params;
1983 
1984     /* AE exif debug parameters */
1985     uint8_t is_ae_exif_debug_valid;
1986     cam_ae_exif_debug_t ae_exif_debug_params;
1987 
1988     /* AWB exif debug parameters */
1989     uint8_t is_awb_exif_debug_valid;
1990     cam_awb_exif_debug_t awb_exif_debug_params;
1991 
1992     /* AF exif debug parameters */
1993     uint8_t is_af_exif_debug_valid;
1994     cam_af_exif_debug_t af_exif_debug_params;
1995 
1996     /* ASD exif debug parameters */
1997     uint8_t is_asd_exif_debug_valid;
1998     cam_asd_exif_debug_t asd_exif_debug_params;
1999 
2000     /* Stats buffer exif debug parameters */
2001     uint8_t is_stats_buffer_exif_debug_valid;
2002     cam_stats_buffer_exif_debug_t stats_buffer_exif_debug_params;
2003 
2004     /* BE stats buffer exif debug parameters */
2005     uint8_t is_bestats_buffer_exif_debug_valid;
2006     cam_bestats_buffer_exif_debug_t bestats_buffer_exif_debug_params;
2007 
2008     /* Bhist exif debug parameters. */
2009     uint8_t is_bhist_exif_debug_valid;
2010     cam_bhist_buffer_exif_debug_t bhist_exif_debug_params;
2011 
2012     /* AWB parameters */
2013     uint8_t is_awb_params_valid;
2014     cam_awb_params_t awb_params;
2015 
2016     /* sensor parameters */
2017     uint8_t is_sensor_params_valid;
2018     cam_sensor_params_t sensor_params;
2019 
2020     /* Meta valid params */
2021     uint8_t is_meta_valid;
2022     cam_meta_valid_t meta_valid_params;
2023 
2024     /*Tuning Data*/
2025     uint8_t is_tuning_params_valid;
2026     tuning_params_t tuning_params;
2027 
2028     uint8_t is_chromatix_lite_isp_valid;
2029     cam_chromatix_lite_isp_t chromatix_lite_isp_data;
2030 
2031     uint8_t is_chromatix_lite_pp_valid;
2032     cam_chromatix_lite_pp_t chromatix_lite_pp_data;
2033 
2034     uint8_t is_chromatix_lite_ae_stats_valid;
2035     cam_chromatix_lite_ae_stats_t chromatix_lite_ae_stats_data;
2036 
2037     uint8_t is_chromatix_lite_awb_stats_valid;
2038     cam_chromatix_lite_awb_stats_t chromatix_lite_awb_stats_data;
2039 
2040     uint8_t is_chromatix_lite_af_stats_valid;
2041     cam_chromatix_lite_af_stats_t chromatix_lite_af_stats_data;
2042 
2043     uint8_t is_dcrf_result_valid;
2044     cam_dcrf_result_t dcrf_result;
2045 
2046     /* Dynamic feature enablement from postprocessing modules */
2047     uint8_t is_dyn_img_data_valid;
2048     cam_dyn_img_data_t dyn_img_data;
2049 
2050 } cam_metadata_info_t;
2051 
2052 typedef enum {
2053     CAM_INTF_PARM_HAL_VERSION = 0x1,
2054 
2055     /* Overall mode of 3A control routines. We need to have this parameter
2056      * because not all android.control.* have an OFF option, for example,
2057      * AE_FPS_Range, aePrecaptureTrigger */
2058     CAM_INTF_META_MODE,
2059     /* Whether AE is currently updating the sensor exposure and sensitivity
2060      * fields */
2061     CAM_INTF_META_AEC_MODE,
2062     CAM_INTF_PARM_WHITE_BALANCE,
2063     CAM_INTF_PARM_FOCUS_MODE,
2064 
2065     /* common between HAL1 and HAL3 */
2066     CAM_INTF_PARM_ANTIBANDING,
2067     CAM_INTF_PARM_EXPOSURE_COMPENSATION,
2068     CAM_INTF_PARM_EV_STEP,
2069     CAM_INTF_PARM_AEC_LOCK,
2070     CAM_INTF_PARM_FPS_RANGE, /* 10 */
2071     CAM_INTF_PARM_AWB_LOCK,
2072     CAM_INTF_PARM_EFFECT,
2073     CAM_INTF_PARM_BESTSHOT_MODE,
2074     CAM_INTF_PARM_DIS_ENABLE,
2075     CAM_INTF_PARM_LED_MODE,
2076     CAM_INTF_META_HISTOGRAM,
2077     CAM_INTF_META_FACE_DETECTION,
2078     /* Whether optical image stabilization is enabled. */
2079     CAM_INTF_META_LENS_OPT_STAB_MODE,
2080     /* specific to HAl1 */
2081     CAM_INTF_META_AUTOFOCUS_DATA,
2082     CAM_INTF_PARM_QUERY_FLASH4SNAP, /* 20 */
2083     CAM_INTF_PARM_EXPOSURE,
2084     CAM_INTF_PARM_SHARPNESS,
2085     CAM_INTF_PARM_CONTRAST,
2086     CAM_INTF_PARM_SATURATION,
2087     CAM_INTF_PARM_BRIGHTNESS,
2088     CAM_INTF_PARM_ISO,
2089     CAM_INTF_PARM_ZOOM,
2090     CAM_INTF_PARM_ROLLOFF,
2091     CAM_INTF_PARM_MODE,             /* camera mode */
2092     CAM_INTF_PARM_AEC_ALGO_TYPE, /* 30 */ /* auto exposure algorithm */
2093     CAM_INTF_PARM_FOCUS_ALGO_TYPE,  /* focus algorithm */
2094     CAM_INTF_PARM_AEC_ROI,
2095     CAM_INTF_PARM_AF_ROI,
2096     CAM_INTF_PARM_SCE_FACTOR,
2097     CAM_INTF_PARM_FD,
2098     CAM_INTF_PARM_MCE,
2099     CAM_INTF_PARM_HFR,
2100     CAM_INTF_PARM_REDEYE_REDUCTION,
2101     CAM_INTF_PARM_WAVELET_DENOISE,
2102     CAM_INTF_PARM_TEMPORAL_DENOISE, /* 40 */
2103     CAM_INTF_PARM_HISTOGRAM,
2104     CAM_INTF_PARM_ASD_ENABLE,
2105     CAM_INTF_PARM_RECORDING_HINT,
2106     CAM_INTF_PARM_HDR,
2107     CAM_INTF_PARM_MAX_DIMENSION,
2108     CAM_INTF_PARM_SENSOR_MODE_INFO,
2109     CAM_INTF_PARM_CURRENT_SENSOR_MODE_INFO,
2110     CAM_INTF_PARM_FRAMESKIP,
2111     CAM_INTF_PARM_ZSL_MODE,  /* indicating if it's running in ZSL mode */
2112     CAM_INTF_PARM_BURST_NUM,
2113     CAM_INTF_PARM_RETRO_BURST_NUM, /* 50 */
2114     CAM_INTF_PARM_BURST_LED_ON_PERIOD,
2115     CAM_INTF_PARM_HDR_NEED_1X, /* if HDR needs 1x output */
2116     CAM_INTF_PARM_LOCK_CAF,
2117     CAM_INTF_PARM_VIDEO_HDR,
2118     CAM_INTF_PARM_SENSOR_HDR,
2119     CAM_INTF_PARM_ROTATION,
2120     CAM_INTF_PARM_SCALE,
2121     CAM_INTF_PARM_VT, /* indicating if it's a Video Call Apllication */
2122     CAM_INTF_META_CROP_DATA,
2123     CAM_INTF_META_PREP_SNAPSHOT_DONE, /* 60 */
2124     CAM_INTF_META_GOOD_FRAME_IDX_RANGE,
2125     CAM_INTF_META_ASD_HDR_SCENE_DATA,
2126     CAM_INTF_META_ASD_SCENE_INFO,
2127     CAM_INTF_META_CURRENT_SCENE,
2128     CAM_INTF_META_AEC_INFO,
2129     CAM_INTF_META_SENSOR_INFO,
2130     CAM_INTF_META_CHROMATIX_LITE_ISP,
2131     CAM_INTF_META_CHROMATIX_LITE_PP,
2132     CAM_INTF_META_CHROMATIX_LITE_AE,
2133     CAM_INTF_META_CHROMATIX_LITE_AWB, /* 70 */
2134     CAM_INTF_META_CHROMATIX_LITE_AF,
2135     CAM_INTF_META_CHROMATIX_LITE_ASD,
2136     CAM_INTF_META_EXIF_DEBUG_AE,
2137     CAM_INTF_META_EXIF_DEBUG_AWB,
2138     CAM_INTF_META_EXIF_DEBUG_AF,
2139     CAM_INTF_META_EXIF_DEBUG_ASD,
2140     CAM_INTF_META_EXIF_DEBUG_STATS,
2141     CAM_INTF_META_EXIF_DEBUG_BESTATS,
2142     CAM_INTF_META_EXIF_DEBUG_BHIST,
2143     CAM_INTF_META_EXIF_DEBUG_3A_TUNING,
2144     CAM_INTF_PARM_GET_CHROMATIX,
2145     CAM_INTF_PARM_SET_RELOAD_CHROMATIX,
2146     CAM_INTF_PARM_SET_AUTOFOCUSTUNING, /* 80 */
2147     CAM_INTF_PARM_GET_AFTUNE,
2148     CAM_INTF_PARM_SET_RELOAD_AFTUNE,
2149     CAM_INTF_PARM_SET_VFE_COMMAND,
2150     CAM_INTF_PARM_SET_PP_COMMAND,
2151     CAM_INTF_PARM_TINTLESS,
2152     CAM_INTF_PARM_LONGSHOT_ENABLE,
2153     CAM_INTF_PARM_RDI_MODE,
2154     CAM_INTF_PARM_CDS_MODE,
2155     CAM_INTF_PARM_TONE_MAP_MODE,
2156     CAM_INTF_PARM_CAPTURE_FRAME_CONFIG, /* 90 */
2157     CAM_INTF_PARM_DUAL_LED_CALIBRATION,
2158     CAM_INTF_PARM_ADV_CAPTURE_MODE,
2159 
2160     /* stream based parameters */
2161     CAM_INTF_PARM_DO_REPROCESS,
2162     CAM_INTF_PARM_SET_BUNDLE,
2163     CAM_INTF_PARM_STREAM_FLIP,
2164     CAM_INTF_PARM_GET_OUTPUT_CROP,
2165 
2166     CAM_INTF_PARM_EZTUNE_CMD,
2167     CAM_INTF_PARM_INT_EVT,
2168 
2169     /* specific to HAL3 */
2170     /* Whether the metadata maps to a valid frame number */
2171     CAM_INTF_META_FRAME_NUMBER_VALID,
2172     /* Whether the urgent metadata maps to a valid frame number */
2173     CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,
2174     /* Whether the stream buffer corresponding this frame is dropped or not */
2175     CAM_INTF_META_FRAME_DROPPED, /* 100 */
2176     /* COLOR CORRECTION.*/
2177     CAM_INTF_META_COLOR_CORRECT_MODE,
2178     /* A transform matrix to chromatically adapt pixels in the CIE XYZ (1931)
2179      * color space from the scene illuminant to the sRGB-standard D65-illuminant. */
2180     CAM_INTF_META_COLOR_CORRECT_TRANSFORM,
2181     /*Color channel gains in the Bayer raw domain in the order [RGeGoB]*/
2182     CAM_INTF_META_COLOR_CORRECT_GAINS,
2183     /*The best fit color transform matrix calculated by the stats*/
2184     CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM,
2185     /*The best fit color channels gains calculated by the stats*/
2186     CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,
2187     /* CONTROL */
2188     /* A frame counter set by the framework. Must be maintained unchanged in
2189      * output frame. */
2190     CAM_INTF_META_FRAME_NUMBER,
2191     /* A frame counter set by the framework. Must be maintained unchanged in
2192      * output frame. */
2193     CAM_INTF_META_URGENT_FRAME_NUMBER,
2194     /* Choose sensor mode which has Full FOV when multiple modes satisfy the
2195      * other requirements. MUST be defined before CAM_INTF_META_STREAM_INFO */
2196     CAM_INTF_META_SENSOR_MODE_FULLFOV,
2197     /*Number of streams and size of streams in current configuration*/
2198     CAM_INTF_META_STREAM_INFO,
2199     /* List of areas to use for metering */
2200     CAM_INTF_META_AEC_ROI,
2201     /* Whether the HAL must trigger precapture metering.*/
2202     CAM_INTF_META_AEC_PRECAPTURE_TRIGGER, /* 110 */
2203     /* The ID sent with the latest CAMERA2_TRIGGER_PRECAPTURE_METERING call */
2204     /* Current state of AE algorithm */
2205     CAM_INTF_META_AEC_STATE,
2206     /* Tracking AF trigger. This has to be before AF_ROI so that the behavior of
2207      * AF_ROI depends on TRACKING_AF_TRIGGER.*/
2208     CAM_INTF_META_TRACKING_AF_TRIGGER,
2209     /* List of areas to use for focus estimation */
2210     CAM_INTF_META_AF_ROI,
2211     /* Default ROI of the camera to be sent to FOV control*/
2212     CAM_INTF_META_AF_DEFAULT_ROI,
2213     /* Whether the HAL must trigger autofocus. */
2214     CAM_INTF_META_AF_TRIGGER,
2215     /* Current state of AF algorithm */
2216     CAM_INTF_META_AF_STATE,
2217     /* List of areas to use for illuminant estimation */
2218     CAM_INTF_META_AWB_REGIONS,
2219     /* Current state of AWB algorithm */
2220     CAM_INTF_META_AWB_STATE,
2221     /*Whether black level compensation is frozen or free to vary*/
2222     CAM_INTF_META_BLACK_LEVEL_LOCK,
2223     /* Information to 3A routines about the purpose of this capture, to help
2224      * decide optimal 3A strategy */
2225     CAM_INTF_META_CAPTURE_INTENT,
2226     /* DEMOSAIC */
2227     /* Controls the quality of the demosaicing processing */
2228     CAM_INTF_META_DEMOSAIC,
2229     /* EDGE */
2230     /* Operation mode for edge enhancement */
2231     CAM_INTF_META_EDGE_MODE, /* 120 */
2232     /* Control the amount of edge enhancement applied to the images.*/
2233     /* 1-10; 10 is maximum sharpening */
2234     CAM_INTF_META_SHARPNESS_STRENGTH,
2235     /* FLASH */
2236     /* Power for flash firing/torch, 10 is max power; 0 is no flash. Linear */
2237     CAM_INTF_META_FLASH_POWER,
2238     /* Firing time of flash relative to start of exposure, in nanoseconds*/
2239     CAM_INTF_META_FLASH_FIRING_TIME,
2240     /* Current state of the flash unit */
2241     CAM_INTF_META_FLASH_STATE,
2242     /* GEOMETRIC */
2243     /* Operating mode of geometric correction */
2244     CAM_INTF_META_GEOMETRIC_MODE,
2245     /* Control the amount of shading correction applied to the images */
2246     CAM_INTF_META_GEOMETRIC_STRENGTH,
2247     /* HOT PIXEL */
2248     /* Set operational mode for hot pixel correction */
2249     CAM_INTF_META_HOTPIXEL_MODE,
2250     /* LENS */
2251     /* Size of the lens aperture */
2252     CAM_INTF_META_LENS_APERTURE,
2253     /* State of lens neutral density filter(s) */
2254     CAM_INTF_META_LENS_FILTERDENSITY,
2255     /* Lens optical zoom setting */
2256     CAM_INTF_META_LENS_FOCAL_LENGTH, /* 130 */
2257     /* Distance to plane of sharpest focus, measured from frontmost surface
2258      * of the lens */
2259     CAM_INTF_META_LENS_FOCUS_DISTANCE,
2260     /* The range of scene distances that are in sharp focus (depth of field) */
2261     CAM_INTF_META_LENS_FOCUS_RANGE,
2262     /*Whether the hal needs to output the lens shading map*/
2263     CAM_INTF_META_LENS_SHADING_MAP_MODE,
2264     /* Current lens status */
2265     CAM_INTF_META_LENS_STATE,
2266     /* NOISE REDUCTION */
2267     /* Mode of operation for the noise reduction algorithm */
2268     CAM_INTF_META_NOISE_REDUCTION_MODE,
2269    /* Control the amount of noise reduction applied to the images.
2270     * 1-10; 10 is max noise reduction */
2271     CAM_INTF_META_NOISE_REDUCTION_STRENGTH,
2272     /* SCALER */
2273     /* Top-left corner and width of the output region to select from the active
2274      * pixel array */
2275     CAM_INTF_META_SCALER_CROP_REGION,
2276     /* The estimated scene illumination lighting frequency */
2277     CAM_INTF_META_SCENE_FLICKER,
2278     /* SENSOR */
2279     /* Duration each pixel is exposed to light, in nanoseconds */
2280     CAM_INTF_META_SENSOR_EXPOSURE_TIME,
2281     /* Duration from start of frame exposure to start of next frame exposure,
2282      * in nanoseconds */
2283     CAM_INTF_META_SENSOR_FRAME_DURATION, /* 140 */
2284     /* Gain applied to image data. Must be implemented through analog gain only
2285      * if set to values below 'maximum analog sensitivity'. */
2286     CAM_INTF_META_SENSOR_SENSITIVITY,
2287     /* Time at start of exposure of first row */
2288     CAM_INTF_META_SENSOR_TIMESTAMP,
2289     /* Time at start of exposure of first row, AV timestamp */
2290     CAM_INTF_META_SENSOR_TIMESTAMP_AV,
2291     /* Duration b/w start of first row exposure and the start of last
2292        row exposure in nanoseconds */
2293     CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW,
2294     /* SHADING */
2295     /* Quality of lens shading correction applied to the image data */
2296     CAM_INTF_META_SHADING_MODE,
2297     /* Control the amount of shading correction applied to the images.
2298      * unitless: 1-10; 10 is full shading compensation */
2299     CAM_INTF_META_SHADING_STRENGTH,
2300     /* STATISTICS */
2301     /* State of the face detector unit */
2302     CAM_INTF_META_STATS_FACEDETECT_MODE,
2303     /* Operating mode for histogram generation */
2304     CAM_INTF_META_STATS_HISTOGRAM_MODE,
2305     /* Operating mode for sharpness map generation */
2306     CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,
2307     /* A 3-channel sharpness map, based on the raw sensor data,
2308      * If only a monochrome sharpness map is supported, all channels
2309      * should have the same data
2310      */
2311     CAM_INTF_META_STATS_SHARPNESS_MAP,
2312 
2313     /* TONEMAP */
2314     /* Tone map mode */
2315     CAM_INTF_META_TONEMAP_MODE, /* 150 */
2316     /* Table mapping RGB input values to output values */
2317     CAM_INTF_META_TONEMAP_CURVES,
2318 
2319     CAM_INTF_META_FLASH_MODE,
2320     /* 2D array of gain factors for each color channel that was used to
2321      * compensate for lens shading for this frame */
2322     CAM_INTF_META_LENS_SHADING_MAP,
2323     CAM_INTF_META_PRIVATE_DATA,
2324     CAM_INTF_PARM_STATS_DEBUG_MASK,
2325     CAM_INTF_PARM_STATS_AF_PAAF,
2326     /* Indicates streams ID of all the requested buffers */
2327     CAM_INTF_META_STREAM_ID,
2328     CAM_INTF_PARM_FOCUS_BRACKETING,
2329     CAM_INTF_PARM_FLASH_BRACKETING,
2330     CAM_INTF_PARM_GET_IMG_PROP, /* 160 */
2331     CAM_INTF_META_JPEG_GPS_COORDINATES,
2332     CAM_INTF_META_JPEG_GPS_PROC_METHODS,
2333     CAM_INTF_META_JPEG_GPS_TIMESTAMP,
2334     CAM_INTF_META_JPEG_ORIENTATION,
2335     CAM_INTF_META_JPEG_QUALITY,
2336     CAM_INTF_META_JPEG_THUMB_QUALITY,
2337     CAM_INTF_META_JPEG_THUMB_SIZE,
2338 
2339     CAM_INTF_META_TEST_PATTERN_DATA,
2340     /* DNG file support */
2341     CAM_INTF_META_PROFILE_TONE_CURVE,
2342     CAM_INTF_META_NEUTRAL_COL_POINT, /* 170 */
2343 
2344     /* CAC */
2345     CAM_INTF_META_CAC_INFO,
2346     CAM_INTF_PARM_CAC,
2347     CAM_INTF_META_IMG_HYST_INFO,
2348 
2349     /* trigger for all modules to read the debug/log level properties */
2350     CAM_INTF_PARM_UPDATE_DEBUG_LEVEL,
2351 
2352     /* OTP : WB gr/gb */
2353     CAM_INTF_META_OTP_WB_GRGB,
2354     /* LED override for EZTUNE */
2355     CAM_INTF_META_LED_MODE_OVERRIDE,
2356     /* auto lens position info */
2357     CAM_INTF_META_FOCUS_POSITION,
2358     /* Manual exposure time */
2359     CAM_INTF_PARM_EXPOSURE_TIME,
2360     /* AWB meta data info */
2361     CAM_INTF_META_AWB_INFO,
2362     /* Manual lens position info */
2363     CAM_INTF_PARM_MANUAL_FOCUS_POS, /* 180 */
2364     /* Manual White balance gains */
2365     CAM_INTF_PARM_WB_MANUAL,
2366     /* Offline Data Overwrite */
2367     CAM_INTF_PARM_HW_DATA_OVERWRITE,
2368     /* IMG LIB reprocess debug section */
2369     CAM_INTF_META_IMGLIB, /* cam_intf_meta_imglib_t */
2370     /* OEM specific parameters */
2371     CAM_INTF_PARM_CUSTOM,
2372     /* parameters added for related cameras */
2373     /* fetch calibration info for related cam subsystem */
2374     CAM_INTF_PARM_RELATED_SENSORS_CALIBRATION,
2375     /* focal length ratio info */
2376     CAM_INTF_META_AF_FOCAL_LENGTH_RATIO,
2377     /* crop for binning & FOV adjust */
2378     CAM_INTF_META_SNAP_CROP_INFO_SENSOR,
2379     /* crop for trimming edge pixels */
2380     CAM_INTF_META_SNAP_CROP_INFO_CAMIF,
2381     /* crop for FOV adjust and zoom */
2382     CAM_INTF_META_SNAP_CROP_INFO_ISP,
2383     /* crop for image-stabilization and zoom */
2384     CAM_INTF_META_SNAP_CROP_INFO_CPP, /* 190 */
2385     /* parameter for enabling DCRF */
2386     CAM_INTF_PARM_DCRF,
2387     /* metadata tag for DCRF info */
2388     CAM_INTF_META_DCRF,
2389     /* FLIP mode parameter*/
2390     CAM_INTF_PARM_FLIP,
2391     /*Frame divert info from ISP*/
2392     CAM_INTF_BUF_DIVERT_INFO,
2393     /* Use AV timer */
2394     CAM_INTF_META_USE_AV_TIMER,
2395     CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,
2396     /* Special event to request stream frames*/
2397     CAM_INTF_PARM_REQUEST_FRAMES,
2398     /* Special event to request operational mode*/
2399     CAM_INTF_PARM_REQUEST_OPS_MODE,
2400     /*Black level parameters*/
2401     CAM_INTF_META_LDAF_EXIF,
2402     CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN,
2403     /* Applied black level pattern in RGGB order */
2404     CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN, /* 200 */
2405     CAM_INTF_META_CDS_DATA,
2406     /*3A low light level information*/
2407     CAM_INTF_META_LOW_LIGHT,
2408     /* dynamic feature detection */
2409     CAM_INTF_META_IMG_DYN_FEAT, /* 200 */
2410     /*Parameter entry to communicate manual
2411     capture type*/
2412     CAM_INTF_PARM_MANUAL_CAPTURE_TYPE,
2413     /*AF state change detected by AF module*/
2414     CAM_INTF_AF_STATE_TRANSITION,
2415     /* face recognition */
2416     CAM_INTF_META_FACE_RECOG,
2417     /* face blink detection */
2418     CAM_INTF_META_FACE_BLINK,
2419     /* face gaze detection */
2420     CAM_INTF_META_FACE_GAZE,
2421     /* face smile detection */
2422     CAM_INTF_META_FACE_SMILE,
2423     /* face landmark detection */
2424     CAM_INTF_META_FACE_LANDMARK, /* 210 */
2425     /* face contour detection */
2426     CAM_INTF_META_FACE_CONTOUR,
2427     /* Whether EIS is enabled */
2428     CAM_INTF_META_VIDEO_STAB_MODE,
2429     /* Touch exposure compensation (EV) status */
2430     CAM_INTF_META_TOUCH_AE_RESULT,
2431     /* Param for updating initial exposure index value*/
2432     CAM_INTF_PARM_INITIAL_EXPOSURE_INDEX,
2433     /* Gain applied post raw captrue prior to stats collection.
2434        ISP digital gain */
2435     CAM_INTF_META_ISP_SENSITIVITY,
2436     /* Param for enabling instant aec*/
2437     CAM_INTF_PARM_INSTANT_AEC,
2438     /* Param for tracking previous reprocessing activity */
2439     CAM_INTF_META_REPROCESS_FLAGS,
2440     /* Param of cropping information for JPEG encoder */
2441     CAM_INTF_PARM_JPEG_ENCODE_CROP,
2442     /* Param of scaling information for JPEG encoder */
2443     CAM_INTF_PARM_JPEG_SCALE_DIMENSION,
2444     /*Param for updating Quadra CFA mode */
2445     CAM_INTF_PARM_QUADRA_CFA,
2446     /* Meta Raw Dim */
2447     CAM_INTF_META_RAW,
2448     /* Number of streams and size of streams in
2449        current configuration for pic res*/
2450     CAM_INTF_META_STREAM_INFO_FOR_PIC_RES,
2451     CAM_INTF_META_FOCUS_DEPTH_INFO,
2452     /* Operation Mode for IR */
2453     CAM_INTF_META_IR_MODE,
2454     /* AEC,AWB Speed control enabled */
2455     CAM_INTF_META_AEC_CONVERGENCE_SPEED,
2456     CAM_INTF_META_AWB_CONVERGENCE_SPEED,
2457     /*Focus value output from af core*/
2458     CAM_INTF_META_FOCUS_VALUE,
2459     /*Spot light detection result output from af core*/
2460     CAM_INTF_META_SPOT_LIGHT_DETECT,
2461     /* HAL based HDR*/
2462     CAM_INTF_PARM_HAL_BRACKETING_HDR,
2463     /* Dual camera - Spatial Alignment Compute/Correction output info*/
2464     CAM_INTF_META_DC_SAC_OUTPUT_INFO,
2465     /* Dual camera - enable low power mode for the slave camera */
2466     CAM_INTF_META_DC_LOW_POWER_ENABLE,
2467     /* Dual camera - indicate if in the snapshot postprocess zoom range */
2468     CAM_INTF_META_DC_IN_SNAPSHOT_PP_ZOOM_RANGE,
2469     /* Dual camera - indicate if snapshot bokeh mode is selected */
2470     CAM_INTF_META_DC_BOKEH_MODE,
2471     CAM_INTF_PARM_FOV_COMP_ENABLE,
2472     /*Meta to update dual LED calibration results to app*/
2473     CAM_INTF_META_LED_CALIB_RESULT,
2474     /* Whether to enable hybrid ae mode */
2475     CAM_INTF_META_HYBRID_AE,
2476     /* Whether to enable motion detection */
2477     CAM_INTF_META_MOTION_DETECTION_ENABLE,
2478     /* DevCamDebug metadata CAM_TYPES.h */
2479     CAM_INTF_META_DEV_CAM_ENABLE,
2480     /* DevCamDebug metadata CAM_TYPES.h AF */
2481     CAM_INTF_META_DEV_CAM_AF_LENS_POSITION,
2482     CAM_INTF_META_AF_TOF_CONFIDENCE,
2483     CAM_INTF_META_AF_TOF_DISTANCE,
2484     CAM_INTF_META_DEV_CAM_AF_LUMA,
2485     CAM_INTF_META_DEV_CAM_AF_HAF_STATE,
2486     CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_TARGET_POS,
2487     CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_CONFIDENCE,
2488     CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_REFOCUS,
2489     CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_TARGET_POS,
2490     CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_CONFIDENCE,
2491     CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_REFOCUS,
2492     CAM_INTF_META_DEV_CAM_AF_MONITOR_TYPE_SELECT,
2493     CAM_INTF_META_DEV_CAM_AF_MONITOR_REFOCUS,
2494     CAM_INTF_META_DEV_CAM_AF_MONITOR_TARGET_POS,
2495     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_TARGET_POS,
2496     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_NEXT_POS,
2497     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_NEAR_POS,
2498     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_FAR_POS,
2499     CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_CONFIDENCE,
2500     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_TARGET_POS,
2501     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_NEXT_POS,
2502     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_NEAR_POS,
2503     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_FAR_POS,
2504     CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_CONFIDENCE,
2505     CAM_INTF_META_DEV_CAM_AF_SEARCH_TYPE_SELECT,
2506     CAM_INTF_META_DEV_CAM_AF_SEARCH_NEXT_POS,
2507     CAM_INTF_META_DEV_CAM_AF_SEARCH_TARGET_POS,
2508     /* DevCamDebug metadata CAM_TYPES.h AEC */
2509     CAM_INTF_META_DEV_CAM_AEC_TARGET_LUMA,
2510     CAM_INTF_META_DEV_CAM_AEC_COMP_LUMA,
2511     CAM_INTF_META_DEV_CAM_AEC_AVG_LUMA,
2512     CAM_INTF_META_DEV_CAM_AEC_CUR_LUMA,
2513     CAM_INTF_META_DEV_CAM_AEC_LINECOUNT,
2514     CAM_INTF_META_DEV_CAM_AEC_REAL_GAIN,
2515     CAM_INTF_META_DEV_CAM_AEC_EXP_INDEX,
2516     CAM_INTF_META_DEV_CAM_AEC_LUX_IDX,
2517     /* DevCamDebug metadata CAM_TYPES.h zzHDR */
2518     CAM_INTF_META_DEV_CAM_AEC_L_REAL_GAIN,
2519     CAM_INTF_META_DEV_CAM_AEC_L_LINECOUNT,
2520     CAM_INTF_META_DEV_CAM_AEC_S_REAL_GAIN,
2521     CAM_INTF_META_DEV_CAM_AEC_S_LINECOUNT,
2522     CAM_INTF_META_DEV_CAM_AEC_HDR_SENSITIVITY_RATIO,
2523     CAM_INTF_META_DEV_CAM_AEC_HDR_EXP_TIME_RATIO,
2524     /* DevCamDebug metadata CAM_TYPES.h ARDC */
2525     CAM_INTF_META_DEV_CAM_AEC_TOTAL_DRC_GAIN,
2526     CAM_INTF_META_DEV_CAM_AEC_COLOR_DRC_GAIN,
2527     CAM_INTF_META_DEV_CAM_AEC_GTM_RATIO,
2528     CAM_INTF_META_DEV_CAM_AEC_LTM_RATIO,
2529     CAM_INTF_META_DEV_CAM_AEC_LA_RATIO,
2530     CAM_INTF_META_DEV_CAM_AEC_GAMMA_RATIO,
2531     /* DevCamDebug metadata CAM_INTF.H AEC MOTION */
2532     CAM_INTF_META_DEV_CAM_AEC_CAMERA_MOTION_DX,
2533     CAM_INTF_META_DEV_CAM_AEC_CAMERA_MOTION_DY,
2534     CAM_INTF_META_DEV_CAM_AEC_SUBJECT_MOTION,
2535     /* DevCamDebug metadata CAM_TYPES.h AWB */
2536     CAM_INTF_META_DEV_CAM_AWB_R_GAIN,
2537     CAM_INTF_META_DEV_CAM_AWB_G_GAIN,
2538     CAM_INTF_META_DEV_CAM_AWB_B_GAIN,
2539     CAM_INTF_META_DEV_CAM_AWB_CCT,
2540     CAM_INTF_META_DEV_CAM_AWB_DECISION,
2541     /* DevCamDebug metadata end */
2542     /* AF scene change */
2543     CAM_INTF_META_AF_SCENE_CHANGE,
2544     /* Gain applied post stats collection in ISP */
2545     CAM_INTF_META_ISP_POST_STATS_SENSITIVITY,
2546     /* Dual camera - user zoom value. This will always be the wider camera zoom value */
2547     CAM_INTF_PARM_DC_USERZOOM,
2548     /* Dual camera sync parameter */
2549     CAM_INTF_PARM_SYNC_DC_PARAMETERS,
2550     /* AF focus position info */
2551     CAM_INTF_META_AF_FOCUS_POS,
2552     /* AEC LUX index */
2553     CAM_INTF_META_AEC_LUX_INDEX,
2554     /* Object's focus distance in cm*/
2555     CAM_INTF_META_AF_OBJ_DIST_CM,
2556     /* Binning Correction Algorithm */
2557     CAM_INTF_META_BINNING_CORRECTION_MODE,
2558     /* Read Sensor OIS data */
2559     CAM_INTF_META_OIS_READ_DATA,
2560     /* OIS data info within frame */
2561     CAM_INTF_META_FRAME_OIS_DATA,
2562     CAM_INTF_META_PDAF_DATA_ENABLE,
2563     /*event to flush stream buffers*/
2564     CAM_INTF_PARM_FLUSH_FRAMES,
2565     /* Number of histogram bins */
2566     CAM_INTF_META_STATS_HISTOGRAM_BINS,
2567     /* AF regions condidence */
2568     CAM_INTF_META_AF_REGIONS_CONFIDENCE,
2569     /* Early AF state due to trigger */
2570     CAM_INTF_META_EARLY_AF_STATE,
2571     /* Exposure time boost */
2572     CAM_INTF_META_EXP_TIME_BOOST,
2573     /* Easel HDR+ makernote */
2574     CAM_INTF_META_MAKERNOTE,
2575     /* EIS crop information */
2576     CAM_INTF_META_EIS_CROP_INFO,
2577     CAM_INTF_PARM_MAX
2578 } cam_intf_parm_type_t;
2579 
2580 typedef struct {
2581     uint32_t forced;
2582     union {
2583       uint32_t force_linecount_value;
2584       float    force_gain_value;
2585       float    force_snap_exp_value;
2586       float    force_exp_value;
2587       uint32_t force_snap_linecount_value;
2588       float    force_snap_gain_value;
2589     } u;
2590 } cam_ez_force_params_t;
2591 
2592 typedef struct {
2593     float cam_black_level[4];
2594 } cam_black_level_metadata_t;
2595 
2596 typedef enum {
2597     CAM_EZTUNE_CMD_STATUS,
2598     CAM_EZTUNE_CMD_AEC_ENABLE,
2599     CAM_EZTUNE_CMD_AWB_ENABLE,
2600     CAM_EZTUNE_CMD_AF_ENABLE,
2601     CAM_EZTUNE_CMD_AEC_FORCE_LINECOUNT,
2602     CAM_EZTUNE_CMD_AEC_FORCE_GAIN,
2603     CAM_EZTUNE_CMD_AEC_FORCE_EXP,
2604     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_LC,
2605     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_GAIN,
2606     CAM_EZTUNE_CMD_AEC_FORCE_SNAP_EXP,
2607     CAM_EZTUNE_CMD_AWB_MODE,
2608     CAM_EZTUNE_CMD_AWB_FORCE_DUAL_LED_IDX,
2609 } cam_eztune_cmd_type_t;
2610 
2611 typedef struct {
2612   cam_eztune_cmd_type_t   cmd;
2613   union {
2614     int32_t running;
2615     int32_t aec_enable;
2616     int32_t awb_enable;
2617     int32_t af_enable;
2618     cam_ez_force_params_t ez_force_param;
2619     int32_t awb_mode;
2620     int32_t ez_force_dual_led_idx;
2621   } u;
2622 } cam_eztune_cmd_data_t;
2623 
2624 
2625 /*****************************************************************************
2626  *                 Code for HAL3 data types                                  *
2627  ****************************************************************************/
2628 typedef enum {
2629     CAM_INTF_METADATA_MAX
2630 } cam_intf_metadata_type_t;
2631 
2632 typedef enum {
2633     CAM_INTENT_CUSTOM,
2634     CAM_INTENT_PREVIEW,
2635     CAM_INTENT_STILL_CAPTURE,
2636     CAM_INTENT_VIDEO_RECORD,
2637     CAM_INTENT_VIDEO_SNAPSHOT,
2638     CAM_INTENT_ZERO_SHUTTER_LAG,
2639     CAM_INTENT_MANUAL,
2640     CAM_INTENT_MOTION_TRACKING,
2641     CAM_INTENT_MAX,
2642 } cam_intent_t;
2643 
2644 typedef enum {
2645     /* Full application control of pipeline. All 3A routines are disabled,
2646      * no other settings in android.control.* have any effect */
2647     CAM_CONTROL_OFF,
2648     /* Use settings for each individual 3A routine. Manual control of capture
2649      * parameters is disabled. All controls in android.control.* besides sceneMode
2650      * take effect */
2651     CAM_CONTROL_AUTO,
2652     /* Use specific scene mode. Enabling this disables control.aeMode,
2653      * control.awbMode and control.afMode controls; the HAL must ignore those
2654      * settings while USE_SCENE_MODE is active (except for FACE_PRIORITY scene mode).
2655      * Other control entries are still active. This setting can only be used if
2656      * availableSceneModes != UNSUPPORTED. TODO: Should we remove this and handle this
2657      * in HAL ?*/
2658     CAM_CONTROL_USE_SCENE_MODE,
2659     CAM_CONTROL_MAX
2660 } cam_control_mode_t;
2661 
2662 typedef enum {
2663     /* Use the android.colorCorrection.transform matrix to do color conversion */
2664     CAM_COLOR_CORRECTION_TRANSFORM_MATRIX,
2665     /* Must not slow down frame rate relative to raw bayer output */
2666     CAM_COLOR_CORRECTION_FAST,
2667     /* Frame rate may be reduced by high quality */
2668     CAM_COLOR_CORRECTION_HIGH_QUALITY,
2669 } cam_color_correct_mode_t;
2670 
2671 typedef enum {
2672     CAM_COLOR_CORRECTION_ABERRATION_OFF,
2673     CAM_COLOR_CORRECTION_ABERRATION_FAST,
2674     CAM_COLOR_CORRECTION_ABERRATION_HIGH_QUALITY,
2675     CAM_COLOR_CORRECTION_ABERRATION_MAX
2676 } cam_aberration_mode_t;
2677 
2678 #define CC_MATRIX_ROWS 3
2679 #define CC_MATRIX_COLS 3
2680 
2681 typedef struct {
2682     /* 3x3 float matrix in row-major order. each element is in range of (0, 1) */
2683     cam_rational_type_t transform_matrix[CC_MATRIX_ROWS][CC_MATRIX_COLS];
2684 } cam_color_correct_matrix_t;
2685 
2686 #define CAM_FOCAL_LENGTHS_MAX     1
2687 #define CAM_APERTURES_MAX         1
2688 #define CAM_FILTER_DENSITIES_MAX  1
2689 #define CAM_MAX_MAP_HEIGHT        6
2690 #define CAM_MAX_MAP_WIDTH         6
2691 #define CAM_MAX_SHADING_MAP_WIDTH 17
2692 #define CAM_MAX_SHADING_MAP_HEIGHT 13
2693 #define CAM_MAX_TONEMAP_CURVE_SIZE 64
2694 #define CAM_MAX_FLASH_BRACKETING    5
2695 
2696 typedef struct {
2697     /* A 1D array of pairs of floats.
2698      * Mapping a 0-1 input range to a 0-1 output range.
2699      * The input range must be monotonically increasing with N,
2700      * and values between entries should be linearly interpolated.
2701      * For example, if the array is: [0.0, 0.0, 0.3, 0.5, 1.0, 1.0],
2702      * then the input->output mapping for a few sample points would be:
2703      * 0 -> 0, 0.15 -> 0.25, 0.3 -> 0.5, 0.5 -> 0.64 */
2704     float tonemap_points[CAM_MAX_TONEMAP_CURVE_SIZE][2];
2705 } cam_tonemap_curve_t;
2706 
2707 typedef struct {
2708    size_t tonemap_points_cnt;
2709    cam_tonemap_curve_t curves[3];
2710 } cam_rgb_tonemap_curves;
2711 
2712 typedef struct {
2713    size_t tonemap_points_cnt;
2714    cam_tonemap_curve_t curve;
2715 } cam_profile_tone_curve;
2716 
2717 #define NEUTRAL_COL_POINTS 3
2718 
2719 typedef struct {
2720     cam_rational_type_t neutral_col_point[NEUTRAL_COL_POINTS];
2721 } cam_neutral_col_point_t;
2722 
2723 typedef enum {
2724     OFF,
2725     FAST,
2726     QUALITY,
2727 } cam_quality_preference_t;
2728 
2729 typedef enum {
2730     CAM_FLASH_CTRL_OFF,
2731     CAM_FLASH_CTRL_SINGLE,
2732     CAM_FLASH_CTRL_TORCH
2733 } cam_flash_ctrl_t;
2734 
2735 typedef struct {
2736     uint8_t ae_mode;
2737     uint8_t awb_mode;
2738     uint8_t af_mode;
2739 } cam_scene_mode_overrides_t;
2740 
2741 typedef struct {
2742     int32_t left;
2743     int32_t top;
2744     int32_t width;
2745     int32_t height;
2746 } cam_crop_region_t;
2747 
2748 typedef struct {
2749     /* Estimated sharpness for each region of the input image.
2750      * Normalized to be between 0 and maxSharpnessMapValue.
2751      * Higher values mean sharper (better focused) */
2752     int32_t sharpness[CAM_MAX_MAP_WIDTH][CAM_MAX_MAP_HEIGHT];
2753 } cam_sharpness_map_t;
2754 
2755 typedef struct {
2756    float lens_shading[4*CAM_MAX_SHADING_MAP_HEIGHT*CAM_MAX_SHADING_MAP_WIDTH];
2757 } cam_lens_shading_map_t;
2758 
2759 typedef struct {
2760     int32_t min_value;
2761     int32_t max_value;
2762     int32_t def_value;
2763     int32_t step;
2764 } cam_control_range_t;
2765 
2766 #define CAM_QCOM_FEATURE_NONE            (cam_feature_mask_t)0UL
2767 #define CAM_QCOM_FEATURE_FACE_DETECTION ((cam_feature_mask_t)1UL<<0)
2768 #define CAM_QCOM_FEATURE_DENOISE2D      ((cam_feature_mask_t)1UL<<1)
2769 #define CAM_QCOM_FEATURE_CROP           ((cam_feature_mask_t)1UL<<2)
2770 #define CAM_QCOM_FEATURE_ROTATION       ((cam_feature_mask_t)1UL<<3)
2771 #define CAM_QCOM_FEATURE_FLIP           ((cam_feature_mask_t)1UL<<4)
2772 #define CAM_QCOM_FEATURE_HDR            ((cam_feature_mask_t)1UL<<5)
2773 #define CAM_QCOM_FEATURE_REGISTER_FACE  ((cam_feature_mask_t)1UL<<6)
2774 #define CAM_QCOM_FEATURE_SHARPNESS      ((cam_feature_mask_t)1UL<<7)
2775 #define CAM_QCOM_FEATURE_VIDEO_HDR      ((cam_feature_mask_t)1UL<<8)
2776 #define CAM_QCOM_FEATURE_CAC            ((cam_feature_mask_t)1UL<<9)
2777 #define CAM_QCOM_FEATURE_SCALE          ((cam_feature_mask_t)1UL<<10)
2778 #define CAM_QCOM_FEATURE_EFFECT         ((cam_feature_mask_t)1UL<<11)
2779 #define CAM_QCOM_FEATURE_UBIFOCUS       ((cam_feature_mask_t)1UL<<12)
2780 #define CAM_QCOM_FEATURE_CHROMA_FLASH   ((cam_feature_mask_t)1UL<<13)
2781 #define CAM_QCOM_FEATURE_OPTIZOOM       ((cam_feature_mask_t)1UL<<14)
2782 #define CAM_QCOM_FEATURE_SENSOR_HDR     ((cam_feature_mask_t)1UL<<15)
2783 #define CAM_QCOM_FEATURE_REFOCUS        ((cam_feature_mask_t)1UL<<16)
2784 #define CAM_QCOM_FEATURE_CPP_TNR        ((cam_feature_mask_t)1UL<<17)
2785 #define CAM_QCOM_FEATURE_RAW_PROCESSING ((cam_feature_mask_t)1UL<<18)
2786 #define CAM_QCOM_FEATURE_TRUEPORTRAIT   ((cam_feature_mask_t)1UL<<19)
2787 #define CAM_QCOM_FEATURE_LLVD           ((cam_feature_mask_t)1UL<<20)
2788 #define CAM_QCOM_FEATURE_DIS20          ((cam_feature_mask_t)1UL<<21)
2789 #define CAM_QCOM_FEATURE_STILLMORE      ((cam_feature_mask_t)1UL<<22)
2790 #define CAM_QCOM_FEATURE_DCRF           ((cam_feature_mask_t)1UL<<23)
2791 #define CAM_QCOM_FEATURE_CDS            ((cam_feature_mask_t)1UL<<24)
2792 #define CAM_QCOM_FEATURE_EZTUNE         ((cam_feature_mask_t)1UL<<25)
2793 #define CAM_QCOM_FEATURE_DSDN           ((cam_feature_mask_t)1UL<<26) //Special CDS in CPP block
2794 #define CAM_QCOM_FEATURE_SW2D           ((cam_feature_mask_t)1UL<<27)
2795 #define CAM_OEM_FEATURE_1               ((cam_feature_mask_t)1UL<<28)
2796 #define CAM_OEM_FEATURE_2               ((cam_feature_mask_t)1UL<<29)
2797 #define CAM_QTI_FEATURE_SW_TNR          ((cam_feature_mask_t)1UL<<30)
2798 #define CAM_QCOM_FEATURE_METADATA_PROCESSING ((cam_feature_mask_t)1UL<<31)
2799 #define CAM_QCOM_FEATURE_PAAF           (((cam_feature_mask_t)1UL)<<32)
2800 #define CAM_QCOM_FEATURE_QUADRA_CFA     (((cam_feature_mask_t)1UL)<<33)
2801 #define CAM_QTI_FEATURE_PPEISCORE       (((cam_feature_mask_t)1UL)<<34)
2802 #define CAM_QCOM_FEATURE_ZIGZAG_HDR     (((cam_feature_mask_t)1UL)<<35)
2803 #define CAM_QCOM_FEATURE_STAGGERED_VIDEO_HDR (((cam_feature_mask_t)1UL)<<36)
2804 #define CAM_QCOM_FEATURE_METADATA_BYPASS (((cam_feature_mask_t)1UL)<<37)
2805 #define CAM_QTI_FEATURE_SAT             (((cam_feature_mask_t)1UL)<<38)
2806 #define CAM_QTI_FEATURE_CPP_DOWNSCALE   (((cam_feature_mask_t)1UL)<<39)
2807 #define CAM_QTI_FEATURE_FIXED_FOVC      (((cam_feature_mask_t)1UL) << 40)
2808 #define CAM_QCOM_FEATURE_IR             (((cam_feature_mask_t)1UL)<<41)
2809 #define CAM_QTI_FEATURE_SAC             (((cam_feature_mask_t)1UL)<<42)
2810 #define CAM_QTI_FEATURE_RTBDM           (((cam_feature_mask_t)1UL)<<43)
2811 #define CAM_QTI_FEATURE_BINNING_CORRECTION (((cam_feature_mask_t)1UL)<<44)
2812 #define CAM_QTI_FEATURE_RTB             (((cam_feature_mask_t)1UL)<<45)
2813 #define CAM_QCOM_FEATURE_GOOG_ZOOM      (((cam_feature_mask_t)1UL)<<46)
2814 #define CAM_QCOM_FEATURE_PP_SUPERSET    (CAM_QCOM_FEATURE_DENOISE2D|CAM_QCOM_FEATURE_CROP|\
2815                                          CAM_QCOM_FEATURE_ROTATION|CAM_QCOM_FEATURE_SHARPNESS|\
2816                                          CAM_QCOM_FEATURE_SCALE|CAM_QCOM_FEATURE_CAC|\
2817                                          CAM_QCOM_FEATURE_EZTUNE|CAM_QCOM_FEATURE_CPP_TNR|\
2818                                          CAM_QCOM_FEATURE_LLVD|CAM_QCOM_FEATURE_QUADRA_CFA)
2819 
2820 #define CAM_QCOM_FEATURE_PP_PASS_1      CAM_QCOM_FEATURE_PP_SUPERSET
2821 #define CAM_QCOM_FEATURE_PP_PASS_2      CAM_QCOM_FEATURE_SCALE | CAM_QCOM_FEATURE_CROP;
2822 
2823 typedef struct {
2824    cam_rotation_t rotation;         /* jpeg rotation */
2825    cam_rotation_t device_rotation;  /* device rotation */
2826    uint32_t streamId;
2827 } cam_rotation_info_t;
2828 
2829 typedef enum {
2830     FLIP_NONE = 0, /* 00b */
2831     FLIP_H = 1,    /* 01b */
2832     FLIP_V = 2,    /* 10b */
2833     FLIP_V_H = 3,  /* 11b */
2834 } cam_flip_t;
2835 
2836 typedef struct {
2837     uint32_t bundle_id;                            /* bundle id */
2838     uint8_t num_of_streams;                        /* number of streams in the bundle */
2839     uint32_t stream_ids[MAX_STREAM_NUM_IN_BUNDLE]; /* array of stream ids to be bundled */
2840 } cam_bundle_config_t;
2841 
2842 typedef enum {
2843     CAM_ONLINE_REPROCESS_TYPE,    /* online reprocess, frames from running streams */
2844     CAM_OFFLINE_REPROCESS_TYPE,   /* offline reprocess, frames from external source */
2845 } cam_reprocess_type_enum_t;
2846 
2847 typedef struct {
2848     uint8_t burst_count;
2849     uint8_t min_burst_count;
2850     uint8_t max_burst_count;
2851 } cam_still_more_t;
2852 
2853 typedef struct {
2854     uint8_t burst_count;
2855     uint8_t output_count;
2856     uint8_t flash_bracketing[CAM_MAX_FLASH_BRACKETING];
2857     uint8_t metadata_index;
2858 } cam_chroma_flash_t;
2859 
2860 typedef enum {
2861     CAM_HDR_MODE_SINGLEFRAME,    /* Single frame HDR mode which does only tone mapping */
2862     CAM_HDR_MODE_MULTIFRAME,     /* Multi frame HDR mode which needs two frames with 0.5x and 2x exposure respectively */
2863 } cam_hdr_mode_enum_t;
2864 
2865 typedef struct {
2866     uint32_t hdr_enable;
2867     uint32_t hdr_need_1x; /* when CAM_QCOM_FEATURE_HDR enabled, indicate if 1x is needed for output */
2868     cam_hdr_mode_enum_t hdr_mode;
2869 } cam_hdr_param_t;
2870 
2871 typedef struct {
2872     int32_t output_width;
2873     int32_t output_height;
2874 } cam_scale_param_t;
2875 
2876 typedef struct {
2877     uint8_t enable;
2878     uint8_t burst_count;
2879     uint8_t focus_steps[MAX_AF_BRACKETING_VALUES];
2880     uint8_t output_count;
2881     uint32_t meta_max_size;
2882 } cam_af_bracketing_t;
2883 
2884 typedef struct {
2885     uint8_t enable;
2886     uint8_t burst_count;
2887 } cam_flash_bracketing_t;
2888 
2889 typedef struct {
2890     uint8_t enable;
2891     uint8_t burst_count;
2892     uint8_t zoom_threshold;
2893 } cam_opti_zoom_t;
2894 
2895 typedef struct {
2896     size_t meta_max_size;
2897 } cam_true_portrait_t;
2898 
2899 typedef enum {
2900     CAM_FLASH_OFF,
2901     CAM_FLASH_ON
2902 } cam_flash_value_t;
2903 
2904 typedef struct {
2905     cam_sensor_t sens_type;
2906     cam_format_t native_format;
2907 } cam_sensor_type_t;
2908 
2909 typedef struct {
2910     uint32_t result;
2911     uint32_t header_size;
2912     uint32_t width;
2913     uint32_t height;
2914     uint8_t data[0];
2915 } cam_misc_buf_t;
2916 
2917 typedef struct {
2918     uint32_t misc_buffer_index;
2919 } cam_misc_buf_param_t;
2920 
2921 typedef struct {
2922     /* reprocess feature mask */
2923     cam_feature_mask_t feature_mask;
2924 
2925     /* individual setting for features to be reprocessed */
2926     cam_denoise_param_t denoise2d;
2927     cam_rect_t input_crop;
2928     cam_rotation_t rotation;
2929     uint32_t flip;
2930     int32_t sharpness;
2931     int32_t effect;
2932     cam_hdr_param_t hdr_param;
2933     cam_scale_param_t scale_param;
2934 
2935     uint8_t zoom_level;
2936     cam_flash_value_t flash_value;
2937     cam_misc_buf_param_t misc_buf_param;
2938     uint32_t burst_cnt;
2939     uint8_t cur_reproc_count;
2940     uint8_t total_reproc_count;
2941 } cam_pp_feature_config_t;
2942 
2943 typedef struct {
2944     uint32_t input_stream_id;
2945     /* input source stream type */
2946     cam_stream_type_t input_stream_type;
2947 } cam_pp_online_src_config_t;
2948 
2949 typedef struct {
2950     /* image format */
2951     cam_format_t input_fmt;
2952 
2953     /* image dimension */
2954     cam_dimension_t input_dim;
2955 
2956     /* buffer plane information, will be calc based on stream_type, fmt,
2957        dim, and padding_info(from stream config). Info including:
2958        offset_x, offset_y, stride, scanline, plane offset */
2959     cam_stream_buf_plane_info_t input_buf_planes;
2960 
2961     /* number of input reprocess buffers */
2962     uint8_t num_of_bufs;
2963 
2964     /* input source type */
2965     cam_stream_type_t input_type;
2966 
2967 } cam_pp_offline_src_config_t;
2968 
2969 /* reprocess stream input configuration */
2970 typedef struct {
2971     /* input source config */
2972     cam_reprocess_type_enum_t pp_type;
2973     union {
2974         cam_pp_online_src_config_t online;
2975         cam_pp_offline_src_config_t offline;
2976     };
2977 
2978     /* pp feature config */
2979     cam_pp_feature_config_t pp_feature_config;
2980 } cam_stream_reproc_config_t;
2981 
2982 typedef struct {
2983     uint8_t crop_enabled;
2984     cam_rect_t input_crop;
2985 } cam_crop_param_t;
2986 
2987 typedef struct {
2988     uint8_t trigger;
2989     int32_t trigger_id;
2990 } cam_trigger_t;
2991 
2992 typedef struct {
2993     cam_denoise_param_t denoise2d;
2994     cam_crop_param_t crop;
2995     uint32_t flip;     /* 0 means no flip */
2996     uint32_t uv_upsample; /* 0 means no chroma upsampling */
2997     int32_t sharpness; /* 0 means no sharpness */
2998     int32_t effect;
2999     cam_rotation_t rotation;
3000     cam_rotation_t device_rotation;
3001 } cam_per_frame_pp_config_t;
3002 
3003 typedef enum {
3004     CAM_OPT_STAB_OFF,
3005     CAM_OPT_STAB_ON,
3006     CAM_OPT_STAB_MAX
3007 } cam_optical_stab_modes_t;
3008 
3009 typedef enum {
3010     CAM_FILTER_ARRANGEMENT_RGGB,
3011     CAM_FILTER_ARRANGEMENT_GRBG,
3012     CAM_FILTER_ARRANGEMENT_GBRG,
3013     CAM_FILTER_ARRANGEMENT_BGGR,
3014 
3015     /* Sensor is not Bayer; output has 3 16-bit values for each pixel,
3016      * instead of just 1 16-bit value per pixel.*/
3017     CAM_FILTER_ARRANGEMENT_RGB,
3018     /* Sensor is YUV; SW do not have access to actual RAW,
3019      * output is interleaved UYVY */
3020     CAM_FILTER_ARRANGEMENT_UYVY,
3021     CAM_FILTER_ARRANGEMENT_YUYV,
3022     CAM_FILTER_ARRANGEMENT_Y
3023 } cam_color_filter_arrangement_t;
3024 
3025 typedef enum {
3026   CAM_AF_LENS_STATE_STATIONARY,
3027   CAM_AF_LENS_STATE_MOVING,
3028 } cam_af_lens_state_t;
3029 
3030 typedef enum {
3031     CAM_AWB_STATE_INACTIVE,
3032     CAM_AWB_STATE_SEARCHING,
3033     CAM_AWB_STATE_CONVERGED,
3034     CAM_AWB_STATE_LOCKED
3035 } cam_awb_state_t;
3036 
3037 typedef enum {
3038     CAM_FOCUS_UNCALIBRATED,
3039     CAM_FOCUS_APPROXIMATE,
3040     CAM_FOCUS_CALIBRATED
3041 } cam_focus_calibration_t;
3042 
3043 typedef enum {
3044     CAM_TEST_PATTERN_OFF,
3045     CAM_TEST_PATTERN_SOLID_COLOR,
3046     CAM_TEST_PATTERN_COLOR_BARS,
3047     CAM_TEST_PATTERN_COLOR_BARS_FADE_TO_GRAY,
3048     CAM_TEST_PATTERN_PN9,
3049     CAM_TEST_PATTERN_CUSTOM1 = 256
3050 } cam_test_pattern_mode_t;
3051 
3052 typedef struct {
3053     cam_test_pattern_mode_t mode;
3054     int32_t r;
3055     int32_t gr;
3056     int32_t gb;
3057     int32_t b;
3058 } cam_test_pattern_data_t;
3059 
3060 typedef enum {
3061     CAM_AWB_D50,
3062     CAM_AWB_D65,
3063     CAM_AWB_D75,
3064     CAM_AWB_A,
3065     CAM_AWB_CUSTOM_A,
3066     CAM_AWB_WARM_FLO,
3067     CAM_AWB_COLD_FLO,
3068     CAM_AWB_CUSTOM_FLO,
3069     CAM_AWB_NOON,
3070     CAM_AWB_CUSTOM_DAYLIGHT,
3071     CAM_AWB_INVALID_ALL_LIGHT,
3072 } cam_illuminat_t;
3073 
3074 typedef enum {
3075     LEGACY_RAW,
3076     MIPI_RAW,
3077 } cam_opaque_raw_format_t;
3078 
3079 typedef enum {
3080     CAM_PERF_NORMAL = 0,
3081     CAM_PERF_HIGH,
3082     CAM_PERF_HIGH_PERFORMANCE,
3083 } cam_perf_mode_t;
3084 
3085 typedef struct {
3086     float real_gain;
3087     float lux_idx;
3088     float exp_time;
3089 } cam_intf_aec_t;
3090 
3091 #define CAM_INTF_AEC_DATA_MAX   (10)
3092 
3093 typedef struct {
3094     uint32_t frame_count;
3095     cam_intf_aec_t aec_data[CAM_INTF_AEC_DATA_MAX];
3096 } cam_intf_meta_imglib_input_aec_t;
3097 
3098 typedef struct {
3099     cam_intf_meta_imglib_input_aec_t meta_imglib_input_aec;
3100 } cam_intf_meta_imglib_t;
3101 
3102 typedef struct {
3103     uint8_t previewOnly;
3104     uint64_t value;
3105 } cam_intf_parm_manual_3a_t;
3106 
3107 typedef enum {
3108     CAM_MANUAL_CAPTURE_TYPE_OFF, /*Manual capture mode disabled*/
3109     CAM_MANUAL_CAPTURE_TYPE_1,   /*Normal ZSL capture with limited 3A settings*/
3110     CAM_MANUAL_CAPTURE_TYPE_2,   /*Low light capture mode */
3111     CAM_MANUAL_CAPTURE_TYPE_3,   /*Offline RAW processing */
3112     CAM_MANUAL_CAPTURE_TYPE_4    /*Offline RAW processing with multiple RAW*/
3113 } cam_manual_capture_type;
3114 
3115 typedef enum {
3116     CAM_ANALYSIS_INFO_FD_STILL,   /*Analysis requirements for STILL PREVIEW*/
3117     CAM_ANALYSIS_INFO_FD_VIDEO,   /*Analysis requirements for VIDEO*/
3118     CAM_ANALYSIS_INFO_PAAF,       /*Analysis requirements for PAAF*/
3119     CAM_ANALYSIS_INFO_MAX,     /*Max number*/
3120 } cam_analysis_info_type;
3121 
3122 typedef struct {
3123     /* Whether the information here is valid or not */
3124     uint8_t valid;
3125 
3126     /* Whether analysis supported by hw */
3127     uint8_t hw_analysis_supported;
3128 
3129     /* Analysis stream max supported size */
3130     cam_dimension_t analysis_max_res;
3131 
3132     /* Analysis stream padding info */
3133     cam_padding_info_t analysis_padding_info;
3134 
3135     /* Analysis format */
3136     cam_format_t analysis_format;
3137 
3138     /* Analysis recommended size */
3139     cam_dimension_t analysis_recommended_res;
3140 } cam_analysis_info_t;
3141 
3142 /** mm_camera_event_t: structure for event
3143 *    @server_event_type : event type from serer
3144 *    @status : status of an event, value could be
3145 *              CAM_STATUS_SUCCESS
3146 *              CAM_STATUS_FAILED
3147 **/
3148 typedef struct {
3149     cam_event_type_t server_event_type;
3150     uint32_t status;
3151 } cam_event_t;
3152 
3153 typedef struct {
3154     /* Information for DDM metadata*/
3155     cam_stream_crop_info_t   sensor_crop_info; /* sensor crop info */
3156     cam_stream_crop_info_t   camif_crop_info; /* CAMIF crop info */
3157     cam_stream_crop_info_t   isp_crop_info; /* ISP crop info */
3158     cam_stream_crop_info_t   cpp_crop_info; /* CPP crop info */
3159     cam_focal_length_ratio_t af_focal_length_ratio; /* AF focal length ratio */
3160     int32_t                  pipeline_flip; /* current pipeline flip and rotational parameters */
3161     cam_rotation_info_t      rotation_info; /* rotation information */
3162     cam_area_t               af_roi;        /* AF roi info */
3163     /* Information for CPP reprocess */
3164     cam_dyn_img_data_t       dyn_mask;      /* Post processing dynamic feature mask */
3165 } cam_reprocess_info_t;
3166 
3167 /***********************************
3168 * ENUM definition for custom parameter type
3169 ************************************/
3170 typedef enum {
3171     CAM_CUSTOM_PARM_EXAMPLE,
3172     CAM_CUSTOM_PARM_MAX,
3173 } cam_custom_parm_type;
3174 
3175 typedef enum {
3176     CAM_STREAM_CACHE_OPS_CLEAR_FLAGS,
3177     CAM_STREAM_CACHE_OPS_HONOUR_FLAGS,
3178     CAM_STREAM_CACHE_OPS_DISABLED
3179 } cam_stream_cache_ops_t;
3180 
3181 typedef struct {
3182   int reserved_i[16];
3183   float reserved_f[16];
3184 }tuning_mod1_data_AWB;
3185 
3186 typedef struct {
3187   int reserved_i[16];
3188   float reserved_f[16];
3189 }tuning_mod1_data_AEC;
3190 
3191 typedef struct {
3192   int reserved_i[16];
3193   float reserved_f[16];
3194 }tuning_mod1_data_AF;
3195 
3196 
3197 // Used with MSM_CAMERA_PRIV_STREAM_ON.
3198 typedef enum {
3199     CAM_STREAM_ON_TYPE_CONFIG, // Configure modules for stream ON without starting sensor streaming.
3200     CAM_STREAM_ON_TYPE_START_SENSOR_STREAMING, // Start sensor streaming.
3201 } cam_stream_on_type_t;
3202 
3203 
3204 // Used with CAM_INTF_META_MAKERNOTE.
3205 typedef struct {
3206     char data[MAX_MAKERNOTE_LENGTH];
3207     uint32_t length;
3208 } cam_makernote_t;
3209 
3210 // Used with CAM_META_EIS_CROP_INFO
3211 typedef struct {
3212     int32_t delta_x;
3213     int32_t delta_y;
3214     int32_t delta_width;
3215     int32_t delta_height;
3216 } cam_eis_crop_info_t;
3217 
3218 #endif /* __QCAMERA_TYPES_H__ */
3219