blob: 50d95c4da9d8894de18f7361439c8c40e498c1e4 [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"
Raja Mallik477ca242019-06-21 14:23:32 +05307#include "cam_cpas.h"
Jing Zhou8184f312017-01-31 14:06:30 -08008
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
Ravikishore Pampanaff6132e2017-07-27 15:32:31 +053076#define CAM_ISP_PACKET_META_DUAL_CONFIG 9
Harsh Shah9d676dd2017-08-30 16:30:04 -070077#define CAM_ISP_PACKET_META_GENERIC_BLOB_LEFT 10
78#define CAM_ISP_PACKET_META_GENERIC_BLOB_RIGHT 11
79#define CAM_ISP_PACKET_META_GENERIC_BLOB_COMMON 12
Jing Zhou8184f312017-01-31 14:06:30 -080080
Jing Zhou6562f692017-02-15 15:56:54 -080081/* DSP mode */
82#define CAM_ISP_DSP_MODE_NONE 0
83#define CAM_ISP_DSP_MODE_ONE_WAY 1
84#define CAM_ISP_DSP_MODE_ROUND 2
85
Pavan Kumar Chilamkurthi649cdf92017-08-15 01:40:57 -070086/* ISP Generic Cmd Buffer Blob types */
Raja Mallike3ed1a32019-08-22 17:12:32 +053087#define CAM_ISP_GENERIC_BLOB_TYPE_HFR_CONFIG 0
88#define CAM_ISP_GENERIC_BLOB_TYPE_CLOCK_CONFIG 1
89#define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG 2
90#define CAM_ISP_GENERIC_BLOB_TYPE_UBWC_CONFIG 3
91#define CAM_ISP_GENERIC_BLOB_TYPE_CSID_CLOCK_CONFIG 4
92#define CAM_ISP_GENERIC_BLOB_TYPE_FE_CONFIG 5
93#define CAM_ISP_GENERIC_BLOB_TYPE_BW_CONFIG_V2 6
94#define CAM_ISP_GENERIC_BLOB_TYPE_INIT_FRAME_DROP 10
95#define CAM_ISP_GENERIC_BLOB_TYPE_SENSOR_DIMENSION_CONFIG 11
96#define CAM_ISP_GENERIC_BLOB_TYPE_FPS_CONFIG 12
Raja Mallik477ca242019-06-21 14:23:32 +053097
98/* Per Path Usage Data */
99#define CAM_ISP_USAGE_INVALID 0
100#define CAM_ISP_USAGE_LEFT_PX 1
101#define CAM_ISP_USAGE_RIGHT_PX 2
102#define CAM_ISP_USAGE_RDI 3
Jing Zhou8184f312017-01-31 14:06:30 -0800103
104/* Query devices */
105/**
106 * struct cam_isp_dev_cap_info - A cap info for particular hw type
107 *
108 * @hw_type: Hardware type for the cap info
Jing Zhou6562f692017-02-15 15:56:54 -0800109 * @reserved: reserved field for alignment
Jing Zhou8184f312017-01-31 14:06:30 -0800110 * @hw_version: Hardware version
111 *
112 */
113struct cam_isp_dev_cap_info {
114 uint32_t hw_type;
Jing Zhou6562f692017-02-15 15:56:54 -0800115 uint32_t reserved;
Jing Zhou8184f312017-01-31 14:06:30 -0800116 struct cam_hw_version hw_version;
117};
118
119/**
120 * struct cam_isp_query_cap_cmd - ISP query device capability payload
121 *
122 * @device_iommu: returned iommu handles for device
123 * @cdm_iommu: returned iommu handles for cdm
124 * @num_dev: returned number of device capabilities
125 * @reserved: reserved field for alignment
126 * @dev_caps: returned device capability array
127 *
128 */
129struct cam_isp_query_cap_cmd {
130 struct cam_iommu_handle device_iommu;
131 struct cam_iommu_handle cdm_iommu;
132 int32_t num_dev;
133 uint32_t reserved;
134 struct cam_isp_dev_cap_info dev_caps[CAM_ISP_HW_MAX];
135};
136
137/* Acquire Device */
138/**
139 * struct cam_isp_out_port_info - An output port resource info
140 *
141 * @res_type: output resource type defined in file
142 * cam_isp_vfe.h or cam_isp_ife.h
143 * @format: output format of the resource
144 * @wdith: output width in pixels
145 * @height: output height in lines
146 * @comp_grp_id: composite group id for the resource.
147 * @split_point: split point in pixels for the dual VFE.
148 * @secure_mode: flag to tell if output should be run in secure
149 * mode or not. See cam_defs.h for definition
150 * @reserved: reserved field for alignment
151 *
152 */
153struct cam_isp_out_port_info {
154 uint32_t res_type;
155 uint32_t format;
156 uint32_t width;
157 uint32_t height;
158 uint32_t comp_grp_id;
159 uint32_t split_point;
160 uint32_t secure_mode;
161 uint32_t reserved;
162};
163
164/**
165 * struct cam_isp_in_port_info - An input port resource info
166 *
167 * @res_type: input resource type define in file
168 * cam_isp_vfe.h or cam_isp_ife.h
169 * @lane_type: lane type: c-phy or d-phy.
170 * @lane_num: active lane number
171 * @lane_cfg: lane configurations: 4 bits per lane
172 * @vc: input virtual channel number
173 * @dt: input data type number
174 * @format: input format
175 * @test_pattern: test pattern for the testgen
176 * @usage_type: whether dual vfe is required
177 * @left_start: left input start offset in pixels
178 * @left_stop: left input stop offset in pixels
179 * @left_width: left input width in pixels
180 * @right_start: right input start offset in pixels.
181 * Only for Dual VFE
182 * @right_stop: right input stop offset in pixels.
183 * Only for Dual VFE
184 * @right_width: right input width in pixels.
185 * Only for dual VFE
186 * @line_start: top of the line number
187 * @line_stop: bottome of the line number
188 * @height: input height in lines
189 * @pixel_clk; sensor output clock
190 * @batch_size: batch size for HFR mode
Jing Zhou6562f692017-02-15 15:56:54 -0800191 * @dsp_mode: DSP stream mode (Defines as CAM_ISP_DSP_MODE_*)
192 * @hbi_cnt: HBI count for the camif input
193 * @reserved: Reserved field for alignment
Jing Zhou8184f312017-01-31 14:06:30 -0800194 * @num_out_res: number of the output resource associated
195 * @data: payload that contains the output resources
196 *
197 */
198struct cam_isp_in_port_info {
199 uint32_t res_type;
200 uint32_t lane_type;
201 uint32_t lane_num;
202 uint32_t lane_cfg;
203 uint32_t vc;
204 uint32_t dt;
205 uint32_t format;
206 uint32_t test_pattern;
207 uint32_t usage_type;
208 uint32_t left_start;
209 uint32_t left_stop;
210 uint32_t left_width;
211 uint32_t right_start;
212 uint32_t right_stop;
213 uint32_t right_width;
214 uint32_t line_start;
215 uint32_t line_stop;
216 uint32_t height;
217 uint32_t pixel_clk;
218 uint32_t batch_size;
Jing Zhou6562f692017-02-15 15:56:54 -0800219 uint32_t dsp_mode;
220 uint32_t hbi_cnt;
Jing Zhou8184f312017-01-31 14:06:30 -0800221 uint32_t reserved;
222 uint32_t num_out_res;
223 struct cam_isp_out_port_info data[1];
224};
225
226/**
227 * struct cam_isp_resource - A resource bundle
228 *
229 * @resoruce_id: resource id for the resource bundle
230 * @length: length of the while resource blob
231 * @handle_type: type of the resource handle
232 * @reserved: reserved field for alignment
233 * @res_hdl: resource handle that points to the
234 * resource array;
235 *
236 */
237struct cam_isp_resource {
238 uint32_t resource_id;
239 uint32_t length;
240 uint32_t handle_type;
241 uint32_t reserved;
242 uint64_t res_hdl;
243};
244
Pavan Kumar Chilamkurthi649cdf92017-08-15 01:40:57 -0700245/**
246 * struct cam_isp_port_hfr_config - HFR configuration for this port
247 *
248 * @resource_type: Resource type
249 * @subsample_pattern: Subsample pattern. Used in HFR mode. It
250 * should be consistent with batchSize and
251 * CAMIF programming.
252 * @subsample_period: Subsample period. Used in HFR mode. It
253 * should be consistent with batchSize and
254 * CAMIF programming.
255 * @framedrop_pattern: Framedrop pattern
256 * @framedrop_period: Framedrop period
257 * @reserved: Reserved for alignment
258 */
259struct cam_isp_port_hfr_config {
260 uint32_t resource_type;
261 uint32_t subsample_pattern;
262 uint32_t subsample_period;
263 uint32_t framedrop_pattern;
264 uint32_t framedrop_period;
265 uint32_t reserved;
Harsh Shah29102392017-09-21 16:01:47 -0700266} __attribute__((packed));
Pavan Kumar Chilamkurthi649cdf92017-08-15 01:40:57 -0700267
268/**
269 * struct cam_isp_resource_hfr_config - Resource HFR configuration
270 *
Harsh Shah9d676dd2017-08-30 16:30:04 -0700271 * @num_ports: Number of ports
Pavan Kumar Chilamkurthi649cdf92017-08-15 01:40:57 -0700272 * @reserved: Reserved for alignment
Harsh Shah9d676dd2017-08-30 16:30:04 -0700273 * @port_hfr_config: HFR configuration for each IO port
Pavan Kumar Chilamkurthi649cdf92017-08-15 01:40:57 -0700274 */
275struct cam_isp_resource_hfr_config {
Harsh Shah9d676dd2017-08-30 16:30:04 -0700276 uint32_t num_ports;
Pavan Kumar Chilamkurthi649cdf92017-08-15 01:40:57 -0700277 uint32_t reserved;
Harsh Shah9d676dd2017-08-30 16:30:04 -0700278 struct cam_isp_port_hfr_config port_hfr_config[1];
Harsh Shah29102392017-09-21 16:01:47 -0700279} __attribute__((packed));
Pavan Kumar Chilamkurthi649cdf92017-08-15 01:40:57 -0700280
Ravikishore Pampanaff6132e2017-07-27 15:32:31 +0530281/**
282 * struct cam_isp_dual_split_params - dual isp spilt parameters
283 *
284 * @split_point: Split point information x, where (0 < x < width)
285 * left ISP's input ends at x + righ padding and
286 * Right ISP's input starts at x - left padding
287 * @right_padding: Padding added past the split point for left
288 * ISP's input
289 * @left_padding: Padding added before split point for right
290 * ISP's input
291 * @reserved: Reserved filed for alignment
292 *
293 */
294struct cam_isp_dual_split_params {
295 uint32_t split_point;
296 uint32_t right_padding;
297 uint32_t left_padding;
298 uint32_t reserved;
299};
300
301/**
302 * struct cam_isp_dual_stripe_config - stripe config per bus client
303 *
304 * @offset: Start horizontal offset relative to
305 * output buffer
306 * In UBWC mode, this value indicates the H_INIT
307 * value in pixel
308 * @width: Width of the stripe in bytes
309 * @tileconfig Ubwc meta tile config. Contain the partial
310 * tile info
311 * @port_id: port id of ISP output
312 *
313 */
314struct cam_isp_dual_stripe_config {
315 uint32_t offset;
316 uint32_t width;
317 uint32_t tileconfig;
318 uint32_t port_id;
319};
320
321/**
322 * struct cam_isp_dual_config - dual isp configuration
323 *
324 * @num_ports Number of isp output ports
325 * @reserved Reserved field for alignment
326 * @split_params: Inpput split parameters
327 * @stripes: Stripe information
328 *
329 */
330struct cam_isp_dual_config {
331 uint32_t num_ports;
332 uint32_t reserved;
333 struct cam_isp_dual_split_params split_params;
334 struct cam_isp_dual_stripe_config stripes[1];
Harsh Shah29102392017-09-21 16:01:47 -0700335} __attribute__((packed));
336
337/**
338 * struct cam_isp_clock_config - Clock configuration
339 *
340 * @usage_type: Usage type (Single/Dual)
341 * @num_rdi: Number of RDI votes
342 * @left_pix_hz: Pixel Clock for Left ISP
343 * @right_pix_hz: Pixel Clock for Right ISP, valid only if Dual
344 * @rdi_hz: RDI Clock. ISP clock will be max of RDI and
345 * PIX clocks. For a particular context which ISP
346 * HW the RDI is allocated to is not known to UMD.
347 * Hence pass the clock and let KMD decide.
348 */
349struct cam_isp_clock_config {
350 uint32_t usage_type;
351 uint32_t num_rdi;
352 uint64_t left_pix_hz;
353 uint64_t right_pix_hz;
354 uint64_t rdi_hz[1];
355} __attribute__((packed));
356
357/**
Raja Mallik70d8a932018-12-13 16:22:43 +0530358 * struct cam_isp_csid_clock_config - CSID clock configuration
359 *
360 * @csid_clock CSID clock
361 */
362struct cam_isp_csid_clock_config {
363 uint64_t csid_clock;
364} __attribute__((packed));
365
366/**
Harsh Shah29102392017-09-21 16:01:47 -0700367 * struct cam_isp_bw_vote - Bandwidth vote information
368 *
369 * @resource_id: Resource ID
370 * @reserved: Reserved field for alignment
371 * @cam_bw_bps: Bandwidth vote for CAMNOC
372 * @ext_bw_bps: Bandwidth vote for path-to-DDR after CAMNOC
373 */
Harsh Shah29102392017-09-21 16:01:47 -0700374struct cam_isp_bw_vote {
375 uint32_t resource_id;
376 uint32_t reserved;
377 uint64_t cam_bw_bps;
378 uint64_t ext_bw_bps;
379} __attribute__((packed));
380
381/**
382 * struct cam_isp_bw_config - Bandwidth configuration
383 *
384 * @usage_type: Usage type (Single/Dual)
385 * @num_rdi: Number of RDI votes
386 * @left_pix_vote: Bandwidth vote for left ISP
387 * @right_pix_vote: Bandwidth vote for right ISP
388 * @rdi_vote: RDI bandwidth requirements
389 */
Harsh Shah29102392017-09-21 16:01:47 -0700390struct cam_isp_bw_config {
391 uint32_t usage_type;
392 uint32_t num_rdi;
393 struct cam_isp_bw_vote left_pix_vote;
394 struct cam_isp_bw_vote right_pix_vote;
395 struct cam_isp_bw_vote rdi_vote[1];
396} __attribute__((packed));
Ravikishore Pampanaff6132e2017-07-27 15:32:31 +0530397
Raja Mallik8b88b232019-04-04 14:32:27 +0530398
399/**
400 * struct cam_isp_bw_config_ab - Bandwidth configuration
401 *
402 * @usage_type: Usage type (Single/Dual)
403 * @num_rdi: Number of RDI votes
404 * @left_pix_vote_ab: AB Bandwidth vote for left ISP
405 * @right_pix_vote_ab: AB Bandwidth vote for right ISP
406 * @rdi_vote_ab: AB RDI bandwidth requirements
407 */
408
409struct cam_isp_bw_config_ab {
410 uint32_t usage_type;
411 uint32_t num_rdi;
412 uint64_t left_pix_vote_ab;
413 uint64_t right_pix_vote_ab;
414 uint64_t rdi_vote_ab[1];
415} __attribute__((packed));
416
Raja Mallikfe46d932019-02-12 20:34:07 +0530417/**
Raja Mallik477ca242019-06-21 14:23:32 +0530418 * struct cam_isp_bw_config_v2 - Bandwidth configuration
419 *
420 * @usage_type: Usage type (Single/Dual)
421 * @num_paths: Number of axi data paths
422 * @axi_path Per path vote info
423 */
424struct cam_isp_bw_config_v2 {
425 uint32_t usage_type;
426 uint32_t num_paths;
427 struct cam_axi_per_path_bw_vote axi_path[1];
428} __attribute__((packed));
429
430/**
Raja Mallikfe46d932019-02-12 20:34:07 +0530431 * struct cam_fe_config - Fetch Engine configuration
432 *
433 * @version: fetch engine veriosn
434 * @min_vbi: require min vbi
435 * @fs_mode: indicates if fs mode enabled
436 * @fs_line_sync_en: frame level sync or line level
437 * sync for fetch engine
438 * @hbi_count: hbi count
439 * @fs_sync_enable: indicates if fetch engine working
440 * wokring in sync with write engine
441 * @go_cmd_sel: softwrae go_cmd or hw go_cmd
442 * @client_enable: enable read engine
443 * @source_addr: adrress of buffer to read from
444 * @width: buffer width
445 * @height: buffer height
446 * @stride: buffer stride (here equal to width)
447 * @format: format of image in buffer
448 * @unpacker_cfg: unpacker config type
449 * @latency_buf_size: latency buffer for read engine
450 */
451struct cam_fe_config {
452 uint64_t version;
453 uint32_t min_vbi;
454 uint32_t fs_mode;
455 uint32_t fs_line_sync_en;
456 uint32_t hbi_count;
457 uint32_t fs_sync_enable;
458 uint32_t go_cmd_sel;
459 uint32_t client_enable;
460 uint32_t source_addr;
461 uint32_t width;
462 uint32_t height;
463 uint32_t stride;
464 uint32_t format;
465 uint32_t unpacker_cfg;
466 uint32_t latency_buf_size;
467} __attribute__((packed));
Raja Mallik70d8a932018-12-13 16:22:43 +0530468
Raja Mallike3ed1a32019-08-22 17:12:32 +0530469/**
470 * struct cam_isp_sensor_path_dimension
471 *
472 * @width expected width
473 * @height expected height
474 * @measure_enabled flag to indicate if pixel measurement is to be enabled
475 */
476struct cam_isp_sensor_dimension {
477 uint32_t width;
478 uint32_t height;
479 uint32_t measure_enabled;
480} __attribute__((packed));
481
482/**
483 * struct cam_isp_sensor_config - Sensor Dimension configuration
484 *
485 * @pix_path: expected ppp path configuration
486 * @pix_path: expected ipp path configuration
487 * @rdi_path: expected rdi path configuration
488 * @hbi: HBI value
489 * @vbi: VBI value
490 */
491struct cam_isp_sensor_config {
492 struct cam_isp_sensor_dimension ppp_path;
493 struct cam_isp_sensor_dimension ipp_path;
494 struct cam_isp_sensor_dimension rdi_path[4];
495 uint32_t hbi;
496 uint32_t vbi;
497} __attribute__((packed));
498
Raja Mallik70d8a932018-12-13 16:22:43 +0530499/* Acquire Device/HW v2 */
500
501/**
502 * struct cam_isp_acquire_hw_info - ISP acquire HW params
503 *
504 * @common_info_version : Version of common info struct used
505 * @common_info_size : Size of common info struct used
506 * @common_info_offset : Offset of common info from start of data
507 * @num_inputs : Number of inputs
508 * @input_info_version : Version of input info struct used
509 * @input_info_size : Size of input info struct used
510 * @input_info_offset : Offset of input info from start of data
511 * @data : Start of data region
512 */
513struct cam_isp_acquire_hw_info {
514 uint16_t common_info_version;
515 uint16_t common_info_size;
516 uint32_t common_info_offset;
517 uint32_t num_inputs;
518 uint32_t input_info_version;
519 uint32_t input_info_size;
520 uint32_t input_info_offset;
521 uint64_t data;
522};
523
Raja Mallike3ed1a32019-08-22 17:12:32 +0530524/**
525 * struct cam_fps_config - FPS blob support
526 *
527 * @fps: FPS value
528 */
529struct cam_fps_config {
530 uint32_t fps;
531} __attribute__((packed));
532
Raja Mallik70d8a932018-12-13 16:22:43 +0530533#define CAM_ISP_ACQUIRE_COMMON_VER0 0x1000
534
535#define CAM_ISP_ACQUIRE_COMMON_SIZE_VER0 0x0
536
537#define CAM_ISP_ACQUIRE_INPUT_VER0 0x2000
538
539#define CAM_ISP_ACQUIRE_OUT_VER0 0x3000
540
Raja Mallik477ca242019-06-21 14:23:32 +0530541/**
542 * struct cam_isp_init_frame_drop_config - init frame drop configuration
543 *
544 * @init_frame_drop: Initial number of frames needs to drop
545 */
546
547struct cam_isp_init_frame_drop_config {
548 uint32_t init_frame_drop;
549} __attribute__((packed));
550
Jing Zhou8184f312017-01-31 14:06:30 -0800551#endif /* __UAPI_CAM_ISP_H__ */