media: staging: atomisp: stop duplicating input format types
[linux-2.6-block.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / isys / interface / ia_css_isys.h
CommitLineData
a49d2536
AC
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/**
17Support for Intel Camera Imaging ISP subsystem.
18Copyright (c) 2010 - 2015, Intel Corporation.
19
20This program is free software; you can redistribute it and/or modify it
21under the terms and conditions of the GNU General Public License,
22version 2, as published by the Free Software Foundation.
23
24This program is distributed in the hope it will be useful, but WITHOUT
25ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
27more 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 */
46typedef input_system_cfg_t ia_css_isys_descr_t;
d929fb4e 47/* end of Virtual Input System */
a49d2536
AC
48#endif
49
50#if defined(USE_INPUT_SYSTEM_VERSION_2) || defined(USE_INPUT_SYSTEM_VERSION_2401)
51input_system_error_t ia_css_isys_init(void);
52void ia_css_isys_uninit(void);
fd418c8a
MCC
53enum mipi_port_id ia_css_isys_port_to_mipi_port(
54 enum mipi_port_id api_port);
a49d2536
AC
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 */
70enum ia_css_err ia_css_isys_csi_rx_register_stream(
fd418c8a 71 enum mipi_port_id port,
a49d2536
AC
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 */
85enum ia_css_err ia_css_isys_csi_rx_unregister_stream(
fd418c8a 86 enum mipi_port_id port,
a49d2536
AC
87 uint32_t isys_stream_id);
88
89enum ia_css_err ia_css_isys_convert_compressed_format(
90 struct ia_css_csi2_compression *comp,
91 struct input_system_cfg_s *cfg);
92unsigned int ia_css_csi2_calculate_input_system_alignment(
0116b8df 93 enum atomisp_input_format fmt_type);
a49d2536
AC
94#endif
95
96#if !defined(USE_INPUT_SYSTEM_VERSION_2401)
97/* CSS Receiver */
98void ia_css_isys_rx_configure(
99 const rx_cfg_t *config,
100 const enum ia_css_input_mode input_mode);
101
102void ia_css_isys_rx_disable(void);
103
fd418c8a 104void ia_css_isys_rx_enable_all_interrupts(enum mipi_port_id port);
a49d2536 105
fd418c8a
MCC
106unsigned int ia_css_isys_rx_get_interrupt_reg(enum mipi_port_id port);
107void ia_css_isys_rx_get_irq_info(enum mipi_port_id port,
a49d2536 108 unsigned int *irq_infos);
fd418c8a 109void ia_css_isys_rx_clear_irq_info(enum mipi_port_id port,
a49d2536
AC
110 unsigned int irq_infos);
111unsigned int ia_css_isys_rx_translate_irq_infos(unsigned int bits);
112
113#endif /* #if !defined(USE_INPUT_SYSTEM_VERSION_2401) */
114
d929fb4e 115/* @brief Translate format and compression to format type.
a49d2536
AC
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 */
126enum ia_css_err ia_css_isys_convert_stream_format_to_mipi_format(
0116b8df 127 enum atomisp_input_format input_format,
a49d2536
AC
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 */
135extern 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
140extern void ia_css_isys_stream_destroy(
141 ia_css_isys_stream_h isys_stream);
142
143extern 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
148extern void ia_css_isys_csi_rx_lut_rmgr_init(void);
149
150extern void ia_css_isys_csi_rx_lut_rmgr_uninit(void);
151
152extern 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
157extern 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
163extern void ia_css_isys_ibuf_rmgr_init(void);
164
165extern void ia_css_isys_ibuf_rmgr_uninit(void);
166
167extern bool ia_css_isys_ibuf_rmgr_acquire(
168 uint32_t size,
169 uint32_t *start_addr);
170
171extern void ia_css_isys_ibuf_rmgr_release(
172 uint32_t *start_addr);
173
174extern void ia_css_isys_dma_channel_rmgr_init(void);
175
176extern void ia_css_isys_dma_channel_rmgr_uninit(void);
177
178extern bool ia_css_isys_dma_channel_rmgr_acquire(
179 isys2401_dma_ID_t dma_id,
180 isys2401_dma_channel *channel);
181
182extern void ia_css_isys_dma_channel_rmgr_release(
183 isys2401_dma_ID_t dma_id,
184 isys2401_dma_channel *channel);
185
186extern void ia_css_isys_stream2mmio_sid_rmgr_init(void);
187
188extern void ia_css_isys_stream2mmio_sid_rmgr_uninit(void);
189
190extern bool ia_css_isys_stream2mmio_sid_rmgr_acquire(
191 stream2mmio_ID_t stream2mmio,
192 stream2mmio_sid_ID_t *sid);
193
194extern void ia_css_isys_stream2mmio_sid_rmgr_release(
195 stream2mmio_ID_t stream2mmio,
196 stream2mmio_sid_ID_t *sid);
197
d929fb4e 198/* end of Virtual Input System */
a49d2536
AC
199#endif
200
201#endif /* __IA_CSS_ISYS_H__ */