@@ -196,9 +196,9 @@ void SpectraMaster::init() {
196196 assert (isp_fd >= 0 );
197197 LOGD (" opened isp" );
198198
199- // icp_fd = open_v4l_by_name_and_index("cam-icp");
200- // assert(icp_fd >= 0);
201- // LOGD("opened icp");
199+ icp_fd = open_v4l_by_name_and_index (" cam-icp" );
200+ assert (icp_fd >= 0 );
201+ LOGD (" opened icp" );
202202
203203 // query ISP for MMU handles
204204 LOG (" -- Query for MMU handles" );
@@ -215,15 +215,13 @@ void SpectraMaster::init() {
215215 cdm_iommu = isp_query_cap_cmd.cdm_iommu .non_secure ;
216216
217217 // query ICP for MMU handles
218- /*
219218 struct cam_icp_query_cap_cmd icp_query_cap_cmd = {0 };
220219 query_cap_cmd.caps_handle = (uint64_t )&icp_query_cap_cmd;
221220 query_cap_cmd.size = sizeof (icp_query_cap_cmd);
222221 ret = do_cam_control (icp_fd, CAM_QUERY_CAP, &query_cap_cmd, sizeof (query_cap_cmd));
223222 assert (ret == 0 );
224223 LOGD (" using ICP MMU handle: %x" , icp_query_cap_cmd.dev_iommu_handle .non_secure );
225224 icp_device_iommu = icp_query_cap_cmd.dev_iommu_handle .non_secure ;
226- */
227225
228226 // subscribe
229227 LOG (" -- Subscribing" );
@@ -712,13 +710,13 @@ void SpectraCamera::enqueue_buffer(int i, bool dp) {
712710 }
713711 sync_objs[i] = sync_create.sync_obj ;
714712
715- /*
716- ret = do_cam_control(m->cam_sync_fd, CAM_SYNC_CREATE, &sync_create, sizeof(sync_create));
717- if (ret != 0) {
718- LOGE("failed to create fence: %d %d", ret, sync_create.sync_obj);
713+ if (icp_dev_handle > 0 ) {
714+ ret = do_cam_control (m->cam_sync_fd , CAM_SYNC_CREATE, &sync_create, sizeof (sync_create));
715+ if (ret != 0 ) {
716+ LOGE (" failed to create fence: %d %d" , ret, sync_create.sync_obj );
717+ }
718+ sync_objs_bps_out[i] = sync_create.sync_obj ;
719719 }
720- sync_objs_bps_out[i] = sync_create.sync_obj;
721- */
722720
723721 // schedule request with camera request manager
724722 struct cam_req_mgr_sched_request req_mgr_sched_request = {0 };
@@ -746,8 +744,10 @@ void SpectraCamera::camera_map_bufs() {
746744 mem_mgr_map_cmd.flags = CAM_MEM_FLAG_HW_READ_WRITE;
747745 mem_mgr_map_cmd.mmu_hdls [0 ] = m->device_iommu ;
748746 mem_mgr_map_cmd.num_hdl = 1 ;
749- // mem_mgr_map_cmd.mmu_hdls[1] = m->icp_device_iommu;
750- // mem_mgr_map_cmd.num_hdl = 2;
747+ if (icp_dev_handle > 0 ) {
748+ mem_mgr_map_cmd.num_hdl = 2 ;
749+ mem_mgr_map_cmd.mmu_hdls [1 ] = m->icp_device_iommu ;
750+ }
751751
752752 if (is_raw) {
753753 // RAW bayer images
@@ -899,8 +899,6 @@ void SpectraCamera::configISP() {
899899}
900900
901901void SpectraCamera::configICP () {
902- if (!enabled) return ;
903-
904902 /*
905903 Configures both the ICP and BPS.
906904 */
@@ -1048,6 +1046,10 @@ void SpectraCamera::camera_close() {
10481046
10491047 // release devices
10501048 LOGD (" -- Release devices" );
1049+ if (icp_dev_handle > 0 ) {
1050+ ret = device_control (m->icp_fd , CAM_RELEASE_DEV, session_handle, icp_dev_handle);
1051+ LOGD (" release icp: %d" , ret);
1052+ }
10511053 ret = device_control (m->isp_fd , CAM_RELEASE_DEV, session_handle, isp_dev_handle);
10521054 LOGD (" release isp: %d" , ret);
10531055 ret = device_control (csiphy_fd, CAM_RELEASE_DEV, session_handle, csiphy_dev_handle);
0 commit comments