1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21#ifndef __ATOMISP_CMD_H__
22#define __ATOMISP_CMD_H__
23
24#include "../../include/linux/atomisp.h"
25#include <linux/interrupt.h>
26#include <linux/videodev2.h>
27
28#include <media/v4l2-subdev.h>
29
30#include "atomisp_internal.h"
31
32#include "ia_css_types.h"
33#include "ia_css.h"
34
35struct atomisp_device;
36struct ia_css_frame;
37
38#define MSI_ENABLE_BIT 16
39#define INTR_DISABLE_BIT 10
40#define BUS_MASTER_ENABLE 2
41#define MEMORY_SPACE_ENABLE 1
42#define INTR_IER 24
43#define INTR_IIR 16
44
45
46#define RUNMODE_MASK (ATOMISP_RUN_MODE_VIDEO | ATOMISP_RUN_MODE_STILL_CAPTURE \
47 | ATOMISP_RUN_MODE_PREVIEW)
48
49
50extern int atomisp_punit_hpll_freq;
51
52
53void dump_sp_dmem(struct atomisp_device *isp, unsigned int addr,
54 unsigned int size);
55struct camera_mipi_info *atomisp_to_sensor_mipi_info(struct v4l2_subdev *sd);
56struct atomisp_video_pipe *atomisp_to_video_pipe(struct video_device *dev);
57struct atomisp_acc_pipe *atomisp_to_acc_pipe(struct video_device *dev);
58int atomisp_reset(struct atomisp_device *isp);
59void atomisp_flush_bufs_and_wakeup(struct atomisp_sub_device *asd);
60void atomisp_clear_css_buffer_counters(struct atomisp_sub_device *asd);
61
62bool atomisp_buffers_queued(struct atomisp_sub_device *asd);
63
64bool atomisp_buffers_queued_pipe(struct atomisp_video_pipe *pipe);
65
66
67void atomisp_msi_irq_init(struct atomisp_device *isp);
68void atomisp_msi_irq_uninit(struct atomisp_device *isp);
69void atomisp_wdt_work(struct work_struct *work);
70void atomisp_wdt(struct timer_list *t);
71void atomisp_setup_flash(struct atomisp_sub_device *asd);
72irqreturn_t atomisp_isr(int irq, void *dev);
73irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr);
74const struct atomisp_format_bridge *get_atomisp_format_bridge_from_mbus(
75 u32 mbus_code);
76bool atomisp_is_mbuscode_raw(uint32_t code);
77int atomisp_get_frame_pgnr(struct atomisp_device *isp,
78 const struct ia_css_frame *frame, u32 *p_pgnr);
79void atomisp_delayed_init_work(struct work_struct *work);
80
81
82bool atomisp_is_viewfinder_support(struct atomisp_device *isp);
83
84
85
86
87
88
89
90int atomisp_set_sensor_runmode(struct atomisp_sub_device *asd,
91 struct atomisp_s_runmode *runmode);
92
93
94
95
96int atomisp_gdc_cac(struct atomisp_sub_device *asd, int flag,
97 __s32 *value);
98
99
100int atomisp_low_light(struct atomisp_sub_device *asd, int flag,
101 __s32 *value);
102
103
104
105
106
107int atomisp_xnr(struct atomisp_sub_device *asd, int flag, int *arg);
108
109int atomisp_formats(struct atomisp_sub_device *asd, int flag,
110 struct atomisp_formats_config *config);
111
112
113int atomisp_nr(struct atomisp_sub_device *asd, int flag,
114 struct atomisp_nr_config *config);
115
116
117int atomisp_tnr(struct atomisp_sub_device *asd, int flag,
118 struct atomisp_tnr_config *config);
119
120
121int atomisp_black_level(struct atomisp_sub_device *asd, int flag,
122 struct atomisp_ob_config *config);
123
124
125int atomisp_ee(struct atomisp_sub_device *asd, int flag,
126 struct atomisp_ee_config *config);
127
128
129int atomisp_gamma(struct atomisp_sub_device *asd, int flag,
130 struct atomisp_gamma_table *config);
131
132
133int atomisp_ctc(struct atomisp_sub_device *asd, int flag,
134 struct atomisp_ctc_table *config);
135
136
137int atomisp_gamma_correction(struct atomisp_sub_device *asd, int flag,
138 struct atomisp_gc_config *config);
139
140
141int atomisp_gdc_cac_table(struct atomisp_sub_device *asd, int flag,
142 struct atomisp_morph_table *config);
143
144
145int atomisp_macc_table(struct atomisp_sub_device *asd, int flag,
146 struct atomisp_macc_config *config);
147
148
149int atomisp_get_dis_stat(struct atomisp_sub_device *asd,
150 struct atomisp_dis_statistics *stats);
151
152
153int atomisp_get_dvs2_bq_resolutions(struct atomisp_sub_device *asd,
154 struct atomisp_dvs2_bq_resolutions *bq_res);
155
156
157int atomisp_set_dis_coefs(struct atomisp_sub_device *asd,
158 struct atomisp_dis_coefficients *coefs);
159
160
161int atomisp_set_dis_vector(struct atomisp_sub_device *asd,
162 struct atomisp_dis_vector *vector);
163
164
165int atomisp_3a_stat(struct atomisp_sub_device *asd, int flag,
166 struct atomisp_3a_statistics *config);
167
168
169int atomisp_get_metadata(struct atomisp_sub_device *asd, int flag,
170 struct atomisp_metadata *config);
171
172int atomisp_get_metadata_by_type(struct atomisp_sub_device *asd, int flag,
173 struct atomisp_metadata_with_type *config);
174
175int atomisp_set_parameters(struct video_device *vdev,
176 struct atomisp_parameters *arg);
177
178
179int atomisp_param(struct atomisp_sub_device *asd, int flag,
180 struct atomisp_parm *config);
181
182
183int atomisp_color_effect(struct atomisp_sub_device *asd, int flag,
184 __s32 *effect);
185
186
187int atomisp_bad_pixel(struct atomisp_sub_device *asd, int flag,
188 __s32 *value);
189
190
191int atomisp_bad_pixel_param(struct atomisp_sub_device *asd, int flag,
192 struct atomisp_dp_config *config);
193
194
195int atomisp_video_stable(struct atomisp_sub_device *asd, int flag,
196 __s32 *value);
197
198
199int atomisp_fixed_pattern(struct atomisp_sub_device *asd, int flag,
200 __s32 *value);
201
202
203int atomisp_fixed_pattern_table(struct atomisp_sub_device *asd,
204 struct v4l2_framebuffer *config);
205
206
207int atomisp_false_color(struct atomisp_sub_device *asd, int flag,
208 __s32 *value);
209
210
211int atomisp_false_color_param(struct atomisp_sub_device *asd, int flag,
212 struct atomisp_de_config *config);
213
214
215int atomisp_white_balance_param(struct atomisp_sub_device *asd, int flag,
216 struct atomisp_wb_config *config);
217
218int atomisp_3a_config_param(struct atomisp_sub_device *asd, int flag,
219 struct atomisp_3a_config *config);
220
221
222int atomisp_digital_zoom(struct atomisp_sub_device *asd, int flag,
223 __s32 *value);
224
225
226int atomisp_set_array_res(struct atomisp_sub_device *asd,
227 struct atomisp_resolution *config);
228
229
230int atomisp_calculate_real_zoom_region(struct atomisp_sub_device *asd,
231 struct ia_css_dz_config *dz_config,
232 enum ia_css_pipe_id css_pipe_id);
233
234int atomisp_cp_general_isp_parameters(struct atomisp_sub_device *asd,
235 struct atomisp_parameters *arg,
236 struct atomisp_css_params *css_param,
237 bool from_user);
238
239int atomisp_cp_lsc_table(struct atomisp_sub_device *asd,
240 struct atomisp_shading_table *source_st,
241 struct atomisp_css_params *css_param,
242 bool from_user);
243
244int atomisp_css_cp_dvs2_coefs(struct atomisp_sub_device *asd,
245 struct ia_css_dvs2_coefficients *coefs,
246 struct atomisp_css_params *css_param,
247 bool from_user);
248
249int atomisp_cp_morph_table(struct atomisp_sub_device *asd,
250 struct atomisp_morph_table *source_morph_table,
251 struct atomisp_css_params *css_param,
252 bool from_user);
253
254int atomisp_cp_dvs_6axis_config(struct atomisp_sub_device *asd,
255 struct atomisp_dvs_6axis_config *user_6axis_config,
256 struct atomisp_css_params *css_param,
257 bool from_user);
258
259int atomisp_makeup_css_parameters(struct atomisp_sub_device *asd,
260 struct atomisp_parameters *arg,
261 struct atomisp_css_params *css_param);
262
263int atomisp_compare_grid(struct atomisp_sub_device *asd,
264 struct atomisp_grid_info *atomgrid);
265
266int atomisp_get_sensor_mode_data(struct atomisp_sub_device *asd,
267 struct atomisp_sensor_mode_data *config);
268
269int atomisp_get_fmt(struct video_device *vdev, struct v4l2_format *f);
270
271
272int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
273 bool *res_overflow);
274
275int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f);
276int atomisp_set_fmt_file(struct video_device *vdev, struct v4l2_format *f);
277
278int atomisp_set_shading_table(struct atomisp_sub_device *asd,
279 struct atomisp_shading_table *shading_table);
280
281int atomisp_offline_capture_configure(struct atomisp_sub_device *asd,
282 struct atomisp_cont_capture_conf *cvf_config);
283
284int atomisp_ospm_dphy_down(struct atomisp_device *isp);
285int atomisp_ospm_dphy_up(struct atomisp_device *isp);
286int atomisp_exif_makernote(struct atomisp_sub_device *asd,
287 struct atomisp_makernote_info *config);
288
289void atomisp_free_internal_buffers(struct atomisp_sub_device *asd);
290
291int atomisp_s_ae_window(struct atomisp_sub_device *asd,
292 struct atomisp_ae_window *arg);
293
294int atomisp_flash_enable(struct atomisp_sub_device *asd,
295 int num_frames);
296
297int atomisp_freq_scaling(struct atomisp_device *vdev,
298 enum atomisp_dfs_mode mode,
299 bool force);
300
301void atomisp_buf_done(struct atomisp_sub_device *asd, int error,
302 enum ia_css_buffer_type buf_type,
303 enum ia_css_pipe_id css_pipe_id,
304 bool q_buffers, enum atomisp_input_stream_id stream_id);
305
306void atomisp_css_flush(struct atomisp_device *isp);
307int atomisp_source_pad_to_stream_id(struct atomisp_sub_device *asd,
308 uint16_t source_pad);
309
310
311void atomisp_eof_event(struct atomisp_sub_device *asd, uint8_t exp_id);
312
313enum mipi_port_id __get_mipi_port(struct atomisp_device *isp,
314 enum atomisp_camera_port port);
315
316bool atomisp_is_vf_pipe(struct atomisp_video_pipe *pipe);
317
318void atomisp_apply_css_parameters(
319 struct atomisp_sub_device *asd,
320 struct atomisp_css_params *css_param);
321void atomisp_free_css_parameters(struct atomisp_css_params *css_param);
322
323void atomisp_handle_parameter_and_buffer(struct atomisp_video_pipe *pipe);
324
325void atomisp_flush_params_queue(struct atomisp_video_pipe *asd);
326
327
328int atomisp_exp_id_unlock(struct atomisp_sub_device *asd, int *exp_id);
329int atomisp_exp_id_capture(struct atomisp_sub_device *asd, int *exp_id);
330
331
332int atomisp_set_raw_buffer_bitmap(struct atomisp_sub_device *asd, int exp_id);
333void atomisp_init_raw_buffer_bitmap(struct atomisp_sub_device *asd);
334
335
336int atomisp_enable_dz_capt_pipe(struct atomisp_sub_device *asd,
337 unsigned int *enable);
338
339
340enum atomisp_metadata_type
341atomisp_get_metadata_type(struct atomisp_sub_device *asd,
342 enum ia_css_pipe_id pipe_id);
343
344
345int atomisp_inject_a_fake_event(struct atomisp_sub_device *asd, int *event);
346
347
348
349
350
351int atomisp_get_invalid_frame_num(struct video_device *vdev,
352 int *invalid_frame_num);
353
354int atomisp_mrfld_power_up(struct atomisp_device *isp);
355int atomisp_mrfld_power_down(struct atomisp_device *isp);
356int atomisp_runtime_suspend(struct device *dev);
357int atomisp_runtime_resume(struct device *dev);
358#endif
359