1 #ifndef __UAPI_CAM_SENSOR_H__ 2 #define __UAPI_CAM_SENSOR_H__ 3 4 #include <linux/types.h> 5 #include <linux/ioctl.h> 6 #include <media/cam_defs.h> 7 8 #define CAM_SENSOR_PROBE_CMD (CAM_COMMON_OPCODE_MAX + 1) 9 #define CAM_FLASH_MAX_LED_TRIGGERS 3 10 #define MAX_OIS_NAME_SIZE 32 11 #define CAM_CSIPHY_SECURE_MODE_ENABLED 1 12 13 #ifdef CONFIG_BOARD_SUNFISH 14 #define CAM_IR_LED_SUPPORTED 15 #endif /*CONFIG_BOARD_SUNFISH*/ 16 17 #ifdef CONFIG_BOARD_FLORAL 18 #define MAX_RAINBOW_CONFIG_SIZE 32 19 20 enum rainbow_op_type { 21 RAINBOW_SEQ_READ, 22 RAINBOW_RANDOM_READ, 23 RAINBOW_SEQ_WRITE, 24 RAINBOW_RANDOM_WRITE 25 }; 26 27 enum strobe_type { 28 STROBE_ALTERNATIVE, 29 STROBE_SYNCHRONIZE, 30 STROBE_NONE 31 }; 32 33 enum silego_self_test_result_type { 34 SILEGO_TEST_FAILED, 35 SILEGO_TEST_PASS, 36 SILEGO_TEST_BYPASS 37 }; 38 39 struct rainbow_config { 40 enum rainbow_op_type operation; 41 uint32_t size; 42 uint32_t reg_addr[MAX_RAINBOW_CONFIG_SIZE]; 43 uint32_t reg_data[MAX_RAINBOW_CONFIG_SIZE]; 44 } __attribute__((packed)); 45 46 struct silego_self_test_result { 47 enum silego_self_test_result_type result; 48 bool is_cracked; 49 } __attribute__((packed)); 50 51 #define RAINBOW_CONFIG \ 52 _IOWR('R', 1, struct rainbow_config) 53 54 #define LM36011_SET_CERTIFICATION_STATUS \ 55 _IOWR('R', 1, bool) 56 57 #define LM36011_SILEGO_SELF_TEST \ 58 _IOWR('R', 1, struct silego_self_test_result) 59 60 #endif /*CONFIG_BOARD_FLORAL*/ 61 62 struct cam_sensor_query_cap { 63 uint32_t slot_info; 64 uint32_t secure_camera; 65 uint32_t pos_pitch; 66 uint32_t pos_roll; 67 uint32_t pos_yaw; 68 uint32_t actuator_slot_id; 69 uint32_t eeprom_slot_id; 70 uint32_t ois_slot_id; 71 uint32_t flash_slot_id; 72 uint32_t csiphy_slot_id; 73 #ifdef CONFIG_BOARD_SUNFISH 74 int32_t ir_led_slot_id; 75 #endif /*CONFIG_BOARD_SUNFISH*/ 76 } __attribute__((packed)); 77 78 struct cam_csiphy_query_cap { 79 uint32_t slot_info; 80 uint32_t version; 81 uint32_t clk_lane; 82 uint32_t reserved; 83 } __attribute__((packed)); 84 85 struct cam_actuator_query_cap { 86 uint32_t slot_info; 87 uint32_t reserved; 88 } __attribute__((packed)); 89 90 struct cam_eeprom_query_cap_t { 91 uint32_t slot_info; 92 uint16_t eeprom_kernel_probe; 93 uint16_t reserved; 94 } __attribute__((packed)); 95 96 struct cam_ois_query_cap_t { 97 uint32_t slot_info; 98 uint16_t reserved; 99 } __attribute__((packed)); 100 101 struct cam_cmd_i2c_info { 102 uint16_t slave_addr; 103 uint8_t i2c_freq_mode; 104 uint8_t cmd_type; 105 } __attribute__((packed)); 106 107 struct cam_cmd_get_ois_data { 108 uint32_t reg_addr; 109 uint32_t reg_data; 110 uint64_t query_size_handle; 111 uint64_t query_data_handle; 112 } __attribute__((packed)); 113 114 struct cam_ois_shift { 115 int16_t ois_shift_x; 116 int16_t ois_shift_y; 117 int16_t af_lop1; 118 int64_t time_readout; 119 } __attribute__((packed)); 120 121 struct cam_ois_opcode { 122 uint32_t prog; 123 uint32_t coeff; 124 uint32_t pheripheral; 125 uint32_t memory; 126 } __attribute__((packed)); 127 128 struct cam_cmd_ois_info { 129 uint16_t slave_addr; 130 uint8_t i2c_freq_mode; 131 uint8_t cmd_type; 132 uint8_t ois_fw_flag; 133 uint8_t is_ois_calib; 134 char ois_name[MAX_OIS_NAME_SIZE]; 135 struct cam_ois_opcode opcode; 136 } __attribute__((packed)); 137 138 struct cam_cmd_probe { 139 uint8_t data_type; 140 uint8_t addr_type; 141 uint8_t op_code; 142 uint8_t cmd_type; 143 uint32_t reg_addr; 144 uint32_t expected_data; 145 uint32_t data_mask; 146 uint16_t camera_id; 147 uint8_t fw_update_flag; 148 uint16_t reserved; 149 } __attribute__((packed)); 150 151 struct cam_power_settings { 152 uint16_t power_seq_type; 153 uint16_t reserved; 154 uint32_t config_val_low; 155 uint32_t config_val_high; 156 } __attribute__((packed)); 157 158 struct cam_cmd_power { 159 uint16_t count; 160 uint8_t reserved; 161 uint8_t cmd_type; 162 struct cam_power_settings power_settings[1]; 163 } __attribute__((packed)); 164 165 struct i2c_rdwr_header { 166 uint16_t count; 167 uint8_t op_code; 168 uint8_t cmd_type; 169 uint8_t data_type; 170 uint8_t addr_type; 171 172 #ifdef CONFIG_BOARD_FLORAL 173 uint16_t slave_addr; 174 #endif /*CONFIG_BOARD_FLORAL*/ 175 #ifdef CONFIG_BOARD_SUNFISH 176 int16_t reserved; 177 #endif /*CONFIG_BOARD_SUNFISH*/ 178 } __attribute__((packed)); 179 180 struct i2c_random_wr_payload { 181 uint32_t reg_addr; 182 uint32_t reg_data; 183 } __attribute__((packed)); 184 185 struct cam_cmd_i2c_random_wr { 186 struct i2c_rdwr_header header; 187 struct i2c_random_wr_payload random_wr_payload[1]; 188 } __attribute__((packed)); 189 190 struct cam_cmd_read { 191 uint32_t reg_data; 192 uint32_t reserved; 193 } __attribute__((packed)); 194 195 struct cam_cmd_i2c_continuous_wr { 196 struct i2c_rdwr_header header; 197 uint32_t reg_addr; 198 struct cam_cmd_read data_read[1]; 199 } __attribute__((packed)); 200 201 struct cam_cmd_i2c_random_rd { 202 struct i2c_rdwr_header header; 203 struct cam_cmd_read data_read[1]; 204 } __attribute__((packed)); 205 206 struct cam_cmd_i2c_continuous_rd { 207 struct i2c_rdwr_header header; 208 uint32_t reg_addr; 209 } __attribute__((packed)); 210 211 struct cam_cmd_conditional_wait { 212 uint8_t data_type; 213 uint8_t addr_type; 214 uint8_t op_code; 215 uint8_t cmd_type; 216 uint16_t timeout; 217 uint16_t reserved; 218 uint32_t reg_addr; 219 uint32_t reg_data; 220 uint32_t data_mask; 221 } __attribute__((packed)); 222 223 struct cam_cmd_unconditional_wait { 224 int16_t delay; 225 uint8_t op_code; 226 uint8_t cmd_type; 227 } __attribute__((packed)); 228 229 struct cam_csiphy_info { 230 uint16_t lane_mask; 231 uint16_t lane_assign; 232 uint8_t csiphy_3phase; 233 uint8_t combo_mode; 234 uint8_t lane_cnt; 235 uint8_t secure_mode; 236 uint64_t settle_time; 237 uint64_t data_rate; 238 } __attribute__((packed)); 239 240 struct cam_csiphy_acquire_dev_info { 241 uint32_t combo_mode; 242 uint32_t reserved; 243 } __attribute__((packed)); 244 245 struct cam_sensor_acquire_dev { 246 uint32_t session_handle; 247 uint32_t device_handle; 248 uint32_t handle_type; 249 uint32_t reserved; 250 uint64_t info_handle; 251 } __attribute__((packed)); 252 253 struct cam_sensor_streamon_dev { 254 uint32_t session_handle; 255 uint32_t device_handle; 256 uint32_t handle_type; 257 uint32_t reserved; 258 uint64_t info_handle; 259 } __attribute__((packed)); 260 261 struct cam_cmd_get_sensor_data { 262 uint32_t reg_addr; 263 uint32_t reg_data; 264 uint64_t query_size_handle; 265 uint64_t query_data_handle; 266 } __attribute__((packed)); 267 268 struct cam_flash_init { 269 uint8_t flash_type; 270 uint16_t reserved; 271 uint8_t cmd_type; 272 } __attribute__((packed)); 273 274 struct cam_flash_set_rer { 275 uint16_t count; 276 uint8_t opcode; 277 uint8_t cmd_type; 278 uint16_t num_iteration; 279 uint16_t reserved; 280 uint32_t led_on_delay_ms; 281 uint32_t led_off_delay_ms; 282 uint32_t led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS]; 283 } __attribute__((packed)); 284 285 struct cam_flash_set_on_off { 286 uint16_t count; 287 uint8_t opcode; 288 uint8_t cmd_type; 289 uint32_t led_current_ma[CAM_FLASH_MAX_LED_TRIGGERS]; 290 } __attribute__((packed)); 291 292 struct cam_flash_query_curr { 293 uint16_t reserved; 294 uint8_t opcode; 295 uint8_t cmd_type; 296 uint32_t query_current_ma; 297 } __attribute__ ((packed)); 298 299 struct cam_flash_query_cap_info { 300 uint32_t slot_info; 301 uint32_t max_current_flash[CAM_FLASH_MAX_LED_TRIGGERS]; 302 uint32_t max_duration_flash[CAM_FLASH_MAX_LED_TRIGGERS]; 303 uint32_t max_current_torch[CAM_FLASH_MAX_LED_TRIGGERS]; 304 } __attribute__ ((packed)); 305 306 #ifdef CONFIG_BOARD_SUNFISH 307 308 struct cam_ir_led_query_cap_info { 309 uint32_t slot_info; 310 } __attribute__ ((packed)); 311 312 struct cam_ir_led_set_on_off { 313 uint16_t reserved; 314 uint8_t opcode; 315 uint8_t cmd_type; 316 uint32_t ir_led_intensity; 317 uint32_t pwm_duty_on_ns; 318 uint32_t pwm_period_ns; 319 } __attribute__((packed)); 320 321 #endif /*CONFIG_BOARD_SUNFISH*/ 322 323 #endif 324