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