diff --git a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c index 03ee81c12cc1..b87cadb04850 100644 --- a/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +++ b/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c @@ -1667,6 +1667,13 @@ static int cam_ife_mgr_acquire_cid_res( if (in_port->num_out_res) out_port = &(in_port->data[0]); + if (ife_ctx->is_tpg) { + if (ife_ctx->res_list_tpg.hw_res[0]->hw_intf->hw_idx == 0) + csid_acquire.phy_sel = CAM_ISP_IFE_IN_RES_PHY_0; + else + csid_acquire.phy_sel = CAM_ISP_IFE_IN_RES_PHY_1; + } + /* Try acquiring CID resource from previously acquired HW */ list_for_each_entry(cid_res_iterator, &ife_ctx->res_list_ife_cid, list) { @@ -1766,6 +1773,15 @@ acquire_successful: csid_acquire.node_res = NULL; csid_acquire.res_type = CAM_ISP_RESOURCE_CID; csid_acquire.in_port = in_port; + + if (ife_ctx->is_tpg) { + if (ife_ctx->res_list_tpg.hw_res[0]->hw_intf->hw_idx + == 0) + csid_acquire.phy_sel = CAM_ISP_IFE_IN_RES_PHY_0; + else + csid_acquire.phy_sel = CAM_ISP_IFE_IN_RES_PHY_1; + } + for (j = 0; j < CAM_IFE_CSID_HW_NUM_MAX; j++) { if (!ife_hw_mgr->csid_devices[j]) continue; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c index 4202a8c1d3f9..173d1a9f5cac 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_core.c @@ -688,6 +688,7 @@ int cam_ife_csid_cid_reserve(struct cam_ife_csid_hw *csid_hw, struct cam_ife_csid_cid_data *cid_data; uint32_t camera_hw_version; uint32_t valid_vc_dt; + uint32_t res_type; CAM_DBG(CAM_ISP, "CSID:%d res_sel:0x%x Lane type:%d lane_num:%d dt:%d vc:%d", @@ -952,6 +953,19 @@ int cam_ife_csid_cid_reserve(struct cam_ife_csid_hw *csid_hw, csid_hw->csi2_rx_cfg.lane_num = cid_reserv->in_port->lane_num; + res_type = cid_reserv->in_port->res_type; + if ((res_type == CAM_ISP_IFE_IN_RES_CPHY_TPG_0) || + (res_type == CAM_ISP_IFE_IN_RES_CPHY_TPG_1) || + (res_type == CAM_ISP_IFE_IN_RES_CPHY_TPG_2)) { + csid_hw->csi2_rx_cfg.phy_sel = + (cid_reserv->phy_sel & 0xFF) - 1; + csid_hw->csi2_reserve_cnt++; + CAM_DBG(CAM_ISP, "CSID:%d CID:%d acquired", + csid_hw->hw_intf->hw_idx, + cid_reserv->node_res->res_id); + goto end; + } + if (cid_reserv->in_port->res_type != CAM_ISP_IFE_IN_RES_TPG) { csid_hw->csi2_rx_cfg.phy_sel = (cid_reserv->in_port->res_type & 0xFF) - 1; diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h b/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h index bd866c6202f3..28e0c14b3761 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/include/cam_ife_csid_hw_intf.h @@ -127,6 +127,7 @@ struct cam_isp_in_port_generic_info { * @drop_enable : Flag to indicate CSID drop enable * @priv: private data to be sent in callback * @event_cb: CSID event callback to hw manager + * @phy_sel: Phy selection number if tpg is enabled from userspace * */ struct cam_csid_hw_reserve_resource_args { @@ -142,6 +143,7 @@ struct cam_csid_hw_reserve_resource_args { bool drop_enable; void *priv; cam_hw_mgr_event_cb_func event_cb; + uint32_t phy_sel; }; /** diff --git a/drivers/cam_isp/isp_hw_mgr/isp_hw/top_tpg/cam_top_tpg_ver2.c b/drivers/cam_isp/isp_hw_mgr/isp_hw/top_tpg/cam_top_tpg_ver2.c index 555cebf79f8f..9ba520323b86 100644 --- a/drivers/cam_isp/isp_hw_mgr/isp_hw/top_tpg/cam_top_tpg_ver2.c +++ b/drivers/cam_isp/isp_hw_mgr/isp_hw/top_tpg/cam_top_tpg_ver2.c @@ -173,7 +173,7 @@ static int cam_top_tpg_ver2_start( cam_io_w_mb(val, soc_info->reg_map[0].mem_base + tpg_reg->tpg_cfg_2); /* program number of frames */ - cam_io_w_mb(1, soc_info->reg_map[0].mem_base + tpg_reg->tpg_cfg_3); + cam_io_w_mb(0xFFFFF, soc_info->reg_map[0].mem_base + tpg_reg->tpg_cfg_3); cam_io_w_mb(tpg_reg->tpg_module_en, soc_info->reg_map[0].mem_base + tpg_reg->tpg_module_cfg);