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 #include <input_system.h>
22 #include "ia_css_types.h"
23 #include "ia_css_stream_public.h"
24 
25 /**
26  * structure to hold all internal stream related information
27  */
28 struct ia_css_stream {
29 	struct ia_css_stream_config    config;
30 	struct ia_css_stream_info      info;
31 	rx_cfg_t                       csi_rx_config;
32 	bool                           reconfigure_css_rx;
33 	struct ia_css_pipe            *last_pipe;
34 	int                            num_pipes;
35 	struct ia_css_pipe           **pipes;
36 	struct ia_css_pipe            *continuous_pipe;
37 	struct ia_css_isp_parameters  *isp_params_configs;
38 	struct ia_css_isp_parameters  *per_frame_isp_params_configs;
39 
40 	bool                           cont_capt;
41 	bool                           disable_cont_vf;
42 
43 	/* ISP2401 */
44 	bool                           stop_copy_preview;
45 	bool                           started;
46 };
47 
48 /* @brief Get a binary in the stream, which binary has the shading correction.
49  *
50  * @param[in] stream: The stream.
51  * @return	The binary which has the shading correction.
52  *
53  */
54 struct ia_css_binary *
55 ia_css_stream_get_shading_correction_binary(const struct ia_css_stream *stream);
56 
57 struct ia_css_binary *
58 ia_css_stream_get_dvs_binary(const struct ia_css_stream *stream);
59 
60 struct ia_css_binary *
61 ia_css_stream_get_3a_binary(const struct ia_css_stream *stream);
62 
63 unsigned int
64 ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream);
65 
66 bool
67 sh_css_params_set_binning_factor(struct ia_css_stream *stream,
68 				 unsigned int sensor_binning);
69 
70 void
71 sh_css_invalidate_params(struct ia_css_stream *stream);
72 
73 /* The following functions are used for testing purposes only */
74 const struct ia_css_fpn_table *
75 ia_css_get_fpn_table(struct ia_css_stream *stream);
76 
77 /* @brief Get a pointer to the shading table.
78  *
79  * @param[in] stream: The stream.
80  * @return	The pointer to the shading table.
81  *
82  */
83 struct ia_css_shading_table *
84 ia_css_get_shading_table(struct ia_css_stream *stream);
85 
86 void
87 ia_css_get_isp_dis_coefficients(struct ia_css_stream *stream,
88 				short *horizontal_coefficients,
89 				short *vertical_coefficients);
90 
91 void
92 ia_css_get_isp_dvs2_coefficients(struct ia_css_stream *stream,
93 				 short *hor_coefs_odd_real,
94 				 short *hor_coefs_odd_imag,
95 				 short *hor_coefs_even_real,
96 				 short *hor_coefs_even_imag,
97 				 short *ver_coefs_odd_real,
98 				 short *ver_coefs_odd_imag,
99 				 short *ver_coefs_even_real,
100 				 short *ver_coefs_even_imag);
101 
102 int
103 ia_css_stream_isp_parameters_init(struct ia_css_stream *stream);
104 
105 void
106 ia_css_stream_isp_parameters_uninit(struct ia_css_stream *stream);
107 
108 #endif /*_IA_CSS_STREAM_H_*/
109