1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  *
5  * Copyright (c) 2013 Intel Corporation. All Rights Reserved.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License version
9  * 2 as published by the Free Software Foundation.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  *
17  */
18 #ifndef __ATOMISP_COMPAT_IOCTL32_H__
19 #define __ATOMISP_COMPAT_IOCTL32_H__
20 
21 #include <linux/compat.h>
22 #include <linux/videodev2.h>
23 
24 #include "atomisp_compat.h"
25 
26 struct atomisp_histogram32 {
27 	unsigned int num_elements;
28 	compat_uptr_t data;
29 };
30 
31 struct atomisp_dvs2_stat_types32 {
32 	compat_uptr_t odd_real; /** real part of the odd statistics*/
33 	compat_uptr_t odd_imag; /** imaginary part of the odd statistics*/
34 	compat_uptr_t even_real;/** real part of the even statistics*/
35 	compat_uptr_t even_imag;/** imaginary part of the even statistics*/
36 };
37 
38 struct atomisp_dvs2_coef_types32 {
39 	compat_uptr_t odd_real; /** real part of the odd coefficients*/
40 	compat_uptr_t odd_imag; /** imaginary part of the odd coefficients*/
41 	compat_uptr_t even_real;/** real part of the even coefficients*/
42 	compat_uptr_t even_imag;/** imaginary part of the even coefficients*/
43 };
44 
45 struct atomisp_dvs2_statistics32 {
46 	struct atomisp_dvs_grid_info grid_info;
47 	struct atomisp_dvs2_stat_types32 hor_prod;
48 	struct atomisp_dvs2_stat_types32 ver_prod;
49 };
50 
51 struct atomisp_dis_statistics32 {
52 	struct atomisp_dvs2_statistics32 dvs2_stat;
53 	u32 exp_id;
54 };
55 
56 struct atomisp_dis_coefficients32 {
57 	struct atomisp_dvs_grid_info grid_info;
58 	struct atomisp_dvs2_coef_types32 hor_coefs;
59 	struct atomisp_dvs2_coef_types32 ver_coefs;
60 };
61 
62 struct atomisp_3a_statistics32 {
63 	struct atomisp_grid_info  grid_info;
64 	compat_uptr_t data;
65 	compat_uptr_t rgby_data;
66 	u32 exp_id;
67 	u32 isp_config_id;
68 };
69 
70 struct atomisp_morph_table32 {
71 	unsigned int enabled;
72 	unsigned int height;
73 	unsigned int width;	/* number of valid elements per line */
74 	compat_uptr_t coordinates_x[ATOMISP_MORPH_TABLE_NUM_PLANES];
75 	compat_uptr_t coordinates_y[ATOMISP_MORPH_TABLE_NUM_PLANES];
76 };
77 
78 struct v4l2_framebuffer32 {
79 	__u32			capability;
80 	__u32			flags;
81 	compat_uptr_t		base;
82 	struct v4l2_pix_format	fmt;
83 };
84 
85 struct atomisp_overlay32 {
86 	/* the frame containing the overlay data The overlay frame width should
87 	 * be the multiples of 2*ISP_VEC_NELEMS. The overlay frame height
88 	 * should be the multiples of 2.
89 	 */
90 	compat_uptr_t frame;
91 	/* Y value of overlay background */
92 	unsigned char bg_y;
93 	/* U value of overlay background */
94 	char bg_u;
95 	/* V value of overlay background */
96 	char bg_v;
97 	/* the blending percent of input data for Y subpixels */
98 	unsigned char blend_input_perc_y;
99 	/* the blending percent of input data for U subpixels */
100 	unsigned char blend_input_perc_u;
101 	/* the blending percent of input data for V subpixels */
102 	unsigned char blend_input_perc_v;
103 	/* the blending percent of overlay data for Y subpixels */
104 	unsigned char blend_overlay_perc_y;
105 	/* the blending percent of overlay data for U subpixels */
106 	unsigned char blend_overlay_perc_u;
107 	/* the blending percent of overlay data for V subpixels */
108 	unsigned char blend_overlay_perc_v;
109 	/* the overlay start x pixel position on output frame It should be the
110 	   multiples of 2*ISP_VEC_NELEMS. */
111 	unsigned int overlay_start_x;
112 	/* the overlay start y pixel position on output frame It should be the
113 	   multiples of 2. */
114 	unsigned int overlay_start_y;
115 };
116 
117 struct atomisp_shading_table32 {
118 	__u32 enable;
119 	__u32 sensor_width;
120 	__u32 sensor_height;
121 	__u32 width;
122 	__u32 height;
123 	__u32 fraction_bits;
124 
125 	compat_uptr_t data[ATOMISP_NUM_SC_COLORS];
126 };
127 
128 struct atomisp_parameters32 {
129 	compat_uptr_t wb_config;  /* White Balance config */
130 	compat_uptr_t cc_config;  /* Color Correction config */
131 	compat_uptr_t tnr_config; /* Temporal Noise Reduction */
132 	compat_uptr_t ecd_config; /* Eigen Color Demosaicing */
133 	compat_uptr_t ynr_config; /* Y(Luma) Noise Reduction */
134 	compat_uptr_t fc_config;  /* Fringe Control */
135 	compat_uptr_t formats_config;  /* Formats Control */
136 	compat_uptr_t cnr_config; /* Chroma Noise Reduction */
137 	compat_uptr_t macc_config;  /* MACC */
138 	compat_uptr_t ctc_config; /* Chroma Tone Control */
139 	compat_uptr_t aa_config;  /* Anti-Aliasing */
140 	compat_uptr_t baa_config;  /* Anti-Aliasing */
141 	compat_uptr_t ce_config;
142 	compat_uptr_t dvs_6axis_config;
143 	compat_uptr_t ob_config;  /* Objective Black config */
144 	compat_uptr_t dp_config;  /* Dead Pixel config */
145 	compat_uptr_t nr_config;  /* Noise Reduction config */
146 	compat_uptr_t ee_config;  /* Edge Enhancement config */
147 	compat_uptr_t de_config;  /* Demosaic config */
148 	compat_uptr_t gc_config;  /* Gamma Correction config */
149 	compat_uptr_t anr_config; /* Advanced Noise Reduction */
150 	compat_uptr_t a3a_config; /* 3A Statistics config */
151 	compat_uptr_t xnr_config; /* eXtra Noise Reduction */
152 	compat_uptr_t dz_config;  /* Digital Zoom */
153 	compat_uptr_t yuv2rgb_cc_config; /* Color
154 							Correction config */
155 	compat_uptr_t rgb2yuv_cc_config; /* Color
156 							Correction config */
157 	compat_uptr_t macc_table;
158 	compat_uptr_t gamma_table;
159 	compat_uptr_t ctc_table;
160 	compat_uptr_t xnr_table;
161 	compat_uptr_t r_gamma_table;
162 	compat_uptr_t g_gamma_table;
163 	compat_uptr_t b_gamma_table;
164 	compat_uptr_t motion_vector; /* For 2-axis DVS */
165 	compat_uptr_t shading_table;
166 	compat_uptr_t morph_table;
167 	compat_uptr_t dvs_coefs; /* DVS 1.0 coefficients */
168 	compat_uptr_t dvs2_coefs; /* DVS 2.0 coefficients */
169 	compat_uptr_t capture_config;
170 	compat_uptr_t anr_thres;
171 
172 	compat_uptr_t	lin_2500_config;       /* Skylake: Linearization config */
173 	compat_uptr_t	obgrid_2500_config;    /* Skylake: OBGRID config */
174 	compat_uptr_t	bnr_2500_config;       /* Skylake: bayer denoise config */
175 	compat_uptr_t	shd_2500_config;       /* Skylake: shading config */
176 	compat_uptr_t	dm_2500_config;        /* Skylake: demosaic config */
177 	compat_uptr_t	rgbpp_2500_config;     /* Skylake: RGBPP config */
178 	compat_uptr_t	dvs_stat_2500_config;  /* Skylake: DVS STAT config */
179 	compat_uptr_t	lace_stat_2500_config; /* Skylake: LACE STAT config */
180 	compat_uptr_t	yuvp1_2500_config;     /* Skylake: yuvp1 config */
181 	compat_uptr_t	yuvp2_2500_config;     /* Skylake: yuvp2 config */
182 	compat_uptr_t	tnr_2500_config;       /* Skylake: TNR config */
183 	compat_uptr_t	dpc_2500_config;       /* Skylake: DPC config */
184 	compat_uptr_t	awb_2500_config;       /* Skylake: auto white balance config */
185 	compat_uptr_t
186 	awb_fr_2500_config;    /* Skylake: auto white balance filter response config */
187 	compat_uptr_t	anr_2500_config;       /* Skylake: ANR config */
188 	compat_uptr_t	af_2500_config;        /* Skylake: auto focus config */
189 	compat_uptr_t	ae_2500_config;        /* Skylake: auto exposure config */
190 	compat_uptr_t	bds_2500_config;       /* Skylake: bayer downscaler config */
191 	compat_uptr_t
192 	dvs_2500_config;       /* Skylake: digital video stabilization config */
193 	compat_uptr_t	res_mgr_2500_config;
194 
195 	/*
196 	 * Output frame pointer the config is to be applied to (optional),
197 	 * set to NULL to make this config is applied as global.
198 	 */
199 	compat_uptr_t	output_frame;
200 	/*
201 	 * Unique ID to track which config was actually applied to a particular
202 	 * frame, driver will send this id back with output frame together.
203 	 */
204 	u32	isp_config_id;
205 	u32	per_frame_setting;
206 };
207 
208 struct atomisp_dvs_6axis_config32 {
209 	u32 exp_id;
210 	u32 width_y;
211 	u32 height_y;
212 	u32 width_uv;
213 	u32 height_uv;
214 	compat_uptr_t xcoords_y;
215 	compat_uptr_t ycoords_y;
216 	compat_uptr_t xcoords_uv;
217 	compat_uptr_t ycoords_uv;
218 };
219 
220 #define ATOMISP_IOC_G_HISTOGRAM32 \
221 	_IOWR('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_histogram32)
222 #define ATOMISP_IOC_S_HISTOGRAM32 \
223 	_IOW('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_histogram32)
224 
225 #define ATOMISP_IOC_G_DIS_STAT32 \
226 	_IOWR('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_statistics32)
227 #define ATOMISP_IOC_S_DIS_COEFS32 \
228 	_IOW('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_coefficients32)
229 
230 #define ATOMISP_IOC_S_DIS_VECTOR32 \
231 	_IOW('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dvs_6axis_config32)
232 
233 #define ATOMISP_IOC_G_3A_STAT32 \
234 	_IOWR('v', BASE_VIDIOC_PRIVATE + 7, struct atomisp_3a_statistics32)
235 
236 #define ATOMISP_IOC_G_ISP_GDC_TAB32 \
237 	_IOR('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_morph_table32)
238 #define ATOMISP_IOC_S_ISP_GDC_TAB32 \
239 	_IOW('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_morph_table32)
240 
241 #define ATOMISP_IOC_S_ISP_FPN_TABLE32 \
242 	_IOW('v', BASE_VIDIOC_PRIVATE + 17, struct v4l2_framebuffer32)
243 
244 #define ATOMISP_IOC_G_ISP_OVERLAY32 \
245 	_IOWR('v', BASE_VIDIOC_PRIVATE + 18, struct atomisp_overlay32)
246 #define ATOMISP_IOC_S_ISP_OVERLAY32 \
247 	_IOW('v', BASE_VIDIOC_PRIVATE + 18, struct atomisp_overlay32)
248 
249 #define ATOMISP_IOC_S_ISP_SHD_TAB32 \
250 	_IOWR('v', BASE_VIDIOC_PRIVATE + 27, struct atomisp_shading_table32)
251 
252 #define ATOMISP_IOC_S_PARAMETERS32 \
253 	_IOW('v', BASE_VIDIOC_PRIVATE + 32, struct atomisp_parameters32)
254 
255 #endif /* __ATOMISP_COMPAT_IOCTL32_H__ */
256