Other Parts Discussed in Thread: ALP
高通845 linux,OX03C10 + DS90UB953 + DS90UB954。直接连接03C10可以正常使用。连接954、953后报 SOF Freeze。954和953配置如下。
int main(int argc, char *argv[])
{
if (Hardware::PC())
{
printf("exiting, camerad is not meant to run on PC\n");
return 0;
}
int ret = util::set_realtime_priority(53);
assert(ret == 0);
ret = util::set_core_affinity({6});
assert(ret == 0 || Params().getBool("IsOffroad")); // failure ok while offroad due to offlining cores
// camerad_thread();
LOGE("-- UB954 TEST --");
LOGE("-- Opening devices");
// video0 is req_mgr, the target of many ioctls
cameras.video0_fd = HANDLE_EINTR(open("/dev/v4l/by-path/platform-soc:qcom_cam-req-mgr-video-index0", O_RDWR | O_NONBLOCK));
assert(cameras.video0_fd >= 0);
LOGE("opened video0");
// video1 is cam_sync, the target of some ioctls
cameras.cam_sync_fd = HANDLE_EINTR(open("/dev/v4l/by-path/platform-cam_sync-video-index0", O_RDWR | O_NONBLOCK));
assert(cameras.cam_sync_fd >= 0);
LOGE("opened video1 (cam_sync)");
// looks like there'cameras only one of these
cameras.isp_fd = open_v4l_by_name_and_index("cam-isp");
assert(cameras.isp_fd >= 0);
LOGE("opened isp");
// query icp for MMU handles
LOGE("-- Query ICP for MMU handles");
struct cam_isp_query_cap_cmd isp_query_cap_cmd = {0};
struct cam_query_cap_cmd query_cap_cmd = {0};
query_cap_cmd.handle_type = 1;
query_cap_cmd.caps_handle = (uint64_t)&isp_query_cap_cmd;
query_cap_cmd.size = sizeof(isp_query_cap_cmd);
ret = do_cam_control(cameras.isp_fd, CAM_QUERY_CAP, &query_cap_cmd, sizeof(query_cap_cmd));
assert(ret == 0);
LOGE("using MMU handle: %x", isp_query_cap_cmd.device_iommu.non_secure);
LOGE("using MMU handle: %x", isp_query_cap_cmd.cdm_iommu.non_secure);
cameras.device_iommu = isp_query_cap_cmd.device_iommu.non_secure;
cameras.cdm_iommu = isp_query_cap_cmd.cdm_iommu.non_secure;
// subscribe
LOG("-- Subscribing");
struct v4l2_event_subscription sub = {0};
sub.type = V4L_EVENT_CAM_REQ_MGR_EVENT;
sub.id = V4L_EVENT_CAM_REQ_MGR_SOF_BOOT_TS;
ret = HANDLE_EINTR(ioctl(cameras.video0_fd, VIDIOC_SUBSCRIBE_EVENT, &sub));
LOGE("req mgr subscribe: %d", ret);
sensor_fd = open_v4l_by_name_and_index("cam-sensor-driver", 1);
assert(sensor_fd >= 0);
LOGE("TIAN opened sensor for %d", 1);
// init memorymanager for this camera
mm.init(cameras.video0_fd);
LOGE("-- Probing sensor %d", 1);
ret = sensors_init(0x60, 0x1E);
if (ret != 0)
{
LOGE("init failed----");
return 0;
}
// create session
struct cam_req_mgr_session_info session_info = {};
ret = do_cam_control(cameras.video0_fd, CAM_REQ_MGR_CREATE_SESSION, &session_info, sizeof(session_info));
LOGE("get session: %d 0x%X", ret, session_info.session_hdl);
session_handle = session_info.session_hdl;
// access the sensor
LOGE("-- Accessing sensor");
auto sensor_dev_handle_ = device_acquire(sensor_fd, session_handle, nullptr);
assert(sensor_dev_handle_);
sensor_dev_handle = *sensor_dev_handle_;
LOGE("acquire sensor dev");
LOGE("-- Configuring sensor");
ret = i2c_compare(0x00, 0x60);
ret = i2c_write(0x4C, 0x01); // select port 0,依赖与硬件设计
ret = i2c_write(0x0C, 0x01); // enable port0
ret = i2c_write(0x6D, 0x7C);
ret = i2c_write(0x58, 0x5E); //i2c PASS-THROUGH 该寄存器直接导致I2c是否能通过954透传给953或者sensor
ret = i2c_write(0x5C, 0x30); //953 i2c addr
ret = i2c_write(0x5D, 0x6C); // sensor ox03c10 i2c addr
ret = i2c_write(0x65, 0x6C); // sensor i2c addr
ret = i2c_write(0x20, 0x20); //FWD_CTL1 很重要,Forwarding enabled for RX Port 0
ret = i2c_write(0x7C, 0x81);
ret = i2c_write(0x70, 0x1E);
ret = i2c_write(0x33, 0x03); //4 lanes
ret = i2c_compare(0x04, 0xCF);
ret = sensors_init(0x30, 0x73);
if (ret != 0)
{
ret = sensors_init(0x30, 0x33);
if (ret != 0)
{
LOGE("init failed----");
return 0;
}
}
ret = i2c_compare(0x00, 0x30);
ret = i2c_write(0x0E, 0xF0); //enable gpio out
ret = i2c_write(0x0D, 0x00); //gpio out LOW
ret = i2c_write(0x06, 0x81); //HS 16 M=1
ret = i2c_write(0x07, 0x05); //N=5
ret = i2c_write(0x03, 0x5A); //很重要,异步模式CSI-2 Non-synchronous external clock Mode
ret = i2c_write(0x02, 0x73); //continues clock ,4 lane
ret = i2c_write(0x0D, 0x04); //gpio HIGH 0x03c10 sensor 使能
return 0;
}
报错如下

ALP显示,镜头配置的分辨率为1928*1208
