aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/dream/include/mach/qdsp5/qdsp5vfecmdi.h
blob: 55e8fc2269f7b6a7267d48c9e6e8778694b746d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
#ifndef QDSP5VFECMDI_H
#define QDSP5VFECMDI_H

/*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*

    V F E   I N T E R N A L   C O M M A N D S

GENERAL DESCRIPTION
  This file contains defintions of format blocks of commands
  that are accepted by VFE Task

REFERENCES
  None

EXTERNALIZED FUNCTIONS
  None

Copyright(c) 1992 - 2008 by QUALCOMM, Incorporated.

This software is licensed under the terms of the GNU General Public
License version 2, as published by the Free Software Foundation, and
may be copied, distributed, and modified under those terms.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

*====*====*====*====*====*====*====*====*====*====*====*====*====*====*====*/
/*===========================================================================

                      EDIT HISTORY FOR FILE

This section contains comments describing changes made to this file.
Notice that changes are listed in reverse chronological order.

$Header: //source/qcom/qct/multimedia2/AdspSvc/7XXX/qdsp5cmd/video/qdsp5vfecmdi.h#2 $ $DateTime: 2008/07/30 10:50:23 $ $Author: pavanr $
Revision History:

when       who     what, where, why
--------   ---     ----------------------------------------------------------
06/12/08   sv      initial version
===========================================================================*/

/******************************************************************************
 * Commands through vfeCommandScaleQueue
 *****************************************************************************/

/*
 * Command to program scaler for op1 . max op of scaler is VGA
 */


#define	VFE_CMD_SCALE_OP1_CFG		0x0000
#define	VFE_CMD_SCALE_OP1_CFG_LEN	\
	sizeof(vfe_cmd_scale_op1_cfg)

#define	VFE_CMD_SCALE_OP1_SEL_IP_SEL_Y_STANDARD	0x0000
#define	VFE_CMD_SCALE_OP1_SEL_IP_SEL_Y_CASCADED	0x0001
#define	VFE_CMD_SCALE_OP1_SEL_H_Y_SCALER_DIS	0x0000
#define	VFE_CMD_SCALE_OP1_SEL_H_Y_SCALER_ENA	0x0002
#define	VFE_CMD_SCALE_OP1_SEL_H_PP_Y_SCALER_DIS	0x0000
#define	VFE_CMD_SCALE_OP1_SEL_H_PP_Y_SCALER_ENA	0x0004
#define	VFE_CMD_SCALE_OP1_SEL_V_Y_SCALER_DIS	0x0000
#define	VFE_CMD_SCALE_OP1_SEL_V_Y_SCALER_ENA	0x0008
#define	VFE_CMD_SCALE_OP1_SEL_V_PP_Y_SCALER_DIS	0x0000
#define	VFE_CMD_SCALE_OP1_SEL_V_PP_Y_SCALER_ENA	0x0010
#define	VFE_CMD_SCALE_OP1_SEL_IP_SEL_CBCR_STANDARD	0x0000
#define	VFE_CMD_SCALE_OP1_SEL_IP_SEL_CBCR_CASCADED	0x0020
#define	VFE_CMD_SCALE_OP1_SEL_H_CBCR_SCALER_DIS		0x0000
#define	VFE_CMD_SCALE_OP1_SEL_H_CBCR_SCALER_ENA		0x0040
#define	VFE_CMD_SCALE_OP1_SEL_V_CBCR_SCALER_DIS		0x0000
#define	VFE_CMD_SCALE_OP1_SEL_V_CBCR_SCALER_ENA		0x0080

#define	VFE_CMD_OP1_PP_Y_SCALER_CFG_PART1_DONT_LOAD_COEFFS	0x80000000
#define	VFE_CMD_OP1_PP_Y_SCALER_CFG_PART1_LOAD_COEFFS	0x80000000

typedef struct {
	unsigned int	cmd_id;
	unsigned int	scale_op1_sel;
	unsigned int	y_scaler_cfg_part1;
	unsigned int	y_scaler_cfg_part2;
	unsigned int	cbcr_scaler_cfg_part1;
	unsigned int	cbcr_scaler_cfg_part2;
	unsigned int	cbcr_scaler_cfg_part3;
	unsigned int	pp_y_scaler_cfg_part1;
	unsigned int	pp_y_scaler_cfg_part2;
	unsigned int	y_scaler_v_coeff_bank_part1[16];
	unsigned int	y_scaler_v_coeff_bank_part2[16];
	unsigned int	y_scaler_h_coeff_bank_part1[16];
	unsigned int	y_scaler_h_coeff_bank_part2[16];
} __attribute__((packed)) vfe_cmd_scale_op1_cfg;


/*
 * Command to program scaler for op2
 */

#define	VFE_CMD_SCALE_OP2_CFG		0x0001
#define	VFE_CMD_SCALE_OP2_CFG_LEN	\
	sizeof(vfe_cmd_scale_op2_cfg)

#define	VFE_CMD_SCALE_OP2_SEL_IP_SEL_Y_STANDARD	0x0000
#define	VFE_CMD_SCALE_OP2_SEL_IP_SEL_Y_CASCADED	0x0001
#define	VFE_CMD_SCALE_OP2_SEL_H_Y_SCALER_DIS	0x0000
#define	VFE_CMD_SCALE_OP2_SEL_H_Y_SCALER_ENA	0x0002
#define	VFE_CMD_SCALE_OP2_SEL_H_PP_Y_SCALER_DIS	0x0000
#define	VFE_CMD_SCALE_OP2_SEL_H_PP_Y_SCALER_ENA	0x0004
#define	VFE_CMD_SCALE_OP2_SEL_V_Y_SCALER_DIS	0x0000
#define	VFE_CMD_SCALE_OP2_SEL_V_Y_SCALER_ENA	0x0008
#define	VFE_CMD_SCALE_OP2_SEL_V_PP_Y_SCALER_DIS	0x0000
#define	VFE_CMD_SCALE_OP2_SEL_V_PP_Y_SCALER_ENA	0x0010
#define	VFE_CMD_SCALE_OP2_SEL_IP_SEL_CBCR_STANDARD	0x0000
#define	VFE_CMD_SCALE_OP2_SEL_IP_SEL_CBCR_CASCADED	0x0020
#define	VFE_CMD_SCALE_OP2_SEL_H_CBCR_SCALER_DIS		0x0000
#define	VFE_CMD_SCALE_OP2_SEL_H_CBCR_SCALER_ENA		0x0040
#define	VFE_CMD_SCALE_OP2_SEL_V_CBCR_SCALER_DIS		0x0000
#define	VFE_CMD_SCALE_OP2_SEL_V_CBCR_SCALER_ENA		0x0080

#define	VFE_CMD_OP2_PP_Y_SCALER_CFG_PART1_DONT_LOAD_COEFFS	0x80000000
#define	VFE_CMD_OP2_PP_Y_SCALER_CFG_PART1_LOAD_COEFFS		0x80000000

typedef struct {
	unsigned int	cmd_id;
	unsigned int	scale_op2_sel;
	unsigned int	y_scaler_cfg_part1;
	unsigned int	y_scaler_cfg_part2;
	unsigned int	cbcr_scaler_cfg_part1;
	unsigned int	cbcr_scaler_cfg_part2;
	unsigned int	cbcr_scaler_cfg_part3;
	unsigned int	pp_y_scaler_cfg_part1;
	unsigned int	pp_y_scaler_cfg_part2;
	unsigned int	y_scaler_v_coeff_bank_part1[16];
	unsigned int	y_scaler_v_coeff_bank_part2[16];
	unsigned int	y_scaler_h_coeff_bank_part1[16];
	unsigned int	y_scaler_h_coeff_bank_part2[16];
} __attribute__((packed)) vfe_cmd_scale_op2_cfg;


/******************************************************************************
 * Commands through vfeCommandTableQueue
 *****************************************************************************/

/*
 * Command to program the AXI ip paths
 */

#define	VFE_CMD_AXI_IP_CFG		0x0000
#define	VFE_CMD_AXI_IP_CFG_LEN		sizeof(vfe_cmd_axi_ip_cfg)

#define	VFE_CMD_IP_SEL_IP_FORMAT_8	0x0000
#define	VFE_CMD_IP_SEL_IP_FORMAT_10	0x0001
#define	VFE_CMD_IP_SEL_IP_FORMAT_12	0x0002

typedef struct {
	unsigned int	cmd_id;
	unsigned int	ip_sel;
	unsigned int	ip_cfg_part1;
	unsigned int	ip_cfg_part2;
	unsigned int	ip_unpack_cfg_part[6];
	unsigned int	ip_buf_addr[8];
} __attribute__ ((packed)) vfe_cmd_axi_ip_cfg;


/*
 * Command to program axi op paths
 */

#define	VFE_CMD_AXI_OP_CFG	0x0001
#define	VFE_CMD_AXI_OP_CFG_LEN	sizeof(vfe_cmd_axi_op_cfg)

#define	VFE_CMD_OP_SEL_OP1		0x0000
#define	VFE_CMD_OP_SEL_OP2		0x0001
#define	VFE_CMD_OP_SEL_OP1_OP2		0x0002
#define	VFE_CMD_OP_SEL_CTOA		0x0003
#define	VFE_CMD_OP_SEL_CTOA_OP1		0x0004
#define	VFE_CMD_OP_SEL_CTOA_OP2		0x0005
#define	VFE_CMD_OP_SEL_OP_FORMAT_8	0x0000
#define	VFE_CMD_OP_SEL_OP_FORMAT_10	0x0008
#define	VFE_CMD_OP_SEL_OP_FORMAT_12	0x0010


typedef struct {
	unsigned int	cmd_id;
	unsigned int	op_sel;
	unsigned int	op1_y_cfg_part1;
	unsigned int	op1_y_cfg_part2;
	unsigned int	op1_cbcr_cfg_part1;
	unsigned int	op1_cbcr_cfg_part2;
	unsigned int	op2_y_cfg_part1;
	unsigned int	op2_y_cfg_part2;
	unsigned int	op2_cbcr_cfg_part1;
	unsigned int	op2_cbcr_cfg_part2;
	unsigned int	op1_buf1_addr[16];
	unsigned int	op2_buf1_addr[16];
} __attribute__((packed)) vfe_cmd_axi_op_cfg;




/*
 * Command to program the roll off correction module
 */

#define	VFE_CMD_ROLLOFF_CFG	0x0002
#define	VFE_CMD_ROLLOFF_CFG_LEN	\
	sizeof(vfe_cmd_rolloff_cfg)


typedef struct {
	unsigned int	cmd_id;
	unsigned int	correction_opt_center_pos;
	unsigned int	radius_square_entry[32];
	unsigned int	red_table_entry[32];
	unsigned int	green_table_entry[32];
	unsigned int	blue_table_entry[32];
} __attribute__((packed)) vfe_cmd_rolloff_cfg;

/*
 * Command to program RGB gamma table
 */

#define	VFE_CMD_RGB_GAMMA_CFG		0x0003
#define	VFE_CMD_RGB_GAMMA_CFG_LEN	\
	sizeof(vfe_cmd_rgb_gamma_cfg)

#define	VFE_CMD_RGB_GAMMA_SEL_LINEAR		0x0000
#define	VFE_CMD_RGB_GAMMA_SEL_PW_LINEAR		0x0001
typedef struct {
	unsigned int	cmd_id;
	unsigned int	rgb_gamma_sel;
	unsigned int	rgb_gamma_entry[256];
} __attribute__((packed)) vfe_cmd_rgb_gamma_cfg;


/*
 * Command to program luma gamma table for the noise reduction path
 */

#define	VFE_CMD_Y_GAMMA_CFG		0x0004
#define	VFE_CMD_Y_GAMMA_CFG_LEN		\
	sizeof(vfe_cmd_y_gamma_cfg)

#define	VFE_CMD_Y_GAMMA_SEL_LINEAR	0x0000
#define	VFE_CMD_Y_GAMMA_SEL_PW_LINEAR	0x0001

typedef struct {
	unsigned int	cmd_id;
	unsigned int	y_gamma_sel;
	unsigned int	y_gamma_entry[256];
} __attribute__((packed)) vfe_cmd_y_gamma_cfg;



/******************************************************************************
 * Commands through vfeCommandQueue
 *****************************************************************************/

/*
 * Command to reset the VFE to a known good state.All previously programmed
 * Params will be lost
 */


#define	VFE_CMD_RESET		0x0000
#define	VFE_CMD_RESET_LEN	sizeof(vfe_cmd_reset)


typedef struct {
	unsigned short	cmd_id;
} __attribute__((packed)) vfe_cmd_reset;


/*
 * Command to start VFE processing based on the config params
 */


#define	VFE_CMD_START		0x0001
#define	VFE_CMD_START_LEN	sizeof(vfe_cmd_start)

#define	VFE_CMD_STARTUP_PARAMS_SRC_CAMIF	0x0000
#define	VFE_CMD_STARTUP_PARAMS_SRC_AXI		0x0001
#define	VFE_CMD_STARTUP_PARAMS_MODE_CONTINUOUS	0x0000
#define	VFE_CMD_STARTUP_PARAMS_MODE_SNAPSHOT	0x0002

#define	VFE_CMD_IMAGE_PL_BLACK_LVL_CORR_DIS	0x0000
#define	VFE_CMD_IMAGE_PL_BLACK_LVL_CORR_ENA	0x0001
#define	VFE_CMD_IMAGE_PL_ROLLOFF_CORR_DIS	0x0000
#define	VFE_CMD_IMAGE_PL_ROLLOFF_CORR_ENA	0x0002
#define	VFE_CMD_IMAGE_PL_WHITE_BAL_DIS		0x0000
#define	VFE_CMD_IMAGE_PL_WHITE_BAL_ENA		0x0004
#define	VFE_CMD_IMAGE_PL_RGB_GAMMA_DIS		0x0000
#define	VFE_CMD_IMAGE_PL_RGB_GAMMA_ENA		0x0008
#define	VFE_CMD_IMAGE_PL_LUMA_NOISE_RED_PATH_DIS	0x0000
#define	VFE_CMD_IMAGE_PL_LUMA_NOISE_RED_PATH_ENA	0x0010
#define	VFE_CMD_IMAGE_PL_ADP_FILTER_DIS		0x0000
#define	VFE_CMD_IMAGE_PL_ADP_FILTER_ENA		0x0020
#define	VFE_CMD_IMAGE_PL_CHROMA_SAMP_DIS	0x0000
#define	VFE_CMD_IMAGE_PL_CHROMA_SAMP_ENA	0x0040


typedef struct {
	unsigned int	cmd_id;
	unsigned int	startup_params;
	unsigned int	image_pipeline;
	unsigned int	frame_dimension;
} __attribute__((packed)) vfe_cmd_start;


/*
 * Command to halt all processing
 */

#define	VFE_CMD_STOP		0x0002
#define	VFE_CMD_STOP_LEN	sizeof(vfe_cmd_stop)

typedef struct {
	unsigned short	cmd_id;
} __attribute__((packed)) vfe_cmd_stop;


/*
 * Command to commit the params that have been programmed to take
 * effect on the next frame
 */

#define	VFE_CMD_UPDATE		0x0003
#define	VFE_CMD_UPDATE_LEN	sizeof(vfe_cmd_update)


typedef struct {
	unsigned short	cmd_id;
} __attribute__((packed)) vfe_cmd_update;


/*
 * Command to program CAMIF module
 */

#define	VFE_CMD_CAMIF_CFG	0x0004
#define	VFE_CMD_CAMIF_CFG_LEN	sizeof(vfe_cmd_camif_cfg)

#define	VFE_CMD_CFG_VSYNC_SYNC_EDGE_HIGH	0x0000
#define	VFE_CMD_CFG_VSYNC_SYNC_EDGE_LOW		0x0002
#define	VFE_CMD_CFG_HSYNC_SYNC_EDGE_HIGH	0x0000
#define	VFE_CMD_CFG_HSYNC_SYNC_EDGE_LOW		0x0004
#define	VFE_CMD_CFG_SYNC_MODE_APS		0x0000
#define	VFE_CMD_CFG_SYNC_MODE_EFS		0X0008
#define	VFE_CMD_CFG_SYNC_MODE_ELS		0x0010
#define	VFE_CMD_CFG_SYNC_MODE_RVD		0x0018
#define	VFE_CMD_CFG_VFE_SUBSAMP_EN_DIS		0x0000
#define	VFE_CMD_CFG_VFE_SUBSAMP_EN_ENA		0x0020
#define	VFE_CMD_CFG_BUS_SUBSAMP_EN_DIS		0x0000
#define	VFE_CMD_CFG_BUS_SUBSAMP_EN_ENA		0x0080
#define	VFE_CMD_CFG_IRQ_SUBSAMP_EN_DIS		0x0000
#define	VFE_CMD_CFG_IRQ_SUBSAMP_EN_ENA		0x0800

#define	VFE_CMD_SUBSAMP2_CFG_PIXEL_SKIP_16	0x0000
#define	VFE_CMD_SUBSAMP2_CFG_PIXEL_SKIP_12	0x0010

#define	VFE_CMD_EPOCH_IRQ_1_DIS			0x0000
#define	VFE_CMD_EPOCH_IRQ_1_ENA			0x4000
#define	VFE_CMD_EPOCH_IRQ_2_DIS			0x0000
#define	VFE_CMD_EPOCH_IRQ_2_ENA			0x8000

typedef struct {
	unsigned int	cmd_id;
	unsigned int	cfg;
	unsigned int	efs_cfg;
	unsigned int	frame_cfg;
	unsigned int	window_width_cfg;
	unsigned int	window_height_cfg;
	unsigned int	subsamp1_cfg;
	unsigned int	subsamp2_cfg;
	unsigned int	epoch_irq;
} __attribute__((packed)) vfe_cmd_camif_cfg;



/*
 * Command to program the black level module
 */

#define	VFE_CMD_BLACK_LVL_CFG		0x0005
#define	VFE_CMD_BLACK_LVL_CFG_LEN	sizeof(vfe_cmd_black_lvl_cfg)

#define	VFE_CMD_BL_SEL_MANUAL		0x0000
#define	VFE_CMD_BL_SEL_AUTO		0x0001

typedef struct {
	unsigned int	cmd_id;
	unsigned int	black_lvl_sel;
	unsigned int	cfg_part[3];
} __attribute__((packed)) vfe_cmd_black_lvl_cfg;


/*
 * Command to program the active region by cropping the region of interest
 */

#define	VFE_CMD_ACTIVE_REGION_CFG	0x0006
#define	VFE_CMD_ACTIVE_REGION_CFG_LEN	\
	sizeof(vfe_cmd_active_region_cfg)


typedef struct {
	unsigned int	cmd_id;
	unsigned int	cfg_part1;
	unsigned int	cfg_part2;
} __attribute__((packed)) vfe_cmd_active_region_cfg;



/*
 * Command to program the defective pixel correction(DPC) ,
 * adaptive bayer filter (ABF) and demosaic modules
 */

#define	VFE_CMD_DEMOSAIC_CFG		0x0007
#define	VFE_CMD_DEMOSAIC_CFG_LEN	sizeof(vfe_cmd_demosaic_cfg)

#define	VFE_CMD_DEMOSAIC_PART1_ABF_EN_DIS	0x0000
#define	VFE_CMD_DEMOSAIC_PART1_ABF_EN_ENA	0x0001
#define	VFE_CMD_DEMOSAIC_PART1_DPC_EN_DIS	0x0000
#define	VFE_CMD_DEMOSAIC_PART1_DPC_EN_ENA	0x0002
#define	VFE_CMD_DEMOSAIC_PART1_FORCE_ABF_OFF	0x0000
#define	VFE_CMD_DEMOSAIC_PART1_FORCE_ABF_ON	0x0004
#define	VFE_CMD_DEMOSAIC_PART1_SLOPE_SHIFT_1	0x00000000
#define	VFE_CMD_DEMOSAIC_PART1_SLOPE_SHIFT_2	0x10000000
#define	VFE_CMD_DEMOSAIC_PART1_SLOPE_SHIFT_4	0x20000000
#define	VFE_CMD_DEMOSAIC_PART1_SLOPE_SHIFT_8	0x30000000
#define	VFE_CMD_DEMOSAIC_PART1_SLOPE_SHIFT_1_2	0x50000000
#define	VFE_CMD_DEMOSAIC_PART1_SLOPE_SHIFT_1_4	0x60000000
#define	VFE_CMD_DEMOSAIC_PART1_SLOPE_SHIFT_1_8	0x70000000

typedef struct {
	unsigned int	cmd_id;
	unsigned int	demosaic_part1;
	unsigned int	demosaic_part2;
	unsigned int	demosaic_part3;
	unsigned int	demosaic_part4;
	unsigned int	demosaic_part5;
} __attribute__((packed)) vfe_cmd_demosaic_cfg;


/*
 * Command to program the ip format
 */

#define	VFE_CMD_IP_FORMAT_CFG		0x0008
#define	VFE_CMD_IP_FORMAT_CFG_LEN	\
	sizeof(vfe_cmd_ip_format_cfg)

#define	VFE_CMD_IP_FORMAT_SEL_RGRG	0x0000
#define	VFE_CMD_IP_FORMAT_SEL_GRGR	0x0001
#define	VFE_CMD_IP_FORMAT_SEL_BGBG	0x0002
#define	VFE_CMD_IP_FORMAT_SEL_GBGB	0x0003
#define	VFE_CMD_IP_FORMAT_SEL_YCBYCR	0x0004
#define	VFE_CMD_IP_FORMAT_SEL_YCRYCB	0x0005
#define	VFE_CMD_IP_FORMAT_SEL_CBYCRY	0x0006
#define	VFE_CMD_IP_FORMAT_SEL_CRYCBY	0x0007
#define	VFE_CMD_IP_FORMAT_SEL_NO_CHROMA	0x0000
#define	VFE_CMD_IP_FORMAT_SEL_CHROMA	0x0008


typedef struct {
	unsigned int	cmd_id;
	unsigned int	ip_format_sel;
	unsigned int	balance_gains_part1;
	unsigned int	balance_gains_part2;
} __attribute__((packed)) vfe_cmd_ip_format_cfg;



/*
 * Command to program max and min allowed op values
 */

#define	VFE_CMD_OP_CLAMP_CFG		0x0009
#define	VFE_CMD_OP_CLAMP_CFG_LEN	\
	sizeof(vfe_cmd_op_clamp_cfg)

typedef struct {
	unsigned int	cmd_id;
	unsigned int	op_clamp_max;
	unsigned int	op_clamp_min;
} __attribute__((packed)) vfe_cmd_op_clamp_cfg;


/*
 * Command to program chroma sub sample module
 */

#define	VFE_CMD_CHROMA_SUBSAMPLE_CFG		0x000A
#define	VFE_CMD_CHROMA_SUBSAMPLE_CFG_LEN	\
	sizeof(vfe_cmd_chroma_subsample_cfg)

#define	VFE_CMD_CHROMA_SUBSAMP_SEL_H_INTERESTIAL_SAMPS	0x0000
#define	VFE_CMD_CHROMA_SUBSAMP_SEL_H_COSITED_SAMPS	0x0001
#define	VFE_CMD_CHROMA_SUBSAMP_SEL_V_INTERESTIAL_SAMPS	0x0000
#define	VFE_CMD_CHROMA_SUBSAMP_SEL_V_COSITED_SAMPS	0x0002
#define	VFE_CMD_CHROMA_SUBSAMP_SEL_H_SUBSAMP_DIS	0x0000
#define	VFE_CMD_CHROMA_SUBSAMP_SEL_H_SUBSAMP_ENA	0x0004
#define	VFE_CMD_CHROMA_SUBSAMP_SEL_V_SUBSAMP_DIS	0x0000
#define	VFE_CMD_CHROMA_SUBSAMP_SEL_V_SUBSAMP_ENA	0x0008

typedef struct {
	unsigned int	cmd_id;
	unsigned int	chroma_subsamp_sel;
} __attribute__((packed)) vfe_cmd_chroma_subsample_cfg;


/*
 * Command to program the white balance module
 */

#define	VFE_CMD_WHITE_BALANCE_CFG	0x000B
#define	VFE_CMD_WHITE_BALANCE_CFG_LEN	\
	sizeof(vfe_cmd_white_balance_cfg)

typedef struct {
	unsigned int	cmd_id;
	unsigned int	white_balance_gains;
} __attribute__((packed)) vfe_cmd_white_balance_cfg;


/*
 * Command to program the color processing module
 */

#define	VFE_CMD_COLOR_PROCESS_CFG	0x000C
#define	VFE_CMD_COLOR_PROCESS_CFG_LEN	\
	sizeof(vfe_cmd_color_process_cfg)

#define	VFE_CMD_COLOR_CORRE_PART7_Q7_FACTORS	0x0000
#define	VFE_CMD_COLOR_CORRE_PART7_Q8_FACTORS	0x0001
#define	VFE_CMD_COLOR_CORRE_PART7_Q9_FACTORS	0x0002
#define	VFE_CMD_COLOR_CORRE_PART7_Q10_FACTORS	0x0003

typedef struct {
	unsigned int	cmd_id;
	unsigned int	color_correction_part1;
	unsigned int	color_correction_part2;
	unsigned int	color_correction_part3;
	unsigned int	color_correction_part4;
	unsigned int	color_correction_part5;
	unsigned int	color_correction_part6;
	unsigned int	color_correction_part7;
	unsigned int	chroma_enhance_part1;
	unsigned int	chroma_enhance_part2;
	unsigned int	chroma_enhance_part3;
	unsigned int	chroma_enhance_part4;
	unsigned int	chroma_enhance_part5;
	unsigned int	luma_calc_part1;
	unsigned int	luma_calc_part2;
} __attribute__((packed)) vfe_cmd_color_process_cfg;


/*
 * Command to program adaptive filter module
 */

#define	VFE_CMD_ADP_FILTER_CFG		0x000D
#define	VFE_CMD_ADP_FILTER_CFG_LEN	\
	sizeof(vfe_cmd_adp_filter_cfg)

#define	VFE_CMD_ASF_CFG_PART_SMOOTH_FILTER_DIS		0x0000
#define	VFE_CMD_ASF_CFG_PART_SMOOTH_FILTER_ENA		0x0001
#define	VFE_CMD_ASF_CFG_PART_NO_SHARP_MODE		0x0000
#define	VFE_CMD_ASF_CFG_PART_SINGLE_FILTER		0x0002
#define	VFE_CMD_ASF_CFG_PART_DUAL_FILTER		0x0004
#define	VFE_CMD_ASF_CFG_PART_SHARP_MODE			0x0007

typedef struct {
	unsigned int	cmd_id;
	unsigned int	asf_cfg_part[7];
} __attribute__((packed)) vfe_cmd_adp_filter_cfg;


/*
 * Command to program for frame skip pattern for op1 and op2
 */

#define	VFE_CMD_FRAME_SKIP_CFG		0x000E
#define	VFE_CMD_FRAME_SKIP_CFG_LEN	\
	sizeof(vfe_cmd_frame_skip_cfg)

typedef struct {
	unsigned int	cmd_id;
	unsigned int	frame_skip_pattern_op1;
	unsigned int	frame_skip_pattern_op2;
} __attribute__((packed)) vfe_cmd_frame_skip_cfg;


/*
 * Command to program field-of-view crop for digital zoom
 */

#define	VFE_CMD_FOV_CROP	0x000F
#define	VFE_CMD_FOV_CROP_LEN	sizeof(vfe_cmd_fov_crop)

typedef struct {
	unsigned int	cmd_id;
	unsigned int	fov_crop_part1;
	unsigned int	fov_crop_part2;
} __attribute__((packed)) vfe_cmd_fov_crop;



/*
 * Command to program auto focus(AF) statistics module
 */

#define	VFE_CMD_STATS_AUTOFOCUS_CFG	0x0010
#define	VFE_CMD_STATS_AUTOFOCUS_CFG_LEN	\
	sizeof(vfe_cmd_stats_autofocus_cfg)

#define	VFE_CMD_AF_STATS_SEL_STATS_DIS	0x0000
#define	VFE_CMD_AF_STATS_SEL_STATS_ENA	0x0001
#define	VFE_CMD_AF_STATS_SEL_PRI_FIXED	0x0000
#define	VFE_CMD_AF_STATS_SEL_PRI_VAR	0x0002
#define	VFE_CMD_AF_STATS_CFG_PART_METRIC_SUM	0x00000000
#define	VFE_CMD_AF_STATS_CFG_PART_METRIC_MAX	0x00200000

typedef struct {
	unsigned int	cmd_id;
	unsigned int	af_stats_sel;
	unsigned int	af_stats_cfg_part[8];
	unsigned int	af_stats_op_buf_hdr;
	unsigned int	af_stats_op_buf[3];
} __attribute__((packed)) vfe_cmd_stats_autofocus_cfg;


/*
 * Command to program White balance(wb) and exposure (exp)
 * statistics module
 */

#define	VFE_CMD_STATS_WB_EXP_CFG	0x0011
#define	VFE_CMD_STATS_WB_EXP_CFG_LEN	\
	sizeof(vfe_cmd_stats_wb_exp_cfg)

#define	VFE_CMD_WB_EXP_STATS_SEL_STATS_DIS	0x0000
#define	VFE_CMD_WB_EXP_STATS_SEL_STATS_ENA	0x0001
#define	VFE_CMD_WB_EXP_STATS_SEL_PRI_FIXED	0x0000
#define	VFE_CMD_WB_EXP_STATS_SEL_PRI_VAR	0x0002

#define	VFE_CMD_WB_EXP_STATS_CFG_PART1_EXP_REG_8_8	0x0000
#define	VFE_CMD_WB_EXP_STATS_CFG_PART1_EXP_REG_16_16	0x0001
#define	VFE_CMD_WB_EXP_STATS_CFG_PART1_EXP_SREG_8_8	0x0000
#define	VFE_CMD_WB_EXP_STATS_CFG_PART1_EXP_SREG_4_4	0x0002

typedef struct {
	unsigned int	cmd_id;
	unsigned int	wb_exp_stats_sel;
	unsigned int	wb_exp_stats_cfg_part1;
	unsigned int	wb_exp_stats_cfg_part2;
	unsigned int	wb_exp_stats_cfg_part3;
	unsigned int	wb_exp_stats_cfg_part4;
	unsigned int	wb_exp_stats_op_buf_hdr;
	unsigned int	wb_exp_stats_op_buf[3];
} __attribute__((packed)) vfe_cmd_stats_wb_exp_cfg;


/*
 * Command to program histogram(hg) stats module
 */

#define	VFE_CMD_STATS_HG_CFG		0x0012
#define	VFE_CMD_STATS_HG_CFG_LEN	\
	sizeof(vfe_cmd_stats_hg_cfg)

#define	VFE_CMD_HG_STATS_SEL_PRI_FIXED	0x0000
#define	VFE_CMD_HG_STATS_SEL_PRI_VAR	0x0002

typedef struct {
	unsigned int	cmd_id;
	unsigned int	hg_stats_sel;
	unsigned int	hg_stats_cfg_part1;
	unsigned int	hg_stats_cfg_part2;
	unsigned int	hg_stats_op_buf_hdr;
	unsigned int	hg_stats_op_buf;
} __attribute__((packed)) vfe_cmd_stats_hg_cfg;


/*
 * Command to acknowledge last MSG_VFE_OP1 message
 */

#define	VFE_CMD_OP1_ACK		0x0013
#define	VFE_CMD_OP1_ACK_LEN	sizeof(vfe_cmd_op1_ack)

typedef struct {
	unsigned int	cmd_id;
	unsigned int	op1_buf_y_addr;
	unsigned int	op1_buf_cbcr_addr;
} __attribute__((packed)) vfe_cmd_op1_ack;



/*
 * Command to acknowledge last MSG_VFE_OP2 message
 */

#define	VFE_CMD_OP2_ACK		0x0014
#define	VFE_CMD_OP2_ACK_LEN	sizeof(vfe_cmd_op2_ack)

typedef struct {
	unsigned int	cmd_id;
	unsigned int	op2_buf_y_addr;
	unsigned int	op2_buf_cbcr_addr;
} __attribute__((packed)) vfe_cmd_op2_ack;



/*
 * Command to acknowledge MSG_VFE_STATS_AUTOFOCUS msg
 */

#define	VFE_CMD_STATS_AF_ACK		0x0015
#define	VFE_CMD_STATS_AF_ACK_LEN	sizeof(vfe_cmd_stats_af_ack)


typedef struct {
	unsigned int	cmd_id;
	unsigned int	af_stats_op_buf;
} __attribute__((packed)) vfe_cmd_stats_af_ack;


/*
 * Command to acknowledge MSG_VFE_STATS_WB_EXP msg
 */

#define	VFE_CMD_STATS_WB_EXP_ACK	0x0016
#define	VFE_CMD_STATS_WB_EXP_ACK_LEN	sizeof(vfe_cmd_stats_wb_exp_ack)

typedef struct {
	unsigned int	cmd_id;
	unsigned int	wb_exp_stats_op_buf;
} __attribute__((packed)) vfe_cmd_stats_wb_exp_ack;


/*
 * Command to acknowledge MSG_VFE_EPOCH1 message
 */

#define	VFE_CMD_EPOCH1_ACK	0x0017
#define	VFE_CMD_EPOCH1_ACK_LEN	sizeof(vfe_cmd_epoch1_ack)

typedef struct {
	unsigned short cmd_id;
} __attribute__((packed)) vfe_cmd_epoch1_ack;


/*
 * Command to acknowledge MSG_VFE_EPOCH2 message
 */

#define	VFE_CMD_EPOCH2_ACK	0x0018
#define	VFE_CMD_EPOCH2_ACK_LEN	sizeof(vfe_cmd_epoch2_ack)

typedef struct {
	unsigned short cmd_id;
} __attribute__((packed)) vfe_cmd_epoch2_ack;



/*
 * Command to configure, enable or disable synchronous timer1
 */

#define	VFE_CMD_SYNC_TIMER1_CFG		0x0019
#define	VFE_CMD_SYNC_TIMER1_CFG_LEN	\
	sizeof(vfe_cmd_sync_timer1_cfg)

#define	VFE_CMD_SYNC_T1_CFG_PART1_TIMER_DIS	0x0000
#define	VFE_CMD_SYNC_T1_CFG_PART1_TIMER_ENA	0x0001
#define	VFE_CMD_SYNC_T1_CFG_PART1_POL_HIGH	0x0000
#define	VFE_CMD_SYNC_T1_CFG_PART1_POL_LOW	0x0002

typedef struct {
	unsigned int	cmd_id;
	unsigned int	sync_t1_cfg_part1;
	unsigned int	sync_t1_h_sync_countdown;
	unsigned int	sync_t1_pclk_countdown;
	unsigned int	sync_t1_duration;
} __attribute__((packed)) vfe_cmd_sync_timer1_cfg;


/*
 * Command to configure, enable or disable synchronous timer1
 */

#define	VFE_CMD_SYNC_TIMER2_CFG		0x001A
#define	VFE_CMD_SYNC_TIMER2_CFG_LEN	\
	sizeof(vfe_cmd_sync_timer2_cfg)

#define	VFE_CMD_SYNC_T2_CFG_PART1_TIMER_DIS	0x0000
#define	VFE_CMD_SYNC_T2_CFG_PART1_TIMER_ENA	0x0001
#define	VFE_CMD_SYNC_T2_CFG_PART1_POL_HIGH	0x0000
#define	VFE_CMD_SYNC_T2_CFG_PART1_POL_LOW	0x0002

typedef struct {
	unsigned int	cmd_id;
	unsigned int	sync_t2_cfg_part1;
	unsigned int	sync_t2_h_sync_countdown;
	unsigned int	sync_t2_pclk_countdown;
	unsigned int	sync_t2_duration;
} __attribute__((packed)) vfe_cmd_sync_timer2_cfg;


/*
 * Command to configure and start asynchronous timer1
 */

#define	VFE_CMD_ASYNC_TIMER1_START	0x001B
#define	VFE_CMD_ASYNC_TIMER1_START_LEN	\
	sizeof(vfe_cmd_async_timer1_start)

#define	VFE_CMD_ASYNC_T1_POLARITY_A_HIGH	0x0000
#define	VFE_CMD_ASYNC_T1_POLARITY_A_LOW		0x0001
#define	VFE_CMD_ASYNC_T1_POLARITY_B_HIGH	0x0000
#define	VFE_CMD_ASYNC_T1_POLARITY_B_LOW		0x0002

typedef struct {
	unsigned int	cmd_id;
	unsigned int	async_t1a_cfg;
	unsigned int	async_t1b_cfg;
	unsigned int	async_t1_polarity;
} __attribute__((packed)) vfe_cmd_async_timer1_start;


/*
 * Command to configure and start asynchronous timer2
 */

#define	VFE_CMD_ASYNC_TIMER2_START	0x001C
#define	VFE_CMD_ASYNC_TIMER2_START_LEN	\
	sizeof(vfe_cmd_async_timer2_start)

#define	VFE_CMD_ASYNC_T2_POLARITY_A_HIGH	0x0000
#define	VFE_CMD_ASYNC_T2_POLARITY_A_LOW		0x0001
#define	VFE_CMD_ASYNC_T2_POLARITY_B_HIGH	0x0000
#define	VFE_CMD_ASYNC_T2_POLARITY_B_LOW		0x0002

typedef struct {
	unsigned int	cmd_id;
	unsigned int	async_t2a_cfg;
	unsigned int	async_t2b_cfg;
	unsigned int	async_t2_polarity;
} __attribute__((packed)) vfe_cmd_async_timer2_start;


/*
 * Command to program partial configurations of auto focus(af)
 */

#define	VFE_CMD_STATS_AF_UPDATE		0x001D
#define	VFE_CMD_STATS_AF_UPDATE_LEN	\
	sizeof(vfe_cmd_stats_af_update)

#define	VFE_CMD_AF_UPDATE_PART1_WINDOW_ONE	0x00000000
#define	VFE_CMD_AF_UPDATE_PART1_WINDOW_MULTI	0x80000000

typedef struct {
	unsigned int	cmd_id;
	unsigned int	af_update_part1;
	unsigned int	af_update_part2;
} __attribute__((packed)) vfe_cmd_stats_af_update;


/*
 * Command to program partial cfg of wb and exp
 */

#define	VFE_CMD_STATS_WB_EXP_UPDATE	0x001E
#define	VFE_CMD_STATS_WB_EXP_UPDATE_LEN	\
	sizeof(vfe_cmd_stats_wb_exp_update)

#define	VFE_CMD_WB_EXP_UPDATE_PART1_REGIONS_8_8		0x0000
#define	VFE_CMD_WB_EXP_UPDATE_PART1_REGIONS_16_16	0x0001
#define	VFE_CMD_WB_EXP_UPDATE_PART1_SREGIONS_8_8	0x0000
#define	VFE_CMD_WB_EXP_UPDATE_PART1_SREGIONS_4_4	0x0002

typedef struct {
	unsigned int	cmd_id;
	unsigned int	wb_exp_update_part1;
	unsigned int	wb_exp_update_part2;
	unsigned int	wb_exp_update_part3;
	unsigned int	wb_exp_update_part4;
} __attribute__((packed)) vfe_cmd_stats_wb_exp_update;



/*
 * Command to re program the CAMIF FRAME CONFIG settings
 */

#define	VFE_CMD_UPDATE_CAMIF_FRAME_CFG		0x001F
#define	VFE_CMD_UPDATE_CAMIF_FRAME_CFG_LEN	\
	sizeof(vfe_cmd_update_camif_frame_cfg)

typedef struct {
	unsigned int	cmd_id;
	unsigned int	camif_frame_cfg;
} __attribute__((packed)) vfe_cmd_update_camif_frame_cfg;


#endif