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