File Index
Files and directories
Sign in
FILE

atomisp.h

File preview with syntax highlighting.

linux-6.19.14/drivers/staging/media/atomisp/include/linux/atomisp.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * Support for Medifield PNW Camera Imaging ISP subsystem.
  4 *
  5 * Copyright (c) 2010 Intel Corporation. All Rights Reserved.
  6 */
  7
  8#ifndef _ATOM_ISP_H
  9#define _ATOM_ISP_H
 10
 11#include <linux/types.h>
 12
 13/* struct media_device_info.hw_revision */
 14#define ATOMISP_HW_REVISION_MASK	0x0000ff00
 15#define ATOMISP_HW_REVISION_SHIFT	8
 16#define ATOMISP_HW_REVISION_ISP2300	0x00
 17#define ATOMISP_HW_REVISION_ISP2400	0x10
 18#define ATOMISP_HW_REVISION_ISP2401_LEGACY 0x11
 19#define ATOMISP_HW_REVISION_ISP2401	0x20
 20
 21#define ATOMISP_HW_STEPPING_MASK	0x000000ff
 22#define ATOMISP_HW_STEPPING_A0		0x00
 23#define ATOMISP_HW_STEPPING_B0		0x10
 24
 25/*ISP binary running mode*/
 26#define CI_MODE_PREVIEW		0x8000
 27#define CI_MODE_VIDEO		0x4000
 28#define CI_MODE_STILL_CAPTURE	0x2000
 29#define CI_MODE_NONE		0x0000
 30
 31#define OUTPUT_MODE_FILE 0x0100
 32#define OUTPUT_MODE_TEXT 0x0200
 33
 34/*
 35 * Camera HAL sets this flag in v4l2_buffer reserved2 to indicate this
 36 * buffer has a per-frame parameter.
 37 */
 38#define ATOMISP_BUFFER_HAS_PER_FRAME_SETTING	0x80000000
 39
 40/* Custom format for RAW capture from M10MO 0x3130314d */
 41#define V4L2_PIX_FMT_CUSTOM_M10MO_RAW	v4l2_fourcc('M', '1', '0', '1')
 42
 43/* Custom media bus formats being used in atomisp */
 44#define V4L2_MBUS_FMT_CUSTOM_YUV420	0x8001
 45#define V4L2_MBUS_FMT_CUSTOM_YVU420	0x8002
 46#define V4L2_MBUS_FMT_CUSTOM_YUV422P	0x8003
 47#define V4L2_MBUS_FMT_CUSTOM_YUV444	0x8004
 48#define V4L2_MBUS_FMT_CUSTOM_NV12	0x8005
 49#define V4L2_MBUS_FMT_CUSTOM_NV21	0x8006
 50#define V4L2_MBUS_FMT_CUSTOM_NV16	0x8007
 51#define V4L2_MBUS_FMT_CUSTOM_YUYV	0x8008
 52#define V4L2_MBUS_FMT_CUSTOM_SBGGR16	0x8009
 53#define V4L2_MBUS_FMT_CUSTOM_RGB32	0x800a
 54
 55/* Custom media bus format for M10MO RAW capture */
 56#if 0
 57#define V4L2_MBUS_FMT_CUSTOM_M10MO_RAW	0x800b
 58#endif
 59
 60/* Configuration used by Bayer noise reduction and YCC noise reduction */
 61struct atomisp_nr_config {
 62	/* [gain] Strength of noise reduction for Bayer NR (Used by Bayer NR) */
 63	unsigned int bnr_gain;
 64	/* [gain] Strength of noise reduction for YCC NR (Used by YCC NR) */
 65	unsigned int ynr_gain;
 66	/* [intensity] Sensitivity of Edge (Used by Bayer NR) */
 67	unsigned int direction;
 68	/* [intensity] coring threshold for Cb (Used by YCC NR) */
 69	unsigned int threshold_cb;
 70	/* [intensity] coring threshold for Cr (Used by YCC NR) */
 71	unsigned int threshold_cr;
 72};
 73
 74/* Temporal noise reduction configuration */
 75struct atomisp_tnr_config {
 76	unsigned int gain;	 /* [gain] Strength of NR */
 77	unsigned int threshold_y;/* [intensity] Motion sensitivity for Y */
 78	unsigned int threshold_uv;/* [intensity] Motion sensitivity for U/V */
 79};
 80
 81/* Histogram. This contains num_elements values of type unsigned int.
 82 * The data pointer is a DDR pointer (virtual address).
 83 */
 84struct atomisp_histogram {
 85	unsigned int num_elements;
 86	void __user *data;
 87};
 88
 89enum atomisp_ob_mode {
 90	atomisp_ob_mode_none,
 91	atomisp_ob_mode_fixed,
 92	atomisp_ob_mode_raster
 93};
 94
 95/* Optical black level configuration */
 96struct atomisp_ob_config {
 97	/* Obtical black level mode (Fixed / Raster) */
 98	enum atomisp_ob_mode mode;
 99	/* [intensity] optical black level for GR (relevant for fixed mode) */
100	unsigned int level_gr;
101	/* [intensity] optical black level for R (relevant for fixed mode) */
102	unsigned int level_r;
103	/* [intensity] optical black level for B (relevant for fixed mode) */
104	unsigned int level_b;
105	/* [intensity] optical black level for GB (relevant for fixed mode) */
106	unsigned int level_gb;
107	/* [BQ] 0..63 start position of OB area (relevant for raster mode) */
108	unsigned short start_position;
109	/* [BQ] start..63 end position of OB area (relevant for raster mode) */
110	unsigned short end_position;
111};
112
113/* Edge enhancement (sharpen) configuration */
114struct atomisp_ee_config {
115	/* [gain] The strength of sharpness. u5_11 */
116	unsigned int gain;
117	/* [intensity] The threshold that divides noises from edge. u8_8 */
118	unsigned int threshold;
119	/* [gain] The strength of sharpness in pell-mell area. u5_11 */
120	unsigned int detail_gain;
121};
122
123struct atomisp_3a_output {
124	int ae_y;
125	int awb_cnt;
126	int awb_gr;
127	int awb_r;
128	int awb_b;
129	int awb_gb;
130	int af_hpf1;
131	int af_hpf2;
132};
133
134enum atomisp_calibration_type {
135	calibration_type1,
136	calibration_type2,
137	calibration_type3
138};
139
140struct atomisp_gc_config {
141	__u16 gain_k1;
142	__u16 gain_k2;
143};
144
145struct atomisp_3a_config {
146	unsigned int ae_y_coef_r;	/* [gain] Weight of R for Y */
147	unsigned int ae_y_coef_g;	/* [gain] Weight of G for Y */
148	unsigned int ae_y_coef_b;	/* [gain] Weight of B for Y */
149	unsigned int awb_lg_high_raw;	/* [intensity]
150					   AWB level gate high for raw */
151	unsigned int awb_lg_low;	/* [intensity] AWB level gate low */
152	unsigned int awb_lg_high;	/* [intensity] AWB level gate high */
153	int af_fir1_coef[7];	/* [factor] AF FIR coefficients of fir1 */
154	int af_fir2_coef[7];	/* [factor] AF FIR coefficients of fir2 */
155};
156
157struct atomisp_dvs_grid_info {
158	u32 enable;
159	u32 width;
160	u32 aligned_width;
161	u32 height;
162	u32 aligned_height;
163	u32 bqs_per_grid_cell;
164	u32 num_hor_coefs;
165	u32 num_ver_coefs;
166};
167
168struct atomisp_dvs_envelop {
169	unsigned int width;
170	unsigned int height;
171};
172
173struct atomisp_grid_info {
174	u32 enable;
175	u32 use_dmem;
176	u32 has_histogram;
177	u32 s3a_width;
178	u32 s3a_height;
179	u32 aligned_width;
180	u32 aligned_height;
181	u32 s3a_bqs_per_grid_cell;
182	u32 deci_factor_log2;
183	u32 elem_bit_depth;
184};
185
186struct atomisp_dis_vector {
187	int x;
188	int y;
189};
190
191/* DVS 2.0 Coefficient types. This structure contains 4 pointers to
192 *  arrays that contain the coefficients for each type.
193 */
194struct atomisp_dvs2_coef_types {
195	short __user *odd_real; /** real part of the odd coefficients*/
196	short __user *odd_imag; /** imaginary part of the odd coefficients*/
197	short __user *even_real;/** real part of the even coefficients*/
198	short __user *even_imag;/** imaginary part of the even coefficients*/
199};
200
201/*
202 * DVS 2.0 Statistic types. This structure contains 4 pointers to
203 * arrays that contain the statistics for each type.
204 */
205struct atomisp_dvs2_stat_types {
206	int __user *odd_real; /** real part of the odd statistics*/
207	int __user *odd_imag; /** imaginary part of the odd statistics*/
208	int __user *even_real;/** real part of the even statistics*/
209	int __user *even_imag;/** imaginary part of the even statistics*/
210};
211
212struct atomisp_dis_coefficients {
213	struct atomisp_dvs_grid_info grid_info;
214	struct atomisp_dvs2_coef_types hor_coefs;
215	struct atomisp_dvs2_coef_types ver_coefs;
216};
217
218struct atomisp_dvs2_statistics {
219	struct atomisp_dvs_grid_info grid_info;
220	struct atomisp_dvs2_stat_types hor_prod;
221	struct atomisp_dvs2_stat_types ver_prod;
222};
223
224struct atomisp_dis_statistics {
225	struct atomisp_dvs2_statistics dvs2_stat;
226	u32 exp_id;
227};
228
229struct atomisp_3a_rgby_output {
230	u32 r;
231	u32 g;
232	u32 b;
233	u32 y;
234};
235
236/*
237 * Because we have 2 pipes at max to output metadata, therefore driver will use
238 * ATOMISP_MAIN_METADATA to specify the metadata from the pipe which keeps
239 * streaming always and use ATOMISP_SEC_METADATA to specify the metadata from
240 * the pipe which is streaming by request like capture pipe of ZSL or SDV mode
241 * as secondary metadata. And for the use case which has only one pipe
242 * streaming like online capture, ATOMISP_MAIN_METADATA will be used.
243 */
244enum atomisp_metadata_type {
245	ATOMISP_MAIN_METADATA = 0,
246	ATOMISP_SEC_METADATA,
247	ATOMISP_METADATA_TYPE_NUM,
248};
249
250struct atomisp_ext_isp_ctrl {
251	u32 id;
252	u32 data;
253};
254
255struct atomisp_3a_statistics {
256	struct atomisp_grid_info  grid_info;
257	struct atomisp_3a_output __user *data;
258	struct atomisp_3a_rgby_output __user *rgby_data;
259	u32 exp_id; /* exposure ID */
260	u32 isp_config_id; /* isp config ID */
261};
262
263/* White Balance (Gain Adjust) */
264struct atomisp_wb_config {
265	unsigned int integer_bits;
266	unsigned int gr;	/* unsigned <integer_bits>.<16-integer_bits> */
267	unsigned int r;		/* unsigned <integer_bits>.<16-integer_bits> */
268	unsigned int b;		/* unsigned <integer_bits>.<16-integer_bits> */
269	unsigned int gb;	/* unsigned <integer_bits>.<16-integer_bits> */
270};
271
272/* Color Space Conversion settings */
273struct atomisp_cc_config {
274	unsigned int fraction_bits;
275	int matrix[3 * 3];	/* RGB2YUV Color matrix, signed
276				   <13-fraction_bits>.<fraction_bits> */
277};
278
279/* De pixel noise configuration */
280struct atomisp_de_config {
281	unsigned int pixelnoise;
282	unsigned int c1_coring_threshold;
283	unsigned int c2_coring_threshold;
284};
285
286/* Chroma enhancement */
287struct atomisp_ce_config {
288	unsigned char uv_level_min;
289	unsigned char uv_level_max;
290};
291
292/* Defect pixel correction configuration */
293struct atomisp_dp_config {
294	/* [intensity] The threshold of defect Pixel Correction, representing
295	 * the permissible difference of intensity between one pixel and its
296	 * surrounding pixels. Smaller values result in more frequent pixel
297	 * corrections. u0_16
298	 */
299	unsigned int threshold;
300	/* [gain] The sensitivity of mis-correction. ISP will miss a lot of
301	 * defects if the value is set too large. u8_8
302	 */
303	unsigned int gain;
304	unsigned int gr;
305	unsigned int r;
306	unsigned int b;
307	unsigned int gb;
308};
309
310/* XNR threshold */
311struct atomisp_xnr_config {
312	__u16 threshold;
313};
314
315/* metadata config */
316struct atomisp_metadata_config {
317	u32 metadata_height;
318	u32 metadata_stride;
319};
320
321/*
322 * Generic resolution structure.
323 */
324struct atomisp_resolution {
325	u32 width;  /** Width */
326	u32 height; /** Height */
327};
328
329/*
330 * This specifies the coordinates (x,y)
331 */
332struct atomisp_zoom_point {
333	s32 x; /** x coordinate */
334	s32 y; /** y coordinate */
335};
336
337/*
338 * This specifies the region
339 */
340struct atomisp_zoom_region {
341	struct atomisp_zoom_point
342		origin; /* Starting point coordinates for the region */
343	struct atomisp_resolution resolution; /* Region resolution */
344};
345
346struct atomisp_dz_config {
347	u32 dx; /** Horizontal zoom factor */
348	u32 dy; /** Vertical zoom factor */
349	struct atomisp_zoom_region zoom_region; /** region for zoom */
350};
351
352struct atomisp_parm {
353	struct atomisp_grid_info info;
354	struct atomisp_dvs_grid_info dvs_grid;
355	struct atomisp_dvs_envelop dvs_envelop;
356	struct atomisp_wb_config wb_config;
357	struct atomisp_cc_config cc_config;
358	struct atomisp_ob_config ob_config;
359	struct atomisp_de_config de_config;
360	struct atomisp_dz_config dz_config;
361	struct atomisp_ce_config ce_config;
362	struct atomisp_dp_config dp_config;
363	struct atomisp_nr_config nr_config;
364	struct atomisp_ee_config ee_config;
365	struct atomisp_tnr_config tnr_config;
366	struct atomisp_metadata_config metadata_config;
367};
368
369struct dvs2_bq_resolution {
370	int width_bq;         /* width [BQ] */
371	int height_bq;        /* height [BQ] */
372};
373
374struct atomisp_dvs2_bq_resolutions {
375	/* GDC source image size [BQ] */
376	struct dvs2_bq_resolution source_bq;
377	/* GDC output image size [BQ] */
378	struct dvs2_bq_resolution output_bq;
379	/* GDC effective envelope size [BQ] */
380	struct dvs2_bq_resolution envelope_bq;
381	/* isp pipe filter size [BQ] */
382	struct dvs2_bq_resolution ispfilter_bq;
383	/* GDC shit size [BQ] */
384	struct dvs2_bq_resolution gdc_shift_bq;
385};
386
387struct atomisp_dvs_6axis_config {
388	u32 exp_id;
389	u32 width_y;
390	u32 height_y;
391	u32 width_uv;
392	u32 height_uv;
393	u32 *xcoords_y;
394	u32 *ycoords_y;
395	u32 *xcoords_uv;
396	u32 *ycoords_uv;
397};
398
399struct atomisp_formats_config {
400	u32 video_full_range_flag;
401};
402
403struct atomisp_parameters {
404	struct atomisp_wb_config   *wb_config;  /* White Balance config */
405	struct atomisp_cc_config   *cc_config;  /* Color Correction config */
406	struct atomisp_tnr_config  *tnr_config; /* Temporal Noise Reduction */
407	struct atomisp_ecd_config  *ecd_config; /* Eigen Color Demosaicing */
408	struct atomisp_ynr_config  *ynr_config; /* Y(Luma) Noise Reduction */
409	struct atomisp_fc_config   *fc_config;  /* Fringe Control */
410	struct atomisp_formats_config *formats_config; /* Formats Control */
411	struct atomisp_cnr_config  *cnr_config; /* Chroma Noise Reduction */
412	struct atomisp_macc_config *macc_config;  /* MACC */
413	struct atomisp_ctc_config  *ctc_config; /* Chroma Tone Control */
414	struct atomisp_aa_config   *aa_config;  /* Anti-Aliasing */
415	struct atomisp_aa_config   *baa_config;  /* Anti-Aliasing */
416	struct atomisp_ce_config   *ce_config;
417	struct atomisp_dvs_6axis_config *dvs_6axis_config;
418	struct atomisp_ob_config   *ob_config;  /* Objective Black config */
419	struct atomisp_dp_config   *dp_config;  /* Dead Pixel config */
420	struct atomisp_nr_config   *nr_config;  /* Noise Reduction config */
421	struct atomisp_ee_config   *ee_config;  /* Edge Enhancement config */
422	struct atomisp_de_config   *de_config;  /* Demosaic config */
423	struct atomisp_gc_config   *gc_config;  /* Gamma Correction config */
424	struct atomisp_anr_config  *anr_config; /* Advanced Noise Reduction */
425	struct atomisp_3a_config   *a3a_config; /* 3A Statistics config */
426	struct atomisp_xnr_config  *xnr_config; /* eXtra Noise Reduction */
427	struct atomisp_dz_config   *dz_config;  /* Digital Zoom */
428	struct atomisp_cc_config *yuv2rgb_cc_config; /* Color
429							Correction config */
430	struct atomisp_cc_config *rgb2yuv_cc_config; /* Color
431							Correction config */
432	struct atomisp_macc_table  *macc_table;
433	struct atomisp_gamma_table *gamma_table;
434	struct atomisp_ctc_table   *ctc_table;
435	struct atomisp_xnr_table   *xnr_table;
436	struct atomisp_rgb_gamma_table *r_gamma_table;
437	struct atomisp_rgb_gamma_table *g_gamma_table;
438	struct atomisp_rgb_gamma_table *b_gamma_table;
439	struct atomisp_vector      *motion_vector; /* For 2-axis DVS */
440	struct atomisp_shading_table *shading_table;
441	struct atomisp_morph_table   *morph_table;
442	struct atomisp_dvs_coefficients *dvs_coefs; /* DVS 1.0 coefficients */
443	struct atomisp_dis_coefficients *dvs2_coefs; /* DVS 2.0 coefficients */
444	struct atomisp_capture_config   *capture_config;
445	struct atomisp_anr_thres   *anr_thres;
446
447	void	*lin_2500_config;       /* Skylake: Linearization config */
448	void	*obgrid_2500_config;    /* Skylake: OBGRID config */
449	void	*bnr_2500_config;       /* Skylake: bayer denoise config */
450	void	*shd_2500_config;       /* Skylake: shading config */
451	void	*dm_2500_config;        /* Skylake: demosaic config */
452	void	*rgbpp_2500_config;     /* Skylake: RGBPP config */
453	void	*dvs_stat_2500_config;  /* Skylake: DVS STAT config */
454	void	*lace_stat_2500_config; /* Skylake: LACE STAT config */
455	void	*yuvp1_2500_config;     /* Skylake: yuvp1 config */
456	void	*yuvp2_2500_config;     /* Skylake: yuvp2 config */
457	void	*tnr_2500_config;       /* Skylake: TNR config */
458	void	*dpc_2500_config;       /* Skylake: DPC config */
459	void	*awb_2500_config;       /* Skylake: auto white balance config */
460	void	*awb_fr_2500_config;    /* Skylake: auto white balance filter response config */
461	void	*anr_2500_config;       /* Skylake: ANR config */
462	void	*af_2500_config;        /* Skylake: auto focus config */
463	void	*ae_2500_config;        /* Skylake: auto exposure config */
464	void	*bds_2500_config;       /* Skylake: bayer downscaler config */
465	void	*dvs_2500_config;       /* Skylake: digital video stabilization config */
466	void	*res_mgr_2500_config;
467
468	/*
469	 * Output frame pointer the config is to be applied to (optional),
470	 * set to NULL to make this config is applied as global.
471	 */
472	void	*output_frame;
473	/*
474	 * Unique ID to track which config was actually applied to a particular
475	 * frame, driver will send this id back with output frame together.
476	 */
477	u32	isp_config_id;
478
479	/*
480	 * Switch to control per_frame setting:
481	 * 0: this is a global setting
482	 * 1: this is a per_frame setting
483	 * PLEASE KEEP THIS AT THE END OF THE STRUCTURE!!
484	 */
485	u32	per_frame_setting;
486};
487
488#define ATOMISP_GAMMA_TABLE_SIZE        1024
489struct atomisp_gamma_table {
490	unsigned short data[ATOMISP_GAMMA_TABLE_SIZE];
491};
492
493/* Morphing table for advanced ISP.
494 * Each line of width elements takes up COORD_TABLE_EXT_WIDTH elements
495 * in memory.
496 */
497#define ATOMISP_MORPH_TABLE_NUM_PLANES  6
498struct atomisp_morph_table {
499	unsigned int enabled;
500
501	unsigned int height;
502	unsigned int width;	/* number of valid elements per line */
503	unsigned short __user *coordinates_x[ATOMISP_MORPH_TABLE_NUM_PLANES];
504	unsigned short __user *coordinates_y[ATOMISP_MORPH_TABLE_NUM_PLANES];
505};
506
507#define ATOMISP_NUM_SC_COLORS	4
508#define ATOMISP_SC_FLAG_QUERY	BIT(0)
509
510struct atomisp_shading_table {
511	__u32 enable;
512
513	__u32 sensor_width;
514	__u32 sensor_height;
515	__u32 width;
516	__u32 height;
517	__u32 fraction_bits;
518
519	__u16 *data[ATOMISP_NUM_SC_COLORS];
520};
521
522/* parameter for MACC */
523#define ATOMISP_NUM_MACC_AXES           16
524struct atomisp_macc_table {
525	short data[4 * ATOMISP_NUM_MACC_AXES];
526};
527
528struct atomisp_macc_config {
529	int color_effect;
530	struct atomisp_macc_table table;
531};
532
533/* Parameter for ctc parameter control */
534#define ATOMISP_CTC_TABLE_SIZE          1024
535struct atomisp_ctc_table {
536	unsigned short data[ATOMISP_CTC_TABLE_SIZE];
537};
538
539/* Parameter for overlay image loading */
540struct atomisp_overlay {
541	/* the frame containing the overlay data The overlay frame width should
542	 * be the multiples of 2*ISP_VEC_NELEMS. The overlay frame height
543	 * should be the multiples of 2.
544	 */
545	struct v4l2_framebuffer *frame;
546	/* Y value of overlay background */
547	unsigned char bg_y;
548	/* U value of overlay background */
549	char bg_u;
550	/* V value of overlay background */
551	char bg_v;
552	/* the blending percent of input data for Y subpixels */
553	unsigned char blend_input_perc_y;
554	/* the blending percent of input data for U subpixels */
555	unsigned char blend_input_perc_u;
556	/* the blending percent of input data for V subpixels */
557	unsigned char blend_input_perc_v;
558	/* the blending percent of overlay data for Y subpixels */
559	unsigned char blend_overlay_perc_y;
560	/* the blending percent of overlay data for U subpixels */
561	unsigned char blend_overlay_perc_u;
562	/* the blending percent of overlay data for V subpixels */
563	unsigned char blend_overlay_perc_v;
564	/* the overlay start x pixel position on output frame It should be the
565	   multiples of 2*ISP_VEC_NELEMS. */
566	unsigned int overlay_start_x;
567	/* the overlay start y pixel position on output frame It should be the
568	   multiples of 2. */
569	unsigned int overlay_start_y;
570};
571
572struct atomisp_exposure {
573	unsigned int integration_time[8];
574	unsigned int shutter_speed[8];
575	unsigned int gain[4];
576	unsigned int aperture;
577};
578
579/* For texture streaming. */
580struct atomisp_bc_video_package {
581	int ioctl_cmd;
582	int device_id;
583	int inputparam;
584	int outputparam;
585};
586
587enum atomisp_focus_hp {
588	ATOMISP_FOCUS_HP_IN_PROGRESS = (1U << 2),
589	ATOMISP_FOCUS_HP_COMPLETE    = (2U << 2),
590	ATOMISP_FOCUS_HP_FAILED      = (3U << 2)
591};
592
593/* Masks */
594#define ATOMISP_FOCUS_STATUS_MOVING           BIT(0)
595#define ATOMISP_FOCUS_STATUS_ACCEPTS_NEW_MOVE BIT(1)
596#define ATOMISP_FOCUS_STATUS_HOME_POSITION    (3U << 2)
597
598enum atomisp_camera_port {
599	ATOMISP_CAMERA_PORT_SECONDARY,
600	ATOMISP_CAMERA_PORT_PRIMARY,
601	ATOMISP_CAMERA_PORT_TERTIARY,
602	ATOMISP_CAMERA_NR_PORTS
603};
604
605enum atomisp_ext_isp_id {
606	EXT_ISP_CID_ISO = 0,
607	EXT_ISP_CID_CAPTURE_HDR,
608	EXT_ISP_CID_CAPTURE_LLS,
609	EXT_ISP_CID_FOCUS_MODE,
610	EXT_ISP_CID_FOCUS_EXECUTION,
611	EXT_ISP_CID_TOUCH_POSX,
612	EXT_ISP_CID_TOUCH_POSY,
613	EXT_ISP_CID_CAF_STATUS,
614	EXT_ISP_CID_AF_STATUS,
615	EXT_ISP_CID_GET_AF_MODE,
616	EXT_ISP_CID_CAPTURE_BURST,
617	EXT_ISP_CID_ZOOM,
618	EXT_ISP_CID_SHOT_MODE
619};
620
621#define EXT_ISP_FOCUS_MODE_NORMAL	0
622#define EXT_ISP_FOCUS_MODE_MACRO	1
623#define EXT_ISP_FOCUS_MODE_TOUCH_AF	2
624#define EXT_ISP_FOCUS_MODE_PREVIEW_CAF	3
625#define EXT_ISP_FOCUS_MODE_MOVIE_CAF	4
626#define EXT_ISP_FOCUS_MODE_FACE_CAF	5
627#define EXT_ISP_FOCUS_MODE_TOUCH_MACRO	6
628#define EXT_ISP_FOCUS_MODE_TOUCH_CAF	7
629
630#define EXT_ISP_FOCUS_STOP		0
631#define EXT_ISP_FOCUS_SEARCH		1
632#define EXT_ISP_PAN_FOCUSING		2
633
634#define EXT_ISP_CAF_RESTART_CHECK	1
635#define EXT_ISP_CAF_STATUS_FOCUSING	2
636#define EXT_ISP_CAF_STATUS_SUCCESS	3
637#define EXT_ISP_CAF_STATUS_FAIL         4
638
639#define EXT_ISP_AF_STATUS_INVALID	1
640#define EXT_ISP_AF_STATUS_FOCUSING	2
641#define EXT_ISP_AF_STATUS_SUCCESS	3
642#define EXT_ISP_AF_STATUS_FAIL		4
643
644enum atomisp_burst_capture_options {
645	EXT_ISP_BURST_CAPTURE_CTRL_START = 0,
646	EXT_ISP_BURST_CAPTURE_CTRL_STOP
647};
648
649#define EXT_ISP_SHOT_MODE_AUTO		0
650#define EXT_ISP_SHOT_MODE_BEAUTY_FACE	1
651#define EXT_ISP_SHOT_MODE_BEST_PHOTO	2
652#define EXT_ISP_SHOT_MODE_DRAMA		3
653#define EXT_ISP_SHOT_MODE_BEST_FACE	4
654#define EXT_ISP_SHOT_MODE_ERASER	5
655#define EXT_ISP_SHOT_MODE_PANORAMA	6
656#define EXT_ISP_SHOT_MODE_RICH_TONE_HDR	7
657#define EXT_ISP_SHOT_MODE_NIGHT		8
658#define EXT_ISP_SHOT_MODE_SOUND_SHOT	9
659#define EXT_ISP_SHOT_MODE_ANIMATED_PHOTO	10
660#define EXT_ISP_SHOT_MODE_SPORTS	11
661
662/*Private IOCTLs for ISP */
663#define ATOMISP_IOC_G_XNR \
664	_IOR('v', BASE_VIDIOC_PRIVATE + 0, int)
665#define ATOMISP_IOC_S_XNR \
666	_IOW('v', BASE_VIDIOC_PRIVATE + 0, int)
667#define ATOMISP_IOC_G_NR \
668	_IOR('v', BASE_VIDIOC_PRIVATE + 1, struct atomisp_nr_config)
669#define ATOMISP_IOC_S_NR \
670	_IOW('v', BASE_VIDIOC_PRIVATE + 1, struct atomisp_nr_config)
671#define ATOMISP_IOC_G_TNR \
672	_IOR('v', BASE_VIDIOC_PRIVATE + 2, struct atomisp_tnr_config)
673#define ATOMISP_IOC_S_TNR \
674	_IOW('v', BASE_VIDIOC_PRIVATE + 2, struct atomisp_tnr_config)
675#define ATOMISP_IOC_G_HISTOGRAM \
676	_IOWR('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_histogram)
677#define ATOMISP_IOC_S_HISTOGRAM \
678	_IOW('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_histogram)
679#define ATOMISP_IOC_G_BLACK_LEVEL_COMP \
680	_IOR('v', BASE_VIDIOC_PRIVATE + 4, struct atomisp_ob_config)
681#define ATOMISP_IOC_S_BLACK_LEVEL_COMP \
682	_IOW('v', BASE_VIDIOC_PRIVATE + 4, struct atomisp_ob_config)
683#define ATOMISP_IOC_G_EE \
684	_IOR('v', BASE_VIDIOC_PRIVATE + 5, struct atomisp_ee_config)
685#define ATOMISP_IOC_S_EE \
686	_IOW('v', BASE_VIDIOC_PRIVATE + 5, struct atomisp_ee_config)
687/* Digital Image Stabilization:
688 * 1. get dis statistics: reads DIS statistics from ISP (every frame)
689 * 2. set dis coefficients: set DIS filter coefficients (one time)
690 * 3. set dis motion vector: set motion vector (result of DIS, every frame)
691 */
692#define ATOMISP_IOC_G_DIS_STAT \
693	_IOWR('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_statistics)
694
695#define ATOMISP_IOC_G_DVS2_BQ_RESOLUTIONS \
696	_IOR('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dvs2_bq_resolutions)
697
698#define ATOMISP_IOC_S_DIS_COEFS \
699	_IOW('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_coefficients)
700
701#define ATOMISP_IOC_S_DIS_VECTOR \
702	_IOW('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dvs_6axis_config)
703
704#define ATOMISP_IOC_G_3A_STAT \
705	_IOWR('v', BASE_VIDIOC_PRIVATE + 7, struct atomisp_3a_statistics)
706#define ATOMISP_IOC_G_ISP_PARM \
707	_IOR('v', BASE_VIDIOC_PRIVATE + 8, struct atomisp_parm)
708#define ATOMISP_IOC_S_ISP_PARM \
709	_IOW('v', BASE_VIDIOC_PRIVATE + 8, struct atomisp_parm)
710#define ATOMISP_IOC_G_ISP_GAMMA \
711	_IOR('v', BASE_VIDIOC_PRIVATE + 9, struct atomisp_gamma_table)
712#define ATOMISP_IOC_S_ISP_GAMMA \
713	_IOW('v', BASE_VIDIOC_PRIVATE + 9, struct atomisp_gamma_table)
714#define ATOMISP_IOC_G_ISP_GDC_TAB \
715	_IOR('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_morph_table)
716#define ATOMISP_IOC_S_ISP_GDC_TAB \
717	_IOW('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_morph_table)
718
719/* macc parameter control*/
720#define ATOMISP_IOC_G_ISP_MACC \
721	_IOR('v', BASE_VIDIOC_PRIVATE + 12, struct atomisp_macc_config)
722#define ATOMISP_IOC_S_ISP_MACC \
723	_IOW('v', BASE_VIDIOC_PRIVATE + 12, struct atomisp_macc_config)
724
725/* Defect pixel detection & Correction */
726#define ATOMISP_IOC_G_ISP_BAD_PIXEL_DETECTION \
727	_IOR('v', BASE_VIDIOC_PRIVATE + 13, struct atomisp_dp_config)
728#define ATOMISP_IOC_S_ISP_BAD_PIXEL_DETECTION \
729	_IOW('v', BASE_VIDIOC_PRIVATE + 13, struct atomisp_dp_config)
730
731/* False Color Correction */
732#define ATOMISP_IOC_G_ISP_FALSE_COLOR_CORRECTION \
733	_IOR('v', BASE_VIDIOC_PRIVATE + 14, struct atomisp_de_config)
734#define ATOMISP_IOC_S_ISP_FALSE_COLOR_CORRECTION \
735	_IOW('v', BASE_VIDIOC_PRIVATE + 14, struct atomisp_de_config)
736
737/* ctc parameter control */
738#define ATOMISP_IOC_G_ISP_CTC \
739	_IOR('v', BASE_VIDIOC_PRIVATE + 15, struct atomisp_ctc_table)
740#define ATOMISP_IOC_S_ISP_CTC \
741	_IOW('v', BASE_VIDIOC_PRIVATE + 15, struct atomisp_ctc_table)
742
743/* white balance Correction */
744#define ATOMISP_IOC_G_ISP_WHITE_BALANCE \
745	_IOR('v', BASE_VIDIOC_PRIVATE + 16, struct atomisp_wb_config)
746#define ATOMISP_IOC_S_ISP_WHITE_BALANCE \
747	_IOW('v', BASE_VIDIOC_PRIVATE + 16, struct atomisp_wb_config)
748
749/* fpn table loading */
750#define ATOMISP_IOC_S_ISP_FPN_TABLE \
751	_IOW('v', BASE_VIDIOC_PRIVATE + 17, struct v4l2_framebuffer)
752
753/* overlay image loading */
754#define ATOMISP_IOC_G_ISP_OVERLAY \
755	_IOWR('v', BASE_VIDIOC_PRIVATE + 18, struct atomisp_overlay)
756#define ATOMISP_IOC_S_ISP_OVERLAY \
757	_IOW('v', BASE_VIDIOC_PRIVATE + 18, struct atomisp_overlay)
758
759/* bcd driver bridge */
760#define ATOMISP_IOC_CAMERA_BRIDGE \
761	_IOWR('v', BASE_VIDIOC_PRIVATE + 19, struct atomisp_bc_video_package)
762
763#define ATOMISP_IOC_S_EXPOSURE \
764	_IOW('v', BASE_VIDIOC_PRIVATE + 21, struct atomisp_exposure)
765
766/* white balance Correction */
767#define ATOMISP_IOC_G_3A_CONFIG \
768	_IOR('v', BASE_VIDIOC_PRIVATE + 23, struct atomisp_3a_config)
769#define ATOMISP_IOC_S_3A_CONFIG \
770	_IOW('v', BASE_VIDIOC_PRIVATE + 23, struct atomisp_3a_config)
771
772/* LCS (shading) table write */
773#define ATOMISP_IOC_S_ISP_SHD_TAB \
774	_IOWR('v', BASE_VIDIOC_PRIVATE + 27, struct atomisp_shading_table)
775
776/* Gamma Correction */
777#define ATOMISP_IOC_G_ISP_GAMMA_CORRECTION \
778	_IOR('v', BASE_VIDIOC_PRIVATE + 28, struct atomisp_gc_config)
779
780#define ATOMISP_IOC_S_ISP_GAMMA_CORRECTION \
781	_IOW('v', BASE_VIDIOC_PRIVATE + 28, struct atomisp_gc_config)
782
783#define ATOMISP_IOC_S_PARAMETERS \
784	_IOW('v', BASE_VIDIOC_PRIVATE + 32, struct atomisp_parameters)
785
786#define ATOMISP_IOC_EXP_ID_UNLOCK \
787	_IOW('v', BASE_VIDIOC_PRIVATE + 36, int)
788
789#define ATOMISP_IOC_EXP_ID_CAPTURE \
790	_IOW('v', BASE_VIDIOC_PRIVATE + 37, int)
791
792#define ATOMISP_IOC_S_ENABLE_DZ_CAPT_PIPE \
793	_IOWR('v', BASE_VIDIOC_PRIVATE + 38, unsigned int)
794
795#define ATOMISP_IOC_G_FORMATS_CONFIG \
796	_IOR('v', BASE_VIDIOC_PRIVATE + 39, struct atomisp_formats_config)
797
798#define ATOMISP_IOC_S_FORMATS_CONFIG \
799	_IOW('v', BASE_VIDIOC_PRIVATE + 39, struct atomisp_formats_config)
800
801#define ATOMISP_IOC_INJECT_A_FAKE_EVENT \
802	_IOW('v', BASE_VIDIOC_PRIVATE + 42, int)
803
804#define ATOMISP_IOC_S_ARRAY_RESOLUTION \
805	_IOW('v', BASE_VIDIOC_PRIVATE + 45, struct atomisp_resolution)
806
807/* for depth mode sensor frame sync compensation */
808#define ATOMISP_IOC_G_DEPTH_SYNC_COMP \
809	_IOR('v', BASE_VIDIOC_PRIVATE + 46, unsigned int)
810
811#define ATOMISP_IOC_S_SENSOR_EE_CONFIG \
812	_IOW('v', BASE_VIDIOC_PRIVATE + 47, unsigned int)
813
814/*
815 * Reserved ioctls. We have customer implementing it internally.
816 * We can't use both numbers to not cause ABI conflict.
817 * Anyway, those ioctls are hacks and not implemented by us:
818 *
819 * #define ATOMISP_IOC_G_SENSOR_REG \
820 *	_IOW('v', BASE_VIDIOC_PRIVATE + 55, struct atomisp_sensor_regs)
821 * #define ATOMISP_IOC_S_SENSOR_REG \
822 *	_IOW('v', BASE_VIDIOC_PRIVATE + 56, struct atomisp_sensor_regs)
823 */
824
825/*  ISP Private control IDs */
826#define V4L2_CID_ATOMISP_BAD_PIXEL_DETECTION \
827	(V4L2_CID_PRIVATE_BASE + 0)
828#define V4L2_CID_ATOMISP_POSTPROCESS_GDC_CAC \
829	(V4L2_CID_PRIVATE_BASE + 1)
830#define V4L2_CID_ATOMISP_VIDEO_STABLIZATION \
831	(V4L2_CID_PRIVATE_BASE + 2)
832#define V4L2_CID_ATOMISP_FIXED_PATTERN_NR \
833	(V4L2_CID_PRIVATE_BASE + 3)
834#define V4L2_CID_ATOMISP_FALSE_COLOR_CORRECTION \
835	(V4L2_CID_PRIVATE_BASE + 4)
836#define V4L2_CID_ATOMISP_LOW_LIGHT \
837	(V4L2_CID_PRIVATE_BASE + 5)
838
839/* Camera class:
840 * Exposure, Flash and privacy (indicator) light controls, to be upstreamed */
841#define V4L2_CID_CAMERA_LASTP1             (V4L2_CID_CAMERA_CLASS_BASE + 1024)
842
843#define V4L2_CID_RUN_MODE			(V4L2_CID_CAMERA_LASTP1 + 20)
844#define ATOMISP_RUN_MODE_VIDEO			1
845#define ATOMISP_RUN_MODE_STILL_CAPTURE		2
846#define ATOMISP_RUN_MODE_PREVIEW		3
847#define ATOMISP_RUN_MODE_MIN			1
848#define ATOMISP_RUN_MODE_MAX			3
849
850#define V4L2_CID_ENABLE_VFPP			(V4L2_CID_CAMERA_LASTP1 + 21)
851#define V4L2_CID_ATOMISP_CONTINUOUS_MODE	(V4L2_CID_CAMERA_LASTP1 + 22)
852#define V4L2_CID_ATOMISP_CONTINUOUS_RAW_BUFFER_SIZE \
853						(V4L2_CID_CAMERA_LASTP1 + 23)
854#define V4L2_CID_ATOMISP_CONTINUOUS_VIEWFINDER \
855						(V4L2_CID_CAMERA_LASTP1 + 24)
856
857#define V4L2_CID_VFPP				(V4L2_CID_CAMERA_LASTP1 + 25)
858#define ATOMISP_VFPP_ENABLE			0
859#define ATOMISP_VFPP_DISABLE_SCALER		1
860#define ATOMISP_VFPP_DISABLE_LOWLAT		2
861
862#define V4L2_CID_START_ZSL_CAPTURE	(V4L2_CID_CAMERA_LASTP1 + 28)
863/* Lock and unlock raw buffer */
864#define V4L2_CID_ENABLE_RAW_BUFFER_LOCK (V4L2_CID_CAMERA_LASTP1 + 29)
865
866#define V4L2_CID_EXPOSURE_ZONE_NUM	(V4L2_CID_CAMERA_LASTP1 + 31)
867/* Disable digital zoom */
868#define V4L2_CID_DISABLE_DZ		(V4L2_CID_CAMERA_LASTP1 + 32)
869
870#define V4L2_CID_ATOMISP_SELECT_ISP_VERSION	(V4L2_CID_CAMERA_LASTP1 + 38)
871
872#define V4L2_BUF_FLAG_BUFFER_INVALID       0x0400
873#define V4L2_BUF_FLAG_BUFFER_VALID         0x0800
874
875#define V4L2_BUF_TYPE_VIDEO_CAPTURE_ION  (V4L2_BUF_TYPE_PRIVATE + 1024)
876
877#define V4L2_EVENT_ATOMISP_3A_STATS_READY   (V4L2_EVENT_PRIVATE_START + 1)
878#define V4L2_EVENT_ATOMISP_METADATA_READY   (V4L2_EVENT_PRIVATE_START + 2)
879#define V4L2_EVENT_ATOMISP_ACC_COMPLETE     (V4L2_EVENT_PRIVATE_START + 4)
880#define V4L2_EVENT_ATOMISP_PAUSE_BUFFER	    (V4L2_EVENT_PRIVATE_START + 5)
881#define V4L2_EVENT_ATOMISP_CSS_RESET	    (V4L2_EVENT_PRIVATE_START + 6)
882/* Nonstandard color effects for V4L2_CID_COLORFX */
883enum {
884	V4L2_COLORFX_SKIN_WHITEN_LOW = 1001,
885	V4L2_COLORFX_SKIN_WHITEN_HIGH = 1002,
886	V4L2_COLORFX_WARM = 1003,
887	V4L2_COLORFX_COLD = 1004,
888	V4L2_COLORFX_WASHED = 1005,
889	V4L2_COLORFX_RED = 1006,
890	V4L2_COLORFX_GREEN = 1007,
891	V4L2_COLORFX_BLUE = 1008,
892	V4L2_COLORFX_PINK = 1009,
893	V4L2_COLORFX_YELLOW = 1010,
894	V4L2_COLORFX_PURPLE = 1011,
895};
896
897#endif /* _ATOM_ISP_H */
~/ Read-only file preview.