1 /* Copyright (c) 2012-2013, 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. TRIGGER_AF in HAL3 request */
41     CAM_PRIV_DO_AUTO_FOCUS,
42     /* session based action: cancel auto focus. TRIGGER_AF in HAL3 request. */
43     CAM_PRIV_CANCEL_AUTO_FOCUS,
44     /* session based action: prepare for snapshot. TRIGGER_AE_PREPARE in HAL3*/
45     CAM_PRIV_PREPARE_SNAPSHOT,
46     /* sync stream info. Used for configure_streams */
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     uint16_t isWnrSupported;
63     /* supported iso modes */
64     uint8_t supported_iso_modes_cnt;
65     cam_iso_mode_type supported_iso_modes[CAM_ISO_MODE_MAX];
66 
67     /* supported flash modes */
68     uint8_t supported_flash_modes_cnt;
69     cam_flash_mode_t supported_flash_modes[CAM_FLASH_MODE_MAX];
70 
71     uint8_t zoom_ratio_tbl_cnt;                             /* table size for zoom ratios */
72     int zoom_ratio_tbl[MAX_ZOOMS_CNT];                      /* zoom ratios table */
73 
74     int qcom_supported_feature_mask;      /* mask of qcom specific features supported:
75                                            * such as CAM_QCOM_FEATURE_SUPPORTED_FACE_DETECTION*/
76 
77     /* supported effect modes */
78     uint8_t supported_effects_cnt;
79     cam_effect_mode_type supported_effects[CAM_EFFECT_MODE_MAX];
80 
81     /* supported scene modes */
82     uint8_t supported_scene_modes_cnt;
83     cam_scene_mode_type supported_scene_modes[CAM_SCENE_MODE_MAX];
84 
85     /* supported auto exposure modes */
86     uint8_t supported_aec_modes_cnt;
87     cam_auto_exposure_mode_type supported_aec_modes[CAM_AEC_MODE_MAX];
88 
89     uint8_t fps_ranges_tbl_cnt;                             /* fps ranges table size */
90     cam_fps_range_t fps_ranges_tbl[MAX_SIZES_CNT];          /* fps ranges table */
91 
92     /* supported antibanding modes */
93     uint8_t supported_antibandings_cnt;
94     cam_antibanding_mode_type supported_antibandings[CAM_ANTIBANDING_MODE_MAX];
95 
96     /* supported white balance modes */
97     uint8_t supported_white_balances_cnt;
98     cam_wb_mode_type supported_white_balances[CAM_WB_MODE_MAX];
99 
100     /* supported focus modes */
101     uint8_t supported_focus_modes_cnt;
102     cam_focus_mode_type supported_focus_modes[CAM_FOCUS_MODE_MAX];
103 
104     int exposure_compensation_min;       /* min value of exposure compensation index */
105     int exposure_compensation_max;       /* max value of exposure compensation index */
106     int exposure_compensation_default;   /* default value of exposure compensation index */
107     float exposure_compensation_step;
108     cam_rational_type_t exp_compensation_step;    /* exposure compensation step value */
109 
110     uint8_t video_stablization_supported; /* flag id video stablization is supported */
111 
112     uint8_t picture_sizes_tbl_cnt;                          /* picture sizes table size */
113     cam_dimension_t picture_sizes_tbl[MAX_SIZES_CNT];       /* picture sizes table */
114 
115     /* capabilities specific to HAL 1 */
116 
117     int modes_supported;                                    /* mask of modes supported: 2D, 3D */
118     uint32_t sensor_mount_angle;                            /* sensor mount angle */
119 
120     float focal_length;                                     /* focal length */
121     float hor_view_angle;                                   /* horizontal view angle */
122     float ver_view_angle;                                   /* vertical view angle */
123 
124     uint8_t preview_sizes_tbl_cnt;                          /* preview sizes table size */
125     cam_dimension_t preview_sizes_tbl[MAX_SIZES_CNT];       /* preiew sizes table */
126 
127     uint8_t video_sizes_tbl_cnt;                            /* video sizes table size */
128     cam_dimension_t video_sizes_tbl[MAX_SIZES_CNT];         /* video sizes table */
129 
130 
131     uint8_t livesnapshot_sizes_tbl_cnt;                     /* livesnapshot sizes table size */
132     cam_dimension_t livesnapshot_sizes_tbl[MAX_SIZES_CNT];  /* livesnapshot sizes table */
133 
134     uint8_t hfr_tbl_cnt;                                    /* table size for HFR */
135     cam_hfr_info_t hfr_tbl[CAM_HFR_MODE_MAX];               /* HFR table */
136 
137     /* supported preview formats */
138     uint8_t supported_preview_fmt_cnt;
139     cam_format_t supported_preview_fmts[CAM_FORMAT_MAX];
140 
141     /* supported picture formats */
142     uint8_t supported_picture_fmt_cnt;
143     cam_format_t supported_picture_fmts[CAM_FORMAT_MAX];
144 
145     /* dimension and supported output format of raw dump from camif */
146     cam_dimension_t raw_dim;
147     uint8_t supported_raw_fmt_cnt;
148     cam_format_t supported_raw_fmts[CAM_FORMAT_MAX];
149 
150     /* supported focus algorithms */
151     uint8_t supported_focus_algos_cnt;
152     cam_focus_algorithm_type supported_focus_algos[CAM_FOCUS_ALGO_MAX];
153 
154 
155     uint8_t auto_wb_lock_supported;       /* flag if auto white balance lock is supported */
156     uint8_t zoom_supported;               /* flag if zoom is supported */
157     uint8_t smooth_zoom_supported;        /* flag if smooth zoom is supported */
158     uint8_t auto_exposure_lock_supported; /* flag if auto exposure lock is supported */
159     uint8_t video_snapshot_supported;     /* flag if video snapshot is supported */
160 
161     uint8_t max_num_roi;                  /* max number of roi can be detected */
162     uint8_t max_num_focus_areas;          /* max num of focus areas */
163     uint8_t max_num_metering_areas;       /* max num opf metering areas */
164     uint8_t max_zoom_step;                /* max zoom step value */
165 
166     /* QCOM specific control */
167     cam_control_range_t brightness_ctrl;  /* brightness */
168     cam_control_range_t sharpness_ctrl;   /* sharpness */
169     cam_control_range_t contrast_ctrl;    /* contrast */
170     cam_control_range_t saturation_ctrl;  /* saturation */
171     cam_control_range_t sce_ctrl;         /* skintone enhancement factor */
172 
173     cam_padding_info_t padding_info;      /* padding information from PP */
174     int8_t min_num_hdr_bufs;              /* minimum number of buffers needed for HDR by imaging module */
175     int8_t min_num_pp_bufs;               /* minimum number of buffers needed by postproc module */
176     uint32_t min_required_pp_mask;        /* min required pp feature masks for ZSL.
177                                            * depends on hardware limitation, i.e. for 8974,
178                                            * sharpness is required for all ZSL snapshot frames */
179 
180     /* capabilities specific to HAL 3 */
181 
182     float min_focus_distance;
183     float hyper_focal_distance;
184 
185     float focal_lengths[CAM_FOCAL_LENGTHS_MAX];
186     uint8_t focal_lengths_count;
187 
188     float apertures[CAM_APERTURES_MAX];
189     uint8_t apertures_count;
190 
191     float filter_densities[CAM_FILTER_DENSITIES_MAX];
192     uint8_t filter_densities_count;
193 
194     cam_optical_stab_modes_t
195         optical_stab_modes[CAM_OPT_STAB_MAX];
196     uint8_t optical_stab_modes_count;
197 
198     cam_dimension_t lens_shading_map_size;
199     float lens_shading_map[3 * CAM_MAX_MAP_WIDTH *
200               CAM_MAX_MAP_HEIGHT];
201 
202     cam_dimension_t geo_correction_map_size;
203     float geo_correction_map[2 * 3 * CAM_MAX_MAP_WIDTH *
204               CAM_MAX_MAP_HEIGHT];
205 
206     float lens_position[3];
207 
208     /* nano seconds */
209     int64_t exposure_time_range[2];
210 
211     /* nano seconds */
212     int64_t max_frame_duration;
213 
214     cam_color_filter_arrangement_t color_arrangement;
215 
216     float sensor_physical_size[2];
217 
218     /* Dimensions of full pixel array, possibly including
219        black calibration pixels */
220     cam_dimension_t pixel_array_size;
221     /* Area of raw data which corresponds to only active
222        pixels; smaller or equal to pixelArraySize. */
223     cam_rect_t active_array_size;
224 
225     /* Maximum raw value output by sensor */
226     int32_t white_level;
227 
228     /* A fixed black level offset for each of the Bayer
229        mosaic channels */
230     int32_t black_level_pattern[4];
231 
232     /* Time taken before flash can fire again in nano secs */
233     int64_t flash_charge_duration;
234 
235     /* flash firing power */
236     uint8_t supported_flash_firing_level_cnt;
237     cam_format_t supported_firing_levels[CAM_FLASH_FIRING_LEVEL_MAX];
238 
239     /* Flash Firing Time */
240     int64_t flash_firing_time;
241 
242     /* Flash Ciolor Temperature */
243     uint8_t flash_color_temp;
244 
245     /* Flash max Energy */
246     uint8_t flash_max_energy;
247 
248     /* Maximum number of supported points in the tonemap
249        curve */
250     int32_t max_tone_map_curve_points;
251 
252     /* supported formats */
253     uint8_t supported_scalar_format_cnt;
254     cam_format_t supported_scalar_fmts[CAM_FORMAT_MAX];
255 
256     /* The minimum frame duration that is supported for above
257        raw resolution */
258     int64_t raw_min_duration;
259 
260     uint8_t supported_sizes_tbl_cnt;
261     cam_dimension_t supported_sizes_tbl[MAX_SIZES_CNT];
262 
263     /* The minimum frame duration that is supported for each
264      * resolution in availableProcessedSizes. Should correspond
265      * to the frame duration when only that processed stream
266      * is active, with all processing set to FAST */
267     int64_t min_duration[MAX_SIZES_CNT];
268 
269     uint32_t max_face_detection_count;
270 
271     /* Number of histogram buckets supported */
272     int32_t histogram_size;
273     /* Maximum value possible for a histogram bucket */
274     int32_t max_histogram_count;
275 
276     cam_dimension_t sharpness_map_size;
277 
278     /* Maximum value possible for a sharpness map region */
279     int32_t max_sharpness_map_value;
280 
281     cam_scene_mode_overrides_t scene_mode_overrides[CAM_SCENE_MODE_MAX];
282 
283     /*Autoexposure modes for camera 3 api*/
284     uint8_t supported_ae_modes_cnt;
285     cam_ae_mode_type supported_ae_modes[CAM_AE_MODE_MAX];
286 
287     int64_t jpeg_min_duration[MAX_SIZES_CNT];
288 
289     cam_sensitivity_range_t sensitivity_range;
290     int32_t max_analog_sensitivity;
291 
292     uint8_t flash_available;
293 
294     cam_rational_type_t base_gain_factor;    /* sensor base gain factor */
295 } cam_capability_t;
296 
297 typedef enum {
298     CAM_STREAM_CONSUMER_DISPLAY,    /* buf to be displayed */
299     CAM_STREAM_CONSUMER_VIDEO_ENC,  /* buf to be encoded by video */
300     CAM_STREAM_CONSUMER_JPEG_ENC,   /* ZSL YUV buf to be fed back to JPEG */
301 } cam_stream_consumer_t;
302 
303 typedef enum {
304     CAM_STREAM_PARAM_TYPE_DO_REPROCESS = CAM_INTF_PARM_DO_REPROCESS,
305     CAM_STREAM_PARAM_TYPE_SET_BUNDLE_INFO = CAM_INTF_PARM_SET_BUNDLE,
306     CAM_STREAM_PARAM_SET_STREAM_CONSUMER,
307     CAM_STREAM_PARAM_TYPE_MAX
308 } cam_stream_param_type_e;
309 
310 typedef struct {
311     uint8_t buf_index;            /* buf index to the source frame buffer that needs reprocess,
312                                     (assume buffer is already mapped)*/
313     uint32_t frame_idx;           /* frame id of source frame to be reprocessed */
314     int32_t ret_val;              /* return value from reprocess. Could have different meanings.
315                                      i.e., faceID in the case of face registration. */
316     uint8_t meta_present;         /* if there is meta data associated with this reprocess frame */
317     uint32_t meta_stream_handle;  /* meta data stream ID. only valid if meta_present != 0 */
318     uint8_t meta_buf_index;       /* buf index to meta data buffer. only valid if meta_present != 0 */
319 
320     cam_per_frame_pp_config_t frame_pp_config; /* per frame post-proc configuration */
321 } cam_reprocess_param;
322 
323 typedef struct {
324     cam_stream_param_type_e type;
325     union {
326         cam_reprocess_param reprocess;  /* do reprocess */
327         cam_bundle_config_t bundleInfo; /* set bundle info*/
328         cam_stream_consumer_t consumer;  /* stream consumer */
329     };
330 } cam_stream_parm_buffer_t;
331 
332 /* stream info */
333 typedef struct {
334     /* stream ID from server */
335     uint32_t stream_svr_id;
336 
337     /* stream type */
338     cam_stream_type_t stream_type;
339 
340     /* image format */
341     cam_format_t fmt;
342 
343     /* image dimension */
344     cam_dimension_t dim;
345 
346     /* buffer plane information, will be calc based on stream_type, fmt,
347        dim, and padding_info(from stream config). Info including:
348        offset_x, offset_y, stride, scanline, plane offset */
349     cam_stream_buf_plane_info_t buf_planes;
350 
351     /* streaming type */
352     cam_streaming_mode_t streaming_mode;
353     /* num of frames needs to be generated.
354      * only valid when streaming_mode = CAM_STREAMING_MODE_BURST */
355     uint8_t num_of_burst;
356 
357     /* stream specific pp config */
358     cam_pp_feature_config_t pp_config;
359 
360     /* this section is valid if offline reprocess type stream */
361     cam_stream_reproc_config_t reprocess_config;
362 
363     cam_stream_parm_buffer_t parm_buf;    /* stream based parameters */
364 } cam_stream_info_t;
365 
366 /*****************************************************************************
367  *                 Code for Domain Socket Based Parameters                   *
368  ****************************************************************************/
369 
370 #define POINTER_OF(PARAM_ID,TABLE_PTR)    \
371         (&(TABLE_PTR->entry[PARAM_ID].data))
372 
373 #define GET_FIRST_PARAM_ID(TABLE_PTR)     \
374         (TABLE_PTR->first_flagged_entry)
375 
376 #define SET_FIRST_PARAM_ID(TABLE_PTR,PARAM_ID)     \
377         TABLE_PTR->first_flagged_entry=PARAM_ID
378 
379 #define GET_NEXT_PARAM_ID(CURRENT_PARAM_ID,TABLE_PTR)    \
380         (TABLE_PTR->entry[CURRENT_PARAM_ID].next_flagged_entry)
381 
382 #define SET_NEXT_PARAM_ID(CURRENT_PARAM_ID,TABLE_PTR,NEXT_PARAM_ID)    \
383         TABLE_PTR->entry[CURRENT_PARAM_ID].next_flagged_entry=NEXT_PARAM_ID;
384 
385 #define INCLUDE(PARAM_ID,DATATYPE,COUNT)  \
386         DATATYPE member_variable_##PARAM_ID[ COUNT ]
387 
388 typedef union {
389 /**************************************************************************************
390  *          ID from (cam_intf_parm_type_t)          DATATYPE                     COUNT
391  **************************************************************************************/
392     INCLUDE(CAM_INTF_PARM_HAL_VERSION,              int32_t,                     1);
393     /* Shared between HAL1 and HAL3 */
394     INCLUDE(CAM_INTF_PARM_ANTIBANDING,              int32_t,                     1);
395     INCLUDE(CAM_INTF_PARM_EXPOSURE_COMPENSATION,    int32_t,                     1);
396     INCLUDE(CAM_INTF_PARM_AEC_LOCK,                 int32_t,                     1);
397     INCLUDE(CAM_INTF_PARM_FPS_RANGE,                cam_fps_range_t,             1);
398     INCLUDE(CAM_INTF_PARM_FOCUS_MODE,               uint8_t,                     1);
399     INCLUDE(CAM_INTF_PARM_AWB_LOCK,                 int32_t,                     1);
400     INCLUDE(CAM_INTF_PARM_WHITE_BALANCE,            int32_t,                     1);
401     INCLUDE(CAM_INTF_PARM_EFFECT,                   int32_t,                     1);
402     INCLUDE(CAM_INTF_PARM_BESTSHOT_MODE,            int32_t,                     1);
403     INCLUDE(CAM_INTF_PARM_DIS_ENABLE,               int32_t,                     1);
404     INCLUDE(CAM_INTF_PARM_LED_MODE,                 int32_t,                     1);
405 
406     /* HAL1 specific */
407     INCLUDE(CAM_INTF_PARM_QUERY_FLASH4SNAP,         int32_t,                     1); //read only
408     INCLUDE(CAM_INTF_PARM_EXPOSURE,                 int32_t,                     1);
409     INCLUDE(CAM_INTF_PARM_SHARPNESS,                int32_t,                     1);
410     INCLUDE(CAM_INTF_PARM_CONTRAST,                 int32_t,                     1);
411     INCLUDE(CAM_INTF_PARM_SATURATION,               int32_t,                     1);
412     INCLUDE(CAM_INTF_PARM_BRIGHTNESS,               int32_t,                     1);
413     INCLUDE(CAM_INTF_PARM_ISO,                      int32_t,                     1);
414     INCLUDE(CAM_INTF_PARM_ZOOM,                     int32_t,                     1);
415     INCLUDE(CAM_INTF_PARM_ROLLOFF,                  int32_t,                     1);
416     INCLUDE(CAM_INTF_PARM_MODE,                     int32_t,                     1);
417     INCLUDE(CAM_INTF_PARM_AEC_ALGO_TYPE,            int32_t,                     1);
418     INCLUDE(CAM_INTF_PARM_FOCUS_ALGO_TYPE,          int32_t,                     1);
419     INCLUDE(CAM_INTF_PARM_AEC_ROI,                  cam_set_aec_roi_t,           1);
420     INCLUDE(CAM_INTF_PARM_AF_ROI,                   cam_roi_info_t,              1);
421     INCLUDE(CAM_INTF_PARM_SCE_FACTOR,               int32_t,                     1);
422     INCLUDE(CAM_INTF_PARM_FD,                       cam_fd_set_parm_t,           1);
423     INCLUDE(CAM_INTF_PARM_MCE,                      int32_t,                     1);
424     INCLUDE(CAM_INTF_PARM_HFR,                      int32_t,                     1);
425     INCLUDE(CAM_INTF_PARM_REDEYE_REDUCTION,         int32_t,                     1);
426     INCLUDE(CAM_INTF_PARM_WAVELET_DENOISE,          cam_denoise_param_t,         1);
427     INCLUDE(CAM_INTF_PARM_HISTOGRAM,                int32_t,                     1);
428     INCLUDE(CAM_INTF_PARM_ASD_ENABLE,               int32_t,                     1);
429     INCLUDE(CAM_INTF_PARM_RECORDING_HINT,           int32_t,                     1);
430     INCLUDE(CAM_INTF_PARM_HDR,                      cam_exp_bracketing_t,        1);
431     INCLUDE(CAM_INTF_PARM_FRAMESKIP,                int32_t,                     1);
432     INCLUDE(CAM_INTF_PARM_ZSL_MODE,                 int32_t,                     1);
433     INCLUDE(CAM_INTF_PARM_HDR_NEED_1X,              int32_t,                     1);
434     INCLUDE(CAM_INTF_PARM_LOCK_CAF,                 int32_t,                     1);
435     INCLUDE(CAM_INTF_PARM_VIDEO_HDR,                int32_t,                     1);
436 
437     /* HAL3 sepcific */
438     INCLUDE(CAM_INTF_META_FRAME_NUMBER,             uint32_t,                    1);
439     INCLUDE(CAM_INTF_META_COLOR_CORRECT_MODE,       uint8_t,                     1);
440     INCLUDE(CAM_INTF_META_COLOR_CORRECT_TRANSFORM,  cam_color_correct_matrix_t,  1);
441     INCLUDE(CAM_INTF_META_COLOR_CORRECT_GAINS,      cam_color_correct_gains_t,   1);
442     INCLUDE(CAM_INTF_META_AEC_MODE,                 uint8_t,                     1);
443     INCLUDE(CAM_INTF_META_AEC_ROI,                  cam_area_t,                  5);
444     INCLUDE(CAM_INTF_META_AEC_PRECAPTURE_TRIGGER,   cam_trigger_t,               1);
445     INCLUDE(CAM_INTF_META_AF_ROI,                   cam_area_t,                  5);
446     INCLUDE(CAM_INTF_META_AF_TRIGGER,               cam_trigger_t,               1);
447     INCLUDE(CAM_INTF_META_AWB_REGIONS,              cam_area_t,                  5);
448     INCLUDE(CAM_INTF_META_BLACK_LEVEL_LOCK,         uint8_t,                     1);
449     INCLUDE(CAM_INTF_META_CAPTURE_INTENT,           uint8_t,                     1);
450     INCLUDE(CAM_INTF_META_MODE,                     uint8_t,                     1);
451     INCLUDE(CAM_INTF_META_DEMOSAIC,                 int32_t,                     1);
452     INCLUDE(CAM_INTF_META_EDGE_MODE,                int32_t,                     1);
453     INCLUDE(CAM_INTF_META_SHARPNESS_STRENGTH,       int32_t,                     1);
454     INCLUDE(CAM_INTF_META_FLASH_POWER,              uint8_t,                     1);
455     INCLUDE(CAM_INTF_META_FLASH_FIRING_TIME,        int64_t,                     1);
456     INCLUDE(CAM_INTF_META_GEOMETRIC_MODE,           uint8_t,                     1);
457     INCLUDE(CAM_INTF_META_GEOMETRIC_STRENGTH,       uint8_t,                     1);
458     INCLUDE(CAM_INTF_META_HOTPIXEL_MODE,            uint8_t,                     1);
459     INCLUDE(CAM_INTF_META_LENS_APERTURE,            float,                       1);
460     INCLUDE(CAM_INTF_META_LENS_FILTERDENSITY,       float,                       1);
461     INCLUDE(CAM_INTF_META_LENS_FOCAL_LENGTH,        float,                       1);
462     INCLUDE(CAM_INTF_META_LENS_FOCUS_DISTANCE,      float,                       1);
463     INCLUDE(CAM_INTF_META_LENS_OPT_STAB_MODE,       uint8_t,                     1);
464     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP_MODE,    uint8_t,                     1);
465     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_MODE,     uint8_t,                     1);
466     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_STRENGTH, int32_t,                     1);
467     INCLUDE(CAM_INTF_META_SCALER_CROP_REGION,       cam_crop_region_t,           1);
468     INCLUDE(CAM_INTF_META_SENSOR_EXPOSURE_TIME,     int64_t,                     1);
469     INCLUDE(CAM_INTF_META_SENSOR_FRAME_DURATION,    int64_t,                     1);
470     INCLUDE(CAM_INTF_META_SENSOR_SENSITIVITY,       int32_t,                     1);
471     INCLUDE(CAM_INTF_META_SHADING_MODE,             uint8_t,                     1);
472     INCLUDE(CAM_INTF_META_SHADING_STRENGTH,         uint8_t,                     1);
473     INCLUDE(CAM_INTF_META_STATS_FACEDETECT_MODE,    uint8_t,                     1);
474     INCLUDE(CAM_INTF_META_STATS_HISTOGRAM_MODE,     uint8_t,                     1);
475     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP_MODE, uint8_t,                     1);
476     INCLUDE(CAM_INTF_META_TONEMAP_CURVE_BLUE,       cam_tonemap_curve_t,         1);
477     INCLUDE(CAM_INTF_META_TONEMAP_CURVE_GREEN,      cam_tonemap_curve_t,         1);
478     INCLUDE(CAM_INTF_META_TONEMAP_CURVE_RED,        cam_tonemap_curve_t,         1);
479     INCLUDE(CAM_INTF_META_TONEMAP_MODE,             uint8_t,                     1);
480     INCLUDE(CAM_INTF_META_FLASH_MODE,               uint8_t,                     1);
481     INCLUDE(CAM_INTF_META_STREAM_TYPE_MASK,         uint32_t,                    1);
482 } parm_type_t;
483 
484 
485 typedef union {
486 /**************************************************************************************
487  *  ID from (cam_intf_metadata_type_t)                DATATYPE                     COUNT
488  **************************************************************************************/
489     /* common between HAL1 and HAL3 */
490     INCLUDE(CAM_INTF_META_HISTOGRAM,                    cam_hist_stats_t,            1);
491     INCLUDE(CAM_INTF_META_FACE_DETECTION,               cam_face_detection_data_t,   1);
492     INCLUDE(CAM_INTF_META_AUTOFOCUS_DATA,               cam_auto_focus_data_t,       1);
493 
494     /* Specific to HAl1 */
495     INCLUDE(CAM_INTF_META_CROP_DATA,                    cam_crop_data_t,             1);
496     INCLUDE(CAM_INTF_META_PREP_SNAPSHOT_DONE,           int32_t,                     1);
497     INCLUDE(CAM_INTF_META_GOOD_FRAME_IDX_RANGE,         cam_frame_idx_range_t,       1);
498     /* Specific to HAL3 */
499     INCLUDE(CAM_INTF_META_FRAME_NUMBER_VALID,           int32_t,                     1);
500     INCLUDE(CAM_INTF_META_PENDING_REQUESTS,             uint32_t,                    1);
501     INCLUDE(CAM_INTF_META_FRAME_NUMBER,                 uint32_t,                    1);
502     INCLUDE(CAM_INTF_META_COLOR_CORRECT_MODE,           uint8_t,                     1);
503     INCLUDE(CAM_INTF_META_COLOR_CORRECT_TRANSFORM,      cam_color_correct_matrix_t,  1);
504     INCLUDE(CAM_INTF_META_COLOR_CORRECT_GAINS,          cam_color_correct_gains_t,   1);
505     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_TRANSFORM, cam_color_correct_matrix_t,  1);
506     INCLUDE(CAM_INTF_META_PRED_COLOR_CORRECT_GAINS,     cam_color_correct_gains_t,   1);
507     INCLUDE(CAM_INTF_META_AEC_PRECAPTURE_ID,            int32_t,                     1);
508     INCLUDE(CAM_INTF_META_AEC_ROI,                      cam_area_t,                  5);
509     INCLUDE(CAM_INTF_META_AEC_STATE,                    uint8_t,                     1);
510     INCLUDE(CAM_INTF_PARM_FOCUS_MODE,                   uint8_t,                     1);
511     INCLUDE(CAM_INTF_META_AF_ROI,                       cam_area_t,                  5);
512     INCLUDE(CAM_INTF_META_AF_STATE,                     uint8_t,                     1);
513     INCLUDE(CAM_INTF_META_AF_TRIGGER_ID,                int32_t,                     1);
514     INCLUDE(CAM_INTF_PARM_WHITE_BALANCE,                int32_t,                     1);
515     INCLUDE(CAM_INTF_META_AWB_REGIONS,                  cam_area_t,                  5);
516     INCLUDE(CAM_INTF_META_AWB_STATE,                    uint8_t,                     1);
517     INCLUDE(CAM_INTF_META_BLACK_LEVEL_LOCK,             uint8_t,                     1);
518     INCLUDE(CAM_INTF_META_MODE,                         uint8_t,                     1);
519     INCLUDE(CAM_INTF_META_EDGE_MODE,                    int32_t,                     1);
520     INCLUDE(CAM_INTF_META_FLASH_POWER,                  uint8_t,                     1);
521     INCLUDE(CAM_INTF_META_FLASH_FIRING_TIME,            int64_t,                     1);
522     INCLUDE(CAM_INTF_META_FLASH_MODE,                   uint8_t,                     1);
523     INCLUDE(CAM_INTF_META_FLASH_STATE,                  int32_t,                     1);
524     INCLUDE(CAM_INTF_META_HOTPIXEL_MODE,                uint8_t,                     1);
525     INCLUDE(CAM_INTF_META_LENS_APERTURE,                float,                       1);
526     INCLUDE(CAM_INTF_META_LENS_FILTERDENSITY,           float,                       1);
527     INCLUDE(CAM_INTF_META_LENS_FOCAL_LENGTH,            float,                       1);
528     INCLUDE(CAM_INTF_META_LENS_FOCUS_DISTANCE,          float,                       1);
529     INCLUDE(CAM_INTF_META_LENS_FOCUS_RANGE,             float,                       2);
530     INCLUDE(CAM_INTF_META_LENS_OPT_STAB_MODE,           uint8_t,                     1);
531     INCLUDE(CAM_INTF_META_LENS_FOCUS_STATE,             uint8_t,                     1);
532     INCLUDE(CAM_INTF_META_NOISE_REDUCTION_MODE,         uint8_t,                     1);
533     INCLUDE(CAM_INTF_META_SCALER_CROP_REGION,           cam_crop_region_t,           1);
534     INCLUDE(CAM_INTF_META_SCENE_FLICKER,                uint8_t,                     1);
535     INCLUDE(CAM_INTF_META_SENSOR_EXPOSURE_TIME,         int64_t,                     1);
536     INCLUDE(CAM_INTF_META_SENSOR_FRAME_DURATION,        int64_t,                     1);
537     INCLUDE(CAM_INTF_META_SENSOR_SENSITIVITY,           int32_t,                     1);
538     INCLUDE(CAM_INTF_META_SENSOR_TIMESTAMP,             struct timeval,              1);
539     INCLUDE(CAM_INTF_META_SHADING_MODE,                 uint8_t,                     1);
540     INCLUDE(CAM_INTF_META_STATS_FACEDETECT_MODE,        uint8_t,                     1);
541     INCLUDE(CAM_INTF_META_STATS_HISTOGRAM_MODE,         uint8_t,                     1);
542     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP_MODE,     uint8_t,                     1);
543     INCLUDE(CAM_INTF_META_STATS_SHARPNESS_MAP,          cam_sharpness_map_t,         3);
544     INCLUDE(CAM_INTF_META_LENS_SHADING_MAP,             cam_lens_shading_map_t,      1);
545     INCLUDE(CAM_INTF_META_PRIVATE_DATA,                 char,                        MAX_METADATA_PAYLOAD_SIZE);
546 } metadata_type_t;
547 
548 /****************************DO NOT MODIFY BELOW THIS LINE!!!!*********************/
549 
550 typedef struct {
551     metadata_type_t data;
552     uint8_t next_flagged_entry;
553 } metadata_entry_type_t;
554 
555 typedef struct {
556     uint8_t first_flagged_entry;
557     metadata_entry_type_t entry[CAM_INTF_PARM_MAX];
558 } metadata_buffer_t;
559 
560 typedef struct {
561     parm_type_t data;
562     uint8_t next_flagged_entry;
563 } parm_entry_type_t;
564 
565 typedef struct {
566     uint8_t first_flagged_entry;
567     parm_entry_type_t entry[CAM_INTF_PARM_MAX];
568 } parm_buffer_t;
569 
570 #endif /* __QCAMERA_INTF_H__ */
571