1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
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.
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
16 /* CSI reveiver has 3 ports. */
17 #define N_CSI_PORTS (3)
19 #include "system_local.h"
20 #include "isys_dma_global.h" /* isys2401_dma_channel,
24 #include "ibuf_ctrl_local.h" /* ibuf_cfg_t,
28 #include "isys_stream2mmio.h" /* stream2mmio_cfg_t */
30 #include "csi_rx.h" /* csi_rx_frontend_cfg_t,
31 * csi_rx_backend_cfg_t,
32 * csi_rx_backend_lut_entry_t
36 #define INPUT_SYSTEM_N_STREAM_ID 6 /* maximum number of simultaneous
37 virtual channels supported*/
40 INPUT_SYSTEM_SOURCE_TYPE_UNDEFINED = 0,
41 INPUT_SYSTEM_SOURCE_TYPE_SENSOR,
42 INPUT_SYSTEM_SOURCE_TYPE_TPG,
43 INPUT_SYSTEM_SOURCE_TYPE_PRBS,
44 N_INPUT_SYSTEM_SOURCE_TYPE
45 } input_system_source_type_t;
48 INPUT_SYSTEM_POLL_ON_WAIT_FOR_FRAME,
49 INPUT_SYSTEM_POLL_ON_CAPTURE_REQUEST,
50 } input_system_polling_mode_t;
52 typedef struct input_system_channel_s input_system_channel_t;
53 struct input_system_channel_s {
54 stream2mmio_ID_t stream2mmio_id;
55 stream2mmio_sid_ID_t stream2mmio_sid_id;
57 ibuf_ctrl_ID_t ibuf_ctrl_id;
58 isp2401_ib_buffer_t ib_buffer;
60 isys2401_dma_ID_t dma_id;
61 isys2401_dma_channel dma_channel;
64 typedef struct input_system_channel_cfg_s input_system_channel_cfg_t;
65 struct input_system_channel_cfg_s {
66 stream2mmio_cfg_t stream2mmio_cfg;
67 ibuf_ctrl_cfg_t ibuf_ctrl_cfg;
68 isys2401_dma_cfg_t dma_cfg;
69 isys2401_dma_port_cfg_t dma_src_port_cfg;
70 isys2401_dma_port_cfg_t dma_dest_port_cfg;
73 typedef struct input_system_input_port_s input_system_input_port_t;
74 struct input_system_input_port_s {
75 input_system_source_type_t source_type;
78 csi_rx_frontend_ID_t frontend_id;
79 csi_rx_backend_ID_t backend_id;
80 csi_mipi_packet_type_t packet_type;
81 csi_rx_backend_lut_entry_t backend_lut_entry;
85 csi_mipi_packet_type_t packet_type;
86 csi_rx_backend_lut_entry_t backend_lut_entry;
90 pixelgen_ID_t pixelgen_id;
94 typedef struct input_system_input_port_cfg_s input_system_input_port_cfg_t;
95 struct input_system_input_port_cfg_s {
97 csi_rx_frontend_cfg_t frontend_cfg;
98 csi_rx_backend_cfg_t backend_cfg;
99 csi_rx_backend_cfg_t md_backend_cfg;
103 pixelgen_tpg_cfg_t tpg_cfg;
104 pixelgen_prbs_cfg_t prbs_cfg;
108 typedef struct isp2401_input_system_cfg_s isp2401_input_system_cfg_t;
109 struct isp2401_input_system_cfg_s {
110 input_system_input_port_ID_t input_port_id;
112 input_system_source_type_t mode;
115 input_system_polling_mode_t polling_mode;
119 s8 linked_isys_stream_id;
130 pixelgen_tpg_cfg_t tpg_port_attr;
132 pixelgen_prbs_cfg_t prbs_port_attr;
135 s32 align_req_in_bytes;
139 } input_port_resolution;
143 s32 max_isp_input_width;
149 s32 align_req_in_bytes;
156 typedef struct virtual_input_system_stream_s virtual_input_system_stream_t;
157 struct virtual_input_system_stream_s {
158 u32 id; /*Used when multiple MIPI data types and/or virtual channels are used.
159 Must be unique within one CSI RX
160 and lower than SH_CSS_MAX_ISYS_CHANNEL_NODES */
162 input_system_input_port_t input_port;
163 input_system_channel_t channel;
164 input_system_channel_t md_channel; /* metadata channel */
166 s8 linked_isys_stream_id;
170 input_system_polling_mode_t polling_mode;
174 typedef struct virtual_input_system_stream_cfg_s
175 virtual_input_system_stream_cfg_t;
176 struct virtual_input_system_stream_cfg_s {
178 input_system_input_port_cfg_t input_port_cfg;
179 input_system_channel_cfg_t channel_cfg;
180 input_system_channel_cfg_t md_channel_cfg;
184 #define ISP_INPUT_BUF_START_ADDR 0
185 #define NUM_OF_INPUT_BUF 2
186 #define NUM_OF_LINES_PER_BUF 2
187 #define LINES_OF_ISP_INPUT_BUF (NUM_OF_INPUT_BUF * NUM_OF_LINES_PER_BUF)
188 #define ISP_INPUT_BUF_STRIDE SH_CSS_MAX_SENSOR_WIDTH