1 /*
2  * Samsung Exynos5 SoC series Camera API 2.0 HAL
3  *
4  * Internal Metadata (controls/dynamic metadata and static metadata)
5  *
6  * Copyright (c) 2012 Samsung Electronics Co., Ltd
7  * Contact: Sungjoong Kang, <sj3.kang@samsung.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13 
14 /*2012.04.18 Version 0.1 Initial Release*/
15 /*2012.04.23 Version 0.2 Added static metadata (draft)*/
16 /*2012.07.04 Version 0.3 Applied google's undocumented changes (draft)*/
17 /*2012.07.11 Version 0.4 Added FD parameters */
18 /*2012.07.27 Version 0.5 Modified HSB control and DM */
19 
20 
21 #ifndef FIMC_IS_METADATA_H_
22 #define FIMC_IS_METADATA_H_
23 
24 struct rational {
25 	uint32_t num;
26 	uint32_t den;
27 };
28 
29 #define CAMERA2_MAX_AVAILABLE_MODE	21
30 #define CAMERA2_MAX_FACES		16
31 
32 #define CAMERA2_FACE_DETECTION_THRESHOLD    35
33 
34 /*
35  *controls/dynamic metadata
36 */
37 
38 /* android.request */
39 
40 enum metadata_mode {
41 	METADATA_MODE_NONE,
42 	METADATA_MODE_FULL
43 };
44 
45 struct camera2_request_ctl {
46 	uint32_t		id;
47 	enum metadata_mode	metadataMode;
48 	uint8_t			outputStreams[16];
49 	uint32_t		frameCount;
50 };
51 
52 struct camera2_request_dm {
53 	uint32_t		id;
54 	enum metadata_mode	metadataMode;
55 	uint32_t		frameCount;
56 };
57 
58 
59 
60 /* android.lens */
61 
62 enum optical_stabilization_mode {
63 	OPTICAL_STABILIZATION_MODE_OFF,
64 	OPTICAL_STABILIZATION_MODE_ON
65 };
66 
67 enum lens_facing {
68 	LENS_FACING_BACK,
69 	LENS_FACING_FRONT
70 };
71 
72 struct camera2_lens_ctl {
73 	uint32_t				focusDistance;
74 	float					aperture;
75 	float					focalLength;
76 	float					filterDensity;
77 	enum optical_stabilization_mode		opticalStabilizationMode;
78 
79 };
80 
81 struct camera2_lens_dm {
82 	uint32_t				focusDistance;
83 	float					aperture;
84 	float					focalLength;
85 	float					filterDensity;
86 	enum optical_stabilization_mode		opticalStabilizationMode;
87 	float					focusRange[2];
88 };
89 
90 struct camera2_lens_sm {
91 	float				minimumFocusDistance;
92 	float				hyperfocalDistance;
93 	float				availableFocalLength[2];
94 	float				availableApertures;
95 	/*assuming 1 aperture*/
96 	float				availableFilterDensities;
97 	/*assuming 1 ND filter value*/
98 	enum optical_stabilization_mode	availableOpticalStabilization;
99 	/*assuming 1*/
100 	uint32_t			shadingMapSize;
101 	float				shadingMap[3][40][30];
102 	uint32_t			geometricCorrectionMapSize;
103 	float				geometricCorrectionMap[2][3][40][30];
104 	enum lens_facing		facing;
105 	float				position[2];
106 };
107 
108 /* android.sensor */
109 
110 enum sensor_colorfilterarrangement {
111 	SENSOR_COLORFILTERARRANGEMENT_RGGB,
112 	SENSOR_COLORFILTERARRANGEMENT_GRBG,
113 	SENSOR_COLORFILTERARRANGEMENT_GBRG,
114 	SENSOR_COLORFILTERARRANGEMENT_BGGR,
115 	SENSOR_COLORFILTERARRANGEMENT_RGB
116 };
117 
118 enum sensor_ref_illuminant {
119 	SENSOR_ILLUMINANT_DAYLIGHT = 1,
120 	SENSOR_ILLUMINANT_FLUORESCENT = 2,
121 	SENSOR_ILLUMINANT_TUNGSTEN = 3,
122 	SENSOR_ILLUMINANT_FLASH = 4,
123 	SENSOR_ILLUMINANT_FINE_WEATHER = 9,
124 	SENSOR_ILLUMINANT_CLOUDY_WEATHER = 10,
125 	SENSOR_ILLUMINANT_SHADE = 11,
126 	SENSOR_ILLUMINANT_DAYLIGHT_FLUORESCENT = 12,
127 	SENSOR_ILLUMINANT_DAY_WHITE_FLUORESCENT = 13,
128 	SENSOR_ILLUMINANT_COOL_WHITE_FLUORESCENT = 14,
129 	SENSOR_ILLUMINANT_WHITE_FLUORESCENT = 15,
130 	SENSOR_ILLUMINANT_STANDARD_A = 17,
131 	SENSOR_ILLUMINANT_STANDARD_B = 18,
132 	SENSOR_ILLUMINANT_STANDARD_C = 19,
133 	SENSOR_ILLUMINANT_D55 = 20,
134 	SENSOR_ILLUMINANT_D65 = 21,
135 	SENSOR_ILLUMINANT_D75 = 22,
136 	SENSOR_ILLUMINANT_D50 = 23,
137 	SENSOR_ILLUMINANT_ISO_STUDIO_TUNGSTEN = 24
138 };
139 
140 struct camera2_sensor_ctl {
141 	/* unit : nano */
142 	uint64_t	exposureTime;
143 	/* unit : nano(It's min frame duration */
144 	uint64_t	frameDuration;
145 	/* unit : percent(need to change ISO value?) */
146 	uint32_t	sensitivity;
147 };
148 
149 struct camera2_sensor_dm {
150 	uint64_t	exposureTime;
151 	uint64_t	frameDuration;
152 	uint32_t	sensitivity;
153 	uint64_t	timeStamp;
154 };
155 
156 struct camera2_sensor_sm {
157 	uint32_t	exposureTimeRange[2];
158 	uint32_t	maxFrameDuration;
159 	/* list of available sensitivities. */
160 	uint32_t	availableSensitivities[10];
161 	enum sensor_colorfilterarrangement colorFilterArrangement;
162 	float		physicalSize[2];
163 	uint32_t	pixelArraySize[2];
164 	uint32_t	activeArraySize[4];
165 	uint32_t	whiteLevel;
166 	uint32_t	blackLevelPattern[4];
167 	struct rational	colorTransform1[9];
168 	struct rational	colorTransform2[9];
169 	enum sensor_ref_illuminant	referenceIlluminant1;
170 	enum sensor_ref_illuminant	referenceIlluminant2;
171 	struct rational	forwardMatrix1[9];
172 	struct rational	forwardMatrix2[9];
173 	struct rational	calibrationTransform1[9];
174 	struct rational	calibrationTransform2[9];
175 	struct rational	baseGainFactor;
176 	uint32_t	maxAnalogSensitivity;
177 	float		noiseModelCoefficients[2];
178 	uint32_t	orientation;
179 };
180 
181 
182 
183 /* android.flash */
184 
185 enum flash_mode {
186     CAM2_FLASH_MODE_NOP = 0,
187     CAM2_FLASH_MODE_OFF = 1,
188     CAM2_FLASH_MODE_SINGLE,
189     CAM2_FLASH_MODE_TORCH,
190     CAM2_FLASH_MODE_BEST
191 };
192 
193 struct camera2_flash_ctl {
194 	enum flash_mode		flashMode;
195 	uint32_t		firingPower;
196 	uint64_t		firingTime;
197 };
198 
199 struct camera2_flash_dm {
200 	enum flash_mode		flashMode;
201 	/*10 is max power*/
202 	uint32_t		firingPower;
203 	/*unit : microseconds*/
204 	uint64_t		firingTime;
205 	/*1 : stable, 0 : unstable*/
206 	uint32_t		firingStable;
207 	/*1 : flash required, 2 : flash not required */
208 	uint32_t		decision;
209 };
210 
211 struct camera2_flash_sm {
212 	uint32_t	available;
213 	uint64_t	chargeDuration;
214 };
215 
216 
217 /* android.hotpixel */
218 
219 enum processing_mode {
220 	PROCESSING_MODE_OFF = 1,
221 	PROCESSING_MODE_FAST,
222 	PROCESSING_MODE_HIGH_QUALITY
223 };
224 
225 
226 struct camera2_hotpixel_ctl {
227 	enum processing_mode	mode;
228 };
229 
230 struct camera2_hotpixel_dm {
231 	enum processing_mode	mode;
232 };
233 
234 
235 
236 /* android.demosaic */
237 
238 struct camera2_demosaic_ctl {
239 	enum processing_mode	mode;
240 };
241 
242 struct camera2_demosaic_dm {
243 	enum processing_mode	mode;
244 };
245 
246 
247 
248 /* android.noiseReduction */
249 
250 struct camera2_noisereduction_ctl {
251 	enum processing_mode	mode;
252 	uint32_t		strength;
253 };
254 
255 struct camera2_noisereduction_dm {
256 	enum processing_mode	mode;
257 	uint32_t		strength;
258 };
259 
260 
261 
262 /* android.shading */
263 
264 struct camera2_shading_ctl {
265 	enum processing_mode	mode;
266 };
267 
268 struct camera2_shading_dm {
269 	enum processing_mode	mode;
270 };
271 
272 
273 
274 /* android.geometric */
275 
276 struct camera2_geometric_ctl {
277 	enum processing_mode	mode;
278 };
279 
280 struct camera2_geometric_dm {
281 	enum processing_mode	mode;
282 };
283 
284 
285 
286 /* android.colorCorrection */
287 
288 enum colorcorrection_mode {
289 	COLORCORRECTION_MODE_FAST = 1,
290 	COLORCORRECTION_MODE_HIGH_QUALITY,
291 	COLORCORRECTION_MODE_TRANSFORM_MATRIX,
292 	COLORCORRECTION_MODE_EFFECT_MONO,
293 	COLORCORRECTION_MODE_EFFECT_NEGATIVE,
294 	COLORCORRECTION_MODE_EFFECT_SOLARIZE,
295 	COLORCORRECTION_MODE_EFFECT_SEPIA,
296 	COLORCORRECTION_MODE_EFFECT_POSTERIZE,
297 	COLORCORRECTION_MODE_EFFECT_WHITEBOARD,
298 	COLORCORRECTION_MODE_EFFECT_BLACKBOARD,
299 	COLORCORRECTION_MODE_EFFECT_AQUA
300 };
301 
302 
303 struct camera2_colorcorrection_ctl {
304 	enum colorcorrection_mode	mode;
305 	float				transform[9];
306 	uint32_t			hue;
307 	uint32_t			saturation;
308 	uint32_t			brightness;
309 };
310 
311 struct camera2_colorcorrection_dm {
312 	enum colorcorrection_mode	mode;
313 	float				transform[9];
314 	uint32_t			hue;
315 	uint32_t			saturation;
316 	uint32_t			brightness;
317 };
318 
319 struct camera2_colorcorrection_sm {
320 	/*assuming 10 supported modes*/
321 	uint8_t			availableModes[CAMERA2_MAX_AVAILABLE_MODE];
322 	uint32_t		hueRange[2];
323 	uint32_t		saturationRange[2];
324 	uint32_t		brightnessRange[2];
325 };
326 
327 
328 /* android.tonemap */
329 
330 enum tonemap_mode {
331 	TONEMAP_MODE_FAST = 1,
332 	TONEMAP_MODE_HIGH_QUALITY,
333 	TONEMAP_MODE_CONTRAST_CURVE
334 };
335 
336 struct camera2_tonemap_ctl {
337 	enum tonemap_mode		mode;
338 	/* assuming maxCurvePoints = 64 */
339 	float				curveRed[64];
340 	float				curveGreen[64];
341 	float				curveBlue[64];
342 };
343 
344 struct camera2_tonemap_dm {
345 	enum tonemap_mode		mode;
346 	/* assuming maxCurvePoints = 64 */
347 	float				curveRed[64];
348 	float				curveGreen[64];
349 	float				curveBlue[64];
350 };
351 
352 struct camera2_tonemap_sm {
353 	uint32_t	maxCurvePoints;
354 };
355 
356 /* android.edge */
357 
358 struct camera2_edge_ctl {
359 	enum processing_mode	mode;
360 	uint32_t		strength;
361 };
362 
363 struct camera2_edge_dm {
364 	enum processing_mode	mode;
365 	uint32_t		strength;
366 };
367 
368 
369 
370 /* android.scaler */
371 
372 enum scaler_availableformats {
373 	SCALER_FORMAT_BAYER_RAW,
374 	SCALER_FORMAT_YV12,
375 	SCALER_FORMAT_NV21,
376 	SCALER_FORMAT_JPEG,
377 	SCALER_FORMAT_UNKNOWN
378 };
379 
380 struct camera2_scaler_ctl {
381 	uint32_t	cropRegion[3];
382 };
383 
384 struct camera2_scaler_dm {
385 	uint32_t	cropRegion[3];
386 };
387 
388 struct camera2_scaler_sm {
389 	enum scaler_availableformats availableFormats[4];
390 	/*assuming # of availableFormats = 4*/
391 	uint32_t	availableRawSizes;
392 	uint64_t	availableRawMinDurations;
393 	/* needs check */
394 	uint32_t	availableProcessedSizes[8];
395 	uint64_t	availableProcessedMinDurations[8];
396 	uint32_t	availableJpegSizes[8][2];
397 	uint64_t	availableJpegMinDurations[8];
398 	uint32_t	availableMaxDigitalZoom[8];
399 };
400 
401 /* android.jpeg */
402 struct camera2_jpeg_ctl {
403 	uint32_t	quality;
404 	uint32_t	thumbnailSize[2];
405 	uint32_t	thumbnailQuality;
406 	double		gpsCoordinates[3];
407 	uint32_t	gpsProcessingMethod;
408 	uint64_t	gpsTimestamp;
409 	uint32_t	orientation;
410 };
411 
412 struct camera2_jpeg_dm {
413 	uint32_t	quality;
414 	uint32_t	thumbnailSize[2];
415 	uint32_t	thumbnailQuality;
416 	double		gpsCoordinates[3];
417 	uint32_t	gpsProcessingMethod;
418 	uint64_t	gpsTimestamp;
419 	uint32_t	orientation;
420 };
421 
422 struct camera2_jpeg_sm {
423 	uint32_t	availableThumbnailSizes[8][2];
424 	uint32_t	maxSize;
425 	/*assuming supported size=8*/
426 };
427 
428 
429 
430 /* android.statistics */
431 
432 enum facedetect_mode {
433 	FACEDETECT_MODE_OFF = 1,
434 	FACEDETECT_MODE_SIMPLE,
435 	FACEDETECT_MODE_FULL
436 };
437 
438 enum stats_mode {
439 	STATS_MODE_OFF = 1,
440 	STATS_MODE_ON
441 };
442 
443 struct camera2_stats_ctl {
444 	enum facedetect_mode	faceDetectMode;
445 	enum stats_mode		histogramMode;
446 	enum stats_mode		sharpnessMapMode;
447 };
448 
449 
450 struct camera2_stats_dm {
451 	enum facedetect_mode	faceDetectMode;
452 	uint32_t		faceRectangles[CAMERA2_MAX_FACES][4];
453 	uint8_t			faceScores[CAMERA2_MAX_FACES];
454 	uint32_t		faceLandmarks[CAMERA2_MAX_FACES][6];
455 	uint32_t		faceIds[CAMERA2_MAX_FACES];
456 /* PAYTON_CHECK_20120712 : histogram_mode -> stats_mode */
457 	enum stats_mode		histogramMode;
458 /* [hj529.kim, 2012/07/19] androd.statistics.histogram */
459 	uint32_t		histogram[3 * 256];
460 /* PAYTON_CHECK_20120712 : sharpnessmap_mode -> stats_mode */
461 	enum stats_mode		sharpnessMapMode;
462 	/*sharpnessMap*/
463 };
464 
465 
466 struct camera2_stats_sm {
467 	uint8_t		availableFaceDetectModes[CAMERA2_MAX_AVAILABLE_MODE];
468 	/*assuming supported modes = 3;*/
469 	uint32_t	maxFaceCount;
470 	uint32_t	histogramBucketCount;
471 	uint32_t	maxHistogramCount;
472 	uint32_t	sharpnessMapSize[2];
473 	uint32_t	maxSharpnessMapValue;
474 };
475 
476 /* android.control */
477 
478 enum aa_capture_intent {
479 	AA_CAPTURE_INTENT_CUSTOM = 0,
480 	AA_CAPTURE_INTENT_PREVIEW,
481 	AA_CAPTURE_INTENT_STILL_CAPTURE,
482 	AA_CAPTURE_INTENT_VIDEO_RECORD,
483 	AA_CAPTURE_INTENT_VIDEO_SNAPSHOT,
484 	AA_CAPTURE_INTENT_ZERO_SHUTTER_LAG
485 };
486 
487 enum aa_mode {
488 	AA_CONTROL_NONE = 0,
489 	AA_CONTROL_OFF,
490 	AA_CONTROL_AUTO,
491 	AA_CONTROL_USE_SCENE_MODE
492 };
493 
494 enum aa_scene_mode {
495 	AA_SCENE_MODE_UNSUPPORTED = 1,
496 	AA_SCENE_MODE_FACE_PRIORITY,
497 	AA_SCENE_MODE_ACTION,
498 	AA_SCENE_MODE_PORTRAIT,
499 	AA_SCENE_MODE_LANDSCAPE,
500 	AA_SCENE_MODE_NIGHT,
501 	AA_SCENE_MODE_NIGHT_PORTRAIT,
502 	AA_SCENE_MODE_THEATRE,
503 	AA_SCENE_MODE_BEACH,
504 	AA_SCENE_MODE_SNOW,
505 	AA_SCENE_MODE_SUNSET,
506 	AA_SCENE_MODE_STEADYPHOTO,
507 	AA_SCENE_MODE_FIREWORKS,
508 	AA_SCENE_MODE_SPORTS,
509 	AA_SCENE_MODE_PARTY,
510 	AA_SCENE_MODE_CANDLELIGHT,
511 	AA_SCENE_MODE_BARCODE,
512 	AA_SCENE_MODE_NIGHT_CAPTURE, /* part of night mode */
513 	AA_SCENE_MODE_MAX
514 };
515 
516 enum aa_effect_mode {
517 	AA_EFFECT_OFF = 1,
518 	AA_EFFECT_MONO,
519 	AA_EFFECT_NEGATIVE,
520 	AA_EFFECT_SOLARIZE,
521 	AA_EFFECT_SEPIA,
522 	AA_EFFECT_POSTERIZE,
523 	AA_EFFECT_WHITEBOARD,
524 	AA_EFFECT_BLACKBOARD,
525 	AA_EFFECT_AQUA
526 };
527 
528 enum aa_aemode {
529 	AA_AEMODE_OFF = 1,
530 	AA_AEMODE_LOCKED,
531 	AA_AEMODE_ON,
532 	AA_AEMODE_ON_AUTO_FLASH,
533 	AA_AEMODE_ON_ALWAYS_FLASH,
534 	AA_AEMODE_ON_AUTO_FLASH_REDEYE
535 };
536 
537 enum aa_ae_flashmode {
538 	AA_FLASHMODE_NOP = 0,
539 	/*all flash control stop*/
540 	AA_FLASHMODE_OFF = 1,
541 	/*internal 3A can control flash*/
542 	AA_FLASHMODE_ON,
543 	/*internal 3A can do auto flash algorithm*/
544 	AA_FLASHMODE_AUTO,
545 	/*internal 3A can fire flash by auto result*/
546 	AA_FLASHMODE_CAPTURE,
547 	/*internal 3A can control flash*/
548 	AA_FLASHMODE_ON_ALWAYS
549 };
550 
551 enum aa_ae_antibanding_mode {
552 	AA_AE_ANTIBANDING_OFF = 1,
553 	AA_AE_ANTIBANDING_50HZ,
554 	AA_AE_ANTIBANDING_60HZ,
555 	AA_AE_ANTIBANDING_AUTO
556 };
557 
558 enum aa_awbmode {
559 	AA_AWBMODE_OFF = 1,
560 	AA_AWBMODE_LOCKED,
561 	AA_AWBMODE_WB_AUTO,
562 	AA_AWBMODE_WB_INCANDESCENT,
563 	AA_AWBMODE_WB_FLUORESCENT,
564 	AA_AWBMODE_WB_WARM_FLUORESCENT,
565 	AA_AWBMODE_WB_DAYLIGHT,
566 	AA_AWBMODE_WB_CLOUDY_DAYLIGHT,
567 	AA_AWBMODE_WB_TWILIGHT,
568 	AA_AWBMODE_WB_SHADE
569 };
570 
571 enum aa_afmode {
572 	NO_CHANGE = 0,
573 	AA_AFMODE_OFF = 1,
574 	AA_AFMODE_AUTO,
575 	AA_AFMODE_MACRO,
576 	AA_AFMODE_CONTINUOUS_VIDEO,
577 	AA_AFMODE_CONTINUOUS_PICTURE,
578 	AA_AFMODE_INFINITY,
579 	AA_AFMODE_AUTO_FACE,
580 	AA_AFMODE_CONTINUOUS_VIDEO_FACE,
581 	AA_AFMODE_CONTINUOUS_PICTURE_FACE,
582 	AA_AFMODE_MANUAL,
583 	AA_AFMODE_EDOF
584 };
585 
586 enum aa_afstate {
587 	AA_AFSTATE_INACTIVE = 1,
588 	AA_AFSTATE_PASSIVE_SCAN,
589 	AA_AFSTATE_ACTIVE_SCAN,
590 	AA_AFSTATE_AF_ACQUIRED_FOCUS,
591 	AA_AFSTATE_AF_FAILED_FOCUS
592 };
593 
594 enum ae_state {
595 	AE_STATE_INACTIVE = 1,
596 	AE_STATE_SEARCHING,
597 	AE_STATE_CONVERGED,
598 	AE_STATE_LOCKED,
599 	AE_STATE_FLASH_REQUIRED,
600 	AE_STATE_PRECAPTURE
601 };
602 
603 enum awb_state {
604 	AWB_STATE_INACTIVE = 1,
605 	AWB_STATE_SEARCHING,
606 	AWB_STATE_CONVERGED,
607 	AWB_STATE_LOCKED
608 };
609 
610 enum aa_isomode {
611 	AA_ISOMODE_AUTO = 1,
612 	AA_ISOMODE_MANUAL,
613 };
614 
615 enum ae_lockmode {
616     AEMODE_LOCK_OFF = 0,
617     AEMODE_LOCK_ON,
618 };
619 
620 enum awb_lockmode {
621     AWBMODE_LOCK_OFF = 0,
622     AWBMODE_LOCK_ON,
623 };
624 
625 struct camera2_aa_ctl {
626 	enum aa_capture_intent		captureIntent;
627 	enum aa_mode			mode;
628 	enum aa_scene_mode		sceneMode;
629 	uint32_t			videoStabilizationMode;
630 	enum aa_aemode			aeMode;
631 	uint32_t			aeRegions[5];
632 	/*5 per region(x1,y1,x2,y2,weight). currently assuming 1 region.*/
633 	int32_t				aeExpCompensation;
634 	uint32_t			aeTargetFpsRange[2];
635 	enum aa_ae_antibanding_mode	aeAntibandingMode;
636 	enum aa_ae_flashmode		aeflashMode;
637 	enum aa_awbmode			awbMode;
638 	uint32_t			awbRegions[5];
639 	/*5 per region(x1,y1,x2,y2,weight). currently assuming 1 region.*/
640 	enum aa_afmode			afMode;
641 	uint32_t			afRegions[5];
642 	/*5 per region(x1,y1,x2,y2,weight). currently assuming 1 region.*/
643 	uint32_t			afTrigger;
644 	enum aa_isomode			isoMode;
645 	uint32_t			isoValue;
646 
647 };
648 
649 struct camera2_aa_dm {
650 	enum aa_mode				mode;
651 	enum aa_effect_mode			effectMode;
652 	enum aa_scene_mode			sceneMode;
653 	uint32_t				videoStabilizationMode;
654 	enum aa_aemode				aeMode;
655 	/*needs check*/
656 	uint32_t				aeRegions[5];
657 	/*5 per region(x1,y1,x2,y2,weight). currently assuming 1 region.*/
658 	enum ae_state				aeState;
659 	enum aa_ae_flashmode			aeflashMode;
660 	/*needs check*/
661 	enum aa_awbmode				awbMode;
662 	uint32_t				awbRegions[5];
663 	enum awb_state				awbState;
664 	/*5 per region(x1,y1,x2,y2,weight). currently assuming 1 region.*/
665 	enum aa_afmode				afMode;
666 	uint32_t				afRegions[5];
667 	/*5 per region(x1,y1,x2,y2,weight). currently assuming 1 region*/
668 	enum aa_afstate				afState;
669 	enum aa_isomode				isoMode;
670 	uint32_t				isoValue;
671 };
672 
673 struct camera2_aa_sm {
674 	uint8_t		availableSceneModes[CAMERA2_MAX_AVAILABLE_MODE];
675 	uint8_t		availableEffects[CAMERA2_MAX_AVAILABLE_MODE];
676 	/*assuming # of available scene modes = 10*/
677 	uint32_t	maxRegions;
678 	uint8_t		aeAvailableModes[CAMERA2_MAX_AVAILABLE_MODE];
679 	/*assuming # of available ae modes = 8*/
680 	struct rational	aeCompensationStep;
681 	int32_t		aeCompensationRange[2];
682 	uint32_t aeAvailableTargetFpsRanges[CAMERA2_MAX_AVAILABLE_MODE][2];
683 	uint8_t		aeAvailableAntibandingModes[CAMERA2_MAX_AVAILABLE_MODE];
684 	uint8_t		awbAvailableModes[CAMERA2_MAX_AVAILABLE_MODE];
685 	/*assuming # of awbAvailableModes = 10*/
686 	uint8_t		afAvailableModes[CAMERA2_MAX_AVAILABLE_MODE];
687 	/*assuming # of afAvailableModes = 4*/
688 	uint8_t availableVideoStabilizationModes[4];
689 	/*assuming # of availableVideoStabilizationModes = 4*/
690 	uint32_t	isoRange[2];
691 };
692 
693 struct camera2_lens_usm {
694 	/** Frame delay between sending command and applying frame data */
695 	uint32_t	focusDistanceFrameDelay;
696 };
697 
698 struct camera2_sensor_usm {
699 	/** Frame delay between sending command and applying frame data */
700 	uint32_t	exposureTimeFrameDelay;
701 	uint32_t	frameDurationFrameDelay;
702 	uint32_t	sensitivityFrameDelay;
703 };
704 
705 struct camera2_flash_usm {
706 	/** Frame delay between sending command and applying frame data */
707 	uint32_t	flashModeFrameDelay;
708 	uint32_t	firingPowerFrameDelay;
709 	uint64_t	firingTimeFrameDelay;
710 };
711 
712 struct camera2_ctl {
713 	struct camera2_request_ctl		request;
714 	struct camera2_lens_ctl			lens;
715 	struct camera2_sensor_ctl		sensor;
716 	struct camera2_flash_ctl		flash;
717 	struct camera2_hotpixel_ctl		hotpixel;
718 	struct camera2_demosaic_ctl		demosaic;
719 	struct camera2_noisereduction_ctl	noise;
720 	struct camera2_shading_ctl		shading;
721 	struct camera2_geometric_ctl		geometric;
722 	struct camera2_colorcorrection_ctl	color;
723 	struct camera2_tonemap_ctl		tonemap;
724 	struct camera2_edge_ctl			edge;
725 	struct camera2_scaler_ctl		scaler;
726 	struct camera2_jpeg_ctl			jpeg;
727 	struct camera2_stats_ctl		stats;
728 	struct camera2_aa_ctl			aa;
729 };
730 
731 struct camera2_dm {
732 	struct camera2_request_dm		request;
733 	struct camera2_lens_dm			lens;
734 	struct camera2_sensor_dm		sensor;
735 	struct camera2_flash_dm			flash;
736 	struct camera2_hotpixel_dm		hotpixel;
737 	struct camera2_demosaic_dm		demosaic;
738 	struct camera2_noisereduction_dm	noise;
739 	struct camera2_shading_dm		shading;
740 	struct camera2_geometric_dm		geometric;
741 	struct camera2_colorcorrection_dm	color;
742 	struct camera2_tonemap_dm		tonemap;
743 	struct camera2_edge_dm			edge;
744 	struct camera2_scaler_dm		scaler;
745 	struct camera2_jpeg_dm			jpeg;
746 	struct camera2_stats_dm			stats;
747 	struct camera2_aa_dm			aa;
748 };
749 
750 struct camera2_sm {
751 	struct camera2_lens_sm			lens;
752 	struct camera2_sensor_sm		sensor;
753 	struct camera2_flash_sm			flash;
754 	struct camera2_colorcorrection_sm	color;
755 	struct camera2_tonemap_sm		tonemap;
756 	struct camera2_scaler_sm		scaler;
757 	struct camera2_jpeg_sm			jpeg;
758 	struct camera2_stats_sm			stats;
759 	struct camera2_aa_sm			aa;
760 
761 	/** User-defined(ispfw specific) static metadata. */
762 	struct camera2_lens_usm			lensUd;
763 	struct camera2_sensor_usm		sensorUd;
764 	struct camera2_flash_usm		flashUd;
765 };
766 
767 /** \brief
768 	User-defined control for lens.
769 */
770 struct camera2_lens_uctl {
771 	struct camera2_lens_ctl ctl;
772 
773 	/** It depends by af algorithm(normally 255 or 1023) */
774 	uint32_t        maxPos;
775 	/** Some actuator support slew rate control. */
776 	uint32_t        slewRate;
777 };
778 
779 /** \brief
780 	User-defined metadata for lens.
781 */
782 struct camera2_lens_udm {
783 	/** It depends by af algorithm(normally 255 or 1023) */
784 	uint32_t        maxPos;
785 	/** Some actuator support slew rate control. */
786 	uint32_t        slewRate;
787 };
788 
789 /** \brief
790 	User-defined control for sensor.
791 */
792 struct camera2_sensor_uctl {
793 	struct camera2_sensor_ctl ctl;
794 	/** Dynamic frame duration.
795 	This feature is decided to max. value between
796 	'sensor.exposureTime'+alpha and 'sensor.frameDuration'.
797 	*/
798 	uint64_t        dynamicFrameDuration;
799 };
800 
801 struct camera2_scaler_uctl {
802 	/** \brief
803 	target address for next frame.
804 	\remarks
805 	[0] invalid address, stop
806 	[others] valid address
807 	*/
808 	uint32_t sccTargetAddress[4];
809 	uint32_t scpTargetAddress[4];
810 };
811 
812 struct camera2_flash_uctl {
813 	struct camera2_flash_ctl ctl;
814 };
815 
816 /** \brief
817 	User-defined control area.
818     \remarks
819 	sensor, lens, flash category is empty value.
820 	It should be filled by a5 for SET_CAM_CONTROL command.
821 	Other category is filled already from host.
822 */
823 struct camera2_uctl {
824 	/** \brief
825 	Set sensor, lens, flash control for next frame.
826 	\remarks
827 	This flag can be combined.
828 	[0 bit] lens
829 	[1 bit] sensor
830 	[2 bit] flash
831 	*/
832 	uint32_t uUpdateBitMap;
833 
834 	/** For debugging */
835 	uint32_t uFrameNumber;
836 
837 	/** ispfw specific control(user-defined) of lens. */
838 	struct camera2_lens_uctl	lensUd;
839 	/** ispfw specific control(user-defined) of sensor. */
840 	struct camera2_sensor_uctl	sensorUd;
841 	/** ispfw specific control(user-defined) of flash. */
842 	struct camera2_flash_uctl	flashUd;
843 
844 	struct camera2_scaler_uctl	scalerUd;
845 };
846 
847 struct camera2_udm {
848 	struct camera2_lens_udm		lens;
849 };
850 
851 struct camera2_shot {
852 	/*google standard area*/
853 	struct camera2_ctl	ctl;
854 	struct camera2_dm	dm;
855 	/*user defined area*/
856 	struct camera2_uctl	uctl;
857 	struct camera2_udm	udm;
858 	/*magic : 23456789*/
859 	uint32_t		magicNumber;
860 };
861 
862 /** \brief
863 	Structure for interfacing between HAL and driver.
864 */
865 struct camera2_shot_ext {
866 	/**	\brief
867 		setfile change
868 		\remarks
869 		[x] mode for setfile
870 	*/
871 	uint32_t		setfile;
872 
873 	/**	\brief
874 		stream control
875 		\remarks
876 		[0] disable stream out
877 		[1] enable stream out
878 	*/
879 	uint32_t		request_sensor;
880 	uint32_t		request_scc;
881 	uint32_t		request_scp;
882 
883 	/**	\brief
884 		post processing control(DRC)
885 		\remarks
886 		[0] bypass off
887 		[1] bypass on
888 	*/
889 	uint32_t		drc_bypass;
890 
891 	/**	\brief
892 		post processing control(DIS)
893 		\remarks
894 		[0] bypass off
895 		[1] bypass on
896 	*/
897 	uint32_t		dis_bypass;
898 
899 	/**	\brief
900 		post processing control(3DNR)
901 		\remarks
902 		[0] bypass off
903 		[1] bypass on
904 	*/
905 	uint32_t		dnr_bypass;
906 
907 	/**	\brief
908 		post processing control(FD)
909 		\remarks
910 		[0] bypass off
911 		[1] bypass on
912 	*/
913 	uint32_t		fd_bypass;
914 
915 	/* reserved for future */
916 	uint32_t		reserved[20];
917 
918 	/**	\brief
919 		processing time debugging
920 		\remarks
921 		taken time(unit : struct timeval)
922 		[0][x] flite start
923 		[1][x] flite end
924 		[2][x] DRV Shot
925 		[3][x] DRV Shot done
926 		[4][x] DRV Meta done
927 	*/
928 	uint32_t		timeZone[10][2];
929 
930 	struct camera2_shot	shot;
931     uint8_t		gpsProcessingMethod[32];
932     uint8_t     isReprocessing;
933     uint8_t     reprocessInput;
934     enum ae_lockmode        ae_lock; // this field is used in cameraHAL only
935     enum awb_lockmode       awb_lock; // this field is used in cameraHAL only
936     enum aa_awbmode         awb_mode_dm;
937 };
938 
939 /** \brief
940 	stream structure for scaler.
941 */
942 struct camera2_stream {
943 	/**	\brief
944 		this address for verifying conincidence of index and address
945 		\remarks
946 		[X] kernel virtual address for this buffer
947 	*/
948 	uint32_t		address;
949 
950 	/**	\brief
951 		this frame count is from FLITE through dm.request.fcount,
952 		this count increases every frame end. initial value is 1.
953 		\remarks
954 		[X] frame count
955 	*/
956 	uint32_t		fcount;
957 
958 	/**	\brief
959 		this request count is from HAL through ctl.request.fcount,
960 		this count is the unique.
961 		\remarks
962 		[X] request count
963 	*/
964 	uint32_t		rcount;
965 
966 	/**	\brief
967 		frame index of isp framemgr.
968 		this value is for driver internal debugging
969 		\remarks
970 		[X] frame index
971 	*/
972 	uint32_t		findex;
973 };
974 
975 #define CAM_LENS_CMD		(0x1 << 0x0)
976 #define CAM_SENSOR_CMD		(0x1 << 0x1)
977 #define CAM_FLASH_CMD		(0x1 << 0x2)
978 
979 
980 #endif
981 
982