1 /* Copyright (c) 2012-2014, 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_INTF_H__
31 #define __QCAMERA_INTF_H__
32 
33 #include <media/msmb_isp.h>
34 #include "cam_types.h"
35 
36 #define CAM_PRIV_IOCTL_BASE (V4L2_CID_PRIVATE_BASE + 14)
37 typedef enum {
38     /* session based parameters */
39     CAM_PRIV_PARM = CAM_PRIV_IOCTL_BASE,
40     /* session based action: do auto focus.*/
41     CAM_PRIV_DO_AUTO_FOCUS,
42     /* session based action: cancel auto focus.*/
43     CAM_PRIV_CANCEL_AUTO_FOCUS,
44     /* session based action: prepare for snapshot.*/
45     CAM_PRIV_PREPARE_SNAPSHOT,
46     /* sync stream info.*/
47     CAM_PRIV_STREAM_INFO_SYNC,
48     /* stream based parameters*/
49     CAM_PRIV_STREAM_PARM,
50     /* start ZSL snapshot.*/
51     CAM_PRIV_START_ZSL_SNAPSHOT,
52     /* stop ZSL snapshot.*/
53     CAM_PRIV_STOP_ZSL_SNAPSHOT,
54 } cam_private_ioctl_enum_t;
55 
56 /* capability struct definition for HAL 1*/
57 typedef struct{
58     cam_hal_version_t version;
59 
60     cam_position_t position;                                /* sensor position: front, back */
61 
62     uint8_t auto_hdr_supported;
63 
64     uint16_t isWnrSupported;
65     /* supported iso modes */
66     uint8_t supported_iso_modes_cnt;
67     cam_iso_mode_type supported_iso_modes[CAM_ISO_MODE_MAX];
68 
69     /* supported flash modes */
70     uint8_t supported_flash_modes_cnt;
71     cam_flash_mode_t supported_flash_modes[CAM_FLASH_MODE_MAX];
72 
73     uint8_t zoom_ratio_tbl_cnt;                             /* table size for zoom ratios */
74     int zoom_ratio_tbl[MAX_ZOOMS_CNT];                      /* zoom ratios table */
75 
76     /* supported effect modes */
77     uint8_t supported_effects_cnt;
78     cam_effect_mode_type supported_effects[CAM_EFFECT_MODE_MAX];
79 
80     /* supported scene modes */
81     uint8_t supported_scene_modes_cnt;
82     cam_scene_mode_type supported_scene_modes[CAM_SCENE_MODE_MAX];
83 
84     /* supported auto exposure modes */
85     uint8_t supported_aec_modes_cnt;
86     cam_auto_exposure_mode_type supported_aec_modes[CAM_AEC_MODE_MAX];
87 
88     uint8_t fps_ranges_tbl_cnt;                             /* fps ranges table size */
89     cam_fps_range_t fps_ranges_tbl[MAX_SIZES_CNT];          /* fps ranges table */
90 
91     /* supported antibanding modes */
92     uint8_t supported_antibandings_cnt;
93     cam_antibanding_mode_type supported_antibandings[CAM_ANTIBANDING_MODE_MAX];
94 
95     /* supported white balance modes */
96     uint8_t supported_white_balances_cnt;
97     cam_wb_mode_type supported_white_balances[CAM_WB_MODE_MAX];
98 
99     /* supported focus modes */
100     uint8_t supported_focus_modes_cnt;
101     cam_focus_mode_type supported_focus_modes[CAM_FOCUS_MODE_MAX];
102 
103     int exposure_compensation_min;       /* min value of exposure compensation index */
104     int exposure_compensation_max;       /* max value of exposure compensation index */
105     int exposure_compensation_default;   /* default value of exposure compensation index */
106     float exposure_compensation_step;
107     cam_rational_type_t exp_compensation_step;    /* exposure compensation step value */
108 
109     uint8_t video_stablization_supported; /* flag id video stablization is supported */
110 
111     uint8_t picture_sizes_tbl_cnt;                          /* picture sizes table size */
112     cam_dimension_t picture_sizes_tbl[MAX_SIZES_CNT];       /* picture sizes table */
113     /* The minimum frame duration that is supported for each
114      * resolution in availableProcessedSizes. Should correspond
115      * to the frame duration when only that processed stream
116      * is active, with all processing set to FAST */
117     int64_t picture_min_duration[MAX_SIZES_CNT];
118 
119     /* capabilities specific to HAL 1 */
120 
121     int modes_supported;                                    /* mask of modes supported: 2D, 3D */
122     uint32_t sensor_mount_angle;                            /* sensor mount angle */
123 
124     float focal_length;                                     /* focal length */
125     float hor_view_angle;                                   /* horizontal view angle */
126     float ver_view_angle;                                   /* vertical view angle */
127 
128     uint8_t preview_sizes_tbl_cnt;                          /* preview sizes table size */
129     cam_dimension_t preview_sizes_tbl[MAX_SIZES_CNT];       /* preiew sizes table */
130 
131     uint8_t video_sizes_tbl_cnt;                            /* video sizes table size */
132     cam_dimension_t video_sizes_tbl[MAX_SIZES_CNT];         /* video sizes table */
133 
134 
135     uint8_t livesnapshot_sizes_tbl_cnt;                     /* livesnapshot sizes table size */
136     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
137 
138     uint8_t hfr_tbl_cnt;                                    /* table size for HFR */
139     cam_hfr_info_t hfr_tbl[CAM_HFR_MODE_MAX];               /* HFR table */
140 
141     /* supported preview formats */
142     uint8_t supported_preview_fmt_cnt;
143     cam_format_t supported_preview_fmts[CAM_FORMAT_MAX];
144 
145     /* supported picture formats */
146     uint8_t supported_picture_fmt_cnt;
147     cam_format_t supported_picture_fmts[CAM_FORMAT_MAX];
148 
149     uint8_t max_downscale_factor;
150 
151     /* dimension and supported output format of raw dump from camif */
152     uint8_t supported_raw_dim_cnt;
153     cam_dimension_t raw_dim[MAX_SIZES_CNT];
154     uint8_t supported_raw_fmt_cnt;
155     cam_format_t supported_raw_fmts[CAM_FORMAT_MAX];
156     /* The minimum frame duration that is supported for above
157        raw resolution */
158     int64_t raw_min_duration[MAX_SIZES_CNT];
159 
160     /* supported focus algorithms */
161     uint8_t supported_focus_algos_cnt;
162     cam_focus_algorithm_type supported_focus_algos[CAM_FOCUS_ALGO_MAX];
163 
164 
165     uint8_t auto_wb_lock_supported;       /* flag if auto white balance lock is supported */
166     uint8_t zoom_supported;               /* flag if zoom is supported */
167     uint8_t smooth_zoom_supported;        /* flag if smooth zoom is supported */
168     uint8_t auto_exposure_lock_supported; /* flag if auto exposure lock is supported */
169     uint8_t video_snapshot_supported;     /* flag if video snapshot is supported */
170 
171     uint8_t max_num_roi;                  /* max number of roi can be detected */
172     uint8_t max_num_focus_areas;          /* max num of focus areas */
173     uint8_t max_num_metering_areas;       /* max num opf metering areas */
174     uint8_t max_zoom_step;                /* max zoom step value */
175 
176     /* QCOM specific control */
177     cam_control_range_t brightness_ctrl;  /* brightness */
178     cam_control_range_t sharpness_ctrl;   /* sharpness */
179     cam_control_range_t contrast_ctrl;    /* contrast */
180     cam_control_range_t saturation_ctrl;  /* saturation */
181     cam_control_range_t sce_ctrl;         /* skintone enhancement factor */
182 
183     /* QCOM HDR specific control. Indicates number of frames and exposure needs for the frames */
184     cam_hdr_bracketing_info_t hdr_bracketing_setting;
185 
186     uint32_t qcom_supported_feature_mask; /* mask of qcom specific features supported:
187                                            * such as CAM_QCOM_FEATURE_SUPPORTED_FACE_DETECTION*/
188     cam_padding_info_t padding_info;      /* padding information from PP */
189     int8_t min_num_pp_bufs;               /* minimum number of buffers needed by postproc module */
190     uint32_t min_required_pp_mask;        /* min required pp feature masks for ZSL.
191                                            * depends on hardware limitation, i.e. for 8974,
192                                            * sharpness is required for all ZSL snapshot frames */
193     cam_format_t rdi_mode_stream_fmt;  /* stream format supported in rdi mode */
194 
195     /* capabilities specific to HAL 3 */
196 
197     float min_focus_distance;
198     float hyper_focal_distance;
199 
200     float focal_lengths[CAM_FOCAL_LENGTHS_MAX];
201     uint8_t focal_lengths_count;
202 
203     /* Needs to be regular f number instead of APEX */
204     float apertures[CAM_APERTURES_MAX];
205     uint8_t apertures_count;
206 
207     float filter_densities[CAM_FILTER_DENSITIES_MAX];
208     uint8_t filter_densities_count;
209 
210     uint8_t optical_stab_modes[CAM_OPT_STAB_MAX];
211     uint8_t optical_stab_modes_count;
212 
213     cam_dimension_t lens_shading_map_size;
214     float lens_shading_map[3 * CAM_MAX_MAP_WIDTH *
215               CAM_MAX_MAP_HEIGHT];
216 
217     cam_dimension_t geo_correction_map_size;
218     float geo_correction_map[2 * 3 * CAM_MAX_MAP_WIDTH *
219               CAM_MAX_MAP_HEIGHT];
220 
221     float lens_position[3];
222 
223     /* nano seconds */
224     int64_t exposure_time_range[2];
225 
226     /* nano seconds */
227     int64_t max_frame_duration;
228 
229     cam_color_filter_arrangement_t color_arrangement;
230     uint8_t num_color_channels;
231 
232     float sensor_physical_size[2];
233 
234     /* Dimensions of full pixel array, possibly including
235        black calibration pixels */
236     cam_dimension_t pixel_array_size;
237     /* Area of raw data which corresponds to only active
238        pixels; smaller or equal to pixelArraySize. */
239     cam_rect_t active_array_size;
240 
241     /* Maximum raw value output by sensor */
242     int32_t white_level;
243 
244     /* A fixed black level offset for each of the Bayer
245        mosaic channels */
246     int32_t black_level_pattern[4];
247 
248     /* Time taken before flash can fire again in nano secs */
249     int64_t flash_charge_duration;
250 
251     /* flash firing power */
252     uint8_t supported_flash_firing_level_cnt;
253     cam_format_t supported_firing_levels[CAM_FLASH_FIRING_LEVEL_MAX];
254 
255     /* Flash Firing Time */
256     int64_t flash_firing_time;
257 
258     /* Flash Ciolor Temperature */
259     uint8_t flash_color_temp;
260 
261     /* Flash max Energy */
262     uint8_t flash_max_energy;
263 
264     /* Maximum number of supported points in the tonemap
265        curve */
266     int32_t max_tone_map_curve_points;
267 
268     /* supported formats */
269     uint8_t supported_scalar_format_cnt;
270     cam_format_t supported_scalar_fmts[CAM_FORMAT_MAX];
271 
272     uint32_t max_face_detection_count;
273 
274     uint8_t histogram_supported;
275     /* Number of histogram buckets supported */
276     int32_t histogram_size;
277     /* Maximum value possible for a histogram bucket */
278     int32_t max_histogram_count;
279 
280     cam_dimension_t sharpness_map_size;
281 
282     /* Maximum value possible for a sharpness map region */
283     int32_t max_sharpness_map_value;
284 
285     /*Autoexposure modes for camera 3 api*/
286     uint8_t supported_ae_modes_cnt;
287     cam_ae_mode_type supported_ae_modes[CAM_AE_MODE_MAX];
288 
289 
290     cam_sensitivity_range_t sensitivity_range;
291     int32_t max_analog_sensitivity;
292 
293     /* picture sizes need scale*/
294     cam_scene_mode_overrides_t scene_mode_overrides[CAM_SCENE_MODE_MAX];
295     uint8_t scale_picture_sizes_cnt;
296     cam_dimension_t scale_picture_sizes[MAX_SCALE_SIZES_CNT];
297 
298     uint8_t flash_available;
299 
300     /* Sensor type information */
301     cam_sensor_type_t sensor_type;
302 
303     cam_rational_type_t base_gain_factor;    /* sensor base gain factor */
304     /* AF Bracketing info */
305     cam_af_bracketing_t  ubifocus_af_bracketing_need;
306     /* opti Zoom info */
307     cam_opti_zoom_t      opti_zoom_settings_need;
308 
309     cam_rational_type_t forward_matrix[3][3];
310     cam_rational_type_t color_transform[3][3];
311 
312     uint8_t focus_dist_calibrated;
313     uint8_t supported_test_pattern_modes_cnt;
314     cam_test_pattern_mode_t supported_test_pattern_modes[MAX_TEST_PATTERN_CNT];
315 
316     int64_t stall_durations[MAX_SIZES_CNT];
317 
318     cam_illuminat_t reference_illuminant1;
319     cam_illuminat_t reference_illuminant2;
320 
321     int64_t jpeg_stall_durations[MAX_SIZES_CNT];
322     int64_t raw16_stall_durations[MAX_SIZES_CNT];
323     cam_rational_type_t forward_matrix1[3][3];
324     cam_rational_type_t forward_matrix2[3][3];
325     cam_rational_type_t color_transform1[3][3];
326     cam_rational_type_t color_transform2[3][3];
327     cam_rational_type_t calibration_transform1[3][3];
328     cam_rational_type_t calibration_transform2[3][3];
329 
330     cam_opaque_raw_format_t opaque_raw_fmt;
331 
332     uint16_t isCacSupported;
333 
334     cam_aberration_mode_t aberration_modes[CAM_COLOR_CORRECTION_ABERRATION_MAX];
335     uint32_t aberration_modes_count;
336 
337     /* Can the sensor timestamp be compared to
338      * timestamps from other sub-systems (gyro, accelerometer etc.) */
339     uint8_t isTimestampCalibrated;
340 
341     /* Max size supported by ISP viewfinder path */
342     cam_dimension_t max_viewfinder_size;
343 } cam_capability_t;
344 
345 typedef enum {
346     CAM_STREAM_PARAM_TYPE_DO_REPROCESS = CAM_INTF_PARM_DO_REPROCESS,
347     CAM_STREAM_PARAM_TYPE_SET_BUNDLE_INFO = CAM_INTF_PARM_SET_BUNDLE,
348     CAM_STREAM_PARAM_TYPE_SET_FLIP = CAM_INTF_PARM_STREAM_FLIP,
349     CAM_STREAM_PARAM_TYPE_GET_OUTPUT_CROP = CAM_INTF_PARM_GET_OUTPUT_CROP,
350     CAM_STREAM_PARAM_TYPE_GET_IMG_PROP = CAM_INTF_PARM_GET_IMG_PROP,
351     CAM_STREAM_PARAM_TYPE_MAX
352 } cam_stream_param_type_e;
353 
354 typedef struct {
355     uint8_t buf_index;            /* buf index to the source frame buffer that needs reprocess,
356                                     (assume buffer is already mapped)*/
357     uint32_t frame_idx;           /* frame id of source frame to be reprocessed */
358     int32_t ret_val;              /* return value from reprocess. Could have different meanings.
359                                      i.e., faceID in the case of face registration. */
360     uint8_t meta_present;         /* if there is meta data associated with this reprocess frame */
361     uint32_t meta_stream_handle;  /* meta data stream ID. only valid if meta_present != 0 */
362     uint8_t meta_buf_index;       /* buf index to meta data buffer. only valid if meta_present != 0 */
363 
364     cam_per_frame_pp_config_t frame_pp_config; /* per frame post-proc configuration */
365 
366     /* opaque metadata required for reprocessing */
367     int32_t private_data[MAX_METADATA_PRIVATE_PAYLOAD_SIZE];
368     cam_rect_t crop_rect;
369 } cam_reprocess_param;
370 
371 typedef struct {
372     uint32_t flip_mask;
373 } cam_flip_mode_t;
374 
375 #define IMG_NAME_SIZE 32
376 typedef struct {
377     cam_rect_t crop;  /* crop info for the image */
378     cam_dimension_t input; /* input dimension of the image */
379     cam_dimension_t output; /* output dimension of the image */
380     char name[IMG_NAME_SIZE]; /* optional name of the ext*/
381     int is_raw_image; /* image is raw */
382     cam_format_t format; /* image format */
383     int analysis_image; /* image is used for analysis. hence skip thumbnail */
384     uint32_t size; /* size of the image */
385 } cam_stream_img_prop_t;
386 
387 typedef struct {
388     cam_stream_param_type_e type;
389     union {
390         cam_reprocess_param reprocess;  /* do reprocess */
391         cam_bundle_config_t bundleInfo; /* set bundle info*/
392         cam_flip_mode_t flipInfo;       /* flip mode */
393         cam_crop_data_t outputCrop;     /* output crop for current frame */
394         cam_stream_img_prop_t imgProp;  /* image properties of current frame */
395     };
396 } cam_stream_parm_buffer_t;
397 
398 /* stream info */
399 typedef struct {
400     /* stream ID from server */
401     uint32_t stream_svr_id;
402 
403     /* stream type */
404     cam_stream_type_t stream_type;
405 
406     /* image format */
407     cam_format_t fmt;
408 
409     /* image dimension */
410     cam_dimension_t dim;
411 
412     /* buffer plane information, will be calc based on stream_type, fmt,
413        dim, and padding_info(from stream config). Info including:
414        offset_x, offset_y, stride, scanline, plane offset */
415     cam_stream_buf_plane_info_t buf_planes;
416 
417     /* number of stream bufs will be allocated */
418     uint8_t num_bufs;
419 
420     /* streaming type */
421     cam_streaming_mode_t streaming_mode;
422     /* num of frames needs to be generated.
423      * only valid when streaming_mode = CAM_STREAMING_MODE_BURST */
424     uint8_t num_of_burst;
425 
426     /* stream specific pp config */
427     cam_pp_feature_config_t pp_config;
428 
429     /* this section is valid if offline reprocess type stream */
430     cam_stream_reproc_config_t reprocess_config;
431 
432     cam_stream_parm_buffer_t parm_buf;    /* stream based parameters */
433 
434     uint8_t useAVTimer; /*flag to indicate use of AVTimer for TimeStamps*/
435 
436     uint8_t dis_enable;
437 
438     /* Image Stabilization type */
439     cam_is_type_t is_type;
440     /* Signifies Secure stream mode */
441     cam_stream_secure_t is_secure;
442 } cam_stream_info_t;
443 
444 /*****************************************************************************
445  *                 Code for Domain Socket Based Parameters                   *
446  ****************************************************************************/
447 #define INCLUDE(PARAM_ID,DATATYPE,COUNT)  \
448         DATATYPE member_variable_##PARAM_ID[ COUNT ]
449 
450 #define POINTER_OF_META(META_ID, TABLE_PTR) \
451         &TABLE_PTR->data.member_variable_##META_ID
452 
453 #define POINTER_OF_PARAM POINTER_OF_META
454 
455 #define IS_META_AVAILABLE(META_ID, TABLE_PTR) \
456         TABLE_PTR->is_valid[META_ID]
457 
458 #define IS_PARAM_AVAILABLE IS_META_AVAILABLE
459 
460 #define SIZE_OF_PARAM(META_ID, TABLE_PTR) \
461          sizeof(TABLE_PTR->data.member_variable_##META_ID)
462 
463 typedef struct {
464 /**************************************************************************************
465  *  ID from (cam_intf_metadata_type_t)                DATATYPE                     COUNT
466  **************************************************************************************/
467     /* common between HAL1 and HAL3 */
468     INCLUDE(CAM_INTF_META_HISTOGRAM,                    cam_hist_stats_t,               1);
469     INCLUDE(CAM_INTF_META_FACE_DETECTION,               cam_face_detection_data_t,      1);
470     INCLUDE(CAM_INTF_META_AUTOFOCUS_DATA,               cam_auto_focus_data_t,          1);
471 
472     /* Specific to HAl1 */
473     INCLUDE(CAM_INTF_META_CROP_DATA,                    cam_crop_data_t,                1);
474     INCLUDE(CAM_INTF_META_PREP_SNAPSHOT_DONE,           int32_t,                        1);
475     INCLUDE(CAM_INTF_META_GOOD_FRAME_IDX_RANGE,         cam_frame_idx_range_t,          1);
476     INCLUDE(CAM_INTF_META_ASD_HDR_SCENE_DATA,           cam_asd_hdr_scene_data_t,       1);
477     INCLUDE(CAM_INTF_META_ASD_SCENE_TYPE,               int32_t,                        1);
478     INCLUDE(CAM_INTF_META_CURRENT_SCENE,                cam_scene_mode_type,            1);
479     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ISP,           cam_chromatix_lite_isp_t,       1);
480     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_PP,            cam_chromatix_lite_pp_t,        1);
481     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AE,            cam_chromatix_lite_ae_stats_t,  1);
482     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AWB,           cam_chromatix_lite_awb_stats_t, 1);
483     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AF,            cam_chromatix_lite_af_stats_t,  1);
484     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ASD,           cam_chromatix_lite_asd_stats_t, 1);
485 
486     /* Specific to HAL3 */
487     INCLUDE(CAM_INTF_META_FRAME_NUMBER_VALID,           int32_t,                     1);
488     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,    int32_t,                     1);
489     INCLUDE(CAM_INTF_META_FRAME_DROPPED,                cam_frame_dropped_t,         1);
490     INCLUDE(CAM_INTF_META_FRAME_NUMBER,                 uint32_t,                    1);
491     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER,          uint32_t,                    1);
492     INCLUDE(CAM_INTF_META_COLOR_CORRECT_MODE,           uint32_t,                    1);
493     INCLUDE(CAM_INTF_META_COLOR_CORRECT_TRANSFORM,      cam_color_correct_matrix_t,  1);
494     INCLUDE(CAM_INTF_META_COLOR_CORRECT_GAINS,          cam_color_correct_gains_t,   1);
495     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM, cam_color_correct_matrix_t,  1);
496     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,     cam_color_correct_gains_t,   1);
497     INCLUDE(CAM_INTF_META_AEC_ROI,                      cam_area_t,                  1);
498     INCLUDE(CAM_INTF_META_AEC_STATE,                    uint32_t,                    1);
499     INCLUDE(CAM_INTF_PARM_FOCUS_MODE,                   uint32_t,                    1);
500     INCLUDE(CAM_INTF_META_AF_ROI,                       cam_area_t,                  1);
501     INCLUDE(CAM_INTF_META_AF_STATE,                     uint32_t,                    1);
502     INCLUDE(CAM_INTF_PARM_WHITE_BALANCE,                int32_t,                     1);
503     INCLUDE(CAM_INTF_META_AWB_REGIONS,                  cam_area_t,                  1);
504     INCLUDE(CAM_INTF_META_AWB_STATE,                    uint32_t,                    1);
505     INCLUDE(CAM_INTF_META_BLACK_LEVEL_LOCK,             uint32_t,                    1);
506     INCLUDE(CAM_INTF_META_MODE,                         uint32_t,                    1);
507     INCLUDE(CAM_INTF_META_EDGE_MODE,                    cam_edge_application_t,      1);
508     INCLUDE(CAM_INTF_META_FLASH_POWER,                  uint32_t,                    1);
509     INCLUDE(CAM_INTF_META_FLASH_FIRING_TIME,            int64_t,                     1);
510     INCLUDE(CAM_INTF_META_FLASH_MODE,                   uint32_t,                    1);
511     INCLUDE(CAM_INTF_META_FLASH_STATE,                  int32_t,                     1);
512     INCLUDE(CAM_INTF_META_HOTPIXEL_MODE,                uint32_t,                    1);
513     INCLUDE(CAM_INTF_META_LENS_APERTURE,                float,                       1);
514     INCLUDE(CAM_INTF_META_LENS_FILTERDENSITY,           float,                       1);
515     INCLUDE(CAM_INTF_META_LENS_FOCAL_LENGTH,            float,                       1);
516     INCLUDE(CAM_INTF_META_LENS_FOCUS_DISTANCE,          float,                       1);
517     INCLUDE(CAM_INTF_META_LENS_FOCUS_RANGE,             float,                       2);
518     INCLUDE(CAM_INTF_META_LENS_STATE,                   uint32_t,                    1);
519     INCLUDE(CAM_INTF_META_LENS_OPT_STAB_MODE,           uint32_t,                    1);
520     INCLUDE(CAM_INTF_META_LENS_FOCUS_STATE,             uint32_t,                    1);
521     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_MODE,         uint32_t,                    1);
522     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_STRENGTH,     uint32_t,                    1);
523     INCLUDE(CAM_INTF_META_SCALER_CROP_REGION,           cam_crop_region_t,           1);
524     INCLUDE(CAM_INTF_META_SCENE_FLICKER,                uint32_t,                    1);
525     INCLUDE(CAM_INTF_META_SENSOR_EXPOSURE_TIME,         int64_t,                     1);
526     INCLUDE(CAM_INTF_META_SENSOR_FRAME_DURATION,        int64_t,                     1);
527     INCLUDE(CAM_INTF_META_SENSOR_SENSITIVITY,           int32_t,                     1);
528     INCLUDE(CAM_INTF_META_SENSOR_TIMESTAMP,             int64_t,                     1);
529     INCLUDE(CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW,  int64_t,                     1);
530     INCLUDE(CAM_INTF_META_SHADING_MODE,                 uint32_t,                    1);
531     INCLUDE(CAM_INTF_META_STATS_FACEDETECT_MODE,        uint32_t,                    1);
532     INCLUDE(CAM_INTF_META_STATS_HISTOGRAM_MODE,         uint32_t,                    1);
533     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,     uint32_t,                    1);
534     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP,          cam_sharpness_map_t,         3);
535     INCLUDE(CAM_INTF_META_TONEMAP_CURVES,               cam_rgb_tonemap_curves,      1);
536     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP,             cam_lens_shading_map_t,      1);
537     INCLUDE(CAM_INTF_META_AEC_INFO,                     cam_3a_params_t,             1);
538     INCLUDE(CAM_INTF_META_SENSOR_INFO,                  cam_sensor_params_t,         1);
539     INCLUDE(CAM_INTF_META_ASD_SCENE_CAPTURE_TYPE,       cam_auto_scene_t,            1);
540     INCLUDE(CAM_INTF_PARM_EFFECT,                       uint32_t,                    1);
541     /* Defining as int32_t so that this array is 4 byte aligned */
542     INCLUDE(CAM_INTF_META_PRIVATE_DATA,                 int32_t,                     MAX_METADATA_PRIVATE_PAYLOAD_SIZE);
543 
544     /* Following are Params only and not metadata currently */
545     INCLUDE(CAM_INTF_PARM_HAL_VERSION,                  int32_t,                     1);
546     /* Shared between HAL1 and HAL3 */
547     INCLUDE(CAM_INTF_PARM_ANTIBANDING,                  uint32_t,                    1);
548     INCLUDE(CAM_INTF_PARM_EXPOSURE_COMPENSATION,        int32_t,                     1);
549     INCLUDE(CAM_INTF_PARM_EV_STEP,                      cam_rational_type_t,         1);
550     INCLUDE(CAM_INTF_PARM_AEC_LOCK,                     uint32_t,                    1);
551     INCLUDE(CAM_INTF_PARM_FPS_RANGE,                    cam_fps_range_t,             1);
552     INCLUDE(CAM_INTF_PARM_AWB_LOCK,                     uint32_t,                    1);
553     INCLUDE(CAM_INTF_PARM_BESTSHOT_MODE,                uint32_t,                    1);
554     INCLUDE(CAM_INTF_PARM_DIS_ENABLE,                   int32_t,                     1);
555     INCLUDE(CAM_INTF_PARM_LED_MODE,                     int32_t,                     1);
556 
557     /* HAL1 specific */
558     /* read only */
559     INCLUDE(CAM_INTF_PARM_QUERY_FLASH4SNAP,             int32_t,                     1);
560     INCLUDE(CAM_INTF_PARM_EXPOSURE,                     int32_t,                     1);
561     INCLUDE(CAM_INTF_PARM_SHARPNESS,                    int32_t,                     1);
562     INCLUDE(CAM_INTF_PARM_CONTRAST,                     int32_t,                     1);
563     INCLUDE(CAM_INTF_PARM_SATURATION,                   int32_t,                     1);
564     INCLUDE(CAM_INTF_PARM_BRIGHTNESS,                   int32_t,                     1);
565     INCLUDE(CAM_INTF_PARM_ISO,                          int32_t,                     1);
566     INCLUDE(CAM_INTF_PARM_ZOOM,                         int32_t,                     1);
567     INCLUDE(CAM_INTF_PARM_ROLLOFF,                      int32_t,                     1);
568     INCLUDE(CAM_INTF_PARM_MODE,                         int32_t,                     1);
569     INCLUDE(CAM_INTF_PARM_AEC_ALGO_TYPE,                int32_t,                     1);
570     INCLUDE(CAM_INTF_PARM_FOCUS_ALGO_TYPE,              int32_t,                     1);
571     INCLUDE(CAM_INTF_PARM_AEC_ROI,                      cam_set_aec_roi_t,           1);
572     INCLUDE(CAM_INTF_PARM_AF_ROI,                       cam_roi_info_t,              1);
573     INCLUDE(CAM_INTF_PARM_SCE_FACTOR,                   int32_t,                     1);
574     INCLUDE(CAM_INTF_PARM_FD,                           cam_fd_set_parm_t,           1);
575     INCLUDE(CAM_INTF_PARM_MCE,                          int32_t,                     1);
576     INCLUDE(CAM_INTF_PARM_HFR,                          int32_t,                     1);
577     INCLUDE(CAM_INTF_PARM_REDEYE_REDUCTION,             int32_t,                     1);
578     INCLUDE(CAM_INTF_PARM_WAVELET_DENOISE,              cam_denoise_param_t,         1);
579     INCLUDE(CAM_INTF_PARM_HISTOGRAM,                    int32_t,                     1);
580     INCLUDE(CAM_INTF_PARM_ASD_ENABLE,                   int32_t,                     1);
581     INCLUDE(CAM_INTF_PARM_RECORDING_HINT,               int32_t,                     1);
582     INCLUDE(CAM_INTF_PARM_HDR,                          cam_hdr_param_t,             1);
583     INCLUDE(CAM_INTF_PARM_FRAMESKIP,                    int32_t,                     1);
584     INCLUDE(CAM_INTF_PARM_ZSL_MODE,                     int32_t,                     1);
585     INCLUDE(CAM_INTF_PARM_HDR_NEED_1X,                  int32_t,                     1);
586     INCLUDE(CAM_INTF_PARM_LOCK_CAF,                     int32_t,                     1);
587     INCLUDE(CAM_INTF_PARM_VIDEO_HDR,                    int32_t,                     1);
588     INCLUDE(CAM_INTF_PARM_VT,                           int32_t,                     1);
589     INCLUDE(CAM_INTF_PARM_GET_CHROMATIX,                tune_chromatix_t,            1);
590     INCLUDE(CAM_INTF_PARM_SET_RELOAD_CHROMATIX,         tune_chromatix_t,            1);
591     INCLUDE(CAM_INTF_PARM_GET_AFTUNE,                   tune_autofocus_t,            1);
592     INCLUDE(CAM_INTF_PARM_SET_RELOAD_AFTUNE,            tune_autofocus_t,            1);
593     INCLUDE(CAM_INTF_PARM_SET_AUTOFOCUSTUNING,          tune_actuator_t,             1);
594     INCLUDE(CAM_INTF_PARM_SET_VFE_COMMAND,              tune_cmd_t,                  1);
595     INCLUDE(CAM_INTF_PARM_SET_PP_COMMAND,               tune_cmd_t,                  1);
596     INCLUDE(CAM_INTF_PARM_MAX_DIMENSION,                cam_dimension_t,             1);
597     INCLUDE(CAM_INTF_PARM_RAW_DIMENSION,                cam_dimension_t,             1);
598     INCLUDE(CAM_INTF_PARM_TINTLESS,                     int32_t,                     1);
599     INCLUDE(CAM_INTF_PARM_CDS_MODE,                     int32_t,                     1);
600     INCLUDE(CAM_INTF_PARM_EZTUNE_CMD,                   cam_eztune_cmd_data_t,       1);
601     INCLUDE(CAM_INTF_PARM_RDI_MODE,                     int32_t,                     1);
602     INCLUDE(CAM_INTF_PARM_BURST_NUM,                    uint32_t,                    1);
603     INCLUDE(CAM_INTF_PARM_RETRO_BURST_NUM,              uint32_t,                    1);
604     INCLUDE(CAM_INTF_PARM_BURST_LED_ON_PERIOD,          uint32_t,                    1);
605 
606     /* HAL3 specific */
607     INCLUDE(CAM_INTF_META_STREAM_INFO,                  cam_stream_size_info_t,      1);
608     INCLUDE(CAM_INTF_META_AEC_MODE,                     uint32_t,                    1);
609     INCLUDE(CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,       cam_trigger_t,               1);
610     INCLUDE(CAM_INTF_META_AF_TRIGGER,                   cam_trigger_t,               1);
611     INCLUDE(CAM_INTF_META_CAPTURE_INTENT,               uint32_t,                    1);
612     INCLUDE(CAM_INTF_META_DEMOSAIC,                     int32_t,                     1);
613     INCLUDE(CAM_INTF_META_SHARPNESS_STRENGTH,           int32_t,                     1);
614     INCLUDE(CAM_INTF_META_GEOMETRIC_MODE,               uint32_t,                    1);
615     INCLUDE(CAM_INTF_META_GEOMETRIC_STRENGTH,           uint32_t,                    1);
616     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP_MODE,        uint32_t,                    1);
617     INCLUDE(CAM_INTF_META_SHADING_STRENGTH,             uint32_t,                    1);
618     INCLUDE(CAM_INTF_META_TONEMAP_MODE,                 uint32_t,                    1);
619     INCLUDE(CAM_INTF_META_STREAM_ID,                    cam_stream_ID_t,             1);
620     INCLUDE(CAM_INTF_PARM_STATS_DEBUG_MASK,             uint32_t,                    1);
621     INCLUDE(CAM_INTF_PARM_STATS_AF_PAAF,                uint32_t,                    1);
622     INCLUDE(CAM_INTF_PARM_FOCUS_BRACKETING,             cam_af_bracketing_t,         1);
623     INCLUDE(CAM_INTF_PARM_FLASH_BRACKETING,             cam_flash_bracketing_t,      1);
624     INCLUDE(CAM_INTF_META_JPEG_GPS_COORDINATES,         double,                      3);
625     INCLUDE(CAM_INTF_META_JPEG_GPS_PROC_METHODS,        uint32_t,                    GPS_PROCESSING_METHOD_SIZE_IN_WORD);
626     INCLUDE(CAM_INTF_META_JPEG_GPS_TIMESTAMP,           int64_t,                     1);
627     INCLUDE(CAM_INTF_META_JPEG_ORIENTATION,             int32_t,                     1);
628     INCLUDE(CAM_INTF_META_JPEG_QUALITY,                 uint32_t,                    1);
629     INCLUDE(CAM_INTF_META_JPEG_THUMB_QUALITY,           uint32_t,                    1);
630     INCLUDE(CAM_INTF_META_JPEG_THUMB_SIZE,              cam_dimension_t,             1);
631     INCLUDE(CAM_INTF_META_TEST_PATTERN_DATA,            cam_test_pattern_data_t,     1);
632     INCLUDE(CAM_INTF_META_PROFILE_TONE_CURVE,           cam_profile_tone_curve,      1);
633     INCLUDE(CAM_INTF_META_OTP_WB_GRGB,                  float,                       1);
634     INCLUDE(CAM_INTF_PARM_CAC,                          cam_aberration_mode_t,       1);
635     INCLUDE(CAM_INTF_META_NEUTRAL_COL_POINT,            cam_neutral_col_point_t,     1);
636     INCLUDE(CAM_INTF_PARM_ROTATION,                     cam_rotation_info_t,         1);
637 } parm_data_t;
638 
639 typedef parm_data_t metadata_data_t;
640 
641 /****************************DO NOT MODIFY BELOW THIS LINE!!!!*********************/
642 
643 typedef struct {
644     union{
645         /* Hash table of 'is valid' flags */
646         uint8_t         is_valid[CAM_INTF_PARM_MAX];
647 
648         /* Hash table of 'is required' flags for the GET PARAM */
649         uint8_t         is_reqd[CAM_INTF_PARM_MAX];
650     };
651     metadata_data_t data;
652     /*Tuning Data */
653     uint8_t is_tuning_params_valid;
654     tuning_params_t tuning_params;
655 } metadata_buffer_t;
656 
657 typedef metadata_buffer_t parm_buffer_t;
658 
659 #ifdef  __cplusplus
660 extern "C" {
661 #endif
662 
663 void *get_pointer_of(cam_intf_parm_type_t meta_id,
664         const metadata_buffer_t* metadata);
665 
666 uint32_t get_size_of(cam_intf_parm_type_t param_id);
667 
668 #ifdef  __cplusplus
669 }
670 #endif
671 
672 #endif /* __QCAMERA_INTF_H__ */
673