1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#ifndef __ATOMISP_COMPAT_H__
20#define __ATOMISP_COMPAT_H__
21
22#include "atomisp_compat_css20.h"
23
24#include "../../include/linux/atomisp.h"
25#include <media/videobuf-vmalloc.h>
26
27struct atomisp_device;
28struct atomisp_sub_device;
29struct video_device;
30enum atomisp_input_stream_id;
31
32struct atomisp_metadata_buf {
33 struct ia_css_metadata *metadata;
34 void *md_vptr;
35 struct list_head list;
36};
37
38void atomisp_css2_hw_store_32(hrt_address addr, uint32_t data);
39void atomisp_load_uint32(hrt_address addr, uint32_t *data);
40
41int atomisp_css_init(struct atomisp_device *isp);
42
43void atomisp_css_uninit(struct atomisp_device *isp);
44
45void atomisp_css_suspend(struct atomisp_device *isp);
46
47int atomisp_css_resume(struct atomisp_device *isp);
48
49void atomisp_css_init_struct(struct atomisp_sub_device *asd);
50
51int atomisp_css_irq_translate(struct atomisp_device *isp,
52 unsigned int *infos);
53
54void atomisp_css_rx_get_irq_info(enum mipi_port_id port,
55 unsigned int *infos);
56
57void atomisp_css_rx_clear_irq_info(enum mipi_port_id port,
58 unsigned int infos);
59
60int atomisp_css_irq_enable(struct atomisp_device *isp,
61 enum ia_css_irq_info info, bool enable);
62
63int atomisp_q_video_buffer_to_css(struct atomisp_sub_device *asd,
64 struct videobuf_vmalloc_memory *vm_mem,
65 enum atomisp_input_stream_id stream_id,
66 enum ia_css_buffer_type css_buf_type,
67 enum ia_css_pipe_id css_pipe_id);
68
69int atomisp_q_s3a_buffer_to_css(struct atomisp_sub_device *asd,
70 struct atomisp_s3a_buf *s3a_buf,
71 enum atomisp_input_stream_id stream_id,
72 enum ia_css_pipe_id css_pipe_id);
73
74int atomisp_q_metadata_buffer_to_css(struct atomisp_sub_device *asd,
75 struct atomisp_metadata_buf *metadata_buf,
76 enum atomisp_input_stream_id stream_id,
77 enum ia_css_pipe_id css_pipe_id);
78
79int atomisp_q_dis_buffer_to_css(struct atomisp_sub_device *asd,
80 struct atomisp_dis_buf *dis_buf,
81 enum atomisp_input_stream_id stream_id,
82 enum ia_css_pipe_id css_pipe_id);
83
84void ia_css_mmu_invalidate_cache(void);
85
86int atomisp_css_start(struct atomisp_sub_device *asd,
87 enum ia_css_pipe_id pipe_id, bool in_reset);
88
89void atomisp_css_update_isp_params(struct atomisp_sub_device *asd);
90void atomisp_css_update_isp_params_on_pipe(struct atomisp_sub_device *asd,
91 struct ia_css_pipe *pipe);
92
93int atomisp_css_queue_buffer(struct atomisp_sub_device *asd,
94 enum atomisp_input_stream_id stream_id,
95 enum ia_css_pipe_id pipe_id,
96 enum ia_css_buffer_type buf_type,
97 struct atomisp_css_buffer *isp_css_buffer);
98
99int atomisp_css_dequeue_buffer(struct atomisp_sub_device *asd,
100 enum atomisp_input_stream_id stream_id,
101 enum ia_css_pipe_id pipe_id,
102 enum ia_css_buffer_type buf_type,
103 struct atomisp_css_buffer *isp_css_buffer);
104
105int atomisp_css_allocate_stat_buffers(struct atomisp_sub_device *asd,
106 u16 stream_id,
107 struct atomisp_s3a_buf *s3a_buf,
108 struct atomisp_dis_buf *dis_buf,
109 struct atomisp_metadata_buf *md_buf);
110
111void atomisp_css_free_stat_buffers(struct atomisp_sub_device *asd);
112
113void atomisp_css_free_3a_buffer(struct atomisp_s3a_buf *s3a_buf);
114
115void atomisp_css_free_dis_buffer(struct atomisp_dis_buf *dis_buf);
116
117void atomisp_css_free_metadata_buffer(struct atomisp_metadata_buf
118 *metadata_buf);
119
120int atomisp_css_get_grid_info(struct atomisp_sub_device *asd,
121 enum ia_css_pipe_id pipe_id,
122 int source_pad);
123
124int atomisp_alloc_3a_output_buf(struct atomisp_sub_device *asd);
125
126int atomisp_alloc_dis_coef_buf(struct atomisp_sub_device *asd);
127
128int atomisp_alloc_metadata_output_buf(struct atomisp_sub_device *asd);
129
130void atomisp_free_metadata_output_buf(struct atomisp_sub_device *asd);
131
132void atomisp_css_get_dis_statistics(struct atomisp_sub_device *asd,
133 struct atomisp_css_buffer *isp_css_buffer,
134 struct ia_css_isp_dvs_statistics_map *dvs_map);
135
136int atomisp_css_dequeue_event(struct atomisp_css_event *current_event);
137
138void atomisp_css_temp_pipe_to_pipe_id(struct atomisp_sub_device *asd,
139 struct atomisp_css_event *current_event);
140
141int atomisp_css_isys_set_resolution(struct atomisp_sub_device *asd,
142 enum atomisp_input_stream_id stream_id,
143 struct v4l2_mbus_framefmt *ffmt,
144 int isys_stream);
145
146void atomisp_css_isys_set_link(struct atomisp_sub_device *asd,
147 enum atomisp_input_stream_id stream_id,
148 int link,
149 int isys_stream);
150
151void atomisp_css_isys_set_valid(struct atomisp_sub_device *asd,
152 enum atomisp_input_stream_id stream_id,
153 bool valid,
154 int isys_stream);
155
156void atomisp_css_isys_set_format(struct atomisp_sub_device *asd,
157 enum atomisp_input_stream_id stream_id,
158 enum atomisp_input_format format,
159 int isys_stream);
160
161int atomisp_css_set_default_isys_config(struct atomisp_sub_device *asd,
162 enum atomisp_input_stream_id stream_id,
163 struct v4l2_mbus_framefmt *ffmt);
164
165int atomisp_css_isys_two_stream_cfg(struct atomisp_sub_device *asd,
166 enum atomisp_input_stream_id stream_id,
167 enum atomisp_input_format input_format);
168
169void atomisp_css_isys_two_stream_cfg_update_stream1(
170 struct atomisp_sub_device *asd,
171 enum atomisp_input_stream_id stream_id,
172 enum atomisp_input_format input_format,
173 unsigned int width, unsigned int height);
174
175void atomisp_css_isys_two_stream_cfg_update_stream2(
176 struct atomisp_sub_device *asd,
177 enum atomisp_input_stream_id stream_id,
178 enum atomisp_input_format input_format,
179 unsigned int width, unsigned int height);
180
181int atomisp_css_input_set_resolution(struct atomisp_sub_device *asd,
182 enum atomisp_input_stream_id stream_id,
183 struct v4l2_mbus_framefmt *ffmt);
184
185void atomisp_css_input_set_binning_factor(struct atomisp_sub_device *asd,
186 enum atomisp_input_stream_id stream_id,
187 unsigned int bin_factor);
188
189void atomisp_css_input_set_bayer_order(struct atomisp_sub_device *asd,
190 enum atomisp_input_stream_id stream_id,
191 enum ia_css_bayer_order bayer_order);
192
193void atomisp_css_input_set_format(struct atomisp_sub_device *asd,
194 enum atomisp_input_stream_id stream_id,
195 enum atomisp_input_format format);
196
197int atomisp_css_input_set_effective_resolution(
198 struct atomisp_sub_device *asd,
199 enum atomisp_input_stream_id stream_id,
200 unsigned int width,
201 unsigned int height);
202
203void atomisp_css_video_set_dis_envelope(struct atomisp_sub_device *asd,
204 unsigned int dvs_w, unsigned int dvs_h);
205
206void atomisp_css_input_set_two_pixels_per_clock(
207 struct atomisp_sub_device *asd,
208 bool two_ppc);
209
210void atomisp_css_enable_raw_binning(struct atomisp_sub_device *asd,
211 bool enable);
212
213void atomisp_css_enable_dz(struct atomisp_sub_device *asd, bool enable);
214
215void atomisp_css_capture_set_mode(struct atomisp_sub_device *asd,
216 enum ia_css_capture_mode mode);
217
218void atomisp_css_input_set_mode(struct atomisp_sub_device *asd,
219 enum ia_css_input_mode mode);
220
221void atomisp_css_capture_enable_online(struct atomisp_sub_device *asd,
222 unsigned short stream_index, bool enable);
223
224void atomisp_css_preview_enable_online(struct atomisp_sub_device *asd,
225 unsigned short stream_index, bool enable);
226
227void atomisp_css_video_enable_online(struct atomisp_sub_device *asd,
228 bool enable);
229
230void atomisp_css_enable_continuous(struct atomisp_sub_device *asd,
231 bool enable);
232
233void atomisp_css_enable_cvf(struct atomisp_sub_device *asd,
234 bool enable);
235
236int atomisp_css_input_configure_port(struct atomisp_sub_device *asd,
237 enum mipi_port_id port,
238 unsigned int num_lanes,
239 unsigned int timeout,
240 unsigned int mipi_freq,
241 enum atomisp_input_format metadata_format,
242 unsigned int metadata_width,
243 unsigned int metadata_height);
244
245void atomisp_create_pipes_stream(struct atomisp_sub_device *asd);
246void atomisp_destroy_pipes_stream_force(struct atomisp_sub_device *asd);
247
248void atomisp_css_stop(struct atomisp_sub_device *asd,
249 enum ia_css_pipe_id pipe_id, bool in_reset);
250
251void atomisp_css_continuous_set_num_raw_frames(
252 struct atomisp_sub_device *asd,
253 int num_frames);
254
255int atomisp_css_copy_configure_output(struct atomisp_sub_device *asd,
256 unsigned int stream_index,
257 unsigned int width, unsigned int height,
258 unsigned int padded_width,
259 enum ia_css_frame_format format);
260
261int atomisp_css_yuvpp_configure_output(struct atomisp_sub_device *asd,
262 unsigned int stream_index,
263 unsigned int width, unsigned int height,
264 unsigned int padded_width,
265 enum ia_css_frame_format format);
266
267int atomisp_css_yuvpp_configure_viewfinder(
268 struct atomisp_sub_device *asd,
269 unsigned int stream_index,
270 unsigned int width, unsigned int height,
271 unsigned int min_width,
272 enum ia_css_frame_format format);
273
274int atomisp_css_yuvpp_get_output_frame_info(
275 struct atomisp_sub_device *asd,
276 unsigned int stream_index,
277 struct ia_css_frame_info *info);
278
279int atomisp_css_yuvpp_get_viewfinder_frame_info(
280 struct atomisp_sub_device *asd,
281 unsigned int stream_index,
282 struct ia_css_frame_info *info);
283
284int atomisp_css_preview_configure_output(struct atomisp_sub_device *asd,
285 unsigned int width, unsigned int height,
286 unsigned int min_width,
287 enum ia_css_frame_format format);
288
289int atomisp_css_capture_configure_output(struct atomisp_sub_device *asd,
290 unsigned int width, unsigned int height,
291 unsigned int min_width,
292 enum ia_css_frame_format format);
293
294int atomisp_css_video_configure_output(struct atomisp_sub_device *asd,
295 unsigned int width, unsigned int height,
296 unsigned int min_width,
297 enum ia_css_frame_format format);
298
299int atomisp_get_css_frame_info(struct atomisp_sub_device *asd,
300 u16 source_pad,
301 struct ia_css_frame_info *frame_info);
302
303int atomisp_css_video_configure_viewfinder(struct atomisp_sub_device *asd,
304 unsigned int width, unsigned int height,
305 unsigned int min_width,
306 enum ia_css_frame_format format);
307
308int atomisp_css_capture_configure_viewfinder(
309 struct atomisp_sub_device *asd,
310 unsigned int width, unsigned int height,
311 unsigned int min_width,
312 enum ia_css_frame_format format);
313
314int atomisp_css_video_get_viewfinder_frame_info(
315 struct atomisp_sub_device *asd,
316 struct ia_css_frame_info *info);
317
318int atomisp_css_capture_get_viewfinder_frame_info(
319 struct atomisp_sub_device *asd,
320 struct ia_css_frame_info *info);
321
322int atomisp_css_copy_get_output_frame_info(
323 struct atomisp_sub_device *asd,
324 unsigned int stream_index,
325 struct ia_css_frame_info *info);
326
327int atomisp_css_capture_get_output_raw_frame_info(
328 struct atomisp_sub_device *asd,
329 struct ia_css_frame_info *info);
330
331int atomisp_css_preview_get_output_frame_info(
332 struct atomisp_sub_device *asd,
333 struct ia_css_frame_info *info);
334
335int atomisp_css_capture_get_output_frame_info(
336 struct atomisp_sub_device *asd,
337 struct ia_css_frame_info *info);
338
339int atomisp_css_video_get_output_frame_info(
340 struct atomisp_sub_device *asd,
341 struct ia_css_frame_info *info);
342
343int atomisp_css_preview_configure_pp_input(
344 struct atomisp_sub_device *asd,
345 unsigned int width, unsigned int height);
346
347int atomisp_css_capture_configure_pp_input(
348 struct atomisp_sub_device *asd,
349 unsigned int width, unsigned int height);
350
351int atomisp_css_video_configure_pp_input(
352 struct atomisp_sub_device *asd,
353 unsigned int width, unsigned int height);
354
355int atomisp_css_offline_capture_configure(struct atomisp_sub_device *asd,
356 int num_captures, unsigned int skip, int offset);
357int atomisp_css_exp_id_capture(struct atomisp_sub_device *asd, int exp_id);
358int atomisp_css_exp_id_unlock(struct atomisp_sub_device *asd, int exp_id);
359
360int atomisp_css_capture_enable_xnr(struct atomisp_sub_device *asd,
361 bool enable);
362
363void atomisp_css_set_ctc_table(struct atomisp_sub_device *asd,
364 struct ia_css_ctc_table *ctc_table);
365
366void atomisp_css_video_set_dis_vector(struct atomisp_sub_device *asd,
367 struct atomisp_dis_vector *vector);
368
369void atomisp_css_set_dvs2_coefs(struct atomisp_sub_device *asd,
370 struct ia_css_dvs2_coefficients *coefs);
371
372int atomisp_css_set_dis_coefs(struct atomisp_sub_device *asd,
373 struct atomisp_dis_coefficients *coefs);
374
375void atomisp_css_set_zoom_factor(struct atomisp_sub_device *asd,
376 unsigned int zoom);
377
378int atomisp_css_get_wb_config(struct atomisp_sub_device *asd,
379 struct atomisp_wb_config *config);
380
381int atomisp_css_get_ob_config(struct atomisp_sub_device *asd,
382 struct atomisp_ob_config *config);
383
384int atomisp_css_get_dp_config(struct atomisp_sub_device *asd,
385 struct atomisp_dp_config *config);
386
387int atomisp_css_get_de_config(struct atomisp_sub_device *asd,
388 struct atomisp_de_config *config);
389
390int atomisp_css_get_nr_config(struct atomisp_sub_device *asd,
391 struct atomisp_nr_config *config);
392
393int atomisp_css_get_ee_config(struct atomisp_sub_device *asd,
394 struct atomisp_ee_config *config);
395
396int atomisp_css_get_tnr_config(struct atomisp_sub_device *asd,
397 struct atomisp_tnr_config *config);
398
399int atomisp_css_get_ctc_table(struct atomisp_sub_device *asd,
400 struct atomisp_ctc_table *config);
401
402int atomisp_css_get_gamma_table(struct atomisp_sub_device *asd,
403 struct atomisp_gamma_table *config);
404
405int atomisp_css_get_gc_config(struct atomisp_sub_device *asd,
406 struct atomisp_gc_config *config);
407
408int atomisp_css_get_3a_config(struct atomisp_sub_device *asd,
409 struct atomisp_3a_config *config);
410
411int atomisp_css_get_formats_config(struct atomisp_sub_device *asd,
412 struct atomisp_formats_config *formats_config);
413
414void atomisp_css_set_formats_config(struct atomisp_sub_device *asd,
415 struct ia_css_formats_config *formats_config);
416
417int atomisp_css_get_zoom_factor(struct atomisp_sub_device *asd,
418 unsigned int *zoom);
419
420struct ia_css_shading_table *atomisp_css_shading_table_alloc(
421 unsigned int width, unsigned int height);
422
423void atomisp_css_set_shading_table(struct atomisp_sub_device *asd,
424 struct ia_css_shading_table *table);
425
426void atomisp_css_shading_table_free(struct ia_css_shading_table *table);
427
428struct ia_css_morph_table *atomisp_css_morph_table_allocate(
429 unsigned int width, unsigned int height);
430
431void atomisp_css_set_morph_table(struct atomisp_sub_device *asd,
432 struct ia_css_morph_table *table);
433
434void atomisp_css_get_morph_table(struct atomisp_sub_device *asd,
435 struct ia_css_morph_table *table);
436
437void atomisp_css_morph_table_free(struct ia_css_morph_table *table);
438
439void atomisp_css_set_cont_prev_start_time(struct atomisp_device *isp,
440 unsigned int overlap);
441
442int atomisp_css_get_dis_stat(struct atomisp_sub_device *asd,
443 struct atomisp_dis_statistics *stats);
444
445int atomisp_css_update_stream(struct atomisp_sub_device *asd);
446
447int atomisp_css_create_acc_pipe(struct atomisp_sub_device *asd);
448
449int atomisp_css_start_acc_pipe(struct atomisp_sub_device *asd);
450
451int atomisp_css_stop_acc_pipe(struct atomisp_sub_device *asd);
452
453void atomisp_css_destroy_acc_pipe(struct atomisp_sub_device *asd);
454
455int atomisp_css_load_acc_extension(struct atomisp_sub_device *asd,
456 struct ia_css_fw_info *fw,
457 enum ia_css_pipe_id pipe_id,
458 unsigned int type);
459
460void atomisp_css_unload_acc_extension(struct atomisp_sub_device *asd,
461 struct ia_css_fw_info *fw,
462 enum ia_css_pipe_id pipe_id);
463
464int atomisp_css_wait_acc_finish(struct atomisp_sub_device *asd);
465
466void atomisp_css_acc_done(struct atomisp_sub_device *asd);
467
468int atomisp_css_load_acc_binary(struct atomisp_sub_device *asd,
469 struct ia_css_fw_info *fw,
470 unsigned int index);
471
472void atomisp_css_unload_acc_binary(struct atomisp_sub_device *asd);
473
474struct atomisp_acc_fw;
475int atomisp_css_set_acc_parameters(struct atomisp_acc_fw *acc_fw);
476
477int atomisp_css_isr_thread(struct atomisp_device *isp,
478 bool *frame_done_found,
479 bool *css_pipe_done);
480
481bool atomisp_css_valid_sof(struct atomisp_device *isp);
482
483void atomisp_en_dz_capt_pipe(struct atomisp_sub_device *asd, bool enable);
484
485#endif
486