]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h
media: atomisp: stop producing hundreds of kernel-doc warnings
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / isys / interface / ia_css_isys.h
1 #ifndef ISP2401
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 #else
16 /**
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
19
20 This program is free software; you can redistribute it and/or modify it
21 under the terms and conditions of the GNU General Public License,
22 version 2, as published by the Free Software Foundation.
23
24 This program is distributed in the hope it will be useful, but WITHOUT
25 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
27 more details.
28 */
29 #endif
30
31 #ifndef __IA_CSS_ISYS_H__
32 #define __IA_CSS_ISYS_H__
33
34 #include <type_support.h>
35 #include <input_system.h>
36 #include <ia_css_input_port.h>
37 #include <ia_css_stream_format.h>
38 #include <ia_css_stream_public.h>
39 #include <system_global.h>
40 #include "ia_css_isys_comm.h"
41
42 #ifdef USE_INPUT_SYSTEM_VERSION_2401
43 /**
44 * Virtual Input System. (Input System 2401)
45 */
46 typedef input_system_cfg_t ia_css_isys_descr_t;
47 /* end of Virtual Input System */
48 #endif
49
50 #if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
51 input_system_error_t ia_css_isys_init(void);
52 void ia_css_isys_uninit(void);
53 mipi_port_ID_t ia_css_isys_port_to_mipi_port(
54 enum ia_css_csi2_port api_port);
55 #endif
56
57 #if defined(USE_INPUT_SYSTEM_VERSION_2401)
58
59 /**
60 * @brief Register one (virtual) stream. This is used to track when all
61 * virtual streams are configured inside the input system. The CSI RX is
62 * only started when all registered streams are configured.
63 *
64 * @param[in] port CSI port
65 * @param[in] isys_stream_id Stream handle generated with ia_css_isys_generate_stream_id()
66 * Must be lower than SH_CSS_MAX_ISYS_CHANNEL_NODES
67 * @return IA_CSS_SUCCESS if successful, IA_CSS_ERR_INTERNAL_ERROR if
68 * there is already a stream registered with the same handle
69 */
70 enum ia_css_err ia_css_isys_csi_rx_register_stream(
71 enum ia_css_csi2_port port,
72 uint32_t isys_stream_id);
73
74 /**
75 * @brief Unregister one (virtual) stream. This is used to track when all
76 * virtual streams are configured inside the input system. The CSI RX is
77 * only started when all registered streams are configured.
78 *
79 * @param[in] port CSI port
80 * @param[in] isys_stream_id Stream handle generated with ia_css_isys_generate_stream_id()
81 * Must be lower than SH_CSS_MAX_ISYS_CHANNEL_NODES
82 * @return IA_CSS_SUCCESS if successful, IA_CSS_ERR_INTERNAL_ERROR if
83 * there is no stream registered with that handle
84 */
85 enum ia_css_err ia_css_isys_csi_rx_unregister_stream(
86 enum ia_css_csi2_port port,
87 uint32_t isys_stream_id);
88
89 enum ia_css_err ia_css_isys_convert_compressed_format(
90 struct ia_css_csi2_compression *comp,
91 struct input_system_cfg_s *cfg);
92 unsigned int ia_css_csi2_calculate_input_system_alignment(
93 enum ia_css_stream_format fmt_type);
94 #endif
95
96 #if !defined(USE_INPUT_SYSTEM_VERSION_2401)
97 /* CSS Receiver */
98 void ia_css_isys_rx_configure(
99 const rx_cfg_t *config,
100 const enum ia_css_input_mode input_mode);
101
102 void ia_css_isys_rx_disable(void);
103
104 void ia_css_isys_rx_enable_all_interrupts(mipi_port_ID_t port);
105
106 unsigned int ia_css_isys_rx_get_interrupt_reg(mipi_port_ID_t port);
107 void ia_css_isys_rx_get_irq_info(mipi_port_ID_t port,
108 unsigned int *irq_infos);
109 void ia_css_isys_rx_clear_irq_info(mipi_port_ID_t port,
110 unsigned int irq_infos);
111 unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits);
112
113 #endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */
114
115 /* @brief Translate format and compression to format type.
116 *
117 * @param[in] input_format The input format.
118 * @param[in] compression The compression scheme.
119 * @param[out] fmt_type Pointer to the resulting format type.
120 * @return Error code.
121 *
122 * Translate an input format and mipi compression pair to the fmt_type.
123 * This is normally done by the sensor, but when using the input fifo, this
124 * format type must be sumitted correctly by the application.
125 */
126 enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format(
127 enum ia_css_stream_format input_format,
128 mipi_predictor_t compression,
129 unsigned int *fmt_type);
130
131 #ifdef USE_INPUT_SYSTEM_VERSION_2401
132 /**
133 * Virtual Input System. (Input System 2401)
134 */
135 extern ia_css_isys_error_t ia_css_isys_stream_create(
136 ia_css_isys_descr_t *isys_stream_descr,
137 ia_css_isys_stream_h isys_stream,
138 uint32_t isys_stream_id);
139
140 extern void ia_css_isys_stream_destroy(
141 ia_css_isys_stream_h isys_stream);
142
143 extern ia_css_isys_error_t ia_css_isys_stream_calculate_cfg(
144 ia_css_isys_stream_h isys_stream,
145 ia_css_isys_descr_t *isys_stream_descr,
146 ia_css_isys_stream_cfg_t *isys_stream_cfg);
147
148 extern void ia_css_isys_csi_rx_lut_rmgr_init(void);
149
150 extern void ia_css_isys_csi_rx_lut_rmgr_uninit(void);
151
152 extern bool ia_css_isys_csi_rx_lut_rmgr_acquire(
153 csi_rx_backend_ID_t backend,
154 csi_mipi_packet_type_t packet_type,
155 csi_rx_backend_lut_entry_t *entry);
156
157 extern void ia_css_isys_csi_rx_lut_rmgr_release(
158 csi_rx_backend_ID_t backend,
159 csi_mipi_packet_type_t packet_type,
160 csi_rx_backend_lut_entry_t *entry);
161
162
163 extern void ia_css_isys_ibuf_rmgr_init(void);
164
165 extern void ia_css_isys_ibuf_rmgr_uninit(void);
166
167 extern bool ia_css_isys_ibuf_rmgr_acquire(
168 uint32_t size,
169 uint32_t *start_addr);
170
171 extern void ia_css_isys_ibuf_rmgr_release(
172 uint32_t *start_addr);
173
174 extern void ia_css_isys_dma_channel_rmgr_init(void);
175
176 extern void ia_css_isys_dma_channel_rmgr_uninit(void);
177
178 extern bool ia_css_isys_dma_channel_rmgr_acquire(
179 isys2401_dma_ID_t dma_id,
180 isys2401_dma_channel *channel);
181
182 extern void ia_css_isys_dma_channel_rmgr_release(
183 isys2401_dma_ID_t dma_id,
184 isys2401_dma_channel *channel);
185
186 extern void ia_css_isys_stream2mmio_sid_rmgr_init(void);
187
188 extern void ia_css_isys_stream2mmio_sid_rmgr_uninit(void);
189
190 extern bool ia_css_isys_stream2mmio_sid_rmgr_acquire(
191 stream2mmio_ID_t stream2mmio,
192 stream2mmio_sid_ID_t *sid);
193
194 extern void ia_css_isys_stream2mmio_sid_rmgr_release(
195 stream2mmio_ID_t stream2mmio,
196 stream2mmio_sid_ID_t *sid);
197
198 /* end of Virtual Input System */
199 #endif
200
201 #endif /* __IA_CSS_ISYS_H__ */