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_INTF_H__
31 #define __QCAMERA_INTF_H__
32 
33 // System dependencies
34 #include <string.h>
35 #include <media/msmb_isp.h>
36 
37 // Camera dependencies
38 #include "cam_types.h"
39 
40 #define CAM_PRIV_IOCTL_BASE (V4L2_CID_PRIVATE_BASE + MSM_CAMERA_PRIV_CMD_MAX)
41 typedef enum {
42     /* session based parameters */
43     CAM_PRIV_PARM = CAM_PRIV_IOCTL_BASE,
44     /* session based action: do auto focus.*/
45     CAM_PRIV_DO_AUTO_FOCUS,
46     /* session based action: cancel auto focus.*/
47     CAM_PRIV_CANCEL_AUTO_FOCUS,
48     /* session based action: prepare for snapshot.*/
49     CAM_PRIV_PREPARE_SNAPSHOT,
50     /* sync stream info.*/
51     CAM_PRIV_STREAM_INFO_SYNC,
52     /* stream based parameters*/
53     CAM_PRIV_STREAM_PARM,
54     /* start ZSL snapshot.*/
55     CAM_PRIV_START_ZSL_SNAPSHOT,
56     /* stop ZSL snapshot.*/
57     CAM_PRIV_STOP_ZSL_SNAPSHOT,
58     /* event for related sensors synchronization. */
59     CAM_PRIV_DUAL_CAM_CMD,
60     /* flush */
61     CAM_PRIV_FLUSH
62 } cam_private_ioctl_enum_t;
63 
64 typedef enum {
65     /* start syncing for related cameras */
66     CAM_SYNC_RELATED_SENSORS_ON = 1,
67     /* stop syncing for related cameras */
68     CAM_SYNC_RELATED_SENSORS_OFF
69 } cam_sync_related_sensors_control_t;
70 
71 typedef enum {
72     /* Driving camera of the related camera sub-system */
73     /* Certain features are enabled only for primary camera
74        such as display mode for preview, autofocus etc
75        In certain configurations for eg. when optical zoom
76        limit is reached, Aux Camera would become
77        the driving camera and there will be role switch.*/
78     CAM_MODE_PRIMARY = 0,
79     /* Non-driving camera of the related camera sub-system
80        no display mode set for secondary camera */
81     CAM_MODE_SECONDARY
82 } cam_sync_mode_t;
83 
84 /*Enum to inform about camera type in dual camera use-cases*/
85 typedef enum {
86     CAM_ROLE_DEFAULT,
87     CAM_ROLE_BAYER,
88     CAM_ROLE_MONO,
89     CAM_ROLE_WIDE,
90     CAM_ROLE_TELE
91 } cam_dual_camera_role_t;
92 
93 /* Enum to define different low performance modes in dual camera*/
94 typedef enum {
95     CAM_PERF_NONE,
96     CAM_PERF_SENSOR_SUSPEND,
97     CAM_PERF_ISPIF_FRAME_DROP,
98     CAM_PERF_ISPIF_FRAME_SKIP,
99     CAM_PERF_STATS_FPS_CONTROL
100 } cam_dual_camera_perf_mode_t;
101 
102 /*Enum to inform about camera type in dual camera use-cases*/
103 typedef enum {
104     CAM_DEFER_DEFAULT,
105     CAM_DEFER_START,
106     CAM_DEFER_PROCESS,
107     CAM_DEFER_FLUSH
108 } cam_dual_camera_defer_cmd_t;
109 
110 /* Payload for sending bundling info to backend */
111 typedef struct {
112     cam_sync_related_sensors_control_t sync_control;
113     cam_sync_type_t type;
114     cam_sync_mode_t mode;
115     cam_3a_sync_mode_t sync_3a_mode;
116     cam_dual_camera_role_t cam_role;
117     /* session Id of the other camera session
118        Linking will be done with this session in the
119        backend */
120     uint32_t related_sensor_session_id;
121     uint8_t is_frame_sync_enabled;
122     /*Low power mode type. Static info per device*/
123     cam_dual_camera_perf_mode_t perf_mode;
124     /*flag indicating if hw-sync is enabled*/
125     uint8_t is_hw_sync_enabled;
126 } cam_dual_camera_bundle_info_t;
127 typedef cam_dual_camera_bundle_info_t cam_sync_related_sensors_event_info_t;
128 
129 /* Structrue to update master camera info in dual camera case*/
130 typedef struct {
131     cam_sync_mode_t mode;
132 } cam_dual_camera_master_info_t;
133 
134 /* Structrue to control performance info in dual camera case*/
135 typedef struct {
136     cam_dual_camera_perf_mode_t perf_mode; /*Control perf using FPS if set*/
137     uint8_t enable;  /*Enable or diable Low power mode*/
138     uint8_t priority; /*Can be used to make LPM forcefully*/
139 } cam_dual_camera_perf_control_t;
140 
141 /* dual camera event payload */
142 typedef struct {
143     cam_dual_camera_cmd_type cmd_type; /*dual camera command type*/
144 
145     /*Payload to carry command info*/
146     union {
147         cam_dual_camera_bundle_info_t  bundle_info;
148         cam_dual_camera_master_info_t  mode;
149         cam_dual_camera_perf_control_t value;
150         cam_dual_camera_defer_cmd_t defer_cmd;
151     };
152 } cam_dual_camera_cmd_info_t;
153 
154 /* Related camera sensor specific calibration data */
155 // Align bytes according to API document.
156 #pragma pack(2)
157 typedef struct {
158     /* Focal length in pixels @ calibration resolution.*/
159     float       normalized_focal_length;
160     /* Native sensor resolution W that was used to capture calibration image */
161     uint16_t    native_sensor_resolution_width;
162     /* Native sensor resolution H that was used to capture calibration image */
163     uint16_t    native_sensor_resolution_height;
164     /* Image size W used internally by calibration tool */
165     uint16_t    calibration_sensor_resolution_width;
166     /* Image size H used internally by calibration tool */
167     uint16_t    calibration_sensor_resolution_height;
168     /* Focal length ratio @ Calibration */
169     float       focal_length_ratio;
170 }cam_related_sensor_calibration_data_t;
171 #pragma pack()
172 
173 /* Related Camera System Calibration data
174    Calibration data for the entire related cam sub-system is
175    in a shared EEPROM. We have 2 fields which are specific to
176    each sensor followed by a set of common calibration of the
177    entire related cam system*/
178 // Align bytes according to API document.
179 #pragma pack(2)
180 typedef struct {
181     /* Version information */
182     uint32_t    calibration_format_version;
183     /* Main Camera Sensor specific calibration */
184     cam_related_sensor_calibration_data_t  main_cam_specific_calibration;
185     /* Aux Camera Sensor specific calibration */
186     cam_related_sensor_calibration_data_t  aux_cam_specific_calibration;
187     /* Relative viewpoint matching matrix w.r.t Main */
188     float      relative_rotation_matrix[RELCAM_CALIB_ROT_MATRIX_MAX];
189     /* Relative geometric surface description parameters */
190     float      relative_geometric_surface_parameters[
191             RELCAM_CALIB_SURFACE_PARMS_MAX];
192     /* Relative offset of sensor center from optical axis along horizontal dimension */
193     float      relative_principle_point_x_offset;
194     /* Relative offset of sensor center from optical axis along vertical dimension */
195     float      relative_principle_point_y_offset;
196     /* 0=Main Camera is on the left of Aux; 1=Main Camera is on the right of Aux */
197     uint16_t   relative_position_flag;
198     /* Camera separation in mm */
199     float      relative_baseline_distance;
200     /* main sensor setting during cal: 0-none, 1-hor-mirror, 2-ver-flip, 3-both */
201     uint16_t   main_sensor_mirror_flip_setting;
202     /* aux sensor setting during cal: 0-none, 1-hor-mirror, 2-ver-flip, 3-both */
203     uint16_t   aux_sensor_mirror_flip_setting;
204     /* module orientation during cal: 0-sensors in landscape, 1-sensors in portrait */
205     uint16_t   module_orientation_during_calibration;
206     /* cal images required rotation: 0-no, 1-90 degrees right, 2-90 degrees left */
207     uint16_t   rotation_flag;
208     /* AEC sync OTP data */
209     /* AEC sync brightness ration. Fixed Point Q10*/
210     int16_t    brightness_ratio;
211     /* Reference aux gain value obtained from setup stage and used during calibration stage */
212     /* Fixed Point Q10 */
213     int16_t    ref_aux_gain;
214     /* Reference aux line count obtained from setup stage and used during calibration stage */
215     uint16_t   ref_aux_linecount;
216     /* Reference master gain value obtained from setup stage and used during calibration stage */
217     /* Fixed Point Q10 */
218     int16_t    ref_master_gain;
219     /* Reference master line count obtained from setup stage and used during calibration stage */
220     uint16_t   ref_master_linecount;
221     /* Reference master color temperature */
222     uint16_t   ref_master_color_temperature;
223     /* Reserved for future use */
224     float      reserved[RELCAM_CALIB_RESERVED_MAX];
225     void       *dc_otp_params;
226     int        dc_otp_size; /* in bytes */
227 } cam_related_system_calibration_data_t;
228 #pragma pack()
229 
230 typedef struct {
231   uint32_t default_sensor_flip;
232   uint32_t sensor_mount_angle;
233   cam_related_system_calibration_data_t otp_calibration_data;
234 } cam_jpeg_metadata_t;
235 
236 /* capability struct definition for HAL 1*/
237 struct cam_capability;
238 typedef struct cam_capability{
239     cam_hal_version_t version;
240 
241     cam_position_t position;                                /* sensor position: front, back */
242 
243     uint8_t auto_hdr_supported;
244 
245     uint16_t isWnrSupported;
246     /* supported iso modes */
247     size_t supported_iso_modes_cnt;
248     cam_iso_mode_type supported_iso_modes[CAM_ISO_MODE_MAX];
249 
250     /* supported flash modes */
251     size_t supported_flash_modes_cnt;
252     cam_flash_mode_t supported_flash_modes[CAM_FLASH_MODE_MAX];
253 
254     size_t zoom_ratio_tbl_cnt;                              /* table size for zoom ratios */
255     uint32_t zoom_ratio_tbl[MAX_ZOOMS_CNT];                 /* zoom ratios table */
256 
257     /* supported effect modes */
258     size_t supported_effects_cnt;
259     cam_effect_mode_type supported_effects[CAM_EFFECT_MODE_MAX];
260 
261     /* supported scene modes */
262     size_t supported_scene_modes_cnt;
263     cam_scene_mode_type supported_scene_modes[CAM_SCENE_MODE_MAX];
264 
265     /* supported auto exposure modes */
266     size_t supported_aec_modes_cnt;
267     cam_auto_exposure_mode_type supported_aec_modes[CAM_AEC_MODE_MAX];
268 
269     size_t fps_ranges_tbl_cnt;                              /* fps ranges table size */
270     cam_fps_range_t fps_ranges_tbl[MAX_SIZES_CNT];          /* fps ranges table */
271 
272     /* supported antibanding modes */
273     size_t supported_antibandings_cnt;
274     cam_antibanding_mode_type supported_antibandings[CAM_ANTIBANDING_MODE_MAX];
275 
276     /* supported white balance modes */
277     size_t supported_white_balances_cnt;
278     cam_wb_mode_type supported_white_balances[CAM_WB_MODE_MAX];
279 
280     /* Capability list of supported insensor HDR types
281      * Backend is expected to fill in all the supported types and set appropriate
282      * count, see cam_sensor_hdr_type_t for valid types
283     */
284     size_t supported_sensor_hdr_types_cnt;
285     cam_sensor_hdr_type_t supported_sensor_hdr_types[CAM_SENSOR_HDR_MAX];
286 
287     /* supported manual wb cct */
288     int32_t min_wb_cct;
289     int32_t max_wb_cct;
290 
291     /* supported manual wb rgb gains */
292     float min_wb_gain;
293     float max_wb_gain;
294 
295     /* supported focus modes */
296     size_t supported_focus_modes_cnt;
297     cam_focus_mode_type supported_focus_modes[CAM_FOCUS_MODE_MAX];
298 
299     /* supported manual focus position */
300     float min_focus_pos[CAM_MANUAL_FOCUS_MODE_MAX];
301     float max_focus_pos[CAM_MANUAL_FOCUS_MODE_MAX];
302 
303     int32_t exposure_compensation_min;       /* min value of exposure compensation index */
304     int32_t exposure_compensation_max;       /* max value of exposure compensation index */
305     int32_t exposure_compensation_default;   /* default value of exposure compensation index */
306     float exposure_compensation_step;
307     cam_rational_type_t exp_compensation_step;    /* exposure compensation step value */
308 
309     uint8_t video_stablization_supported; /* flag id video stablization is supported */
310 
311     size_t picture_sizes_tbl_cnt;                           /* picture sizes table size */
312     cam_dimension_t picture_sizes_tbl[MAX_SIZES_CNT];       /* picture sizes table */
313     /* The minimum frame duration that is supported for each
314      * resolution in availableProcessedSizes. Should correspond
315      * to the frame duration when only that processed stream
316      * is active, with all processing set to FAST */
317     int64_t picture_min_duration[MAX_SIZES_CNT];
318 
319     /* capabilities specific to HAL 1 */
320 
321     int32_t modes_supported;                                /* mask of modes supported: 2D, 3D */
322     uint32_t sensor_mount_angle;                            /* sensor mount angle */
323 
324     float focal_length;                                     /* focal length */
325     float hor_view_angle;                                   /* horizontal view angle */
326     float ver_view_angle;                                   /* vertical view angle */
327     cam_lens_type_t lens_type;                              /*Lens type info - Wide, Tele*/
328 
329     size_t preview_sizes_tbl_cnt;                           /* preview sizes table size */
330     cam_dimension_t preview_sizes_tbl[MAX_SIZES_CNT];       /* preiew sizes table */
331 
332     size_t video_sizes_tbl_cnt;                             /* video sizes table size */
333     cam_dimension_t video_sizes_tbl[MAX_SIZES_CNT];         /* video sizes table */
334 
335 
336     size_t livesnapshot_sizes_tbl_cnt;                      /* livesnapshot sizes table size */
337     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
338 
339     size_t vhdr_livesnapshot_sizes_tbl_cnt;                 /* vhdr_livesnapshot sizes table size */
340     cam_dimension_t vhdr_livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* vhdr_livesnapshot sizes table */
341 
342     size_t hfr_tbl_cnt;                                     /* table size for HFR */
343     cam_hfr_info_t hfr_tbl[CAM_HFR_MODE_MAX];               /* HFR table */
344 
345     size_t zzhdr_sizes_tbl_cnt;                             /* Number of resolutions in zzHDR mode*/
346     cam_dimension_t zzhdr_sizes_tbl[MAX_SIZES_CNT];         /* Table for ZZHDR supported sizes */
347 
348     size_t supported_quadra_cfa_dim_cnt;              /* Number of resolutions in Quadra CFA mode */
349     cam_dimension_t quadra_cfa_dim[MAX_SIZES_CNT];    /* Table for Quadra CFA supported sizes */
350     cam_format_t quadra_cfa_format;                   /* Quadra CFA output format */
351     uint32_t is_remosaic_lib_present;                 /* Flag indicating if remosaic lib present */
352 
353     /* supported preview formats */
354     size_t supported_preview_fmt_cnt;
355     cam_format_t supported_preview_fmts[CAM_FORMAT_MAX];
356 
357     /* supported picture formats */
358     size_t supported_picture_fmt_cnt;
359     cam_format_t supported_picture_fmts[CAM_FORMAT_MAX];
360 
361     uint8_t max_downscale_factor;
362 
363     /* dimension and supported output format of raw dump from camif */
364     size_t supported_raw_dim_cnt;
365     cam_dimension_t raw_dim[MAX_SIZES_CNT];
366     size_t supported_raw_fmt_cnt;
367     cam_format_t supported_raw_fmts[CAM_FORMAT_MAX];
368     /* The minimum frame duration that is supported for above
369        raw resolution */
370     int64_t raw_min_duration[MAX_SIZES_CNT];
371 
372     /* 3A version*/
373     cam_q3a_version_t q3a_version;
374     /* supported focus algorithms */
375     size_t supported_focus_algos_cnt;
376     cam_focus_algorithm_type supported_focus_algos[CAM_FOCUS_ALGO_MAX];
377 
378 
379     uint8_t auto_wb_lock_supported;       /* flag if auto white balance lock is supported */
380     uint8_t zoom_supported;               /* flag if zoom is supported */
381     uint8_t smooth_zoom_supported;        /* flag if smooth zoom is supported */
382     uint8_t auto_exposure_lock_supported; /* flag if auto exposure lock is supported */
383     uint8_t video_snapshot_supported;     /* flag if video snapshot is supported */
384 
385     uint8_t max_num_roi;                  /* max number of roi can be detected */
386     uint8_t max_num_focus_areas;          /* max num of focus areas */
387     uint8_t max_num_metering_areas;       /* max num opf metering areas */
388     uint8_t max_zoom_step;                /* max zoom step value */
389 
390     /* QCOM specific control */
391     cam_control_range_t brightness_ctrl;  /* brightness */
392     cam_control_range_t sharpness_ctrl;   /* sharpness */
393     cam_control_range_t contrast_ctrl;    /* contrast */
394     cam_control_range_t saturation_ctrl;  /* saturation */
395     cam_control_range_t sce_ctrl;         /* skintone enhancement factor */
396 
397     /* QCOM HDR specific control. Indicates number of frames and exposure needs for the frames */
398     cam_hdr_bracketing_info_t hdr_bracketing_setting;
399 
400     cam_feature_mask_t qcom_supported_feature_mask; /* mask of qcom specific features supported:
401                                                      * such as CAM_QCOM_FEATURE_SUPPORTED_FACE_DETECTION*/
402     cam_padding_info_t padding_info;      /* padding information from PP */
403     uint32_t min_num_pp_bufs;             /* minimum number of buffers needed by postproc module */
404     cam_format_t rdi_mode_stream_fmt;  /* stream format supported in rdi mode */
405 
406     /* capabilities specific to HAL 3 */
407 
408     float min_focus_distance;
409     float hyper_focal_distance;
410 
411     float focal_lengths[CAM_FOCAL_LENGTHS_MAX];
412     uint8_t focal_lengths_count;
413 
414     /* Needs to be regular f number instead of APEX */
415     float apertures[CAM_APERTURES_MAX];
416     uint8_t apertures_count;
417 
418     float filter_densities[CAM_FILTER_DENSITIES_MAX];
419     uint8_t filter_densities_count;
420 
421     cam_optical_stab_modes_t optical_stab_modes[CAM_OPT_STAB_MAX];
422     uint8_t optical_stab_modes_count;
423 
424     cam_dimension_t lens_shading_map_size;
425 
426     cam_dimension_t geo_correction_map_size;
427     float geo_correction_map[2 * 3 * CAM_MAX_MAP_WIDTH *
428               CAM_MAX_MAP_HEIGHT];
429 
430     float lens_position[3];
431 
432     /* nano seconds */
433     int64_t exposure_time_range[EXPOSURE_TIME_RANGE_CNT];
434 
435     /* nano seconds */
436     int64_t max_frame_duration;
437 
438     cam_color_filter_arrangement_t color_arrangement;
439     uint8_t num_color_channels;
440 
441     /* parameters required to calculate S and O co-efficients */
442     double gradient_S;
443     double offset_S;
444     double gradient_O;
445     double offset_O;
446 
447     float sensor_physical_size[SENSOR_PHYSICAL_SIZE_CNT];
448 
449     /* Dimensions of full pixel array, possibly including
450        black calibration pixels */
451     cam_dimension_t pixel_array_size;
452     /* Area of raw data which corresponds to only active
453        pixels; smaller or equal to pixelArraySize. */
454     cam_rect_t active_array_size;
455 
456     /* Maximum raw value output by sensor */
457     int32_t white_level;
458 
459     /* A fixed black level offset for each of the Bayer
460        mosaic channels in RGGB order*/
461     int32_t black_level_pattern[BLACK_LEVEL_PATTERN_CNT];
462 
463     /* Time taken before flash can fire again in nano secs */
464     int64_t flash_charge_duration;
465 
466     /* flash firing power */
467     size_t supported_flash_firing_level_cnt;
468     cam_format_t supported_firing_levels[CAM_FLASH_FIRING_LEVEL_MAX];
469 
470     /* Flash Firing Time */
471     int64_t flash_firing_time;
472 
473     /* Flash Ciolor Temperature */
474     uint8_t flash_color_temp;
475 
476     /* Flash max Energy */
477     uint8_t flash_max_energy;
478 
479     /* Maximum number of supported points in the tonemap
480        curve */
481     int32_t max_tone_map_curve_points;
482 
483     /* supported formats */
484     size_t supported_scalar_format_cnt;
485     cam_format_t supported_scalar_fmts[CAM_FORMAT_MAX];
486 
487     uint32_t max_face_detection_count;
488     uint8_t face_bsgc;
489 
490     uint8_t histogram_supported;
491     /* Number of histogram buckets supported */
492     int32_t histogram_size;
493     /* Maximum value possible for a histogram bucket */
494     int32_t max_histogram_count;
495 
496     cam_dimension_t sharpness_map_size;
497 
498     /* Maximum value possible for a sharpness map region */
499     int32_t max_sharpness_map_value;
500 
501     /*Autoexposure modes for camera 3 api*/
502     size_t supported_ae_modes_cnt;
503     cam_ae_mode_type supported_ae_modes[CAM_AE_MODE_MAX];
504 
505 
506     cam_sensitivity_range_t sensitivity_range;
507     int32_t max_analog_sensitivity;
508 
509     /* ISP digital gain */
510     cam_sensitivity_range_t isp_sensitivity_range;
511 
512     /* picture sizes need scale*/
513     cam_scene_mode_overrides_t scene_mode_overrides[CAM_SCENE_MODE_MAX];
514     size_t scale_picture_sizes_cnt;
515     cam_dimension_t scale_picture_sizes[MAX_SCALE_SIZES_CNT];
516 
517     uint8_t flash_available;
518 
519     cam_rational_type_t base_gain_factor;    /* sensor base gain factor */
520     /* AF Bracketing info */
521     cam_af_bracketing_t  ubifocus_af_bracketing_need;
522     cam_af_bracketing_t  refocus_af_bracketing_need;
523     /* opti Zoom info */
524     cam_opti_zoom_t      opti_zoom_settings_need;
525     /* still more info */
526     cam_still_more_t  stillmore_settings_need;
527     /* chroma flash info */
528     cam_chroma_flash_t chroma_flash_settings_need;
529 
530     cam_rational_type_t forward_matrix[3][3];
531     cam_rational_type_t color_transform[3][3];
532 
533     uint8_t focus_dist_calibrated;
534     uint8_t supported_test_pattern_modes_cnt;
535     cam_test_pattern_mode_t supported_test_pattern_modes[MAX_TEST_PATTERN_CNT];
536 
537     int64_t stall_durations[MAX_SIZES_CNT];
538 
539     cam_illuminat_t reference_illuminant1;
540     cam_illuminat_t reference_illuminant2;
541 
542     int64_t jpeg_stall_durations[MAX_SIZES_CNT];
543     int64_t raw16_stall_durations[MAX_SIZES_CNT];
544     cam_rational_type_t forward_matrix1[FORWARD_MATRIX_ROWS][FORWARD_MATRIX_COLS];
545     cam_rational_type_t forward_matrix2[FORWARD_MATRIX_ROWS][FORWARD_MATRIX_COLS];
546     cam_rational_type_t color_transform1[COLOR_TRANSFORM_ROWS][COLOR_TRANSFORM_COLS];
547     cam_rational_type_t color_transform2[COLOR_TRANSFORM_ROWS][COLOR_TRANSFORM_COLS];
548     cam_rational_type_t calibration_transform1[CAL_TRANSFORM_ROWS][CAL_TRANSFORM_COLS];
549     cam_rational_type_t calibration_transform2[CAL_TRANSFORM_ROWS][CAL_TRANSFORM_COLS];
550     uint16_t isCacSupported;
551 
552     cam_opaque_raw_format_t opaque_raw_fmt;
553 
554     /* true Portrait info */
555     cam_true_portrait_t  true_portrait_settings_need;
556 
557     /* Sensor type information */
558     cam_sensor_type_t sensor_type;
559 
560     cam_aberration_mode_t aberration_modes[CAM_COLOR_CORRECTION_ABERRATION_MAX];
561     uint32_t aberration_modes_count;
562 
563     /* Can the sensor timestamp be compared to
564      * timestamps from other sub-systems (gyro, accelerometer etc.) */
565     uint8_t isTimestampCalibrated;
566 
567     /* Max size supported by ISP viewfinder path */
568     cam_dimension_t max_viewfinder_size;
569 
570     /* Analysis buffer requirements */
571     cam_analysis_info_t analysis_info[CAM_ANALYSIS_INFO_MAX];
572 
573     /* This is set to 'true' if sensor cannot guarantee per frame control */
574     /* Default value of this capability is 'false' indicating per-frame */
575     /* control is supported */
576     uint8_t no_per_frame_control_support;
577 
578     /* EIS information */
579     uint8_t supported_is_types_cnt;
580     uint32_t supported_is_types[IS_TYPE_MAX];
581     /*for each type, specify the margin needed. Margin will be
582       the decimal representation of a percentage
583       ex: 10% margin = 0.1 */
584     float supported_is_type_margins[IS_TYPE_MAX];
585 
586     /* Max cpp batch size */
587     uint8_t max_batch_bufs_supported;
588     uint32_t buf_alignment;
589     uint32_t min_stride;
590     uint32_t min_scanline;
591     uint8_t flash_dev_name[QCAMERA_MAX_FILEPATH_LENGTH];
592     uint8_t eeprom_version_info[MAX_EEPROM_VERSION_INFO_LEN];
593 
594     /* maximum pixel bandwidth shared between cameras */
595     uint64_t max_pixel_bandwidth;
596 
597     /* Array of K integers, where K%4==0,
598       as a list of rectangles in the pixelArray co-ord system
599       left, top, right, bottom */
600     int32_t optical_black_regions[MAX_OPTICAL_BLACK_REGIONS * 4];
601     /* Count is K/4 */
602     uint8_t optical_black_region_count;
603 
604     /* hot pixel */
605     uint8_t hotPixel_mode;
606     uint32_t hotPixel_count;
607     cam_coordinate_type_t hotPixelMap[512];
608 
609     /* supported instant capture/AEC convergence modes */
610     size_t supported_instant_aec_modes_cnt;
611     cam_aec_convergence_type supported_instant_aec_modes[CAM_AEC_CONVERGENCE_MAX];
612 
613     /* Dual cam calibration data */
614     cam_related_system_calibration_data_t related_cam_calibration;
615 
616     /* Maximum degree of rotation along X axis for tele sensor with respect to the wide sensor*/
617     float      max_roll_degrees;
618     /* Maximum degree of rotation along Y axis for tele sensor with respect to the wide sensor*/
619     float      max_pitch_degrees;
620     /* Maximum degree of rotation along Z axis for tele sensor with respect to the wide sensor*/
621     float      max_yaw_degrees;
622 
623     /* Pixel pitch in micrometer*/
624     float      pixel_pitch_um;
625 
626     /* Meta_RAW capability */
627     uint8_t meta_raw_channel_count;
628     uint8_t vc[MAX_SIZES_CNT];
629     uint8_t dt[MAX_SIZES_CNT];
630     cam_format_t supported_meta_raw_fmts[CAM_FORMAT_MAX];
631     cam_dimension_t raw_meta_dim[MAX_SIZES_CNT];
632     cam_sub_format_type_t sub_fmt[CAM_FORMAT_SUBTYPE_MAX];
633     /* Supported IR Mode */
634     size_t supported_ir_mode_cnt;
635     cam_ir_mode_type_t supported_ir_modes[CAM_IR_MODE_MAX];
636 
637     /* Supported binning correction Mode */
638     size_t supported_binning_correction_mode_cnt;
639     cam_binning_correction_mode_t supported_binning_modes[CAM_BINNING_CORRECTION_MODE_MAX];
640 
641     /*camera index*/
642     uint32_t camera_index;
643 
644     /*main and aux cam capability*/
645     struct cam_capability *main_cam_cap;
646     struct cam_capability *aux_cam_cap;
647     cam_sync_type_t cam_sensor_mode;
648 
649     /*Available Spatial Alignment solutions*/
650     uint32_t avail_spatial_align_solns;
651 
652     /* Whether camera timestamp is calibrated with sensor */
653     uint8_t timestamp_calibrated;
654 
655     /*PDAF calibration data*/
656     cam_pd_calibration_t pdaf_cal;
657 
658     /*White balance calibration data*/
659     cam_wb_calibration_t wb_cal;
660 
661     /*Max zoom ratio*/
662     float max_zoom;
663 
664 } cam_capability_t;
665 
666 typedef enum {
667     CAM_STREAM_PARAM_TYPE_DO_REPROCESS = CAM_INTF_PARM_DO_REPROCESS,
668     CAM_STREAM_PARAM_TYPE_SET_BUNDLE_INFO = CAM_INTF_PARM_SET_BUNDLE,
669     CAM_STREAM_PARAM_TYPE_SET_FLIP = CAM_INTF_PARM_STREAM_FLIP,
670     CAM_STREAM_PARAM_TYPE_GET_OUTPUT_CROP = CAM_INTF_PARM_GET_OUTPUT_CROP,
671     CAM_STREAM_PARAM_TYPE_GET_IMG_PROP = CAM_INTF_PARM_GET_IMG_PROP,
672     CAM_STREAM_PARAM_TYPE_REQUEST_FRAMES = CAM_INTF_PARM_REQUEST_FRAMES,
673     CAM_STREAM_PARAM_TYPE_REQUEST_OPS_MODE = CAM_INTF_PARM_REQUEST_OPS_MODE,
674     CAM_STREAM_PARAM_TYPE_FLUSH_FRAME = CAM_INTF_PARM_FLUSH_FRAMES,
675     CAM_STREAM_PARAM_TYPE_MAX
676 } cam_stream_param_type_e;
677 
678 typedef struct {
679     uint32_t buf_index;           /* buf index to the source frame buffer that needs reprocess,
680                                     (assume buffer is already mapped)*/
681     uint32_t frame_idx;           /* frame id of source frame to be reprocessed */
682     int32_t ret_val;              /* return value from reprocess. Could have different meanings.
683                                      i.e., faceID in the case of face registration. */
684     uint8_t meta_present;         /* if there is meta data associated with this reprocess frame */
685     uint32_t meta_stream_handle;  /* meta data stream ID. only valid if meta_present != 0 */
686     uint32_t meta_buf_index;      /* buf index to meta data buffer. only valid if meta_present != 0 */
687 
688     uint8_t is_offline_meta_bypass;
689 
690     /* opaque metadata required for reprocessing */
691     int32_t private_data[MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES];
692     cam_rect_t crop_rect;
693     uint8_t is_uv_subsampled;
694 } cam_reprocess_param;
695 
696 typedef struct {
697     uint32_t flip_mask;
698 } cam_flip_mode_t;
699 
700 #define IMG_NAME_SIZE 32
701 typedef struct {
702     cam_rect_t crop;  /* crop info for the image */
703     cam_dimension_t input; /* input dimension of the image */
704     cam_dimension_t output; /* output dimension of the image */
705     char name[IMG_NAME_SIZE]; /* optional name of the ext*/
706     cam_format_t format; /* image format */
707 } cam_stream_img_prop_t;
708 
709 typedef struct {
710     uint8_t enableStream; /*0 - stop and 1-start */
711 } cam_request_frames;
712 
713 typedef struct {
714     cam_stream_param_type_e type;
715     union {
716         cam_reprocess_param reprocess;  /* do reprocess */
717         cam_bundle_config_t bundleInfo; /* set bundle info*/
718         cam_flip_mode_t flipInfo;       /* flip mode */
719         cam_crop_data_t outputCrop;     /* output crop for current frame */
720         cam_stream_img_prop_t imgProp;  /* image properties of current frame */
721         cam_request_frames frameRequest; /*do TNR process*/
722         cam_perf_mode_t perf_mode;       /*request operational mode*/
723     };
724 } cam_stream_parm_buffer_t;
725 
726 /* stream info */
727 typedef struct cam_stream_info {
728     /* stream ID from server */
729     uint32_t stream_svr_id;
730 
731     /* stream type */
732     cam_stream_type_t stream_type;
733 
734     /* image format */
735     cam_format_t fmt;
736 
737     /* image dimension */
738     cam_dimension_t dim;
739 
740     /* buffer plane information, will be calc based on stream_type, fmt,
741        dim, and padding_info(from stream config). Info including:
742        offset_x, offset_y, stride, scanline, plane offset */
743     cam_stream_buf_plane_info_t buf_planes;
744 
745     /* number of stream bufs will be allocated */
746     uint32_t num_bufs;
747 
748     /* number of stream bufs allocated for this stream*/
749     uint32_t buf_cnt;
750 
751     /* buffer stride for this stream*/
752     uint32_t buf_stride;
753 
754     /* streaming type */
755     cam_streaming_mode_t streaming_mode;
756 
757     /* num of frames needs to be generated.
758      * only valid when streaming_mode = CAM_STREAMING_MODE_BURST */
759     uint8_t num_of_burst;
760 
761     /* num of frames in one batch.
762      * only valid when streaming_mode = CAM_STREAMING_MODE_BATCH */
763     cam_stream_user_buf_info_t user_buf_info;
764 
765     /* stream specific pp config */
766     cam_pp_feature_config_t pp_config;
767 
768     /* this section is valid if offline reprocess type stream */
769     cam_stream_reproc_config_t reprocess_config;
770 
771     cam_stream_parm_buffer_t parm_buf;    /* stream based parameters */
772 
773     uint8_t dis_enable;
774 
775     /* Image Stabilization type */
776     cam_is_type_t is_type;
777 
778     /* NR mode */
779     uint8_t nr_mode;
780 
781     /* Signifies Secure stream mode */
782     cam_stream_secure_t is_secure;
783 
784     /* Preferred Performance mode */
785     cam_perf_mode_t perf_mode;
786 
787     /* if frames will not be received */
788     uint8_t noFrameExpected;
789 
790     /* DT for this stream */
791     int32_t dt;
792 
793     /* VC for this stream */
794     int32_t vc;
795 
796    /* Subformat for this stream */
797     cam_sub_format_type_t sub_format_type;
798 
799     /*Stream info for Slave Stream*/
800     struct cam_stream_info *aux_str_info;
801 
802     /* Cache ops for this stream */
803     cam_stream_cache_ops_t cache_ops;
804 } cam_stream_info_t;
805 
806 /*****************************************************************************
807  *                 Code for Domain Socket Based Parameters                   *
808  ****************************************************************************/
809 #define INCLUDE(PARAM_ID,DATATYPE,COUNT)  \
810         DATATYPE member_variable_##PARAM_ID[ COUNT ]
811 
812 #define POINTER_OF_META(META_ID, TABLE_PTR) \
813         ((NULL != TABLE_PTR) ? \
814             (&TABLE_PTR->data.member_variable_##META_ID[ 0 ]) : (NULL))
815 
816 #define SIZE_OF_PARAM(META_ID, TABLE_PTR) \
817         sizeof(TABLE_PTR->data.member_variable_##META_ID)
818 
819 #define IF_META_AVAILABLE(META_TYPE, META_PTR_NAME, META_ID, TABLE_PTR) \
820         META_TYPE *META_PTR_NAME = \
821         (((NULL != TABLE_PTR) && (TABLE_PTR->is_valid[META_ID])) ? \
822             (&TABLE_PTR->data.member_variable_##META_ID[ 0 ]) : \
823             (NULL)); \
824         if (NULL != META_PTR_NAME) \
825 
826 #define ADD_SET_PARAM_ENTRY_TO_BATCH(TABLE_PTR, META_ID, DATA) \
827     ((NULL != TABLE_PTR) ? \
828     ((TABLE_PTR->data.member_variable_##META_ID[ 0 ] = DATA), \
829     (TABLE_PTR->is_valid[META_ID] = 1), (0)) : \
830     ((LOGE("Unable to set metadata TABLE_PTR:%p META_ID:%d", \
831             TABLE_PTR, META_ID)), (-1))) \
832 
833 #define ADD_SET_PARAM_ENTRY_TO_BATCH_FOR_AUX(TABLE_PTR, AUX_TABLE_PTR, META_ID) \
834     ((NULL != TABLE_PTR || (NULL != AUX_TABLE_PTR)) ? \
835     ((AUX_TABLE_PTR->data.member_variable_##META_ID[ 0 ] = TABLE_PTR->data.member_variable_##META_ID[ 0 ]), \
836     (AUX_TABLE_PTR->is_valid[META_ID] = 1), (0)) : \
837     ((LOGE("Unable to set metadata AUX_TABLE_PTR:%p META_ID:%d", \
838             AUX_TABLE_PTR, META_ID)), (-1))) \
839 
840 #define ADD_SET_PARAM_ARRAY_TO_BATCH(TABLE_PTR, META_ID, PDATA, COUNT, RCOUNT) \
841 { \
842     if ((NULL != TABLE_PTR) && \
843             (0 < COUNT) && \
844             ((sizeof(TABLE_PTR->data.member_variable_##META_ID) / \
845             sizeof(TABLE_PTR->data.member_variable_##META_ID[ 0 ])) \
846             >= COUNT))  { \
847         for (size_t _i = 0; _i < COUNT ; _i++) { \
848             TABLE_PTR->data.member_variable_##META_ID[ _i ] = PDATA [ _i ]; \
849         } \
850         TABLE_PTR->is_valid[META_ID] = 1; \
851         RCOUNT = COUNT; \
852     } else { \
853         LOGE("Unable to set metadata TABLE_PTR:%p META_ID:%d COUNT:%zu", \
854               TABLE_PTR, META_ID, COUNT); \
855         RCOUNT = 0; \
856     } \
857 }
858 
859 #define ADD_GET_PARAM_ENTRY_TO_BATCH(TABLE_PTR, META_ID) \
860 { \
861     if (NULL != TABLE_PTR) { \
862         TABLE_PTR->is_reqd[META_ID] = 1; \
863     } else { \
864         LOGE("Unable to get metadata TABLE_PTR:%p META_ID:%d", \
865                   TABLE_PTR, META_ID); \
866     } \
867 }
868 
869 #define READ_PARAM_ENTRY(TABLE_PTR, META_ID, DATA) \
870 { \
871     if (NULL != TABLE_PTR) { \
872         DATA = TABLE_PTR->data.member_variable_##META_ID[ 0 ]; \
873     } else { \
874         LOGE("Unable to read metadata TABLE_PTR:%p META_ID:%d", \
875                   TABLE_PTR, META_ID); \
876     } \
877 }
878 
879 /************************************
880 * Custom parameter data definition
881 *************************************/
882 typedef struct {
883     /*CAM_CUSTOM_PARM_EXAMPLE is added to explain custom param procedure*/
884     INCLUDE(CAM_CUSTOM_PARM_EXAMPLE,            int32_t,           1);
885 } custom_parm_data_t;
886 
887 /************************************
888 * Custom Parameter buffer definition
889 *************************************/
890 typedef struct {
891     union {
892         /* Hash table of 'is valid' flags */
893         uint8_t         is_valid[CAM_CUSTOM_PARM_MAX];
894 
895         /* Hash table of 'is required' flags for the GET PARAM */
896         uint8_t         is_reqd[CAM_CUSTOM_PARM_MAX];
897     };
898     custom_parm_data_t data;
899 } custom_parm_buffer_t;
900 
901 
902 typedef struct {
903 /**************************************************************************************
904  *  ID from (cam_intf_metadata_type_t)                DATATYPE                     COUNT
905  **************************************************************************************/
906     /* common between HAL1 and HAL3 */
907     INCLUDE(CAM_INTF_META_HISTOGRAM,                    cam_hist_stats_t,               1);
908     INCLUDE(CAM_INTF_META_FACE_DETECTION,               cam_face_detection_data_t,      1);
909     INCLUDE(CAM_INTF_META_FACE_RECOG,                   cam_face_recog_data_t,          1);
910     INCLUDE(CAM_INTF_META_FACE_BLINK,                   cam_face_blink_data_t,          1);
911     INCLUDE(CAM_INTF_META_FACE_GAZE,                    cam_face_gaze_data_t,           1);
912     INCLUDE(CAM_INTF_META_FACE_SMILE,                   cam_face_smile_data_t,          1);
913     INCLUDE(CAM_INTF_META_FACE_LANDMARK,                cam_face_landmarks_data_t,      1);
914     INCLUDE(CAM_INTF_META_FACE_CONTOUR,                 cam_face_contour_data_t,        1);
915     INCLUDE(CAM_INTF_META_AUTOFOCUS_DATA,               cam_auto_focus_data_t,          1);
916     INCLUDE(CAM_INTF_META_CDS_DATA,                     cam_cds_data_t,                 1);
917     INCLUDE(CAM_INTF_PARM_UPDATE_DEBUG_LEVEL,           uint32_t,                       1);
918 
919     /* Specific to HAl1 */
920     INCLUDE(CAM_INTF_META_CROP_DATA,                    cam_crop_data_t,                1);
921     INCLUDE(CAM_INTF_META_PREP_SNAPSHOT_DONE,           int32_t,                        1);
922     INCLUDE(CAM_INTF_META_GOOD_FRAME_IDX_RANGE,         cam_frame_idx_range_t,          1);
923     INCLUDE(CAM_INTF_META_ASD_HDR_SCENE_DATA,           cam_asd_hdr_scene_data_t,       1);
924     INCLUDE(CAM_INTF_META_ASD_SCENE_INFO,               cam_asd_decision_t,             1);
925     INCLUDE(CAM_INTF_META_CURRENT_SCENE,                cam_scene_mode_type,            1);
926     INCLUDE(CAM_INTF_META_AWB_INFO,                     cam_awb_params_t,               1);
927     INCLUDE(CAM_INTF_META_FOCUS_POSITION,               cam_focus_pos_info_t,           1);
928     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ISP,           cam_chromatix_lite_isp_t,       1);
929     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_PP,            cam_chromatix_lite_pp_t,        1);
930     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AE,            cam_chromatix_lite_ae_stats_t,  1);
931     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AWB,           cam_chromatix_lite_awb_stats_t, 1);
932     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AF,            cam_chromatix_lite_af_stats_t,  1);
933     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ASD,           cam_chromatix_lite_asd_stats_t, 1);
934     INCLUDE(CAM_INTF_BUF_DIVERT_INFO,                   cam_buf_divert_info_t,          1);
935 
936     /* Specific to HAL3 */
937     INCLUDE(CAM_INTF_META_FRAME_NUMBER_VALID,           int32_t,                     1);
938     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,    int32_t,                     1);
939     INCLUDE(CAM_INTF_META_FRAME_DROPPED,                cam_stream_ID_t,             1);
940     INCLUDE(CAM_INTF_META_FRAME_NUMBER,                 uint32_t,                    1);
941     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER,          uint32_t,                    1);
942     INCLUDE(CAM_INTF_META_COLOR_CORRECT_MODE,           uint32_t,                    1);
943     INCLUDE(CAM_INTF_META_COLOR_CORRECT_TRANSFORM,      cam_color_correct_matrix_t,  1);
944     INCLUDE(CAM_INTF_META_COLOR_CORRECT_GAINS,          cam_color_correct_gains_t,   1);
945     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM, cam_color_correct_matrix_t,  1);
946     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,     cam_color_correct_gains_t,   1);
947     INCLUDE(CAM_INTF_META_AEC_ROI,                      cam_area_t,                  1);
948     INCLUDE(CAM_INTF_META_AEC_STATE,                    uint32_t,                    1);
949     INCLUDE(CAM_INTF_PARM_FOCUS_MODE,                   uint32_t,                    1);
950     INCLUDE(CAM_INTF_PARM_MANUAL_FOCUS_POS,             cam_manual_focus_parm_t,     1);
951     INCLUDE(CAM_INTF_META_AF_ROI,                       cam_area_t,                  1);
952     INCLUDE(CAM_INTF_META_AF_DEFAULT_ROI,               cam_rect_t,                  1);
953     INCLUDE(CAM_INTF_META_AF_STATE,                     uint32_t,                    1);
954     INCLUDE(CAM_INTF_PARM_WHITE_BALANCE,                int32_t,                     1);
955     INCLUDE(CAM_INTF_META_AWB_REGIONS,                  cam_area_t,                  1);
956     INCLUDE(CAM_INTF_META_AWB_STATE,                    uint32_t,                    1);
957     INCLUDE(CAM_INTF_META_AWB_CONVERGENCE_SPEED,        float,                       1);
958     INCLUDE(CAM_INTF_META_BLACK_LEVEL_LOCK,             uint32_t,                    1);
959     INCLUDE(CAM_INTF_META_MODE,                         uint32_t,                    1);
960     INCLUDE(CAM_INTF_META_EDGE_MODE,                    cam_edge_application_t,      1);
961     INCLUDE(CAM_INTF_META_FLASH_POWER,                  uint32_t,                    1);
962     INCLUDE(CAM_INTF_META_FLASH_FIRING_TIME,            int64_t,                     1);
963     INCLUDE(CAM_INTF_META_FLASH_MODE,                   uint32_t,                    1);
964     INCLUDE(CAM_INTF_META_FLASH_STATE,                  int32_t,                     1);
965     INCLUDE(CAM_INTF_META_HOTPIXEL_MODE,                uint32_t,                    1);
966     INCLUDE(CAM_INTF_META_LENS_APERTURE,                float,                       1);
967     INCLUDE(CAM_INTF_META_LENS_FILTERDENSITY,           float,                       1);
968     INCLUDE(CAM_INTF_META_LENS_FOCAL_LENGTH,            float,                       1);
969     INCLUDE(CAM_INTF_META_LENS_FOCUS_DISTANCE,          float,                       1);
970     INCLUDE(CAM_INTF_META_FOCUS_VALUE,                  float,                       1);
971     INCLUDE(CAM_INTF_META_SPOT_LIGHT_DETECT,            uint8_t,                     1);
972     INCLUDE(CAM_INTF_META_LENS_FOCUS_RANGE,             float,                       2);
973     INCLUDE(CAM_INTF_META_LENS_STATE,                   cam_af_lens_state_t,         1);
974     INCLUDE(CAM_INTF_META_LENS_OPT_STAB_MODE,           uint32_t,                    1);
975     INCLUDE(CAM_INTF_META_VIDEO_STAB_MODE,              uint32_t,                    1);
976     INCLUDE(CAM_INTF_META_LENS_FOCUS_STATE,             uint32_t,                    1);
977     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_MODE,         uint32_t,                    1);
978     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_STRENGTH,     uint32_t,                    1);
979     INCLUDE(CAM_INTF_META_SCALER_CROP_REGION,           cam_crop_region_t,           1);
980     INCLUDE(CAM_INTF_META_SCENE_FLICKER,                uint32_t,                    1);
981     INCLUDE(CAM_INTF_META_SENSOR_EXPOSURE_TIME,         int64_t,                     1);
982     INCLUDE(CAM_INTF_META_SENSOR_FRAME_DURATION,        int64_t,                     1);
983     INCLUDE(CAM_INTF_META_SENSOR_SENSITIVITY,           int32_t,                     1);
984     INCLUDE(CAM_INTF_META_ISP_SENSITIVITY ,             int32_t,                     1);
985     INCLUDE(CAM_INTF_META_SENSOR_TIMESTAMP,             int64_t,                     1);
986     INCLUDE(CAM_INTF_META_SENSOR_TIMESTAMP_AV,          int64_t,                     1);
987     INCLUDE(CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW,  int64_t,                     1);
988     INCLUDE(CAM_INTF_META_SHADING_MODE,                 uint32_t,                    1);
989     INCLUDE(CAM_INTF_META_STATS_FACEDETECT_MODE,        uint32_t,                    1);
990     INCLUDE(CAM_INTF_META_STATS_HISTOGRAM_MODE,         uint32_t,                    1);
991     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,     uint32_t,                    1);
992     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP,          cam_sharpness_map_t,         3);
993     INCLUDE(CAM_INTF_META_TONEMAP_CURVES,               cam_rgb_tonemap_curves,      1);
994     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP,             cam_lens_shading_map_t,      1);
995     INCLUDE(CAM_INTF_META_AEC_INFO,                     cam_3a_params_t,             1);
996     INCLUDE(CAM_INTF_META_SENSOR_INFO,                  cam_sensor_params_t,         1);
997     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AE,                cam_ae_exif_debug_t,         1);
998     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AWB,               cam_awb_exif_debug_t,        1);
999     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AF,                cam_af_exif_debug_t,         1);
1000     INCLUDE(CAM_INTF_META_EXIF_DEBUG_ASD,               cam_asd_exif_debug_t,        1);
1001     INCLUDE(CAM_INTF_META_EXIF_DEBUG_STATS,             cam_stats_buffer_exif_debug_t,   1);
1002     INCLUDE(CAM_INTF_META_EXIF_DEBUG_BESTATS,           cam_bestats_buffer_exif_debug_t, 1);
1003     INCLUDE(CAM_INTF_META_EXIF_DEBUG_BHIST,             cam_bhist_buffer_exif_debug_t,   1);
1004     INCLUDE(CAM_INTF_META_EXIF_DEBUG_3A_TUNING,         cam_q3a_tuning_info_t,       1);
1005     INCLUDE(CAM_INTF_META_ASD_SCENE_CAPTURE_TYPE,       cam_auto_scene_t,            1);
1006     INCLUDE(CAM_INTF_PARM_EFFECT,                       uint32_t,                    1);
1007     /* Defining as int32_t so that this array is 4 byte aligned */
1008     INCLUDE(CAM_INTF_META_PRIVATE_DATA,                 int32_t,
1009             MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES / 4);
1010 
1011     /* Following are Params only and not metadata currently */
1012     INCLUDE(CAM_INTF_PARM_HAL_VERSION,                  int32_t,                     1);
1013     /* Shared between HAL1 and HAL3 */
1014     INCLUDE(CAM_INTF_PARM_ANTIBANDING,                  uint32_t,                    1);
1015     INCLUDE(CAM_INTF_PARM_EXPOSURE_COMPENSATION,        int32_t,                     1);
1016     INCLUDE(CAM_INTF_PARM_EV_STEP,                      cam_rational_type_t,         1);
1017     INCLUDE(CAM_INTF_PARM_AEC_LOCK,                     uint32_t,                    1);
1018     INCLUDE(CAM_INTF_PARM_FPS_RANGE,                    cam_fps_range_t,             1);
1019     INCLUDE(CAM_INTF_PARM_AWB_LOCK,                     uint32_t,                    1);
1020     INCLUDE(CAM_INTF_PARM_BESTSHOT_MODE,                uint32_t,                    1);
1021     INCLUDE(CAM_INTF_PARM_DIS_ENABLE,                   int32_t,                     1);
1022     INCLUDE(CAM_INTF_PARM_LED_MODE,                     int32_t,                     1);
1023     INCLUDE(CAM_INTF_META_LED_MODE_OVERRIDE,            uint32_t,                    1);
1024 
1025     /* dual camera specific params */
1026     INCLUDE(CAM_INTF_PARM_RELATED_SENSORS_CALIBRATION,  cam_related_system_calibration_data_t, 1);
1027     INCLUDE(CAM_INTF_META_AF_FOCAL_LENGTH_RATIO,        cam_focal_length_ratio_t, 1);
1028     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_SENSOR,        cam_stream_crop_info_t,   1);
1029     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_CAMIF,         cam_stream_crop_info_t,   1);
1030     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_ISP,           cam_stream_crop_info_t,   1);
1031     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_CPP,           cam_stream_crop_info_t,   1);
1032     INCLUDE(CAM_INTF_META_DCRF,                         cam_dcrf_result_t,        1);
1033     INCLUDE(CAM_INTF_PARM_SYNC_DC_PARAMETERS,           uint32_t,                  1);
1034     INCLUDE(CAM_INTF_META_AF_FOCUS_POS,                 cam_af_focus_pos_t, 1);
1035 
1036     /* HAL1 specific */
1037     /* read only */
1038     INCLUDE(CAM_INTF_PARM_QUERY_FLASH4SNAP,             int32_t,                     1);
1039     INCLUDE(CAM_INTF_PARM_EXPOSURE,                     int32_t,                     1);
1040     INCLUDE(CAM_INTF_PARM_SHARPNESS,                    int32_t,                     1);
1041     INCLUDE(CAM_INTF_PARM_CONTRAST,                     int32_t,                     1);
1042     INCLUDE(CAM_INTF_PARM_SATURATION,                   int32_t,                     1);
1043     INCLUDE(CAM_INTF_PARM_BRIGHTNESS,                   int32_t,                     1);
1044     INCLUDE(CAM_INTF_PARM_ISO,                          cam_intf_parm_manual_3a_t,   1);
1045     INCLUDE(CAM_INTF_PARM_EXPOSURE_TIME,                cam_intf_parm_manual_3a_t,   1);
1046     INCLUDE(CAM_INTF_PARM_ZOOM,                         int32_t,                     1);
1047     INCLUDE(CAM_INTF_PARM_ROLLOFF,                      int32_t,                     1);
1048     INCLUDE(CAM_INTF_PARM_MODE,                         int32_t,                     1);
1049     INCLUDE(CAM_INTF_PARM_AEC_ALGO_TYPE,                int32_t,                     1);
1050     INCLUDE(CAM_INTF_PARM_FOCUS_ALGO_TYPE,              int32_t,                     1);
1051     INCLUDE(CAM_INTF_PARM_AEC_ROI,                      cam_set_aec_roi_t,           1);
1052     INCLUDE(CAM_INTF_PARM_AF_ROI,                       cam_roi_info_t,              1);
1053     INCLUDE(CAM_INTF_PARM_SCE_FACTOR,                   int32_t,                     1);
1054     INCLUDE(CAM_INTF_PARM_FD,                           cam_fd_set_parm_t,           1);
1055     INCLUDE(CAM_INTF_PARM_MCE,                          int32_t,                     1);
1056     INCLUDE(CAM_INTF_PARM_HFR,                          int32_t,                     1);
1057     INCLUDE(CAM_INTF_PARM_REDEYE_REDUCTION,             int32_t,                     1);
1058     INCLUDE(CAM_INTF_PARM_WAVELET_DENOISE,              cam_denoise_param_t,         1);
1059     INCLUDE(CAM_INTF_PARM_TEMPORAL_DENOISE,             cam_denoise_param_t,         1);
1060     INCLUDE(CAM_INTF_PARM_HISTOGRAM,                    int32_t,                     1);
1061     INCLUDE(CAM_INTF_PARM_ASD_ENABLE,                   int32_t,                     1);
1062     INCLUDE(CAM_INTF_PARM_RECORDING_HINT,               int32_t,                     1);
1063     INCLUDE(CAM_INTF_PARM_HDR,                          cam_exp_bracketing_t,        1);
1064     INCLUDE(CAM_INTF_PARM_FRAMESKIP,                    int32_t,                     1);
1065     INCLUDE(CAM_INTF_PARM_ZSL_MODE,                     int32_t,                     1);
1066     INCLUDE(CAM_INTF_PARM_HDR_NEED_1X,                  int32_t,                     1);
1067     INCLUDE(CAM_INTF_PARM_LOCK_CAF,                     int32_t,                     1);
1068     INCLUDE(CAM_INTF_PARM_VIDEO_HDR,                    int32_t,                     1);
1069     INCLUDE(CAM_INTF_PARM_SENSOR_HDR,                   cam_sensor_hdr_type_t,       1);
1070     INCLUDE(CAM_INTF_PARM_VT,                           int32_t,                     1);
1071     INCLUDE(CAM_INTF_PARM_SET_AUTOFOCUSTUNING,          tune_actuator_t,             1);
1072     INCLUDE(CAM_INTF_PARM_SET_VFE_COMMAND,              tune_cmd_t,                  1);
1073     INCLUDE(CAM_INTF_PARM_SET_PP_COMMAND,               tune_cmd_t,                  1);
1074     INCLUDE(CAM_INTF_PARM_MAX_DIMENSION,                cam_dimension_t,             1);
1075     INCLUDE(CAM_INTF_PARM_SENSOR_MODE_INFO,             cam_sensor_mode_info_t,      1);
1076     INCLUDE(CAM_INTF_PARM_CURRENT_SENSOR_MODE_INFO,     cam_sensor_mode_info_t,      1);
1077     INCLUDE(CAM_INTF_PARM_TINTLESS,                     int32_t,                     1);
1078     INCLUDE(CAM_INTF_PARM_WB_MANUAL,                    cam_manual_wb_parm_t,        1);
1079     INCLUDE(CAM_INTF_PARM_CDS_MODE,                     int32_t,                     1);
1080     INCLUDE(CAM_INTF_PARM_EZTUNE_CMD,                   cam_eztune_cmd_data_t,       1);
1081     INCLUDE(CAM_INTF_PARM_INT_EVT,                      cam_int_evt_params_t,        1);
1082     INCLUDE(CAM_INTF_PARM_RDI_MODE,                     int32_t,                     1);
1083     INCLUDE(CAM_INTF_PARM_BURST_NUM,                    uint32_t,                    1);
1084     INCLUDE(CAM_INTF_PARM_RETRO_BURST_NUM,              uint32_t,                    1);
1085     INCLUDE(CAM_INTF_PARM_BURST_LED_ON_PERIOD,          uint32_t,                    1);
1086     INCLUDE(CAM_INTF_PARM_LONGSHOT_ENABLE,              int8_t,                      1);
1087     INCLUDE(CAM_INTF_PARM_TONE_MAP_MODE,                uint32_t,                    1);
1088     INCLUDE(CAM_INTF_META_TOUCH_AE_RESULT,              int32_t,                     1);
1089     INCLUDE(CAM_INTF_PARM_DUAL_LED_CALIBRATION,         int32_t,                     1);
1090     INCLUDE(CAM_INTF_PARM_ADV_CAPTURE_MODE,             uint8_t,                     1);
1091     INCLUDE(CAM_INTF_PARM_QUADRA_CFA,                   int32_t,                     1);
1092     INCLUDE(CAM_INTF_META_RAW,                          cam_dimension_t,             1);
1093     INCLUDE(CAM_INTF_META_STREAM_INFO_FOR_PIC_RES,      cam_stream_size_info_t,      1);
1094 
1095 
1096     /* HAL3 specific */
1097     INCLUDE(CAM_INTF_META_STREAM_INFO,                  cam_stream_size_info_t,      1);
1098     INCLUDE(CAM_INTF_META_AEC_MODE,                     uint32_t,                    1);
1099     INCLUDE(CAM_INTF_META_AEC_CONVERGENCE_SPEED,        float,                       1);
1100     INCLUDE(CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,       cam_trigger_t,               1);
1101     INCLUDE(CAM_INTF_META_AF_TRIGGER,                   cam_trigger_t,               1);
1102     INCLUDE(CAM_INTF_META_CAPTURE_INTENT,               uint32_t,                    1);
1103     INCLUDE(CAM_INTF_META_DEMOSAIC,                     int32_t,                     1);
1104     INCLUDE(CAM_INTF_META_SHARPNESS_STRENGTH,           int32_t,                     1);
1105     INCLUDE(CAM_INTF_META_GEOMETRIC_MODE,               uint32_t,                    1);
1106     INCLUDE(CAM_INTF_META_GEOMETRIC_STRENGTH,           uint32_t,                    1);
1107     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP_MODE,        uint32_t,                    1);
1108     INCLUDE(CAM_INTF_META_SHADING_STRENGTH,             uint32_t,                    1);
1109     INCLUDE(CAM_INTF_META_TONEMAP_MODE,                 uint32_t,                    1);
1110     INCLUDE(CAM_INTF_META_IR_MODE,                      cam_ir_mode_type_t,          1);
1111     INCLUDE(CAM_INTF_META_STREAM_ID,                    cam_stream_ID_t,             1);
1112     INCLUDE(CAM_INTF_PARM_STATS_DEBUG_MASK,             uint32_t,                    1);
1113     INCLUDE(CAM_INTF_PARM_STATS_AF_PAAF,                uint32_t,                    1);
1114     INCLUDE(CAM_INTF_PARM_FOCUS_BRACKETING,             cam_af_bracketing_t,         1);
1115     INCLUDE(CAM_INTF_PARM_FLASH_BRACKETING,             cam_flash_bracketing_t,      1);
1116     INCLUDE(CAM_INTF_META_JPEG_GPS_COORDINATES,         double,                      3);
1117     INCLUDE(CAM_INTF_META_JPEG_GPS_PROC_METHODS,        uint8_t,                     GPS_PROCESSING_METHOD_SIZE);
1118     INCLUDE(CAM_INTF_META_JPEG_GPS_TIMESTAMP,           int64_t,                     1);
1119     INCLUDE(CAM_INTF_META_JPEG_ORIENTATION,             int32_t,                     1);
1120     INCLUDE(CAM_INTF_META_JPEG_QUALITY,                 uint32_t,                    1);
1121     INCLUDE(CAM_INTF_META_JPEG_THUMB_QUALITY,           uint32_t,                    1);
1122     INCLUDE(CAM_INTF_META_JPEG_THUMB_SIZE,              cam_dimension_t,             1);
1123     INCLUDE(CAM_INTF_META_TEST_PATTERN_DATA,            cam_test_pattern_data_t,     1);
1124     INCLUDE(CAM_INTF_META_PROFILE_TONE_CURVE,           cam_profile_tone_curve,      1);
1125     INCLUDE(CAM_INTF_META_OTP_WB_GRGB,                  float,                       1);
1126     INCLUDE(CAM_INTF_META_IMG_HYST_INFO,                cam_img_hysterisis_info_t,   1);
1127     INCLUDE(CAM_INTF_META_CAC_INFO,                     cam_cac_info_t,              1);
1128     INCLUDE(CAM_INTF_PARM_CAC,                          cam_aberration_mode_t,       1);
1129     INCLUDE(CAM_INTF_META_NEUTRAL_COL_POINT,            cam_neutral_col_point_t,     1);
1130     INCLUDE(CAM_INTF_PARM_ROTATION,                     cam_rotation_info_t,         1);
1131     INCLUDE(CAM_INTF_PARM_HW_DATA_OVERWRITE,            cam_hw_data_overwrite_t,     1);
1132     INCLUDE(CAM_INTF_META_IMGLIB,                       cam_intf_meta_imglib_t,      1);
1133     INCLUDE(CAM_INTF_PARM_CAPTURE_FRAME_CONFIG,         cam_capture_frame_config_t,  1);
1134     INCLUDE(CAM_INTF_PARM_CUSTOM,                       custom_parm_buffer_t,        1);
1135     INCLUDE(CAM_INTF_PARM_FLIP,                         int32_t,                     1);
1136     INCLUDE(CAM_INTF_META_USE_AV_TIMER,                 uint8_t,                     1);
1137     INCLUDE(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,    float,                       1);
1138     INCLUDE(CAM_INTF_META_LDAF_EXIF,                    uint32_t,                    2);
1139     INCLUDE(CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN,   cam_black_level_metadata_t,  1);
1140     INCLUDE(CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN,  cam_black_level_metadata_t,  1);
1141     INCLUDE(CAM_INTF_META_LOW_LIGHT,                    cam_low_light_mode_t,        1);
1142     INCLUDE(CAM_INTF_META_IMG_DYN_FEAT,                 cam_dyn_img_data_t,          1);
1143     INCLUDE(CAM_INTF_PARM_MANUAL_CAPTURE_TYPE,          cam_manual_capture_type,     1);
1144     INCLUDE(CAM_INTF_AF_STATE_TRANSITION,               uint8_t,                     1);
1145     INCLUDE(CAM_INTF_PARM_INITIAL_EXPOSURE_INDEX,       uint32_t,                    1);
1146     INCLUDE(CAM_INTF_PARM_INSTANT_AEC,                  uint8_t,                     1);
1147     INCLUDE(CAM_INTF_META_REPROCESS_FLAGS,              uint8_t,                     1);
1148     INCLUDE(CAM_INTF_PARM_JPEG_ENCODE_CROP,             cam_stream_crop_info_t,      1);
1149     INCLUDE(CAM_INTF_PARM_JPEG_SCALE_DIMENSION,         cam_dimension_t,             1);
1150     INCLUDE(CAM_INTF_META_FOCUS_DEPTH_INFO,             uint8_t,                     1);
1151     INCLUDE(CAM_INTF_PARM_HAL_BRACKETING_HDR,           cam_hdr_param_t,             1);
1152     INCLUDE(CAM_INTF_META_DC_LOW_POWER_ENABLE,          uint8_t,                     1);
1153     INCLUDE(CAM_INTF_META_DC_SAC_OUTPUT_INFO,           cam_sac_output_info_t,       1);
1154     INCLUDE(CAM_INTF_META_DC_IN_SNAPSHOT_PP_ZOOM_RANGE, uint8_t,                     1);
1155     INCLUDE(CAM_INTF_META_DC_BOKEH_MODE,                uint8_t,                     1);
1156     INCLUDE(CAM_INTF_PARM_FOV_COMP_ENABLE,              int32_t,                     1);
1157     INCLUDE(CAM_INTF_META_LED_CALIB_RESULT,             int32_t,                     1);
1158     INCLUDE(CAM_INTF_META_HYBRID_AE,                    uint8_t,                     1);
1159     INCLUDE(CAM_INTF_META_MOTION_DETECTION_ENABLE,      uint8_t,                     1);
1160     INCLUDE(CAM_INTF_META_AF_SCENE_CHANGE,              uint8_t,                     1);
1161     /* DevCamDebug metadata CAM_INTF.H */
1162     INCLUDE(CAM_INTF_META_DEV_CAM_ENABLE,               uint8_t,                     1);
1163     /* DevCamDebug metadata CAM_INTF.H AF */
1164     INCLUDE(CAM_INTF_META_DEV_CAM_AF_LENS_POSITION,     int32_t,                     1);
1165     INCLUDE(CAM_INTF_META_AF_TOF_CONFIDENCE,            int32_t,                     1);
1166     INCLUDE(CAM_INTF_META_AF_TOF_DISTANCE,              int32_t,                     1);
1167     INCLUDE(CAM_INTF_META_DEV_CAM_AF_LUMA,                    int32_t,               1);
1168     INCLUDE(CAM_INTF_META_DEV_CAM_AF_HAF_STATE,               int32_t,               1);
1169     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_TARGET_POS, int32_t,               1);
1170     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_CONFIDENCE, int32_t,               1);
1171     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_PDAF_REFOCUS,    int32_t,               1);
1172     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_TARGET_POS,  int32_t,               1);
1173     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_CONFIDENCE,  int32_t,               1);
1174     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TOF_REFOCUS,     int32_t,               1);
1175     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TYPE_SELECT,     int32_t,               1);
1176     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_REFOCUS,         int32_t,               1);
1177     INCLUDE(CAM_INTF_META_DEV_CAM_AF_MONITOR_TARGET_POS,      int32_t,               1);
1178     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_TARGET_POS,  int32_t,               1);
1179     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_NEXT_POS,    int32_t,               1);
1180     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_NEAR_POS,    int32_t,               1);
1181     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_FAR_POS,     int32_t,               1);
1182     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_PDAF_CONFIDENCE,  int32_t,               1);
1183     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_TARGET_POS,   int32_t,               1);
1184     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_NEXT_POS,     int32_t,               1);
1185     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_NEAR_POS,     int32_t,               1);
1186     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_FAR_POS,      int32_t,               1);
1187     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TOF_CONFIDENCE,   int32_t,               1);
1188     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TYPE_SELECT,      int32_t,               1);
1189     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_NEXT_POS,         int32_t,               1);
1190     INCLUDE(CAM_INTF_META_DEV_CAM_AF_SEARCH_TARGET_POS,       int32_t,               1);
1191     /* DevCamDebug metadata CAM_INTF.H AEC */
1192     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_TARGET_LUMA,      int32_t,                     1);
1193     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_COMP_LUMA,        int32_t,                     1);
1194     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_AVG_LUMA,         int32_t,                     1);
1195     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_CUR_LUMA,         int32_t,                     1);
1196     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_LINECOUNT,        int32_t,                     1);
1197     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_REAL_GAIN,        float,                       1);
1198     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_EXP_INDEX,        int32_t,                     1);
1199     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_LUX_IDX,          float,                       1);
1200     /* DevCamDebug metadata CAM_INTF.H zzHDR */
1201     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_L_REAL_GAIN,           float,                  1);
1202     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_L_LINECOUNT,           int32_t,                1);
1203     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_S_REAL_GAIN,           float,                  1);
1204     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_S_LINECOUNT,           int32_t,                1);
1205     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_HDR_SENSITIVITY_RATIO, float,                  1);
1206     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_HDR_EXP_TIME_RATIO,    float,                  1);
1207     /* DevCamDebug metadata CAM_INTF.H ADRC */
1208     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_TOTAL_DRC_GAIN,        float,                  1);
1209     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_COLOR_DRC_GAIN,        float,                  1);
1210     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_GTM_RATIO,             float,                  1);
1211     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_LTM_RATIO,             float,                  1);
1212     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_LA_RATIO,              float,                  1);
1213     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_GAMMA_RATIO,           float,                  1);
1214     /* DevCamDebug metadata CAM_INTF.H AEC MOTION */
1215     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_CAMERA_MOTION_DX,      float,                  1);
1216     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_CAMERA_MOTION_DY,      float,                  1);
1217     INCLUDE(CAM_INTF_META_DEV_CAM_AEC_SUBJECT_MOTION,        float,                  1);
1218     /* DevCamDebug metadata CAM_INTF.H AWB */
1219     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_R_GAIN,           float,                       1);
1220     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_G_GAIN,           float,                       1);
1221     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_B_GAIN,           float,                       1);
1222     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_CCT,              int32_t,                     1);
1223     INCLUDE(CAM_INTF_META_DEV_CAM_AWB_DECISION,         int32_t,                     1);
1224     /* DevCamDebug metadata end */
1225     INCLUDE(CAM_INTF_META_ISP_POST_STATS_SENSITIVITY,   float,                       1);
1226     INCLUDE(CAM_INTF_PARM_DC_USERZOOM,                  int32_t,                     1);
1227     INCLUDE(CAM_INTF_META_AEC_LUX_INDEX,                float,                       1);
1228     INCLUDE(CAM_INTF_META_AF_OBJ_DIST_CM,               int32_t,                     1);
1229     INCLUDE(CAM_INTF_META_BINNING_CORRECTION_MODE,      cam_binning_correction_mode_t,  1);
1230     INCLUDE(CAM_INTF_META_OIS_READ_DATA,                cam_ois_data_t,              1);
1231     INCLUDE(CAM_INTF_META_FRAME_OIS_DATA,               cam_frame_ois_info_t,        1);
1232     INCLUDE(CAM_INTF_META_PDAF_DATA_ENABLE,             cam_sensor_pd_data_t,        1);
1233     INCLUDE(CAM_INTF_META_STATS_HISTOGRAM_BINS,         int32_t,                     1);
1234     INCLUDE(CAM_INTF_META_TRACKING_AF_TRIGGER,          uint8_t,                     1);
1235     INCLUDE(CAM_INTF_META_AF_REGIONS_CONFIDENCE,        int32_t,                     1);
1236     INCLUDE(CAM_INTF_META_SENSOR_MODE_FULLFOV,          int32_t,                     1);
1237     INCLUDE(CAM_INTF_META_EARLY_AF_STATE,               uint32_t,                    1);
1238     INCLUDE(CAM_INTF_META_EXP_TIME_BOOST,               float,                       1);
1239     INCLUDE(CAM_INTF_META_MAKERNOTE,                    cam_makernote_t,             1);
1240     INCLUDE(CAM_INTF_META_EIS_CROP_INFO,                cam_eis_crop_info_t,         1);
1241 } metadata_data_t;
1242 
1243 /* Update clear_metadata_buffer() function when a new is_xxx_valid is added to
1244  * or removed from this structure */
1245 typedef struct {
1246     union{
1247         /* Hash table of 'is valid' flags */
1248         uint8_t         is_valid[CAM_INTF_PARM_MAX];
1249 
1250         /* Hash table of 'is required' flags for the GET PARAM */
1251         uint8_t         is_reqd[CAM_INTF_PARM_MAX];
1252     };
1253     metadata_data_t data;
1254     /*Tuning Data */
1255     uint8_t is_tuning_params_valid;
1256     tuning_params_t tuning_params;
1257 
1258     /* Mobicat Params */
1259     uint8_t is_mobicat_aec_params_valid;
1260     cam_3a_params_t mobicat_aec_params;
1261 
1262     /* Stats 3A Debug Params */
1263     uint8_t is_statsdebug_ae_params_valid;
1264     cam_ae_exif_debug_t statsdebug_ae_data;
1265 
1266     uint8_t is_statsdebug_awb_params_valid;
1267     cam_awb_exif_debug_t statsdebug_awb_data;
1268 
1269     uint8_t is_statsdebug_af_params_valid;
1270     cam_af_exif_debug_t statsdebug_af_data;
1271 
1272     uint8_t is_statsdebug_asd_params_valid;
1273     cam_asd_exif_debug_t statsdebug_asd_data;
1274 
1275     uint8_t is_statsdebug_stats_params_valid;
1276     cam_stats_buffer_exif_debug_t statsdebug_stats_buffer_data;
1277 
1278     uint8_t is_statsdebug_bestats_params_valid;
1279     cam_bestats_buffer_exif_debug_t statsdebug_bestats_buffer_data;
1280 
1281     uint8_t is_statsdebug_bhist_params_valid;
1282     cam_bhist_buffer_exif_debug_t statsdebug_bhist_data;
1283 
1284     uint8_t is_statsdebug_3a_tuning_params_valid;
1285     cam_q3a_tuning_info_t statsdebug_3a_tuning_data;
1286 
1287     uint8_t is_depth_data_valid;
1288     cam_depth_data_t depth_data;
1289 } metadata_buffer_t;
1290 
1291 typedef metadata_buffer_t parm_buffer_t;
1292 
1293 #ifdef  __cplusplus
1294 extern "C" {
1295 #endif
1296 
1297 /* Update this inline function when a new is_xxx_valid is added to
1298  * or removed from metadata_buffer_t */
clear_metadata_buffer(metadata_buffer_t * meta)1299 static inline void clear_metadata_buffer(metadata_buffer_t *meta)
1300 {
1301     if (meta) {
1302       memset(meta->is_valid, 0, CAM_INTF_PARM_MAX);
1303       meta->is_tuning_params_valid = 0;
1304       meta->is_mobicat_aec_params_valid = 0;
1305       meta->is_depth_data_valid = 0;
1306       meta->is_statsdebug_ae_params_valid = 0;
1307       meta->is_statsdebug_awb_params_valid = 0;
1308       meta->is_statsdebug_af_params_valid = 0;
1309       meta->is_statsdebug_asd_params_valid = 0;
1310       meta->is_statsdebug_stats_params_valid = 0;
1311       meta->is_statsdebug_bestats_params_valid = 0;
1312       meta->is_statsdebug_bhist_params_valid = 0;
1313       meta->is_statsdebug_3a_tuning_params_valid = 0;
1314       /* tuning parameter sizes are never gets zero.
1315        * It gets overwritten when it populated
1316        * But we can't reply and make decision based on that
1317        */
1318       meta->tuning_params.tuning_sensor_data_size = 0;
1319       meta->tuning_params.tuning_vfe_data_size = 0;
1320       meta->tuning_params.tuning_mod1_stats_data_size = 0;
1321     }
1322 }
1323 
1324 #ifdef  __cplusplus
1325 }
1326 #endif
1327 
1328 #endif /* __QCAMERA_INTF_H__ */
1329