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;
47 typedef struct input_system_channel_s input_system_channel_t;
48 struct input_system_channel_s {
49 stream2mmio_ID_t stream2mmio_id;
50 stream2mmio_sid_ID_t stream2mmio_sid_id;
52 ibuf_ctrl_ID_t ibuf_ctrl_id;
53 isp2401_ib_buffer_t ib_buffer;
55 isys2401_dma_ID_t dma_id;
56 isys2401_dma_channel dma_channel;
59 typedef struct input_system_channel_cfg_s input_system_channel_cfg_t;
60 struct input_system_channel_cfg_s {
61 stream2mmio_cfg_t stream2mmio_cfg;
62 ibuf_ctrl_cfg_t ibuf_ctrl_cfg;
63 isys2401_dma_cfg_t dma_cfg;
64 isys2401_dma_port_cfg_t dma_src_port_cfg;
65 isys2401_dma_port_cfg_t dma_dest_port_cfg;
68 typedef struct input_system_input_port_s input_system_input_port_t;
69 struct input_system_input_port_s {
70 input_system_source_type_t source_type;
73 csi_rx_frontend_ID_t frontend_id;
74 csi_rx_backend_ID_t backend_id;
75 csi_mipi_packet_type_t packet_type;
76 csi_rx_backend_lut_entry_t backend_lut_entry;
80 csi_mipi_packet_type_t packet_type;
81 csi_rx_backend_lut_entry_t backend_lut_entry;
85 pixelgen_ID_t pixelgen_id;
89 typedef struct input_system_input_port_cfg_s input_system_input_port_cfg_t;
90 struct input_system_input_port_cfg_s {
92 csi_rx_frontend_cfg_t frontend_cfg;
93 csi_rx_backend_cfg_t backend_cfg;
94 csi_rx_backend_cfg_t md_backend_cfg;
98 pixelgen_tpg_cfg_t tpg_cfg;
99 pixelgen_prbs_cfg_t prbs_cfg;
103 typedef struct isp2401_input_system_cfg_s isp2401_input_system_cfg_t;
104 struct isp2401_input_system_cfg_s {
105 input_system_input_port_ID_t input_port_id;
107 input_system_source_type_t mode;
111 s8 linked_isys_stream_id;
122 pixelgen_tpg_cfg_t tpg_port_attr;
124 pixelgen_prbs_cfg_t prbs_port_attr;
127 s32 align_req_in_bytes;
131 } input_port_resolution;
135 s32 max_isp_input_width;
141 s32 align_req_in_bytes;
148 typedef struct virtual_input_system_stream_s virtual_input_system_stream_t;
149 struct virtual_input_system_stream_s {
150 u32 id; /*Used when multiple MIPI data types and/or virtual channels are used.
151 Must be unique within one CSI RX
152 and lower than SH_CSS_MAX_ISYS_CHANNEL_NODES */
154 input_system_input_port_t input_port;
155 input_system_channel_t channel;
156 input_system_channel_t md_channel; /* metadata channel */
158 s8 linked_isys_stream_id;
162 typedef struct virtual_input_system_stream_cfg_s
163 virtual_input_system_stream_cfg_t;
164 struct virtual_input_system_stream_cfg_s {
166 input_system_input_port_cfg_t input_port_cfg;
167 input_system_channel_cfg_t channel_cfg;
168 input_system_channel_cfg_t md_channel_cfg;
172 #define ISP_INPUT_BUF_START_ADDR 0
173 #define NUM_OF_INPUT_BUF 2
174 #define NUM_OF_LINES_PER_BUF 2
175 #define LINES_OF_ISP_INPUT_BUF (NUM_OF_INPUT_BUF * NUM_OF_LINES_PER_BUF)
176 #define ISP_INPUT_BUF_STRIDE SH_CSS_MAX_SENSOR_WIDTH