1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ 2 /* 3 * Copyright (c) 2019, The Linux Foundation. All rights reserved. 4 */ 5 6 #ifndef __UAPI_CAM_CUSTOM_H__ 7 #define __UAPI_CAM_CUSTOM_H__ 8 9 #include "cam_defs.h" 10 11 /* Custom driver name */ 12 #define CAM_CUSTOM_DEV_NAME "cam-custom" 13 14 #define CAM_CUSTOM_NUM_SUB_DEVICES 2 15 16 /* HW type */ 17 #define CAM_CUSTOM_HW1 0 18 #define CAM_CUSTOM_HW2 1 19 20 /* output path resource id's */ 21 #define CAM_CUSTOM_OUT_RES_UDI_0 1 22 #define CAM_CUSTOM_OUT_RES_UDI_1 2 23 #define CAM_CUSTOM_OUT_RES_UDI_2 3 24 25 /* input resource for custom hw */ 26 #define CAM_CUSTOM_IN_RES_UDI_0 1 27 28 /* Resource ID */ 29 #define CAM_CUSTOM_RES_ID_PORT 0 30 31 /* Packet opcode for Custom */ 32 #define CAM_CUSTOM_PACKET_OP_BASE 0 33 #define CAM_CUSTOM_PACKET_INIT_DEV 1 34 #define CAM_CUSTOM_PACKET_UPDATE_DEV 2 35 #define CAM_CUSTOM_PACKET_OP_MAX 3 36 37 /* max number of vc-dt cfg for a given input */ 38 #define CAM_CUSTOM_VC_DT_CFG_MAX 4 39 40 /* phy input resource types */ 41 #define CAM_CUSTOM_IN_RES_BASE 0x5000 42 #define CAM_CUSTOM_IN_RES_PHY_0 (CAM_CUSTOM_IN_RES_BASE + 1) 43 #define CAM_CUSTOM_IN_RES_PHY_1 (CAM_CUSTOM_IN_RES_BASE + 2) 44 #define CAM_CUSTOM_IN_RES_PHY_2 (CAM_CUSTOM_IN_RES_BASE + 3) 45 #define CAM_CUSTOM_IN_RES_PHY_3 (CAM_CUSTOM_IN_RES_BASE + 4) 46 47 /* Query devices */ 48 /** 49 * struct cam_custom_dev_cap_info - A cap info for particular hw type 50 * 51 * @hw_type: Custom HW type 52 * @hw_version: Hardware version 53 * 54 */ 55 struct cam_custom_dev_cap_info { 56 uint32_t hw_type; 57 uint32_t hw_version; 58 }; 59 60 /** 61 * struct cam_custom_query_cap_cmd - Custom HW query device capability payload 62 * 63 * @device_iommu: returned iommu handles for device 64 * @cdm_iommu: returned iommu handles for cdm 65 * @num_dev: returned number of device capabilities 66 * @reserved: reserved field for alignment 67 * @dev_caps: returned device capability array 68 * 69 */ 70 struct cam_custom_query_cap_cmd { 71 struct cam_iommu_handle device_iommu; 72 struct cam_iommu_handle cdm_iommu; 73 int32_t num_dev; 74 uint32_t reserved; 75 struct cam_custom_dev_cap_info dev_caps[CAM_CUSTOM_NUM_SUB_DEVICES]; 76 }; 77 78 /* Acquire Device */ 79 /** 80 * struct cam_custom_out_port_info - An output port resource info 81 * 82 * @res_type: output resource type 83 * @format: output format of the resource 84 * @custom_info 1-3: custom params 85 * @reserved: reserved field for alignment 86 * 87 */ 88 struct cam_custom_out_port_info { 89 uint32_t res_type; 90 uint32_t format; 91 uint32_t custom_info1; 92 uint32_t custom_info2; 93 uint32_t custom_info3; 94 uint32_t reserved; 95 }; 96 97 /** 98 * struct cam_custom_in_port_info - An input port resource info 99 * 100 * @res_type: input resource type 101 * @lane_type: lane type: c-phy or d-phy. 102 * @lane_num: active lane number 103 * @lane_cfg: lane configurations: 4 bits per lane 104 * @vc: input virtual channel number 105 * @dt: input data type number 106 * @num_valid_vc_dt: number of valid vc-dt 107 * @format: input format 108 * @test_pattern: test pattern for the testgen 109 * @usage_type: whether dual vfe is required 110 * @left_start: left input start offset in pixels 111 * @left_stop: left input stop offset in pixels 112 * @left_width: left input width in pixels 113 * @right_start: right input start offset in pixels. 114 * @right_stop: right input stop offset in pixels. 115 * @right_width: right input width in pixels. 116 * @line_start: top of the line number 117 * @line_stop: bottome of the line number 118 * @height: input height in lines 119 * @pixel_clk; sensor output clock 120 * @num_out_byte: number of valid output bytes per cycle 121 * @custom_info1: custom_info1 122 * @custom_info2: custom info 2 123 * @num_out_res: number of the output resource associated 124 * @data: payload that contains the output resources 125 * 126 */ 127 struct cam_custom_in_port_info { 128 uint32_t res_type; 129 uint32_t lane_type; 130 uint32_t lane_num; 131 uint32_t lane_cfg; 132 uint32_t vc[CAM_CUSTOM_VC_DT_CFG_MAX]; 133 uint32_t dt[CAM_CUSTOM_VC_DT_CFG_MAX]; 134 uint32_t num_valid_vc_dt; 135 uint32_t format; 136 uint32_t test_pattern; 137 uint32_t usage_type; 138 uint32_t left_start; 139 uint32_t left_stop; 140 uint32_t left_width; 141 uint32_t right_start; 142 uint32_t right_stop; 143 uint32_t right_width; 144 uint32_t line_start; 145 uint32_t line_stop; 146 uint32_t height; 147 uint32_t pixel_clk; 148 uint32_t num_bytes_out; 149 uint32_t custom_info1; 150 uint32_t custom_info2; 151 uint32_t num_out_res; 152 struct cam_custom_out_port_info data[1]; 153 }; 154 155 /** 156 * struct cam_custom_resource - A resource bundle 157 * 158 * @resource_id: resource id for the resource bundle 159 * @length: length of the while resource blob 160 * @handle_type: type of the resource handle 161 * @reserved: reserved field for alignment 162 * @res_hdl: resource handle that points to the 163 * resource array; 164 */ 165 struct cam_custom_resource { 166 uint32_t resource_id; 167 uint32_t length; 168 uint32_t handle_type; 169 uint32_t reserved; 170 uint64_t res_hdl; 171 }; 172 173 /** 174 * struct cam_custom_acquire_hw_info - Custom acquire HW params 175 * 176 * @num_inputs : Number of inputs 177 * @input_info_size : Size of input info struct used 178 * @input_info_offset : Offset of input info from start of data 179 * @reserved : reserved 180 * @data : Start of data region 181 */ 182 struct cam_custom_acquire_hw_info { 183 uint32_t num_inputs; 184 uint32_t input_info_size; 185 uint32_t input_info_offset; 186 uint32_t reserved; 187 uint64_t data; 188 }; 189 190 /** 191 * struct cam_custom_cmd_buf_type_1 - cmd buf type 1 192 * 193 * @custom_info: custom info 194 * @reserved: reserved 195 */ 196 struct cam_custom_cmd_buf_type_1 { 197 uint32_t custom_info; 198 uint32_t reserved; 199 }; 200 201 /** 202 * struct cam_custom_cmd_buf_type_2 - cmd buf type 2 203 * 204 * @custom_info1: Custom info 1 205 * @custom_info2: Custom info 2 206 * @custom_info3: Custom info 3 207 * @reserved: reserved 208 */ 209 struct cam_custom_cmd_buf_type_2 { 210 uint32_t custom_info1; 211 uint32_t custom_info2; 212 uint32_t custom_info3; 213 uint32_t reserved; 214 }; 215 #endif /* __UAPI_CAM_CUSTOM_H__ */ 216