1 /* Copyright (c) 2012-2016, 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_SYNC_RELATED_SENSORS,
60     /* flush */
61     CAM_PRIV_FLUSH
62 } cam_private_ioctl_enum_t;
63 
64 /* capability struct definition for HAL 1*/
65 typedef struct{
66     cam_hal_version_t version;
67 
68     cam_position_t position;                                /* sensor position: front, back */
69 
70     uint8_t auto_hdr_supported;
71 
72     uint16_t isWnrSupported;
73     /* supported iso modes */
74     size_t supported_iso_modes_cnt;
75     cam_iso_mode_type supported_iso_modes[CAM_ISO_MODE_MAX];
76 
77     /* supported flash modes */
78     size_t supported_flash_modes_cnt;
79     cam_flash_mode_t supported_flash_modes[CAM_FLASH_MODE_MAX];
80 
81     size_t zoom_ratio_tbl_cnt;                              /* table size for zoom ratios */
82     uint32_t zoom_ratio_tbl[MAX_ZOOMS_CNT];                 /* zoom ratios table */
83 
84     /* supported effect modes */
85     size_t supported_effects_cnt;
86     cam_effect_mode_type supported_effects[CAM_EFFECT_MODE_MAX];
87 
88     /* supported scene modes */
89     size_t supported_scene_modes_cnt;
90     cam_scene_mode_type supported_scene_modes[CAM_SCENE_MODE_MAX];
91 
92     /* supported auto exposure modes */
93     size_t supported_aec_modes_cnt;
94     cam_auto_exposure_mode_type supported_aec_modes[CAM_AEC_MODE_MAX];
95 
96     size_t fps_ranges_tbl_cnt;                              /* fps ranges table size */
97     cam_fps_range_t fps_ranges_tbl[MAX_SIZES_CNT];          /* fps ranges table */
98 
99     /* supported antibanding modes */
100     size_t supported_antibandings_cnt;
101     cam_antibanding_mode_type supported_antibandings[CAM_ANTIBANDING_MODE_MAX];
102 
103     /* supported white balance modes */
104     size_t supported_white_balances_cnt;
105     cam_wb_mode_type supported_white_balances[CAM_WB_MODE_MAX];
106 
107     /* Capability list of supported insensor HDR types
108      * Backend is expected to fill in all the supported types and set appropriate
109      * count, see cam_sensor_hdr_type_t for valid types
110     */
111     size_t supported_sensor_hdr_types_cnt;
112     cam_sensor_hdr_type_t supported_sensor_hdr_types[CAM_SENSOR_HDR_MAX];
113 
114     /* supported manual wb cct */
115     int32_t min_wb_cct;
116     int32_t max_wb_cct;
117 
118     /* supported manual wb rgb gains */
119     float min_wb_gain;
120     float max_wb_gain;
121 
122     /* supported focus modes */
123     size_t supported_focus_modes_cnt;
124     cam_focus_mode_type supported_focus_modes[CAM_FOCUS_MODE_MAX];
125 
126     /* supported manual focus position */
127     float min_focus_pos[CAM_MANUAL_FOCUS_MODE_MAX];
128     float max_focus_pos[CAM_MANUAL_FOCUS_MODE_MAX];
129 
130     int32_t exposure_compensation_min;       /* min value of exposure compensation index */
131     int32_t exposure_compensation_max;       /* max value of exposure compensation index */
132     int32_t exposure_compensation_default;   /* default value of exposure compensation index */
133     float exposure_compensation_step;
134     cam_rational_type_t exp_compensation_step;    /* exposure compensation step value */
135 
136     uint8_t video_stablization_supported; /* flag id video stablization is supported */
137 
138     size_t picture_sizes_tbl_cnt;                           /* picture sizes table size */
139     cam_dimension_t picture_sizes_tbl[MAX_SIZES_CNT];       /* picture sizes table */
140     /* The minimum frame duration that is supported for each
141      * resolution in availableProcessedSizes. Should correspond
142      * to the frame duration when only that processed stream
143      * is active, with all processing set to FAST */
144     int64_t picture_min_duration[MAX_SIZES_CNT];
145 
146     /* capabilities specific to HAL 1 */
147 
148     int32_t modes_supported;                                /* mask of modes supported: 2D, 3D */
149     uint32_t sensor_mount_angle;                            /* sensor mount angle */
150 
151     float focal_length;                                     /* focal length */
152     float hor_view_angle;                                   /* horizontal view angle */
153     float ver_view_angle;                                   /* vertical view angle */
154 
155     size_t preview_sizes_tbl_cnt;                           /* preview sizes table size */
156     cam_dimension_t preview_sizes_tbl[MAX_SIZES_CNT];       /* preiew sizes table */
157 
158     size_t video_sizes_tbl_cnt;                             /* video sizes table size */
159     cam_dimension_t video_sizes_tbl[MAX_SIZES_CNT];         /* video sizes table */
160 
161 
162     size_t livesnapshot_sizes_tbl_cnt;                      /* livesnapshot sizes table size */
163     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
164 
165     size_t vhdr_livesnapshot_sizes_tbl_cnt;                 /* vhdr_livesnapshot sizes table size */
166     cam_dimension_t vhdr_livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* vhdr_livesnapshot sizes table */
167 
168     size_t hfr_tbl_cnt;                                     /* table size for HFR */
169     cam_hfr_info_t hfr_tbl[CAM_HFR_MODE_MAX];               /* HFR table */
170 
171     size_t zzhdr_sizes_tbl_cnt;                             /* Number of resolutions in zzHDR mode*/
172     cam_dimension_t zzhdr_sizes_tbl[MAX_SIZES_CNT];         /* Table for ZZHDR supported sizes */
173 
174     /* supported preview formats */
175     size_t supported_preview_fmt_cnt;
176     cam_format_t supported_preview_fmts[CAM_FORMAT_MAX];
177 
178     /* supported picture formats */
179     size_t supported_picture_fmt_cnt;
180     cam_format_t supported_picture_fmts[CAM_FORMAT_MAX];
181 
182     uint8_t max_downscale_factor;
183 
184     /* dimension and supported output format of raw dump from camif */
185     size_t supported_raw_dim_cnt;
186     cam_dimension_t raw_dim[MAX_SIZES_CNT];
187     size_t supported_raw_fmt_cnt;
188     cam_format_t supported_raw_fmts[CAM_FORMAT_MAX];
189     /* The minimum frame duration that is supported for above
190        raw resolution */
191     int64_t raw_min_duration[MAX_SIZES_CNT];
192 
193     /* 3A version*/
194     cam_q3a_version_t q3a_version;
195     /* supported focus algorithms */
196     size_t supported_focus_algos_cnt;
197     cam_focus_algorithm_type supported_focus_algos[CAM_FOCUS_ALGO_MAX];
198 
199 
200     uint8_t auto_wb_lock_supported;       /* flag if auto white balance lock is supported */
201     uint8_t zoom_supported;               /* flag if zoom is supported */
202     uint8_t smooth_zoom_supported;        /* flag if smooth zoom is supported */
203     uint8_t auto_exposure_lock_supported; /* flag if auto exposure lock is supported */
204     uint8_t video_snapshot_supported;     /* flag if video snapshot is supported */
205 
206     uint8_t max_num_roi;                  /* max number of roi can be detected */
207     uint8_t max_num_focus_areas;          /* max num of focus areas */
208     uint8_t max_num_metering_areas;       /* max num opf metering areas */
209     uint8_t max_zoom_step;                /* max zoom step value */
210 
211     /* QCOM specific control */
212     cam_control_range_t brightness_ctrl;  /* brightness */
213     cam_control_range_t sharpness_ctrl;   /* sharpness */
214     cam_control_range_t contrast_ctrl;    /* contrast */
215     cam_control_range_t saturation_ctrl;  /* saturation */
216     cam_control_range_t sce_ctrl;         /* skintone enhancement factor */
217 
218     /* QCOM HDR specific control. Indicates number of frames and exposure needs for the frames */
219     cam_hdr_bracketing_info_t hdr_bracketing_setting;
220 
221     uint32_t qcom_supported_feature_mask; /* mask of qcom specific features supported:
222                                            * such as CAM_QCOM_FEATURE_SUPPORTED_FACE_DETECTION*/
223     cam_padding_info_t padding_info;      /* padding information from PP */
224     uint32_t min_num_pp_bufs;             /* minimum number of buffers needed by postproc module */
225     cam_format_t rdi_mode_stream_fmt;  /* stream format supported in rdi mode */
226 
227     /* capabilities specific to HAL 3 */
228 
229     float min_focus_distance;
230     float hyper_focal_distance;
231 
232     float focal_lengths[CAM_FOCAL_LENGTHS_MAX];
233     uint8_t focal_lengths_count;
234 
235     /* Needs to be regular f number instead of APEX */
236     float apertures[CAM_APERTURES_MAX];
237     uint8_t apertures_count;
238 
239     float filter_densities[CAM_FILTER_DENSITIES_MAX];
240     uint8_t filter_densities_count;
241 
242     uint8_t optical_stab_modes[CAM_OPT_STAB_MAX];
243     uint8_t optical_stab_modes_count;
244 
245     cam_dimension_t lens_shading_map_size;
246 
247     cam_dimension_t geo_correction_map_size;
248     float geo_correction_map[2 * 3 * CAM_MAX_MAP_WIDTH *
249               CAM_MAX_MAP_HEIGHT];
250 
251     float lens_position[3];
252 
253     /* nano seconds */
254     int64_t exposure_time_range[EXPOSURE_TIME_RANGE_CNT];
255 
256     /* nano seconds */
257     int64_t max_frame_duration;
258 
259     cam_color_filter_arrangement_t color_arrangement;
260     uint8_t num_color_channels;
261 
262     /* parameters required to calculate S and O co-efficients */
263     double gradient_S;
264     double offset_S;
265     double gradient_O;
266     double offset_O;
267 
268     float sensor_physical_size[SENSOR_PHYSICAL_SIZE_CNT];
269 
270     /* Dimensions of full pixel array, possibly including
271        black calibration pixels */
272     cam_dimension_t pixel_array_size;
273     /* Area of raw data which corresponds to only active
274        pixels; smaller or equal to pixelArraySize. */
275     cam_rect_t active_array_size;
276 
277     /* Maximum raw value output by sensor */
278     int32_t white_level;
279 
280     /* A fixed black level offset for each of the Bayer
281        mosaic channels */
282     int32_t black_level_pattern[BLACK_LEVEL_PATTERN_CNT];
283 
284     /* Time taken before flash can fire again in nano secs */
285     int64_t flash_charge_duration;
286 
287     /* flash firing power */
288     size_t supported_flash_firing_level_cnt;
289     cam_format_t supported_firing_levels[CAM_FLASH_FIRING_LEVEL_MAX];
290 
291     /* Flash Firing Time */
292     int64_t flash_firing_time;
293 
294     /* Flash Ciolor Temperature */
295     uint8_t flash_color_temp;
296 
297     /* Flash max Energy */
298     uint8_t flash_max_energy;
299 
300     /* Maximum number of supported points in the tonemap
301        curve */
302     int32_t max_tone_map_curve_points;
303 
304     /* supported formats */
305     size_t supported_scalar_format_cnt;
306     cam_format_t supported_scalar_fmts[CAM_FORMAT_MAX];
307 
308     uint32_t max_face_detection_count;
309     uint8_t hw_analysis_supported;
310 
311     uint8_t histogram_supported;
312     /* Number of histogram buckets supported */
313     int32_t histogram_size;
314     /* Maximum value possible for a histogram bucket */
315     int32_t max_histogram_count;
316 
317     cam_dimension_t sharpness_map_size;
318 
319     /* Maximum value possible for a sharpness map region */
320     int32_t max_sharpness_map_value;
321 
322     /*Autoexposure modes for camera 3 api*/
323     size_t supported_ae_modes_cnt;
324     cam_ae_mode_type supported_ae_modes[CAM_AE_MODE_MAX];
325 
326 
327     cam_sensitivity_range_t sensitivity_range;
328     int32_t max_analog_sensitivity;
329 
330     /* ISP digital gain */
331     cam_sensitivity_range_t isp_sensitivity_range;
332 
333     /* picture sizes need scale*/
334     cam_scene_mode_overrides_t scene_mode_overrides[CAM_SCENE_MODE_MAX];
335     size_t scale_picture_sizes_cnt;
336     cam_dimension_t scale_picture_sizes[MAX_SCALE_SIZES_CNT];
337 
338     uint8_t flash_available;
339 
340     cam_rational_type_t base_gain_factor;    /* sensor base gain factor */
341     /* AF Bracketing info */
342     cam_af_bracketing_t  ubifocus_af_bracketing_need;
343     cam_af_bracketing_t  refocus_af_bracketing_need;
344     /* opti Zoom info */
345     cam_opti_zoom_t      opti_zoom_settings_need;
346     /* still more info */
347     cam_still_more_t  stillmore_settings_need;
348     /* chroma flash info */
349     cam_chroma_flash_t chroma_flash_settings_need;
350 
351     cam_rational_type_t forward_matrix[3][3];
352     cam_rational_type_t color_transform[3][3];
353 
354     uint8_t focus_dist_calibrated;
355     uint8_t supported_test_pattern_modes_cnt;
356     cam_test_pattern_mode_t supported_test_pattern_modes[MAX_TEST_PATTERN_CNT];
357 
358     int64_t stall_durations[MAX_SIZES_CNT];
359 
360     cam_illuminat_t reference_illuminant1;
361     cam_illuminat_t reference_illuminant2;
362 
363     int64_t jpeg_stall_durations[MAX_SIZES_CNT];
364     int64_t raw16_stall_durations[MAX_SIZES_CNT];
365     cam_rational_type_t forward_matrix1[FORWARD_MATRIX_ROWS][FORWARD_MATRIX_COLS];
366     cam_rational_type_t forward_matrix2[FORWARD_MATRIX_ROWS][FORWARD_MATRIX_COLS];
367     cam_rational_type_t color_transform1[COLOR_TRANSFORM_ROWS][COLOR_TRANSFORM_COLS];
368     cam_rational_type_t color_transform2[COLOR_TRANSFORM_ROWS][COLOR_TRANSFORM_COLS];
369     cam_rational_type_t calibration_transform1[CAL_TRANSFORM_ROWS][CAL_TRANSFORM_COLS];
370     cam_rational_type_t calibration_transform2[CAL_TRANSFORM_ROWS][CAL_TRANSFORM_COLS];
371     uint16_t isCacSupported;
372 
373     cam_opaque_raw_format_t opaque_raw_fmt;
374 
375     /* true Portrait info */
376     cam_true_portrait_t  true_portrait_settings_need;
377 
378     /* Sensor type information */
379     cam_sensor_type_t sensor_type;
380 
381     cam_aberration_mode_t aberration_modes[CAM_COLOR_CORRECTION_ABERRATION_MAX];
382     uint32_t aberration_modes_count;
383 
384     /* Can the sensor timestamp be compared to
385      * timestamps from other sub-systems (gyro, accelerometer etc.) */
386     uint8_t isTimestampCalibrated;
387 
388     /* Analysis stream max supported size */
389     cam_dimension_t analysis_max_res;
390     /* Analysis stream padding info */
391     cam_padding_info_t analysis_padding_info;
392     /* Max size supported by ISP viewfinder path */
393     cam_dimension_t max_viewfinder_size;
394 
395     /* Analysis recommended size */
396     cam_dimension_t analysis_recommended_res;
397 
398     /* Analysis recommended format */
399     cam_format_t analysis_recommended_format;
400 
401     /* This is set to 'true' if sensor cannot guarantee per frame control */
402     /* Default value of this capability is 'false' indicating per-frame */
403     /* control is supported */
404     uint8_t no_per_frame_control_support;
405 
406     /* EIS information */
407     uint8_t supported_is_types_cnt;
408     uint32_t supported_is_types[IS_TYPE_MAX];
409     /*for each type, specify the margin needed. Margin will be
410       the decimal representation of a percentage
411       ex: 10% margin = 0.1 */
412     float supported_is_type_margins[IS_TYPE_MAX];
413 
414     /* Max cpp batch size */
415     uint8_t max_batch_bufs_supported;
416     uint32_t buf_alignment;
417     uint32_t min_stride;
418     uint32_t min_scanline;
419     uint8_t flash_dev_name[QCAMERA_MAX_FILEPATH_LENGTH];
420     uint8_t eeprom_version_info[MAX_EEPROM_VERSION_INFO_LEN];
421 
422     /* maximum pixel bandwidth shared between cameras */
423     uint64_t max_pixel_bandwidth;
424 
425     /* Array of K integers, where K%4==0,
426       as a list of rectangles in the pixelArray co-ord system
427       left, top, right, bottom */
428     int32_t optical_black_regions[MAX_OPTICAL_BLACK_REGIONS * 4];
429     /* Count is K/4 */
430     uint8_t optical_black_region_count;
431 
432     /* hot pixel */
433     uint8_t hotPixel_mode;
434     uint32_t hotPixel_count;
435     cam_coordinate_type_t hotPixelMap[512];
436 
437     /* supported instant capture/AEC convergence modes */
438     size_t supported_instant_aec_modes_cnt;
439     cam_aec_convergence_type supported_instant_aec_modes[CAM_AEC_CONVERGENCE_MAX];
440 } cam_capability_t;
441 
442 typedef enum {
443     CAM_STREAM_PARAM_TYPE_DO_REPROCESS = CAM_INTF_PARM_DO_REPROCESS,
444     CAM_STREAM_PARAM_TYPE_SET_BUNDLE_INFO = CAM_INTF_PARM_SET_BUNDLE,
445     CAM_STREAM_PARAM_TYPE_SET_FLIP = CAM_INTF_PARM_STREAM_FLIP,
446     CAM_STREAM_PARAM_TYPE_GET_OUTPUT_CROP = CAM_INTF_PARM_GET_OUTPUT_CROP,
447     CAM_STREAM_PARAM_TYPE_GET_IMG_PROP = CAM_INTF_PARM_GET_IMG_PROP,
448     CAM_STREAM_PARAM_TYPE_REQUEST_FRAMES = CAM_INTF_PARM_REQUEST_FRAMES,
449     CAM_STREAM_PARAM_TYPE_REQUEST_OPS_MODE = CAM_INTF_PARM_REQUEST_OPS_MODE,
450     CAM_STREAM_PARAM_TYPE_MAX
451 } cam_stream_param_type_e;
452 
453 typedef struct {
454     uint32_t buf_index;           /* buf index to the source frame buffer that needs reprocess,
455                                     (assume buffer is already mapped)*/
456     uint32_t frame_idx;           /* frame id of source frame to be reprocessed */
457     int32_t ret_val;              /* return value from reprocess. Could have different meanings.
458                                      i.e., faceID in the case of face registration. */
459     uint8_t meta_present;         /* if there is meta data associated with this reprocess frame */
460     uint32_t meta_stream_handle;  /* meta data stream ID. only valid if meta_present != 0 */
461     uint32_t meta_buf_index;      /* buf index to meta data buffer. only valid if meta_present != 0 */
462 
463     /* opaque metadata required for reprocessing */
464     int32_t private_data[MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES];
465     cam_rect_t crop_rect;
466 } cam_reprocess_param;
467 
468 typedef struct {
469     uint32_t flip_mask;
470 } cam_flip_mode_t;
471 
472 typedef enum {
473     /* start syncing for related cameras */
474     CAM_SYNC_RELATED_SENSORS_ON = 1,
475     /* stop syncing for related cameras */
476     CAM_SYNC_RELATED_SENSORS_OFF
477 } cam_sync_related_sensors_control_t;
478 
479 typedef enum {
480     /* Driving camera of the related camera sub-system */
481     /* Certain features are enabled only for primary camera
482        such as display mode for preview, autofocus etc
483        In certain configurations for eg. when optical zoom
484        limit is reached, Aux Camera would become
485        the driving camera and there will be role switch.*/
486     CAM_MODE_PRIMARY = 0,
487     /* Non-driving camera of the related camera sub-system
488        no display mode set for secondary camera */
489     CAM_MODE_SECONDARY
490 } cam_sync_mode_t;
491 
492 typedef enum {
493     /* Main camera of the related cam subsystem which controls
494        HW sync at sensor level*/
495     CAM_TYPE_MAIN = 0,
496     /* Aux camera of the related cam subsystem */
497     CAM_TYPE_AUX
498 } cam_sync_type_t;
499 
500 /* Payload for sending bundling info to backend */
501 typedef struct {
502     cam_sync_related_sensors_control_t sync_control;
503     cam_sync_type_t type;
504     cam_sync_mode_t mode;
505     /* session Id of the other camera session
506        Linking will be done with this session in the
507        backend */
508     uint32_t related_sensor_session_id;
509     uint8_t is_frame_sync_enabled;
510 }cam_sync_related_sensors_event_info_t;
511 
512 /* Related camera sensor specific calibration data */
513 typedef struct {
514     /* Focal length in pixels @ calibration resolution.*/
515     float       normalized_focal_length;
516     /* Native sensor resolution W that was used to capture calibration image */
517     uint16_t    native_sensor_resolution_width;
518     /* Native sensor resolution H that was used to capture calibration image */
519     uint16_t    native_sensor_resolution_height;
520     /* Image size W used internally by calibration tool */
521     uint16_t    calibration_sensor_resolution_width;
522     /* Image size H used internally by calibration tool */
523     uint16_t    calibration_sensor_resolution_height;
524     /* Focal length ratio @ Calibration */
525     float       focal_length_ratio;
526 }cam_related_sensor_calibration_data_t;
527 
528 /* Related Camera System Calibration data
529    Calibration data for the entire related cam sub-system is
530    in a shared EEPROM. We have 2 fields which are specific to
531    each sensor followed by a set of common calibration of the
532    entire related cam system*/
533 typedef struct {
534     /* Version information */
535     uint32_t    calibration_format_version;
536     /* Main Camera Sensor specific calibration */
537     cam_related_sensor_calibration_data_t  main_cam_specific_calibration;
538     /* Aux Camera Sensor specific calibration */
539     cam_related_sensor_calibration_data_t  aux_cam_specific_calibration;
540     /* Relative viewpoint matching matrix w.r.t Main */
541     float      relative_rotation_matrix[RELCAM_CALIB_ROT_MATRIX_MAX];
542     /* Relative geometric surface description parameters */
543     float      relative_geometric_surface_parameters[
544             RELCAM_CALIB_SURFACE_PARMS_MAX];
545     /* Relative offset of sensor center from optical axis along horizontal dimension */
546     float      relative_principle_point_x_offset;
547     /* Relative offset of sensor center from optical axis along vertical dimension */
548     float      relative_principle_point_y_offset;
549     /* 0=Main Camera is on the left of Aux; 1=Main Camera is on the right of Aux */
550     uint16_t   relative_position_flag;
551     /* Camera separation in mm */
552     float      relative_baseline_distance;
553     /* main sensor setting during cal: 0-none, 1-hor-mirror, 2-ver-flip, 3-both */
554     uint16_t   main_sensor_mirror_flip_setting;
555     /* aux sensor setting during cal: 0-none, 1-hor-mirror, 2-ver-flip, 3-both */
556     uint16_t   aux_sensor_mirror_flip_setting;
557     /* module orientation during cal: 0-sensors in landscape, 1-sensors in portrait */
558     uint16_t   module_orientation_during_calibration;
559     /* cal images required rotation: 0-no, 1-90 degrees right, 2-90 degrees left */
560     uint16_t   rotation_flag;
561     /* Reserved for future use */
562     float      reserved[RELCAM_CALIB_RESERVED_MAX];
563 } cam_related_system_calibration_data_t;
564 
565 typedef struct {
566   uint32_t default_sensor_flip;
567   uint32_t sensor_mount_angle;
568   cam_related_system_calibration_data_t otp_calibration_data;
569 } cam_jpeg_metadata_t;
570 
571 #define IMG_NAME_SIZE 32
572 typedef struct {
573     cam_rect_t crop;  /* crop info for the image */
574     cam_dimension_t input; /* input dimension of the image */
575     cam_dimension_t output; /* output dimension of the image */
576     char name[IMG_NAME_SIZE]; /* optional name of the ext*/
577     cam_format_t format; /* image format */
578 } cam_stream_img_prop_t;
579 
580 typedef struct {
581     uint8_t enableStream; /*0 � stop and 1-start */
582 } cam_request_frames;
583 
584 typedef struct {
585     cam_stream_param_type_e type;
586     union {
587         cam_reprocess_param reprocess;  /* do reprocess */
588         cam_bundle_config_t bundleInfo; /* set bundle info*/
589         cam_flip_mode_t flipInfo;       /* flip mode */
590         cam_crop_data_t outputCrop;     /* output crop for current frame */
591         cam_stream_img_prop_t imgProp;  /* image properties of current frame */
592         cam_request_frames frameRequest; /*do TNR process*/
593         cam_perf_mode_t perf_mode;       /*request operational mode*/
594     };
595 } cam_stream_parm_buffer_t;
596 
597 /* stream info */
598 typedef struct {
599     /* stream ID from server */
600     uint32_t stream_svr_id;
601 
602     /* stream type */
603     cam_stream_type_t stream_type;
604 
605     /* image format */
606     cam_format_t fmt;
607 
608     /* image dimension */
609     cam_dimension_t dim;
610 
611     /* buffer plane information, will be calc based on stream_type, fmt,
612        dim, and padding_info(from stream config). Info including:
613        offset_x, offset_y, stride, scanline, plane offset */
614     cam_stream_buf_plane_info_t buf_planes;
615 
616     /* number of stream bufs will be allocated */
617     uint32_t num_bufs;
618 
619     /* streaming type */
620     cam_streaming_mode_t streaming_mode;
621 
622     /* num of frames needs to be generated.
623      * only valid when streaming_mode = CAM_STREAMING_MODE_BURST */
624     uint8_t num_of_burst;
625 
626     /* num of frames in one batch.
627      * only valid when streaming_mode = CAM_STREAMING_MODE_BATCH */
628     cam_stream_user_buf_info_t user_buf_info;
629 
630     /* stream specific pp config */
631     cam_pp_feature_config_t pp_config;
632 
633     /* this section is valid if offline reprocess type stream */
634     cam_stream_reproc_config_t reprocess_config;
635 
636     cam_stream_parm_buffer_t parm_buf;    /* stream based parameters */
637 
638     uint8_t dis_enable;
639 
640     /* Image Stabilization type */
641     cam_is_type_t is_type;
642 
643     /* Signifies Secure stream mode */
644     cam_stream_secure_t is_secure;
645 
646     /* Preferred Performance mode */
647     cam_perf_mode_t perf_mode;
648 
649     /* if frames will not be received */
650     uint8_t noFrameExpected;
651 } cam_stream_info_t;
652 
653 /*****************************************************************************
654  *                 Code for Domain Socket Based Parameters                   *
655  ****************************************************************************/
656 #define INCLUDE(PARAM_ID,DATATYPE,COUNT)  \
657         DATATYPE member_variable_##PARAM_ID[ COUNT ]
658 
659 #define POINTER_OF_META(META_ID, TABLE_PTR) \
660         ((NULL != TABLE_PTR) ? \
661             (&TABLE_PTR->data.member_variable_##META_ID[ 0 ]) : (NULL))
662 
663 #define SIZE_OF_PARAM(META_ID, TABLE_PTR) \
664         sizeof(TABLE_PTR->data.member_variable_##META_ID)
665 
666 #define IF_META_AVAILABLE(META_TYPE, META_PTR_NAME, META_ID, TABLE_PTR) \
667         META_TYPE *META_PTR_NAME = \
668         (((NULL != TABLE_PTR) && (TABLE_PTR->is_valid[META_ID])) ? \
669             (&TABLE_PTR->data.member_variable_##META_ID[ 0 ]) : \
670             (NULL)); \
671         if (NULL != META_PTR_NAME) \
672 
673 #define ADD_SET_PARAM_ENTRY_TO_BATCH(TABLE_PTR, META_ID, DATA) \
674     ((NULL != TABLE_PTR) ? \
675     ((TABLE_PTR->data.member_variable_##META_ID[ 0 ] = DATA), \
676     (TABLE_PTR->is_valid[META_ID] = 1), (0)) : \
677     ((LOGE("Unable to set metadata TABLE_PTR:%p META_ID:%d", \
678             TABLE_PTR, META_ID)), (-1))) \
679 
680 #define ADD_SET_PARAM_ARRAY_TO_BATCH(TABLE_PTR, META_ID, PDATA, COUNT, RCOUNT) \
681 { \
682     if ((NULL != TABLE_PTR) && \
683             (0 < COUNT) && \
684             ((sizeof(TABLE_PTR->data.member_variable_##META_ID) / \
685             sizeof(TABLE_PTR->data.member_variable_##META_ID[ 0 ])) \
686             >= COUNT))  { \
687         for (size_t _i = 0; _i < COUNT ; _i++) { \
688             TABLE_PTR->data.member_variable_##META_ID[ _i ] = PDATA [ _i ]; \
689         } \
690         TABLE_PTR->is_valid[META_ID] = 1; \
691         RCOUNT = COUNT; \
692     } else { \
693         LOGE("Unable to set metadata TABLE_PTR:%p META_ID:%d COUNT:%zu", \
694               TABLE_PTR, META_ID, COUNT); \
695         RCOUNT = 0; \
696     } \
697 }
698 
699 #define ADD_GET_PARAM_ENTRY_TO_BATCH(TABLE_PTR, META_ID) \
700 { \
701     if (NULL != TABLE_PTR) { \
702         TABLE_PTR->is_reqd[META_ID] = 1; \
703     } else { \
704         LOGE("Unable to get metadata TABLE_PTR:%p META_ID:%d", \
705                   TABLE_PTR, META_ID); \
706     } \
707 }
708 
709 #define READ_PARAM_ENTRY(TABLE_PTR, META_ID, DATA) \
710 { \
711     if (NULL != TABLE_PTR) { \
712         DATA = TABLE_PTR->data.member_variable_##META_ID[ 0 ]; \
713     } else { \
714         LOGE("Unable to read metadata TABLE_PTR:%p META_ID:%d", \
715                   TABLE_PTR, META_ID); \
716     } \
717 }
718 
719 /************************************
720 * Custom parameter data definition
721 *************************************/
722 typedef struct {
723     /*CAM_CUSTOM_PARM_EXAMPLE is added to explain custom param procedure*/
724     INCLUDE(CAM_CUSTOM_PARM_EXAMPLE,            int32_t,           1);
725 } custom_parm_data_t;
726 
727 /************************************
728 * Custom Parameter buffer definition
729 *************************************/
730 typedef struct {
731     union {
732         /* Hash table of 'is valid' flags */
733         uint8_t         is_valid[CAM_CUSTOM_PARM_MAX];
734 
735         /* Hash table of 'is required' flags for the GET PARAM */
736         uint8_t         is_reqd[CAM_CUSTOM_PARM_MAX];
737     };
738     custom_parm_data_t data;
739 } custom_parm_buffer_t;
740 
741 
742 typedef struct {
743 /**************************************************************************************
744  *  ID from (cam_intf_metadata_type_t)                DATATYPE                     COUNT
745  **************************************************************************************/
746     /* common between HAL1 and HAL3 */
747     INCLUDE(CAM_INTF_META_HISTOGRAM,                    cam_hist_stats_t,               1);
748     INCLUDE(CAM_INTF_META_FACE_DETECTION,               cam_face_detection_data_t,      1);
749     INCLUDE(CAM_INTF_META_FACE_RECOG,                   cam_face_recog_data_t,          1);
750     INCLUDE(CAM_INTF_META_FACE_BLINK,                   cam_face_blink_data_t,          1);
751     INCLUDE(CAM_INTF_META_FACE_GAZE,                    cam_face_gaze_data_t,           1);
752     INCLUDE(CAM_INTF_META_FACE_SMILE,                   cam_face_smile_data_t,          1);
753     INCLUDE(CAM_INTF_META_FACE_LANDMARK,                cam_face_landmarks_data_t,      1);
754     INCLUDE(CAM_INTF_META_FACE_CONTOUR,                 cam_face_contour_data_t,        1);
755     INCLUDE(CAM_INTF_META_AUTOFOCUS_DATA,               cam_auto_focus_data_t,          1);
756     INCLUDE(CAM_INTF_META_CDS_DATA,                     cam_cds_data_t,                 1);
757     INCLUDE(CAM_INTF_PARM_UPDATE_DEBUG_LEVEL,           uint32_t,                       1);
758 
759     /* Specific to HAl1 */
760     INCLUDE(CAM_INTF_META_CROP_DATA,                    cam_crop_data_t,                1);
761     INCLUDE(CAM_INTF_META_PREP_SNAPSHOT_DONE,           int32_t,                        1);
762     INCLUDE(CAM_INTF_META_GOOD_FRAME_IDX_RANGE,         cam_frame_idx_range_t,          1);
763     INCLUDE(CAM_INTF_META_ASD_HDR_SCENE_DATA,           cam_asd_hdr_scene_data_t,       1);
764     INCLUDE(CAM_INTF_META_ASD_SCENE_INFO,               cam_asd_decision_t,             1);
765     INCLUDE(CAM_INTF_META_CURRENT_SCENE,                cam_scene_mode_type,            1);
766     INCLUDE(CAM_INTF_META_AWB_INFO,                     cam_awb_params_t,               1);
767     INCLUDE(CAM_INTF_META_FOCUS_POSITION,               cam_focus_pos_info_t,           1);
768     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ISP,           cam_chromatix_lite_isp_t,       1);
769     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_PP,            cam_chromatix_lite_pp_t,        1);
770     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AE,            cam_chromatix_lite_ae_stats_t,  1);
771     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AWB,           cam_chromatix_lite_awb_stats_t, 1);
772     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_AF,            cam_chromatix_lite_af_stats_t,  1);
773     INCLUDE(CAM_INTF_META_CHROMATIX_LITE_ASD,           cam_chromatix_lite_asd_stats_t, 1);
774     INCLUDE(CAM_INTF_BUF_DIVERT_INFO,                   cam_buf_divert_info_t,          1);
775 
776     /* Specific to HAL3 */
777     INCLUDE(CAM_INTF_META_FRAME_NUMBER_VALID,           int32_t,                     1);
778     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER_VALID,    int32_t,                     1);
779     INCLUDE(CAM_INTF_META_FRAME_DROPPED,                cam_frame_dropped_t,         1);
780     INCLUDE(CAM_INTF_META_FRAME_NUMBER,                 uint32_t,                    1);
781     INCLUDE(CAM_INTF_META_URGENT_FRAME_NUMBER,          uint32_t,                    1);
782     INCLUDE(CAM_INTF_META_COLOR_CORRECT_MODE,           uint32_t,                    1);
783     INCLUDE(CAM_INTF_META_COLOR_CORRECT_TRANSFORM,      cam_color_correct_matrix_t,  1);
784     INCLUDE(CAM_INTF_META_COLOR_CORRECT_GAINS,          cam_color_correct_gains_t,   1);
785     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM, cam_color_correct_matrix_t,  1);
786     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,     cam_color_correct_gains_t,   1);
787     INCLUDE(CAM_INTF_META_AEC_ROI,                      cam_area_t,                  1);
788     INCLUDE(CAM_INTF_META_AEC_STATE,                    uint32_t,                    1);
789     INCLUDE(CAM_INTF_PARM_FOCUS_MODE,                   uint32_t,                    1);
790     INCLUDE(CAM_INTF_PARM_MANUAL_FOCUS_POS,             cam_manual_focus_parm_t,     1);
791     INCLUDE(CAM_INTF_META_AF_ROI,                       cam_area_t,                  1);
792     INCLUDE(CAM_INTF_META_AF_STATE,                     uint32_t,                    1);
793     INCLUDE(CAM_INTF_PARM_WHITE_BALANCE,                int32_t,                     1);
794     INCLUDE(CAM_INTF_META_AWB_REGIONS,                  cam_area_t,                  1);
795     INCLUDE(CAM_INTF_META_AWB_STATE,                    uint32_t,                    1);
796     INCLUDE(CAM_INTF_META_BLACK_LEVEL_LOCK,             uint32_t,                    1);
797     INCLUDE(CAM_INTF_META_MODE,                         uint32_t,                    1);
798     INCLUDE(CAM_INTF_META_EDGE_MODE,                    cam_edge_application_t,      1);
799     INCLUDE(CAM_INTF_META_FLASH_POWER,                  uint32_t,                    1);
800     INCLUDE(CAM_INTF_META_FLASH_FIRING_TIME,            int64_t,                     1);
801     INCLUDE(CAM_INTF_META_FLASH_MODE,                   uint32_t,                    1);
802     INCLUDE(CAM_INTF_META_FLASH_STATE,                  int32_t,                     1);
803     INCLUDE(CAM_INTF_META_HOTPIXEL_MODE,                uint32_t,                    1);
804     INCLUDE(CAM_INTF_META_LENS_APERTURE,                float,                       1);
805     INCLUDE(CAM_INTF_META_LENS_FILTERDENSITY,           float,                       1);
806     INCLUDE(CAM_INTF_META_LENS_FOCAL_LENGTH,            float,                       1);
807     INCLUDE(CAM_INTF_META_LENS_FOCUS_DISTANCE,          float,                       1);
808     INCLUDE(CAM_INTF_META_LENS_FOCUS_RANGE,             float,                       2);
809     INCLUDE(CAM_INTF_META_LENS_STATE,                   cam_af_lens_state_t,         1);
810     INCLUDE(CAM_INTF_META_LENS_OPT_STAB_MODE,           uint32_t,                    1);
811     INCLUDE(CAM_INTF_META_VIDEO_STAB_MODE,              uint32_t,                    1);
812     INCLUDE(CAM_INTF_META_LENS_FOCUS_STATE,             uint32_t,                    1);
813     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_MODE,         uint32_t,                    1);
814     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_STRENGTH,     uint32_t,                    1);
815     INCLUDE(CAM_INTF_META_SCALER_CROP_REGION,           cam_crop_region_t,           1);
816     INCLUDE(CAM_INTF_META_SCENE_FLICKER,                uint32_t,                    1);
817     INCLUDE(CAM_INTF_META_SENSOR_EXPOSURE_TIME,         int64_t,                     1);
818     INCLUDE(CAM_INTF_META_SENSOR_FRAME_DURATION,        int64_t,                     1);
819     INCLUDE(CAM_INTF_META_SENSOR_SENSITIVITY,           int32_t,                     1);
820     INCLUDE(CAM_INTF_META_ISP_SENSITIVITY ,             int32_t,                     1);
821     INCLUDE(CAM_INTF_META_SENSOR_TIMESTAMP,             int64_t,                     1);
822     INCLUDE(CAM_INTF_META_SENSOR_ROLLING_SHUTTER_SKEW,  int64_t,                     1);
823     INCLUDE(CAM_INTF_META_SHADING_MODE,                 uint32_t,                    1);
824     INCLUDE(CAM_INTF_META_STATS_FACEDETECT_MODE,        uint32_t,                    1);
825     INCLUDE(CAM_INTF_META_STATS_HISTOGRAM_MODE,         uint32_t,                    1);
826     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,     uint32_t,                    1);
827     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP,          cam_sharpness_map_t,         3);
828     INCLUDE(CAM_INTF_META_TONEMAP_CURVES,               cam_rgb_tonemap_curves,      1);
829     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP,             cam_lens_shading_map_t,      1);
830     INCLUDE(CAM_INTF_META_AEC_INFO,                     cam_3a_params_t,             1);
831     INCLUDE(CAM_INTF_META_SENSOR_INFO,                  cam_sensor_params_t,         1);
832     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AE,                cam_ae_exif_debug_t,         1);
833     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AWB,               cam_awb_exif_debug_t,        1);
834     INCLUDE(CAM_INTF_META_EXIF_DEBUG_AF,                cam_af_exif_debug_t,         1);
835     INCLUDE(CAM_INTF_META_EXIF_DEBUG_ASD,               cam_asd_exif_debug_t,        1);
836     INCLUDE(CAM_INTF_META_EXIF_DEBUG_STATS,             cam_stats_buffer_exif_debug_t, 1);
837     INCLUDE(CAM_INTF_PARM_EFFECT,                       uint32_t,                    1);
838     /* Defining as int32_t so that this array is 4 byte aligned */
839     INCLUDE(CAM_INTF_META_PRIVATE_DATA,                 int32_t,
840             MAX_METADATA_PRIVATE_PAYLOAD_SIZE_IN_BYTES / 4);
841 
842     /* Following are Params only and not metadata currently */
843     INCLUDE(CAM_INTF_PARM_HAL_VERSION,                  int32_t,                     1);
844     /* Shared between HAL1 and HAL3 */
845     INCLUDE(CAM_INTF_PARM_ANTIBANDING,                  uint32_t,                    1);
846     INCLUDE(CAM_INTF_PARM_EXPOSURE_COMPENSATION,        int32_t,                     1);
847     INCLUDE(CAM_INTF_PARM_EV_STEP,                      cam_rational_type_t,         1);
848     INCLUDE(CAM_INTF_PARM_AEC_LOCK,                     uint32_t,                    1);
849     INCLUDE(CAM_INTF_PARM_FPS_RANGE,                    cam_fps_range_t,             1);
850     INCLUDE(CAM_INTF_PARM_AWB_LOCK,                     uint32_t,                    1);
851     INCLUDE(CAM_INTF_PARM_BESTSHOT_MODE,                uint32_t,                    1);
852     INCLUDE(CAM_INTF_PARM_DIS_ENABLE,                   int32_t,                     1);
853     INCLUDE(CAM_INTF_PARM_LED_MODE,                     int32_t,                     1);
854     INCLUDE(CAM_INTF_META_LED_MODE_OVERRIDE,            uint32_t,                    1);
855 
856     /* dual camera specific params */
857     INCLUDE(CAM_INTF_PARM_RELATED_SENSORS_CALIBRATION,  cam_related_system_calibration_data_t, 1);
858     INCLUDE(CAM_INTF_META_AF_FOCAL_LENGTH_RATIO,        cam_focal_length_ratio_t, 1);
859     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_SENSOR,        cam_stream_crop_info_t,   1);
860     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_CAMIF,         cam_stream_crop_info_t,   1);
861     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_ISP,           cam_stream_crop_info_t,   1);
862     INCLUDE(CAM_INTF_META_SNAP_CROP_INFO_CPP,           cam_stream_crop_info_t,   1);
863     INCLUDE(CAM_INTF_META_DCRF,                         cam_dcrf_result_t,        1);
864 
865     /* HAL1 specific */
866     /* read only */
867     INCLUDE(CAM_INTF_PARM_QUERY_FLASH4SNAP,             int32_t,                     1);
868     INCLUDE(CAM_INTF_PARM_EXPOSURE,                     int32_t,                     1);
869     INCLUDE(CAM_INTF_PARM_SHARPNESS,                    int32_t,                     1);
870     INCLUDE(CAM_INTF_PARM_CONTRAST,                     int32_t,                     1);
871     INCLUDE(CAM_INTF_PARM_SATURATION,                   int32_t,                     1);
872     INCLUDE(CAM_INTF_PARM_BRIGHTNESS,                   int32_t,                     1);
873     INCLUDE(CAM_INTF_PARM_ISO,                          cam_intf_parm_manual_3a_t,   1);
874     INCLUDE(CAM_INTF_PARM_EXPOSURE_TIME,                cam_intf_parm_manual_3a_t,   1);
875     INCLUDE(CAM_INTF_PARM_ZOOM,                         int32_t,                     1);
876     INCLUDE(CAM_INTF_PARM_ROLLOFF,                      int32_t,                     1);
877     INCLUDE(CAM_INTF_PARM_MODE,                         int32_t,                     1);
878     INCLUDE(CAM_INTF_PARM_AEC_ALGO_TYPE,                int32_t,                     1);
879     INCLUDE(CAM_INTF_PARM_FOCUS_ALGO_TYPE,              int32_t,                     1);
880     INCLUDE(CAM_INTF_PARM_AEC_ROI,                      cam_set_aec_roi_t,           1);
881     INCLUDE(CAM_INTF_PARM_AF_ROI,                       cam_roi_info_t,              1);
882     INCLUDE(CAM_INTF_PARM_SCE_FACTOR,                   int32_t,                     1);
883     INCLUDE(CAM_INTF_PARM_FD,                           cam_fd_set_parm_t,           1);
884     INCLUDE(CAM_INTF_PARM_MCE,                          int32_t,                     1);
885     INCLUDE(CAM_INTF_PARM_HFR,                          int32_t,                     1);
886     INCLUDE(CAM_INTF_PARM_REDEYE_REDUCTION,             int32_t,                     1);
887     INCLUDE(CAM_INTF_PARM_WAVELET_DENOISE,              cam_denoise_param_t,         1);
888     INCLUDE(CAM_INTF_PARM_TEMPORAL_DENOISE,             cam_denoise_param_t,         1);
889     INCLUDE(CAM_INTF_PARM_HISTOGRAM,                    int32_t,                     1);
890     INCLUDE(CAM_INTF_PARM_ASD_ENABLE,                   int32_t,                     1);
891     INCLUDE(CAM_INTF_PARM_RECORDING_HINT,               int32_t,                     1);
892     INCLUDE(CAM_INTF_PARM_HDR,                          cam_exp_bracketing_t,        1);
893     INCLUDE(CAM_INTF_PARM_FRAMESKIP,                    int32_t,                     1);
894     INCLUDE(CAM_INTF_PARM_ZSL_MODE,                     int32_t,                     1);
895     INCLUDE(CAM_INTF_PARM_HDR_NEED_1X,                  int32_t,                     1);
896     INCLUDE(CAM_INTF_PARM_LOCK_CAF,                     int32_t,                     1);
897     INCLUDE(CAM_INTF_PARM_VIDEO_HDR,                    int32_t,                     1);
898     INCLUDE(CAM_INTF_PARM_SENSOR_HDR,                   cam_sensor_hdr_type_t,       1);
899     INCLUDE(CAM_INTF_PARM_VT,                           int32_t,                     1);
900     INCLUDE(CAM_INTF_PARM_SET_AUTOFOCUSTUNING,          tune_actuator_t,             1);
901     INCLUDE(CAM_INTF_PARM_SET_VFE_COMMAND,              tune_cmd_t,                  1);
902     INCLUDE(CAM_INTF_PARM_SET_PP_COMMAND,               tune_cmd_t,                  1);
903     INCLUDE(CAM_INTF_PARM_MAX_DIMENSION,                cam_dimension_t,             1);
904     INCLUDE(CAM_INTF_PARM_RAW_DIMENSION,                cam_dimension_t,             1);
905     INCLUDE(CAM_INTF_PARM_TINTLESS,                     int32_t,                     1);
906     INCLUDE(CAM_INTF_PARM_WB_MANUAL,                    cam_manual_wb_parm_t,        1);
907     INCLUDE(CAM_INTF_PARM_CDS_MODE,                     int32_t,                     1);
908     INCLUDE(CAM_INTF_PARM_EZTUNE_CMD,                   cam_eztune_cmd_data_t,       1);
909     INCLUDE(CAM_INTF_PARM_INT_EVT,                      cam_int_evt_params_t,        1);
910     INCLUDE(CAM_INTF_PARM_RDI_MODE,                     int32_t,                     1);
911     INCLUDE(CAM_INTF_PARM_BURST_NUM,                    uint32_t,                    1);
912     INCLUDE(CAM_INTF_PARM_RETRO_BURST_NUM,              uint32_t,                    1);
913     INCLUDE(CAM_INTF_PARM_BURST_LED_ON_PERIOD,          uint32_t,                    1);
914     INCLUDE(CAM_INTF_PARM_LONGSHOT_ENABLE,              int8_t,                      1);
915     INCLUDE(CAM_INTF_PARM_TONE_MAP_MODE,                uint32_t,                    1);
916     INCLUDE(CAM_INTF_META_TOUCH_AE_RESULT,              int32_t,                     1);
917     INCLUDE(CAM_INTF_PARM_DUAL_LED_CALIBRATION,         int32_t,                     1);
918     INCLUDE(CAM_INTF_PARM_ADV_CAPTURE_MODE,             uint8_t,                     1);
919 
920     /* HAL3 specific */
921     INCLUDE(CAM_INTF_META_STREAM_INFO,                  cam_stream_size_info_t,      1);
922     INCLUDE(CAM_INTF_META_AEC_MODE,                     uint32_t,                    1);
923     INCLUDE(CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,       cam_trigger_t,               1);
924     INCLUDE(CAM_INTF_META_AF_TRIGGER,                   cam_trigger_t,               1);
925     INCLUDE(CAM_INTF_META_CAPTURE_INTENT,               uint32_t,                    1);
926     INCLUDE(CAM_INTF_META_DEMOSAIC,                     int32_t,                     1);
927     INCLUDE(CAM_INTF_META_SHARPNESS_STRENGTH,           int32_t,                     1);
928     INCLUDE(CAM_INTF_META_GEOMETRIC_MODE,               uint32_t,                    1);
929     INCLUDE(CAM_INTF_META_GEOMETRIC_STRENGTH,           uint32_t,                    1);
930     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP_MODE,        uint32_t,                    1);
931     INCLUDE(CAM_INTF_META_SHADING_STRENGTH,             uint32_t,                    1);
932     INCLUDE(CAM_INTF_META_TONEMAP_MODE,                 uint32_t,                    1);
933     INCLUDE(CAM_INTF_META_STREAM_ID,                    cam_stream_ID_t,             1);
934     INCLUDE(CAM_INTF_PARM_STATS_DEBUG_MASK,             uint32_t,                    1);
935     INCLUDE(CAM_INTF_PARM_STATS_AF_PAAF,                uint32_t,                    1);
936     INCLUDE(CAM_INTF_PARM_FOCUS_BRACKETING,             cam_af_bracketing_t,         1);
937     INCLUDE(CAM_INTF_PARM_FLASH_BRACKETING,             cam_flash_bracketing_t,      1);
938     INCLUDE(CAM_INTF_META_JPEG_GPS_COORDINATES,         double,                      3);
939     INCLUDE(CAM_INTF_META_JPEG_GPS_PROC_METHODS,        uint8_t,                     GPS_PROCESSING_METHOD_SIZE);
940     INCLUDE(CAM_INTF_META_JPEG_GPS_TIMESTAMP,           int64_t,                     1);
941     INCLUDE(CAM_INTF_META_JPEG_ORIENTATION,             int32_t,                     1);
942     INCLUDE(CAM_INTF_META_JPEG_QUALITY,                 uint32_t,                    1);
943     INCLUDE(CAM_INTF_META_JPEG_THUMB_QUALITY,           uint32_t,                    1);
944     INCLUDE(CAM_INTF_META_JPEG_THUMB_SIZE,              cam_dimension_t,             1);
945     INCLUDE(CAM_INTF_META_TEST_PATTERN_DATA,            cam_test_pattern_data_t,     1);
946     INCLUDE(CAM_INTF_META_PROFILE_TONE_CURVE,           cam_profile_tone_curve,      1);
947     INCLUDE(CAM_INTF_META_OTP_WB_GRGB,                  float,                       1);
948     INCLUDE(CAM_INTF_META_IMG_HYST_INFO,                cam_img_hysterisis_info_t,   1);
949     INCLUDE(CAM_INTF_META_CAC_INFO,                     cam_cac_info_t,              1);
950     INCLUDE(CAM_INTF_PARM_CAC,                          cam_aberration_mode_t,       1);
951     INCLUDE(CAM_INTF_META_NEUTRAL_COL_POINT,            cam_neutral_col_point_t,     1);
952     INCLUDE(CAM_INTF_PARM_ROTATION,                     cam_rotation_info_t,         1);
953     INCLUDE(CAM_INTF_PARM_HW_DATA_OVERWRITE,            cam_hw_data_overwrite_t,     1);
954     INCLUDE(CAM_INTF_META_IMGLIB,                       cam_intf_meta_imglib_t,      1);
955     INCLUDE(CAM_INTF_PARM_CAPTURE_FRAME_CONFIG,         cam_capture_frame_config_t,  1);
956     INCLUDE(CAM_INTF_PARM_CUSTOM,                       custom_parm_buffer_t,        1);
957     INCLUDE(CAM_INTF_PARM_FLIP,                         int32_t,                     1);
958     INCLUDE(CAM_INTF_META_USE_AV_TIMER,                 uint8_t,                     1);
959     INCLUDE(CAM_INTF_META_EFFECTIVE_EXPOSURE_FACTOR,    float,                       1);
960     INCLUDE(CAM_INTF_META_LDAF_EXIF,                    uint32_t,                    2);
961     INCLUDE(CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN,   cam_black_level_metadata_t,  1);
962     INCLUDE(CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN,  cam_black_level_metadata_t,  1);
963     INCLUDE(CAM_INTF_META_LOW_LIGHT,                    cam_low_light_mode_t,        1);
964     INCLUDE(CAM_INTF_META_IMG_DYN_FEAT,                 cam_dyn_img_data_t,          1);
965     INCLUDE(CAM_INTF_PARM_MANUAL_CAPTURE_TYPE,          cam_manual_capture_type,     1);
966     INCLUDE(CAM_INTF_AF_STATE_TRANSITION,               uint8_t,                     1);
967     INCLUDE(CAM_INTF_PARM_INITIAL_EXPOSURE_INDEX,       uint32_t,                    1);
968     INCLUDE(CAM_INTF_PARM_INSTANT_AEC,                  uint8_t,                     1);
969 } metadata_data_t;
970 
971 /* Update clear_metadata_buffer() function when a new is_xxx_valid is added to
972  * or removed from this structure */
973 typedef struct {
974     union{
975         /* Hash table of 'is valid' flags */
976         uint8_t         is_valid[CAM_INTF_PARM_MAX];
977 
978         /* Hash table of 'is required' flags for the GET PARAM */
979         uint8_t         is_reqd[CAM_INTF_PARM_MAX];
980     };
981     metadata_data_t data;
982     /*Tuning Data */
983     uint8_t is_tuning_params_valid;
984     tuning_params_t tuning_params;
985 
986     /* Mobicat Params */
987     uint8_t is_mobicat_aec_params_valid;
988     cam_3a_params_t mobicat_aec_params;
989 
990     /* Stats 3A Debug Params */
991     uint8_t is_statsdebug_ae_params_valid;
992     cam_ae_exif_debug_t statsdebug_ae_data;
993 
994     uint8_t is_statsdebug_awb_params_valid;
995     cam_awb_exif_debug_t statsdebug_awb_data;
996 
997     uint8_t is_statsdebug_af_params_valid;
998     cam_af_exif_debug_t statsdebug_af_data;
999 
1000     uint8_t is_statsdebug_asd_params_valid;
1001     cam_asd_exif_debug_t statsdebug_asd_data;
1002 
1003     uint8_t is_statsdebug_stats_params_valid;
1004     cam_stats_buffer_exif_debug_t statsdebug_stats_buffer_data;
1005 } metadata_buffer_t;
1006 
1007 typedef metadata_buffer_t parm_buffer_t;
1008 
1009 #ifdef  __cplusplus
1010 extern "C" {
1011 #endif
1012 
1013 /* Update this inline function when a new is_xxx_valid is added to
1014  * or removed from metadata_buffer_t */
clear_metadata_buffer(metadata_buffer_t * meta)1015 static inline void clear_metadata_buffer(metadata_buffer_t *meta)
1016 {
1017     if (meta) {
1018       memset(meta->is_valid, 0, CAM_INTF_PARM_MAX);
1019       meta->is_tuning_params_valid = 0;
1020       meta->is_mobicat_aec_params_valid = 0;
1021       meta->is_statsdebug_ae_params_valid = 0;
1022       meta->is_statsdebug_awb_params_valid = 0;
1023       meta->is_statsdebug_af_params_valid = 0;
1024       meta->is_statsdebug_asd_params_valid = 0;
1025       meta->is_statsdebug_stats_params_valid = 0;
1026     }
1027 }
1028 
1029 #ifdef  __cplusplus
1030 }
1031 #endif
1032 
1033 #endif /* __QCAMERA_INTF_H__ */
1034