Linux-libre 4.14.68-gnu
[librecmc/linux-libre.git] / drivers / staging / media / atomisp / pci / atomisp2 / atomisp_compat_ioctl32.h
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  *
4  * Copyright (c) 2013 Intel Corporation. All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License version
8  * 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA.
19  *
20  */
21 #ifndef __ATOMISP_COMPAT_IOCTL32_H__
22 #define __ATOMISP_COMPAT_IOCTL32_H__
23
24 #include <linux/compat.h>
25 #include <linux/videodev2.h>
26
27 #include "atomisp_compat.h"
28
29 struct atomisp_histogram32 {
30         unsigned int num_elements;
31         compat_uptr_t data;
32 };
33
34 struct atomisp_dvs2_stat_types32 {
35         compat_uptr_t odd_real; /**< real part of the odd statistics*/
36         compat_uptr_t odd_imag; /**< imaginary part of the odd statistics*/
37         compat_uptr_t even_real;/**< real part of the even statistics*/
38         compat_uptr_t even_imag;/**< imaginary part of the even statistics*/
39 };
40
41 struct atomisp_dvs2_coef_types32 {
42         compat_uptr_t odd_real; /**< real part of the odd coefficients*/
43         compat_uptr_t odd_imag; /**< imaginary part of the odd coefficients*/
44         compat_uptr_t even_real;/**< real part of the even coefficients*/
45         compat_uptr_t even_imag;/**< imaginary part of the even coefficients*/
46 };
47
48 struct atomisp_dvs2_statistics32 {
49         struct atomisp_dvs_grid_info grid_info;
50         struct atomisp_dvs2_stat_types32 hor_prod;
51         struct atomisp_dvs2_stat_types32 ver_prod;
52 };
53
54 struct atomisp_dis_statistics32 {
55         struct atomisp_dvs2_statistics32 dvs2_stat;
56         uint32_t exp_id;
57 };
58
59 struct atomisp_dis_coefficients32 {
60         struct atomisp_dvs_grid_info grid_info;
61         struct atomisp_dvs2_coef_types32 hor_coefs;
62         struct atomisp_dvs2_coef_types32 ver_coefs;
63 };
64
65 struct atomisp_3a_statistics32 {
66         struct atomisp_grid_info  grid_info;
67         compat_uptr_t data;
68         compat_uptr_t rgby_data;
69         uint32_t exp_id;
70         uint32_t isp_config_id;
71 };
72
73 struct atomisp_metadata_with_type32 {
74         /* to specify which type of metadata to get */
75         enum atomisp_metadata_type type;
76         compat_uptr_t data;
77         uint32_t width;
78         uint32_t height;
79         uint32_t stride; /* in bytes */
80         uint32_t exp_id; /* exposure ID */
81         compat_uptr_t effective_width;
82 };
83
84 struct atomisp_metadata32 {
85         compat_uptr_t data;
86         uint32_t width;
87         uint32_t height;
88         uint32_t stride;
89         uint32_t exp_id;
90         compat_uptr_t effective_width;
91 };
92
93 struct atomisp_morph_table32 {
94         unsigned int enabled;
95         unsigned int height;
96         unsigned int width;     /* number of valid elements per line */
97         compat_uptr_t coordinates_x[ATOMISP_MORPH_TABLE_NUM_PLANES];
98         compat_uptr_t coordinates_y[ATOMISP_MORPH_TABLE_NUM_PLANES];
99 };
100
101 struct v4l2_framebuffer32 {
102         __u32                   capability;
103         __u32                   flags;
104         compat_uptr_t           base;
105         struct v4l2_pix_format  fmt;
106 };
107
108 struct atomisp_overlay32 {
109         /* the frame containing the overlay data The overlay frame width should
110          * be the multiples of 2*ISP_VEC_NELEMS. The overlay frame height
111          * should be the multiples of 2.
112          */
113         compat_uptr_t frame;
114         /* Y value of overlay background */
115         unsigned char bg_y;
116         /* U value of overlay background */
117         char bg_u;
118         /* V value of overlay background */
119         char bg_v;
120         /* the blending percent of input data for Y subpixels */
121         unsigned char blend_input_perc_y;
122         /* the blending percent of input data for U subpixels */
123         unsigned char blend_input_perc_u;
124         /* the blending percent of input data for V subpixels */
125         unsigned char blend_input_perc_v;
126         /* the blending percent of overlay data for Y subpixels */
127         unsigned char blend_overlay_perc_y;
128         /* the blending percent of overlay data for U subpixels */
129         unsigned char blend_overlay_perc_u;
130         /* the blending percent of overlay data for V subpixels */
131         unsigned char blend_overlay_perc_v;
132         /* the overlay start x pixel position on output frame It should be the
133            multiples of 2*ISP_VEC_NELEMS. */
134         unsigned int overlay_start_x;
135         /* the overlay start y pixel position on output frame It should be the
136            multiples of 2. */
137         unsigned int overlay_start_y;
138 };
139
140 struct atomisp_calibration_group32 {
141         unsigned int size;
142         unsigned int type;
143         compat_uptr_t calb_grp_values;
144 };
145
146 struct atomisp_acc_fw_load32 {
147         unsigned int size;
148         unsigned int fw_handle;
149         compat_uptr_t data;
150 };
151
152 struct atomisp_acc_fw_arg32 {
153         unsigned int fw_handle;
154         unsigned int index;
155         compat_uptr_t value;
156         compat_size_t size;
157 };
158
159 struct v4l2_private_int_data32 {
160         __u32 size;
161         compat_uptr_t data;
162         __u32 reserved[2];
163 };
164
165 struct atomisp_shading_table32 {
166         __u32 enable;
167         __u32 sensor_width;
168         __u32 sensor_height;
169         __u32 width;
170         __u32 height;
171         __u32 fraction_bits;
172
173         compat_uptr_t data[ATOMISP_NUM_SC_COLORS];
174 };
175
176 struct atomisp_acc_map32 {
177         __u32 flags;                    /* Flags, see list below */
178         __u32 length;                   /* Length of data in bytes */
179         compat_uptr_t user_ptr;         /* Pointer into user space */
180         compat_ulong_t css_ptr;         /* Pointer into CSS address space */
181         __u32 reserved[4];              /* Set to zero */
182 };
183
184 struct atomisp_acc_s_mapped_arg32 {
185         unsigned int fw_handle;
186         __u32 memory;                   /* one of enum atomisp_acc_memory */
187         compat_size_t length;
188         compat_ulong_t css_ptr;
189 };
190
191 struct atomisp_parameters32 {
192         compat_uptr_t wb_config;  /* White Balance config */
193         compat_uptr_t cc_config;  /* Color Correction config */
194         compat_uptr_t tnr_config; /* Temporal Noise Reduction */
195         compat_uptr_t ecd_config; /* Eigen Color Demosaicing */
196         compat_uptr_t ynr_config; /* Y(Luma) Noise Reduction */
197         compat_uptr_t fc_config;  /* Fringe Control */
198         compat_uptr_t formats_config;  /* Formats Control */
199         compat_uptr_t cnr_config; /* Chroma Noise Reduction */
200         compat_uptr_t macc_config;  /* MACC */
201         compat_uptr_t ctc_config; /* Chroma Tone Control */
202         compat_uptr_t aa_config;  /* Anti-Aliasing */
203         compat_uptr_t baa_config;  /* Anti-Aliasing */
204         compat_uptr_t ce_config;
205         compat_uptr_t dvs_6axis_config;
206         compat_uptr_t ob_config;  /* Objective Black config */
207         compat_uptr_t dp_config;  /* Dead Pixel config */
208         compat_uptr_t nr_config;  /* Noise Reduction config */
209         compat_uptr_t ee_config;  /* Edge Enhancement config */
210         compat_uptr_t de_config;  /* Demosaic config */
211         compat_uptr_t gc_config;  /* Gamma Correction config */
212         compat_uptr_t anr_config; /* Advanced Noise Reduction */
213         compat_uptr_t a3a_config; /* 3A Statistics config */
214         compat_uptr_t xnr_config; /* eXtra Noise Reduction */
215         compat_uptr_t dz_config;  /* Digital Zoom */
216         compat_uptr_t yuv2rgb_cc_config; /* Color
217                                                         Correction config */
218         compat_uptr_t rgb2yuv_cc_config; /* Color
219                                                         Correction config */
220         compat_uptr_t macc_table;
221         compat_uptr_t gamma_table;
222         compat_uptr_t ctc_table;
223         compat_uptr_t xnr_table;
224         compat_uptr_t r_gamma_table;
225         compat_uptr_t g_gamma_table;
226         compat_uptr_t b_gamma_table;
227         compat_uptr_t motion_vector; /* For 2-axis DVS */
228         compat_uptr_t shading_table;
229         compat_uptr_t morph_table;
230         compat_uptr_t dvs_coefs; /* DVS 1.0 coefficients */
231         compat_uptr_t dvs2_coefs; /* DVS 2.0 coefficients */
232         compat_uptr_t capture_config;
233         compat_uptr_t anr_thres;
234
235         compat_uptr_t   lin_2500_config;       /* Skylake: Linearization config */
236         compat_uptr_t   obgrid_2500_config;    /* Skylake: OBGRID config */
237         compat_uptr_t   bnr_2500_config;       /* Skylake: bayer denoise config */
238         compat_uptr_t   shd_2500_config;       /* Skylake: shading config */
239         compat_uptr_t   dm_2500_config;        /* Skylake: demosaic config */
240         compat_uptr_t   rgbpp_2500_config;     /* Skylake: RGBPP config */
241         compat_uptr_t   dvs_stat_2500_config;  /* Skylake: DVS STAT config */
242         compat_uptr_t   lace_stat_2500_config; /* Skylake: LACE STAT config */
243         compat_uptr_t   yuvp1_2500_config;     /* Skylake: yuvp1 config */
244         compat_uptr_t   yuvp2_2500_config;     /* Skylake: yuvp2 config */
245         compat_uptr_t   tnr_2500_config;       /* Skylake: TNR config */
246         compat_uptr_t   dpc_2500_config;       /* Skylake: DPC config */
247         compat_uptr_t   awb_2500_config;       /* Skylake: auto white balance config */
248         compat_uptr_t   awb_fr_2500_config;    /* Skylake: auto white balance filter response config */
249         compat_uptr_t   anr_2500_config;       /* Skylake: ANR config */
250         compat_uptr_t   af_2500_config;        /* Skylake: auto focus config */
251         compat_uptr_t   ae_2500_config;        /* Skylake: auto exposure config */
252         compat_uptr_t   bds_2500_config;       /* Skylake: bayer downscaler config */
253         compat_uptr_t   dvs_2500_config;       /* Skylake: digital video stabilization config */
254         compat_uptr_t   res_mgr_2500_config;
255
256         /*
257          * Output frame pointer the config is to be applied to (optional),
258          * set to NULL to make this config is applied as global.
259          */
260         compat_uptr_t   output_frame;
261         /*
262          * Unique ID to track which config was actually applied to a particular
263          * frame, driver will send this id back with output frame together.
264          */
265         uint32_t        isp_config_id;
266         uint32_t        per_frame_setting;
267 };
268
269 struct atomisp_acc_fw_load_to_pipe32 {
270         __u32 flags;                    /* Flags, see below for valid values */
271         unsigned int fw_handle;         /* Handle, filled by kernel. */
272         __u32 size;                     /* Firmware binary size */
273         compat_uptr_t data;             /* Pointer to firmware */
274         __u32 type;                     /* Binary type */
275         __u32 reserved[3];              /* Set to zero */
276 };
277
278 struct atomisp_dvs_6axis_config32 {
279         uint32_t exp_id;
280         uint32_t width_y;
281         uint32_t height_y;
282         uint32_t width_uv;
283         uint32_t height_uv;
284         compat_uptr_t xcoords_y;
285         compat_uptr_t ycoords_y;
286         compat_uptr_t xcoords_uv;
287         compat_uptr_t ycoords_uv;
288 };
289
290 struct atomisp_sensor_ae_bracketing_lut32 {
291         compat_uptr_t lut;
292         unsigned int lut_size;
293 };
294
295 #define ATOMISP_IOC_G_HISTOGRAM32 \
296         _IOWR('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_histogram32)
297 #define ATOMISP_IOC_S_HISTOGRAM32 \
298         _IOW('v', BASE_VIDIOC_PRIVATE + 3, struct atomisp_histogram32)
299
300 #define ATOMISP_IOC_G_DIS_STAT32 \
301         _IOWR('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_statistics32)
302 #define ATOMISP_IOC_S_DIS_COEFS32 \
303         _IOW('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dis_coefficients32)
304
305 #define ATOMISP_IOC_S_DIS_VECTOR32 \
306         _IOW('v', BASE_VIDIOC_PRIVATE + 6, struct atomisp_dvs_6axis_config32)
307
308 #define ATOMISP_IOC_G_3A_STAT32 \
309         _IOWR('v', BASE_VIDIOC_PRIVATE + 7, struct atomisp_3a_statistics32)
310
311 #define ATOMISP_IOC_G_ISP_GDC_TAB32 \
312         _IOR('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_morph_table32)
313 #define ATOMISP_IOC_S_ISP_GDC_TAB32 \
314         _IOW('v', BASE_VIDIOC_PRIVATE + 10, struct atomisp_morph_table32)
315
316 #define ATOMISP_IOC_S_ISP_FPN_TABLE32 \
317         _IOW('v', BASE_VIDIOC_PRIVATE + 17, struct v4l2_framebuffer32)
318
319 #define ATOMISP_IOC_G_ISP_OVERLAY32 \
320         _IOWR('v', BASE_VIDIOC_PRIVATE + 18, struct atomisp_overlay32)
321 #define ATOMISP_IOC_S_ISP_OVERLAY32 \
322         _IOW('v', BASE_VIDIOC_PRIVATE + 18, struct atomisp_overlay32)
323
324 #define ATOMISP_IOC_G_SENSOR_CALIBRATION_GROUP32 \
325         _IOWR('v', BASE_VIDIOC_PRIVATE + 22, struct atomisp_calibration_group32)
326
327 #define ATOMISP_IOC_ACC_LOAD32 \
328         _IOWR('v', BASE_VIDIOC_PRIVATE + 24, struct atomisp_acc_fw_load32)
329
330 #define ATOMISP_IOC_ACC_S_ARG32 \
331         _IOW('v', BASE_VIDIOC_PRIVATE + 24, struct atomisp_acc_fw_arg32)
332
333 #define ATOMISP_IOC_ACC_DESTAB32 \
334         _IOW('v', BASE_VIDIOC_PRIVATE + 25, struct atomisp_acc_fw_arg32)
335
336 #define ATOMISP_IOC_G_SENSOR_PRIV_INT_DATA32 \
337         _IOWR('v', BASE_VIDIOC_PRIVATE + 26, struct v4l2_private_int_data32)
338
339 #define ATOMISP_IOC_S_ISP_SHD_TAB32 \
340         _IOWR('v', BASE_VIDIOC_PRIVATE + 27, struct atomisp_shading_table32)
341
342 #define ATOMISP_IOC_G_MOTOR_PRIV_INT_DATA32 \
343         _IOWR('v', BASE_VIDIOC_PRIVATE + 29, struct v4l2_private_int_data32)
344
345 #define ATOMISP_IOC_ACC_MAP32 \
346         _IOWR('v', BASE_VIDIOC_PRIVATE + 30, struct atomisp_acc_map32)
347
348 #define ATOMISP_IOC_ACC_UNMAP32 \
349         _IOW('v', BASE_VIDIOC_PRIVATE + 30, struct atomisp_acc_map32)
350
351 #define ATOMISP_IOC_ACC_S_MAPPED_ARG32 \
352         _IOW('v', BASE_VIDIOC_PRIVATE + 30, struct atomisp_acc_s_mapped_arg32)
353
354 #define ATOMISP_IOC_ACC_LOAD_TO_PIPE32 \
355         _IOWR('v', BASE_VIDIOC_PRIVATE + 31, struct atomisp_acc_fw_load_to_pipe32)
356
357 #define ATOMISP_IOC_S_PARAMETERS32 \
358         _IOW('v', BASE_VIDIOC_PRIVATE + 32, struct atomisp_parameters32)
359
360 #define ATOMISP_IOC_G_METADATA32 \
361         _IOWR('v', BASE_VIDIOC_PRIVATE + 34, struct atomisp_metadata32)
362
363 #define ATOMISP_IOC_G_METADATA_BY_TYPE32 \
364         _IOWR('v', BASE_VIDIOC_PRIVATE + 34, struct atomisp_metadata_with_type32)
365
366 #define ATOMISP_IOC_S_SENSOR_AE_BRACKETING_LUT32 \
367         _IOW('v', BASE_VIDIOC_PRIVATE + 43, struct atomisp_sensor_ae_bracketing_lut32)
368
369 #endif /* __ATOMISP_COMPAT_IOCTL32_H__ */