camerad: IFE config definitions (#33624)

* camerad: more definitions for IFE config

* comment
pull/33626/head
Adeeb Shihadeh 7 months ago committed by GitHub
parent d5039bcbbe
commit 62d044c794
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 18
      system/camerad/cameras/spectra.cc
  2. 11
      system/camerad/cameras/spectra.h

@ -302,7 +302,7 @@ int SpectraCamera::sensors_init() {
auto pkt = mm.alloc<struct cam_packet>(size, &cam_packet_handle);
pkt->num_cmd_buf = 2;
pkt->kmd_cmd_buf_index = -1;
pkt->header.op_code = 0x1000000 | CAM_SENSOR_PACKET_OPCODE_SENSOR_PROBE;
pkt->header.op_code = CSLDeviceTypeImageSensor | CAM_SENSOR_PACKET_OPCODE_SENSOR_PROBE;
pkt->header.size = size;
struct cam_cmd_buf_desc *buf_desc = (struct cam_cmd_buf_desc *)&pkt->payload;
@ -391,7 +391,11 @@ int SpectraCamera::sensors_init() {
return ret;
}
void SpectraCamera::config_isp(int io_mem_handle, int fence, int request_id, int buf0_idx) {
void SpectraCamera::config_ife(int io_mem_handle, int fence, int request_id, int buf0_idx) {
/*
Handles initial + per-frame IFE config.
IFE = Image Front End
*/
int size = sizeof(struct cam_packet) + sizeof(struct cam_cmd_buf_desc)*2;
if (io_mem_handle != 0) {
size += sizeof(struct cam_buf_io_cfg);
@ -401,10 +405,10 @@ void SpectraCamera::config_isp(int io_mem_handle, int fence, int request_id, int
auto pkt = mm.alloc<struct cam_packet>(size, &cam_packet_handle);
if (io_mem_handle != 0) {
pkt->header.op_code = 0xf000001;
pkt->header.op_code = CSLDeviceTypeIFE | OpcodesIFEUpdate; // 0xf000001
pkt->header.request_id = request_id;
} else {
pkt->header.op_code = 0xf000000;
pkt->header.op_code = CSLDeviceTypeIFE | OpcodesIFEInitialConfig; // 0xf000000
pkt->header.request_id = 1;
}
pkt->header.size = size;
@ -595,7 +599,7 @@ void SpectraCamera::enqueue_buffer(int i, bool dp) {
sensors_poke(request_id);
// submit request to the ife
config_isp(buf_handle[i], sync_objs[i], request_id, i);
config_ife(buf_handle[i], sync_objs[i], request_id, i);
}
void SpectraCamera::camera_map_bufs() {
@ -710,11 +714,11 @@ void SpectraCamera::configISP() {
isp_dev_handle = *isp_dev_handle_;
LOGD("acquire isp dev");
// config ISP
// config IFE
alloc_w_mmu_hdl(m->video0_fd, FRAME_BUF_COUNT*ALIGNED_SIZE(buf0_size, buf0_alignment), (uint32_t*)&buf0_handle, buf0_alignment,
CAM_MEM_FLAG_HW_READ_WRITE | CAM_MEM_FLAG_KMD_ACCESS | CAM_MEM_FLAG_UMD_ACCESS | CAM_MEM_FLAG_CMD_BUF_TYPE,
m->device_iommu, m->cdm_iommu);
config_isp(0, 0, 1, 0);
config_ife(0, 0, 1, 0);
}
void SpectraCamera::configCSIPHY() {

@ -16,10 +16,17 @@
const int MIPI_SETTLE_CNT = 33; // Calculated by camera_freqs.py
// For use with the Spectra 280 ISP in the SDM845
// For use with the Titan 170 ISP in the SDM845
// https://github.com/commaai/agnos-kernel-sdm845
// CSLDeviceType/CSLPacketOpcodesIFE from camx
// cam_packet_header.op_code = (device << 24) | (opcode);
#define CSLDeviceTypeImageSensor (0x1 << 24)
#define CSLDeviceTypeIFE (0xF << 24)
#define OpcodesIFEInitialConfig 0x0
#define OpcodesIFEUpdate 0x1
std::optional<int32_t> device_acquire(int fd, int32_t session_handle, void *data, uint32_t num_resources=1);
int device_config(int fd, int32_t session_handle, int32_t dev_handle, uint64_t packet_handle);
int device_control(int fd, int op_code, int session_handle, int dev_handle);
@ -69,7 +76,7 @@ public:
void handle_camera_event(const cam_req_mgr_message *event_data);
void camera_close();
void camera_map_bufs();
void config_isp(int io_mem_handle, int fence, int request_id, int buf0_idx);
void config_ife(int io_mem_handle, int fence, int request_id, int buf0_idx);
int clear_req_queue();
void enqueue_buffer(int i, bool dp);

Loading…
Cancel
Save