blob: 2a571306c2ffcab5f65ff7bd7957941684ad6829 [file] [log] [blame]
Jing Zhou8184f312017-01-31 14:06:30 -08001#ifndef __UAPI_CAM_ISP_H__
2#define __UAPI_CAM_ISP_H__
3
4#include "cam_defs.h"
5#include "cam_isp_vfe.h"
6#include "cam_isp_ife.h"
7
8
9/* ISP driver name */
10#define CAM_ISP_DEV_NAME "cam-isp"
11
12/* HW type */
13#define CAM_ISP_HW_BASE 0
14#define CAM_ISP_HW_CSID 1
15#define CAM_ISP_HW_VFE 2
16#define CAM_ISP_HW_IFE 3
17#define CAM_ISP_HW_ISPIF 4
18#define CAM_ISP_HW_MAX 5
19
20/* Color Pattern */
21#define CAM_ISP_PATTERN_BAYER_RGRGRG 0
22#define CAM_ISP_PATTERN_BAYER_GRGRGR 1
23#define CAM_ISP_PATTERN_BAYER_BGBGBG 2
24#define CAM_ISP_PATTERN_BAYER_GBGBGB 3
25#define CAM_ISP_PATTERN_YUV_YCBYCR 4
26#define CAM_ISP_PATTERN_YUV_YCRYCB 5
27#define CAM_ISP_PATTERN_YUV_CBYCRY 6
28#define CAM_ISP_PATTERN_YUV_CRYCBY 7
29#define CAM_ISP_PATTERN_MAX 8
30
31/* Usage Type */
32#define CAM_ISP_RES_USAGE_SINGLE 0
33#define CAM_ISP_RES_USAGE_DUAL 1
34#define CAM_ISP_RES_USAGE_MAX 2
35
36/* Resource ID */
37#define CAM_ISP_RES_ID_PORT 0
38#define CAM_ISP_RES_ID_CLK 1
39#define CAM_ISP_RES_ID_MAX 2
40
41/* Resource Type - Type of resource for the resource id
42 * defined in cam_isp_vfe.h, cam_isp_ife.h
43 */
44
45/* Lane Type in input resource for Port */
46#define CAM_ISP_LANE_TYPE_DPHY 0
47#define CAM_ISP_LANE_TYPE_CPHY 1
48#define CAM_ISP_LANE_TYPE_MAX 2
49
50/* ISP Resurce Composite Group ID */
51#define CAM_ISP_RES_COMP_GROUP_NONE 0
52#define CAM_ISP_RES_COMP_GROUP_ID_0 1
53#define CAM_ISP_RES_COMP_GROUP_ID_1 2
54#define CAM_ISP_RES_COMP_GROUP_ID_2 3
55#define CAM_ISP_RES_COMP_GROUP_ID_3 4
56#define CAM_ISP_RES_COMP_GROUP_ID_4 5
57#define CAM_ISP_RES_COMP_GROUP_ID_5 6
58#define CAM_ISP_RES_COMP_GROUP_ID_MAX 6
59
60/* ISP packet opcode for ISP */
61#define CAM_ISP_PACKET_OP_BASE 0
62#define CAM_ISP_PACKET_INIT_DEV 1
63#define CAM_ISP_PACKET_UPDATE_DEV 2
64#define CAM_ISP_PACKET_OP_MAX 3
65
66/* ISP packet meta_data type for command buffer */
67#define CAM_ISP_PACKET_META_BASE 0
68#define CAM_ISP_PACKET_META_LEFT 1
69#define CAM_ISP_PACKET_META_RIGHT 2
70#define CAM_ISP_PACKET_META_COMMON 3
71#define CAM_ISP_PACKET_META_DMI_LEFT 4
72#define CAM_ISP_PACKET_META_DMI_RIGHT 5
73#define CAM_ISP_PACKET_META_DMI_COMMON 6
74#define CAM_ISP_PACKET_META_CLOCK 7
75#define CAM_ISP_PACKET_META_CSID 8
76#define CAM_ISP_PACKET_META_MAX 9
77
Jing Zhou6562f692017-02-15 15:56:54 -080078/* DSP mode */
79#define CAM_ISP_DSP_MODE_NONE 0
80#define CAM_ISP_DSP_MODE_ONE_WAY 1
81#define CAM_ISP_DSP_MODE_ROUND 2
82
Jing Zhou8184f312017-01-31 14:06:30 -080083
84/* Query devices */
85/**
86 * struct cam_isp_dev_cap_info - A cap info for particular hw type
87 *
88 * @hw_type: Hardware type for the cap info
Jing Zhou6562f692017-02-15 15:56:54 -080089 * @reserved: reserved field for alignment
Jing Zhou8184f312017-01-31 14:06:30 -080090 * @hw_version: Hardware version
91 *
92 */
93struct cam_isp_dev_cap_info {
94 uint32_t hw_type;
Jing Zhou6562f692017-02-15 15:56:54 -080095 uint32_t reserved;
Jing Zhou8184f312017-01-31 14:06:30 -080096 struct cam_hw_version hw_version;
97};
98
99/**
100 * struct cam_isp_query_cap_cmd - ISP query device capability payload
101 *
102 * @device_iommu: returned iommu handles for device
103 * @cdm_iommu: returned iommu handles for cdm
104 * @num_dev: returned number of device capabilities
105 * @reserved: reserved field for alignment
106 * @dev_caps: returned device capability array
107 *
108 */
109struct cam_isp_query_cap_cmd {
110 struct cam_iommu_handle device_iommu;
111 struct cam_iommu_handle cdm_iommu;
112 int32_t num_dev;
113 uint32_t reserved;
114 struct cam_isp_dev_cap_info dev_caps[CAM_ISP_HW_MAX];
115};
116
117/* Acquire Device */
118/**
119 * struct cam_isp_out_port_info - An output port resource info
120 *
121 * @res_type: output resource type defined in file
122 * cam_isp_vfe.h or cam_isp_ife.h
123 * @format: output format of the resource
124 * @wdith: output width in pixels
125 * @height: output height in lines
126 * @comp_grp_id: composite group id for the resource.
127 * @split_point: split point in pixels for the dual VFE.
128 * @secure_mode: flag to tell if output should be run in secure
129 * mode or not. See cam_defs.h for definition
130 * @reserved: reserved field for alignment
131 *
132 */
133struct cam_isp_out_port_info {
134 uint32_t res_type;
135 uint32_t format;
136 uint32_t width;
137 uint32_t height;
138 uint32_t comp_grp_id;
139 uint32_t split_point;
140 uint32_t secure_mode;
141 uint32_t reserved;
142};
143
144/**
145 * struct cam_isp_in_port_info - An input port resource info
146 *
147 * @res_type: input resource type define in file
148 * cam_isp_vfe.h or cam_isp_ife.h
149 * @lane_type: lane type: c-phy or d-phy.
150 * @lane_num: active lane number
151 * @lane_cfg: lane configurations: 4 bits per lane
152 * @vc: input virtual channel number
153 * @dt: input data type number
154 * @format: input format
155 * @test_pattern: test pattern for the testgen
156 * @usage_type: whether dual vfe is required
157 * @left_start: left input start offset in pixels
158 * @left_stop: left input stop offset in pixels
159 * @left_width: left input width in pixels
160 * @right_start: right input start offset in pixels.
161 * Only for Dual VFE
162 * @right_stop: right input stop offset in pixels.
163 * Only for Dual VFE
164 * @right_width: right input width in pixels.
165 * Only for dual VFE
166 * @line_start: top of the line number
167 * @line_stop: bottome of the line number
168 * @height: input height in lines
169 * @pixel_clk; sensor output clock
170 * @batch_size: batch size for HFR mode
Jing Zhou6562f692017-02-15 15:56:54 -0800171 * @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*)
172 * @hbi_cnt: HBI count for the camif input
173 * @reserved: Reserved field for alignment
Jing Zhou8184f312017-01-31 14:06:30 -0800174 * @num_out_res: number of the output resource associated
175 * @data: payload that contains the output resources
176 *
177 */
178struct cam_isp_in_port_info {
179 uint32_t res_type;
180 uint32_t lane_type;
181 uint32_t lane_num;
182 uint32_t lane_cfg;
183 uint32_t vc;
184 uint32_t dt;
185 uint32_t format;
186 uint32_t test_pattern;
187 uint32_t usage_type;
188 uint32_t left_start;
189 uint32_t left_stop;
190 uint32_t left_width;
191 uint32_t right_start;
192 uint32_t right_stop;
193 uint32_t right_width;
194 uint32_t line_start;
195 uint32_t line_stop;
196 uint32_t height;
197 uint32_t pixel_clk;
198 uint32_t batch_size;
Jing Zhou6562f692017-02-15 15:56:54 -0800199 uint32_t dsp_mode;
200 uint32_t hbi_cnt;
Jing Zhou8184f312017-01-31 14:06:30 -0800201 uint32_t reserved;
202 uint32_t num_out_res;
203 struct cam_isp_out_port_info data[1];
204};
205
206/**
207 * struct cam_isp_resource - A resource bundle
208 *
209 * @resoruce_id: resource id for the resource bundle
210 * @length: length of the while resource blob
211 * @handle_type: type of the resource handle
212 * @reserved: reserved field for alignment
213 * @res_hdl: resource handle that points to the
214 * resource array;
215 *
216 */
217struct cam_isp_resource {
218 uint32_t resource_id;
219 uint32_t length;
220 uint32_t handle_type;
221 uint32_t reserved;
222 uint64_t res_hdl;
223};
224
Jing Zhou8184f312017-01-31 14:06:30 -0800225#endif /* __UAPI_CAM_ISP_H__ */