1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Support for Intel Camera Imaging ISP subsystem.
4  * Copyright (c) 2015, Intel Corporation.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  */
15 
16 #ifndef _IA_CSS_STREAM_H_
17 #define _IA_CSS_STREAM_H_
18 
19 #include <type_support.h>
20 #include <system_local.h>
21 #if !defined(ISP2401)
22 #include <input_system.h>
23 #endif
24 #include "ia_css_types.h"
25 #include "ia_css_stream_public.h"
26 
27 /**
28  * structure to hold all internal stream related information
29  */
30 struct ia_css_stream {
31 	struct ia_css_stream_config    config;
32 	struct ia_css_stream_info      info;
33 #if !defined(ISP2401)
34 	rx_cfg_t                       csi_rx_config;
35 #endif
36 	bool                           reconfigure_css_rx;
37 	struct ia_css_pipe            *last_pipe;
38 	int                            num_pipes;
39 	struct ia_css_pipe           **pipes;
40 	struct ia_css_pipe            *continuous_pipe;
41 	struct ia_css_isp_parameters  *isp_params_configs;
42 	struct ia_css_isp_parameters  *per_frame_isp_params_configs;
43 
44 	bool                           cont_capt;
45 	bool                           disable_cont_vf;
46 
47 	/* ISP2401 */
48 	bool                           stop_copy_preview;
49 	bool                           started;
50 };
51 
52 /* @brief Get a binary in the stream, which binary has the shading correction.
53  *
54  * @param[in] stream: The stream.
55  * @return	The binary which has the shading correction.
56  *
57  */
58 struct ia_css_binary *
59 ia_css_stream_get_shading_correction_binary(const struct ia_css_stream *stream);
60 
61 struct ia_css_binary *
62 ia_css_stream_get_dvs_binary(const struct ia_css_stream *stream);
63 
64 struct ia_css_binary *
65 ia_css_stream_get_3a_binary(const struct ia_css_stream *stream);
66 
67 unsigned int
68 ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream);
69 
70 bool
71 sh_css_params_set_binning_factor(struct ia_css_stream *stream,
72 				 unsigned int sensor_binning);
73 
74 void
75 sh_css_invalidate_params(struct ia_css_stream *stream);
76 
77 /* The following functions are used for testing purposes only */
78 const struct ia_css_fpn_table *
79 ia_css_get_fpn_table(struct ia_css_stream *stream);
80 
81 /* @brief Get a pointer to the shading table.
82  *
83  * @param[in] stream: The stream.
84  * @return	The pointer to the shading table.
85  *
86  */
87 struct ia_css_shading_table *
88 ia_css_get_shading_table(struct ia_css_stream *stream);
89 
90 void
91 ia_css_get_isp_dis_coefficients(struct ia_css_stream *stream,
92 				short *horizontal_coefficients,
93 				short *vertical_coefficients);
94 
95 void
96 ia_css_get_isp_dvs2_coefficients(struct ia_css_stream *stream,
97 				 short *hor_coefs_odd_real,
98 				 short *hor_coefs_odd_imag,
99 				 short *hor_coefs_even_real,
100 				 short *hor_coefs_even_imag,
101 				 short *ver_coefs_odd_real,
102 				 short *ver_coefs_odd_imag,
103 				 short *ver_coefs_even_real,
104 				 short *ver_coefs_even_imag);
105 
106 int
107 ia_css_stream_isp_parameters_init(struct ia_css_stream *stream);
108 
109 void
110 ia_css_stream_isp_parameters_uninit(struct ia_css_stream *stream);
111 
112 #endif /*_IA_CSS_STREAM_H_*/
113