blob: 9351d2da8201cb1e501070df4de069b2fba9343d [file] [log] [blame]
Lakshmi Narayana Kalavala6efb7cf2017-05-09 17:34:29 -07001#ifndef __UAPI_CAM_ICP_H__
2#define __UAPI_CAM_ICP_H__
3
4#include "cam_defs.h"
5
6/* icp, ipe, bps, cdm(ipe/bps) are used in querycap */
7#define CAM_ICP_DEV_TYPE_A5 1
8#define CAM_ICP_DEV_TYPE_IPE 2
9#define CAM_ICP_DEV_TYPE_BPS 3
10#define CAM_ICP_DEV_TYPE_IPE_CDM 4
11#define CAM_ICP_DEV_TYPE_BPS_CDM 5
12#define CAM_ICP_DEV_TYPE_MAX 5
13
14/* definitions needed for icp aquire device */
15#define CAM_ICP_RES_TYPE_BPS 1
16#define CAM_ICP_RES_TYPE_IPE_RT 2
17#define CAM_ICP_RES_TYPE_IPE 3
18#define CAM_ICP_RES_TYPE_MAX 4
19
20/* packet opcode types */
21#define CAM_ICP_OPCODE_IPE_UPDATE 0
22#define CAM_ICP_OPCODE_BPS_UPDATE 1
23
24/* IPE input port resource type */
25#define CAM_ICP_IPE_INPUT_IMAGE_FULL 0x0
26#define CAM_ICP_IPE_INPUT_IMAGE_DS4 0x1
27#define CAM_ICP_IPE_INPUT_IMAGE_DS16 0x2
28#define CAM_ICP_IPE_INPUT_IMAGE_DS64 0x3
29#define CAM_ICP_IPE_INPUT_IMAGE_FULL_REF 0x4
30#define CAM_ICP_IPE_INPUT_IMAGE_DS4_REF 0x5
31#define CAM_ICP_IPE_INPUT_IMAGE_DS16_REF 0x6
32#define CAM_ICP_IPE_INPUT_IMAGE_DS64_REF 0x7
33
34/* IPE output port resource type */
35#define CAM_ICP_IPE_OUTPUT_IMAGE_DISPLAY 0x8
36#define CAM_ICP_IPE_OUTPUT_IMAGE_VIDEO 0x9
37#define CAM_ICP_IPE_OUTPUT_IMAGE_FULL_REF 0xA
38#define CAM_ICP_IPE_OUTPUT_IMAGE_DS4_REF 0xB
39#define CAM_ICP_IPE_OUTPUT_IMAGE_DS16_REF 0xC
40#define CAM_ICP_IPE_OUTPUT_IMAGE_DS64_REF 0xD
41
42#define CAM_ICP_IPE_IMAGE_MAX 0xE
43
44/* BPS input port resource type */
45#define CAM_ICP_BPS_INPUT_IMAGE 0x0
46
47/* BPS output port resource type */
48#define CAM_ICP_BPS_OUTPUT_IMAGE_FULL 0x1
49#define CAM_ICP_BPS_OUTPUT_IMAGE_DS4 0x2
50#define CAM_ICP_BPS_OUTPUT_IMAGE_DS16 0x3
51#define CAM_ICP_BPS_OUTPUT_IMAGE_DS64 0x4
52#define CAM_ICP_BPS_OUTPUT_IMAGE_STATS_BG 0x5
53#define CAM_ICP_BPS_OUTPUT_IMAGE_STATS_BHIST 0x6
54#define CAM_ICP_BPS_OUTPUT_IMAGE_REG1 0x7
55#define CAM_ICP_BPS_OUTPUT_IMAGE_REG2 0x8
56
57#define CAM_ICP_BPS_IO_IMAGES_MAX 0x9
58
59/**
60 * struct cam_icp_dev_ver - Device information for particular hw type
61 *
62 * This is used to get device version info of
63 * ICP, IPE, BPS and CDM related IPE and BPS from firmware
64 * and use this info in CAM_QUERY_CAP IOCTL
65 *
66 * @dev_type: hardware type for the cap info(icp, ipe, bps, cdm(ipe/bps))
67 * @reserved: reserved field
68 * @hw_ver: major, minor and incr values of a device version
69 */
70struct cam_icp_dev_ver {
71 uint32_t dev_type;
72 uint32_t reserved;
73 struct cam_hw_version hw_ver;
74};
75
76/**
77 * struct cam_icp_ver - ICP version info
78 *
79 * This strcuture is used for fw and api version
80 * this is used to get firmware version and api version from firmware
81 * and use this info in CAM_QUERY_CAP IOCTL
82 *
83 * @major: FW version major
84 * @minor: FW version minor
85 * @revision: FW version increment
86 */
87struct cam_icp_ver {
88 uint32_t major;
89 uint32_t minor;
90 uint32_t revision;
91 uint32_t reserved;
92};
93
94/**
95 * struct cam_icp_query_cap_cmd - ICP query device capability payload
96 *
97 * @dev_iommu_handle: icp iommu handles for secure/non secure modes
98 * @cdm_iommu_handle: iommu handles for secure/non secure modes
99 * @fw_version: firmware version info
100 * @api_version: api version info
101 * @num_ipe: number of ipes
102 * @num_bps: number of bps
103 * @dev_ver: returned device capability array
104 */
105struct cam_icp_query_cap_cmd {
106 struct cam_iommu_handle dev_iommu_handle;
107 struct cam_iommu_handle cdm_iommu_handle;
108 struct cam_icp_ver fw_version;
109 struct cam_icp_ver api_version;
110 uint32_t num_ipe;
111 uint32_t num_bps;
112 struct cam_icp_dev_ver dev_ver[CAM_ICP_DEV_TYPE_MAX];
113};
114
115/**
116 * struct cam_icp_res_info - ICP output resource info
117 *
118 * @format: format of the resource
119 * @width: width in pixels
120 * @height: height in lines
121 * @fps: fps
122 */
123struct cam_icp_res_info {
124 uint32_t format;
125 uint32_t width;
126 uint32_t height;
127 uint32_t fps;
128};
129
130/**
131 * struct cam_icp_acquire_dev_info - An ICP device info
132 *
133 * @scratch_mem_size: Output param - size of scratch memory
134 * @dev_type: device type (IPE_RT/IPE_NON_RT/BPS)
135 * @io_config_cmd_size: size of IO config command
136 * @io_config_cmd_handle: IO config command for each acquire
137 * @secure_mode: camera mode (secure/non secure)
138 * @chain_info: chaining info of FW device handles
139 * @in_res: resource info used for clock and bandwidth calculation
140 * @num_out_res: number of output resources
141 * @out_res: output resource
142 */
143struct cam_icp_acquire_dev_info {
144 uint32_t scratch_mem_size;
145 uint32_t dev_type;
146 uint32_t io_config_cmd_size;
147 int32_t io_config_cmd_handle;
148 uint32_t secure_mode;
149 int32_t chain_info;
150 struct cam_icp_res_info in_res;
151 uint32_t num_out_res;
152 struct cam_icp_res_info out_res[1];
153} __attribute__((__packed__));
154
155#endif /* __UAPI_CAM_ICP_H__ */