Loading drivers/media/platform/msm/camera/cam_core/cam_context.c +2 −2 Original line number Diff line number Diff line Loading @@ -357,7 +357,7 @@ int cam_context_handle_start_dev(struct cam_context *ctx, { int rc = 0; if (!ctx->state_machine) { if (!ctx || !ctx->state_machine) { CAM_ERR(CAM_CORE, "Context is not ready"); return -EINVAL; } Loading Loading @@ -386,7 +386,7 @@ int cam_context_handle_stop_dev(struct cam_context *ctx, { int rc = 0; if (!ctx->state_machine) { if (!ctx || !ctx->state_machine) { CAM_ERR(CAM_CORE, "Context is not ready"); return -EINVAL; } Loading drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +19 −0 Original line number Diff line number Diff line Loading @@ -1403,6 +1403,7 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, uint32_t num_rdi_port_per_in = 0; uint32_t total_pix_port = 0; uint32_t total_rdi_port = 0; uint32_t in_port_length = 0; CAM_DBG(CAM_ISP, "Enter..."); Loading Loading @@ -1463,9 +1464,27 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, isp_resource[i].res_hdl, isp_resource[i].length); in_port_length = sizeof(struct cam_isp_in_port_info); if (in_port_length > isp_resource[i].length) { CAM_ERR(CAM_ISP, "buffer size is not enough"); rc = -EINVAL; goto free_res; } in_port = memdup_user((void __user *)isp_resource[i].res_hdl, isp_resource[i].length); if (!IS_ERR(in_port)) { in_port_length = sizeof(struct cam_isp_in_port_info) + (in_port->num_out_res - 1) * sizeof(struct cam_isp_out_port_info); if (in_port_length > isp_resource[i].length) { CAM_ERR(CAM_ISP, "buffer size is not enough"); rc = -EINVAL; kfree(in_port); goto free_res; } rc = cam_ife_mgr_acquire_hw_for_ctx(ife_ctx, in_port, &num_pix_port_per_in, &num_rdi_port_per_in); total_pix_port += num_pix_port_per_in; Loading drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver2.c +49 −56 Original line number Diff line number Diff line Loading @@ -34,11 +34,12 @@ struct cam_vfe_top_ver2_priv { struct cam_vfe_top_ver2_common_data common_data; struct cam_isp_resource_node mux_rsrc[CAM_VFE_TOP_VER2_MUX_MAX]; unsigned long hw_clk_rate; struct cam_axi_vote to_be_applied_axi_vote; struct cam_axi_vote applied_axi_vote; uint32_t counter_to_update_axi_vote; struct cam_axi_vote req_axi_vote[CAM_VFE_TOP_VER2_MUX_MAX]; unsigned long req_clk_rate[CAM_VFE_TOP_VER2_MUX_MAX]; struct cam_axi_vote last_vote[CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES]; uint32_t last_counter; enum cam_vfe_bw_control_action axi_vote_control[CAM_VFE_TOP_VER2_MUX_MAX]; }; Loading Loading @@ -128,6 +129,7 @@ static int cam_vfe_top_set_axi_bw_vote( bool start_stop) { struct cam_axi_vote sum = {0, 0}; struct cam_axi_vote to_be_applied_axi_vote = {0, 0}; int i, rc = 0; struct cam_hw_soc_info *soc_info = top_priv->common_data.soc_info; Loading Loading @@ -156,6 +158,11 @@ static int cam_vfe_top_set_axi_bw_vote( sum.uncompressed_bw, sum.compressed_bw); top_priv->last_vote[top_priv->last_counter] = sum; top_priv->last_counter = (top_priv->last_counter + 1) % (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES); if ((top_priv->applied_axi_vote.uncompressed_bw == sum.uncompressed_bw) && (top_priv->applied_axi_vote.compressed_bw == Loading @@ -163,75 +170,60 @@ static int cam_vfe_top_set_axi_bw_vote( CAM_DBG(CAM_ISP, "BW config unchanged %llu %llu", top_priv->applied_axi_vote.uncompressed_bw, top_priv->applied_axi_vote.compressed_bw); top_priv->counter_to_update_axi_vote = 0; return 0; } if ((top_priv->to_be_applied_axi_vote.uncompressed_bw != sum.uncompressed_bw) || (top_priv->to_be_applied_axi_vote.compressed_bw != sum.compressed_bw)) { // we got a new bw value to apply top_priv->counter_to_update_axi_vote = 0; top_priv->to_be_applied_axi_vote.uncompressed_bw = sum.uncompressed_bw; top_priv->to_be_applied_axi_vote.compressed_bw = sum.compressed_bw; } if (start_stop == true) { CAM_DBG(CAM_ISP, "New bw in start/stop, applying bw now, counter=%d", top_priv->counter_to_update_axi_vote); top_priv->counter_to_update_axi_vote = 0; apply_bw_update = true; } else if ((top_priv->to_be_applied_axi_vote.uncompressed_bw < top_priv->applied_axi_vote.uncompressed_bw) || (top_priv->to_be_applied_axi_vote.compressed_bw < top_priv->applied_axi_vote.compressed_bw)) { if (top_priv->counter_to_update_axi_vote >= /* need to vote current request immediately */ to_be_applied_axi_vote = sum; /* Reset everything, we can start afresh */ memset(top_priv->last_vote, 0x0, sizeof(struct cam_axi_vote) * (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES)) { CAM_DBG(CAM_ISP, "New bw is less, applying bw now, counter=%d", top_priv->counter_to_update_axi_vote); top_priv->counter_to_update_axi_vote = 0; apply_bw_update = true; CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES)); top_priv->last_counter = 0; top_priv->last_vote[top_priv->last_counter] = sum; top_priv->last_counter = (top_priv->last_counter + 1) % (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES); } else { CAM_DBG(CAM_ISP, "New bw is less, Defer applying bw, counter=%d", top_priv->counter_to_update_axi_vote); /* * Find max bw request in last few frames. This will the bw *that we want to vote to CPAS now. */ for (i = 0; i < (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES); i++) { if (to_be_applied_axi_vote.compressed_bw < top_priv->last_vote[i].compressed_bw) to_be_applied_axi_vote.compressed_bw = top_priv->last_vote[i].compressed_bw; top_priv->counter_to_update_axi_vote++; apply_bw_update = false; if (to_be_applied_axi_vote.uncompressed_bw < top_priv->last_vote[i].uncompressed_bw) to_be_applied_axi_vote.uncompressed_bw = top_priv->last_vote[i].uncompressed_bw; } } else { CAM_DBG(CAM_ISP, "New bw is more, applying bw now, counter=%d", top_priv->counter_to_update_axi_vote); top_priv->counter_to_update_axi_vote = 0; apply_bw_update = true; } CAM_DBG(CAM_ISP, "counter=%d, apply_bw_update=%d", top_priv->counter_to_update_axi_vote, apply_bw_update); if ((to_be_applied_axi_vote.uncompressed_bw != top_priv->applied_axi_vote.uncompressed_bw) || (to_be_applied_axi_vote.compressed_bw != top_priv->applied_axi_vote.compressed_bw)) apply_bw_update = true; CAM_DBG(CAM_ISP, "apply_bw_update=%d", apply_bw_update); if (apply_bw_update == true) { rc = cam_cpas_update_axi_vote( soc_private->cpas_handle, &top_priv->to_be_applied_axi_vote); &to_be_applied_axi_vote); if (!rc) { top_priv->applied_axi_vote.uncompressed_bw = top_priv->to_be_applied_axi_vote.uncompressed_bw; to_be_applied_axi_vote.uncompressed_bw; top_priv->applied_axi_vote.compressed_bw = top_priv->to_be_applied_axi_vote.compressed_bw; to_be_applied_axi_vote.compressed_bw; } else { CAM_ERR(CAM_ISP, "BW request failed, rc=%d", rc); } top_priv->counter_to_update_axi_vote = 0; } return rc; Loading Loading @@ -704,11 +696,12 @@ int cam_vfe_top_ver2_init( } vfe_top->top_priv = top_priv; top_priv->hw_clk_rate = 0; top_priv->to_be_applied_axi_vote.compressed_bw = 0; top_priv->to_be_applied_axi_vote.uncompressed_bw = 0; top_priv->applied_axi_vote.compressed_bw = 0; top_priv->applied_axi_vote.uncompressed_bw = 0; top_priv->counter_to_update_axi_vote = 0; memset(top_priv->last_vote, 0x0, sizeof(struct cam_axi_vote) * (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES)); top_priv->last_counter = 0; for (i = 0, j = 0; i < CAM_VFE_TOP_VER2_MUX_MAX; i++) { top_priv->mux_rsrc[i].res_type = CAM_ISP_RESOURCE_VFE_IN; Loading drivers/media/platform/msm/camera/cam_sensor_module/cam_actuator/cam_actuator_core.c +12 −1 Original line number Diff line number Diff line Loading @@ -603,7 +603,11 @@ int32_t cam_actuator_i2c_pkt_parse(struct cam_actuator_ctrl_t *a_ctrl, void cam_actuator_shutdown(struct cam_actuator_ctrl_t *a_ctrl) { int rc; int rc = 0; struct cam_actuator_soc_private *soc_private = (struct cam_actuator_soc_private *)a_ctrl->soc_info.soc_private; struct cam_sensor_power_ctrl_t *power_info = &soc_private->power_info; if (a_ctrl->cam_act_state == CAM_ACTUATOR_INIT) return; Loading @@ -612,6 +616,7 @@ void cam_actuator_shutdown(struct cam_actuator_ctrl_t *a_ctrl) rc = cam_actuator_power_down(a_ctrl); if (rc < 0) CAM_ERR(CAM_ACTUATOR, "Actuator Power down failed"); a_ctrl->cam_act_state = CAM_ACTUATOR_ACQUIRE; } if (a_ctrl->cam_act_state >= CAM_ACTUATOR_ACQUIRE) { Loading @@ -622,6 +627,12 @@ void cam_actuator_shutdown(struct cam_actuator_ctrl_t *a_ctrl) a_ctrl->bridge_intf.link_hdl = -1; a_ctrl->bridge_intf.session_hdl = -1; } kfree(power_info->power_setting); kfree(power_info->power_down_setting); power_info->power_setting = NULL; power_info->power_down_setting = NULL; a_ctrl->cam_act_state = CAM_ACTUATOR_INIT; } Loading drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c +7 −0 Original line number Diff line number Diff line Loading @@ -613,6 +613,13 @@ int32_t cam_csiphy_core_cfg(void *phy_dev, if (csiphy_dev->acquire_count == 0) csiphy_dev->csiphy_state = CAM_CSIPHY_INIT; if (csiphy_dev->config_count == 0) { CAM_DBG(CAM_CSIPHY, "reset csiphy_info"); csiphy_dev->csiphy_info.lane_mask = 0; csiphy_dev->csiphy_info.lane_cnt = 0; csiphy_dev->csiphy_info.combo_mode = 0; } } break; case CAM_CONFIG_DEV: { Loading Loading
drivers/media/platform/msm/camera/cam_core/cam_context.c +2 −2 Original line number Diff line number Diff line Loading @@ -357,7 +357,7 @@ int cam_context_handle_start_dev(struct cam_context *ctx, { int rc = 0; if (!ctx->state_machine) { if (!ctx || !ctx->state_machine) { CAM_ERR(CAM_CORE, "Context is not ready"); return -EINVAL; } Loading Loading @@ -386,7 +386,7 @@ int cam_context_handle_stop_dev(struct cam_context *ctx, { int rc = 0; if (!ctx->state_machine) { if (!ctx || !ctx->state_machine) { CAM_ERR(CAM_CORE, "Context is not ready"); return -EINVAL; } Loading
drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c +19 −0 Original line number Diff line number Diff line Loading @@ -1403,6 +1403,7 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, uint32_t num_rdi_port_per_in = 0; uint32_t total_pix_port = 0; uint32_t total_rdi_port = 0; uint32_t in_port_length = 0; CAM_DBG(CAM_ISP, "Enter..."); Loading Loading @@ -1463,9 +1464,27 @@ static int cam_ife_mgr_acquire_hw(void *hw_mgr_priv, isp_resource[i].res_hdl, isp_resource[i].length); in_port_length = sizeof(struct cam_isp_in_port_info); if (in_port_length > isp_resource[i].length) { CAM_ERR(CAM_ISP, "buffer size is not enough"); rc = -EINVAL; goto free_res; } in_port = memdup_user((void __user *)isp_resource[i].res_hdl, isp_resource[i].length); if (!IS_ERR(in_port)) { in_port_length = sizeof(struct cam_isp_in_port_info) + (in_port->num_out_res - 1) * sizeof(struct cam_isp_out_port_info); if (in_port_length > isp_resource[i].length) { CAM_ERR(CAM_ISP, "buffer size is not enough"); rc = -EINVAL; kfree(in_port); goto free_res; } rc = cam_ife_mgr_acquire_hw_for_ctx(ife_ctx, in_port, &num_pix_port_per_in, &num_rdi_port_per_in); total_pix_port += num_pix_port_per_in; Loading
drivers/media/platform/msm/camera/cam_isp/isp_hw_mgr/isp_hw/vfe_hw/vfe_top/cam_vfe_top_ver2.c +49 −56 Original line number Diff line number Diff line Loading @@ -34,11 +34,12 @@ struct cam_vfe_top_ver2_priv { struct cam_vfe_top_ver2_common_data common_data; struct cam_isp_resource_node mux_rsrc[CAM_VFE_TOP_VER2_MUX_MAX]; unsigned long hw_clk_rate; struct cam_axi_vote to_be_applied_axi_vote; struct cam_axi_vote applied_axi_vote; uint32_t counter_to_update_axi_vote; struct cam_axi_vote req_axi_vote[CAM_VFE_TOP_VER2_MUX_MAX]; unsigned long req_clk_rate[CAM_VFE_TOP_VER2_MUX_MAX]; struct cam_axi_vote last_vote[CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES]; uint32_t last_counter; enum cam_vfe_bw_control_action axi_vote_control[CAM_VFE_TOP_VER2_MUX_MAX]; }; Loading Loading @@ -128,6 +129,7 @@ static int cam_vfe_top_set_axi_bw_vote( bool start_stop) { struct cam_axi_vote sum = {0, 0}; struct cam_axi_vote to_be_applied_axi_vote = {0, 0}; int i, rc = 0; struct cam_hw_soc_info *soc_info = top_priv->common_data.soc_info; Loading Loading @@ -156,6 +158,11 @@ static int cam_vfe_top_set_axi_bw_vote( sum.uncompressed_bw, sum.compressed_bw); top_priv->last_vote[top_priv->last_counter] = sum; top_priv->last_counter = (top_priv->last_counter + 1) % (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES); if ((top_priv->applied_axi_vote.uncompressed_bw == sum.uncompressed_bw) && (top_priv->applied_axi_vote.compressed_bw == Loading @@ -163,75 +170,60 @@ static int cam_vfe_top_set_axi_bw_vote( CAM_DBG(CAM_ISP, "BW config unchanged %llu %llu", top_priv->applied_axi_vote.uncompressed_bw, top_priv->applied_axi_vote.compressed_bw); top_priv->counter_to_update_axi_vote = 0; return 0; } if ((top_priv->to_be_applied_axi_vote.uncompressed_bw != sum.uncompressed_bw) || (top_priv->to_be_applied_axi_vote.compressed_bw != sum.compressed_bw)) { // we got a new bw value to apply top_priv->counter_to_update_axi_vote = 0; top_priv->to_be_applied_axi_vote.uncompressed_bw = sum.uncompressed_bw; top_priv->to_be_applied_axi_vote.compressed_bw = sum.compressed_bw; } if (start_stop == true) { CAM_DBG(CAM_ISP, "New bw in start/stop, applying bw now, counter=%d", top_priv->counter_to_update_axi_vote); top_priv->counter_to_update_axi_vote = 0; apply_bw_update = true; } else if ((top_priv->to_be_applied_axi_vote.uncompressed_bw < top_priv->applied_axi_vote.uncompressed_bw) || (top_priv->to_be_applied_axi_vote.compressed_bw < top_priv->applied_axi_vote.compressed_bw)) { if (top_priv->counter_to_update_axi_vote >= /* need to vote current request immediately */ to_be_applied_axi_vote = sum; /* Reset everything, we can start afresh */ memset(top_priv->last_vote, 0x0, sizeof(struct cam_axi_vote) * (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES)) { CAM_DBG(CAM_ISP, "New bw is less, applying bw now, counter=%d", top_priv->counter_to_update_axi_vote); top_priv->counter_to_update_axi_vote = 0; apply_bw_update = true; CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES)); top_priv->last_counter = 0; top_priv->last_vote[top_priv->last_counter] = sum; top_priv->last_counter = (top_priv->last_counter + 1) % (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES); } else { CAM_DBG(CAM_ISP, "New bw is less, Defer applying bw, counter=%d", top_priv->counter_to_update_axi_vote); /* * Find max bw request in last few frames. This will the bw *that we want to vote to CPAS now. */ for (i = 0; i < (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES); i++) { if (to_be_applied_axi_vote.compressed_bw < top_priv->last_vote[i].compressed_bw) to_be_applied_axi_vote.compressed_bw = top_priv->last_vote[i].compressed_bw; top_priv->counter_to_update_axi_vote++; apply_bw_update = false; if (to_be_applied_axi_vote.uncompressed_bw < top_priv->last_vote[i].uncompressed_bw) to_be_applied_axi_vote.uncompressed_bw = top_priv->last_vote[i].uncompressed_bw; } } else { CAM_DBG(CAM_ISP, "New bw is more, applying bw now, counter=%d", top_priv->counter_to_update_axi_vote); top_priv->counter_to_update_axi_vote = 0; apply_bw_update = true; } CAM_DBG(CAM_ISP, "counter=%d, apply_bw_update=%d", top_priv->counter_to_update_axi_vote, apply_bw_update); if ((to_be_applied_axi_vote.uncompressed_bw != top_priv->applied_axi_vote.uncompressed_bw) || (to_be_applied_axi_vote.compressed_bw != top_priv->applied_axi_vote.compressed_bw)) apply_bw_update = true; CAM_DBG(CAM_ISP, "apply_bw_update=%d", apply_bw_update); if (apply_bw_update == true) { rc = cam_cpas_update_axi_vote( soc_private->cpas_handle, &top_priv->to_be_applied_axi_vote); &to_be_applied_axi_vote); if (!rc) { top_priv->applied_axi_vote.uncompressed_bw = top_priv->to_be_applied_axi_vote.uncompressed_bw; to_be_applied_axi_vote.uncompressed_bw; top_priv->applied_axi_vote.compressed_bw = top_priv->to_be_applied_axi_vote.compressed_bw; to_be_applied_axi_vote.compressed_bw; } else { CAM_ERR(CAM_ISP, "BW request failed, rc=%d", rc); } top_priv->counter_to_update_axi_vote = 0; } return rc; Loading Loading @@ -704,11 +696,12 @@ int cam_vfe_top_ver2_init( } vfe_top->top_priv = top_priv; top_priv->hw_clk_rate = 0; top_priv->to_be_applied_axi_vote.compressed_bw = 0; top_priv->to_be_applied_axi_vote.uncompressed_bw = 0; top_priv->applied_axi_vote.compressed_bw = 0; top_priv->applied_axi_vote.uncompressed_bw = 0; top_priv->counter_to_update_axi_vote = 0; memset(top_priv->last_vote, 0x0, sizeof(struct cam_axi_vote) * (CAM_VFE_TOP_VER2_MUX_MAX * CAM_VFE_DELAY_BW_REDUCTION_NUM_FRAMES)); top_priv->last_counter = 0; for (i = 0, j = 0; i < CAM_VFE_TOP_VER2_MUX_MAX; i++) { top_priv->mux_rsrc[i].res_type = CAM_ISP_RESOURCE_VFE_IN; Loading
drivers/media/platform/msm/camera/cam_sensor_module/cam_actuator/cam_actuator_core.c +12 −1 Original line number Diff line number Diff line Loading @@ -603,7 +603,11 @@ int32_t cam_actuator_i2c_pkt_parse(struct cam_actuator_ctrl_t *a_ctrl, void cam_actuator_shutdown(struct cam_actuator_ctrl_t *a_ctrl) { int rc; int rc = 0; struct cam_actuator_soc_private *soc_private = (struct cam_actuator_soc_private *)a_ctrl->soc_info.soc_private; struct cam_sensor_power_ctrl_t *power_info = &soc_private->power_info; if (a_ctrl->cam_act_state == CAM_ACTUATOR_INIT) return; Loading @@ -612,6 +616,7 @@ void cam_actuator_shutdown(struct cam_actuator_ctrl_t *a_ctrl) rc = cam_actuator_power_down(a_ctrl); if (rc < 0) CAM_ERR(CAM_ACTUATOR, "Actuator Power down failed"); a_ctrl->cam_act_state = CAM_ACTUATOR_ACQUIRE; } if (a_ctrl->cam_act_state >= CAM_ACTUATOR_ACQUIRE) { Loading @@ -622,6 +627,12 @@ void cam_actuator_shutdown(struct cam_actuator_ctrl_t *a_ctrl) a_ctrl->bridge_intf.link_hdl = -1; a_ctrl->bridge_intf.session_hdl = -1; } kfree(power_info->power_setting); kfree(power_info->power_down_setting); power_info->power_setting = NULL; power_info->power_down_setting = NULL; a_ctrl->cam_act_state = CAM_ACTUATOR_INIT; } Loading
drivers/media/platform/msm/camera/cam_sensor_module/cam_csiphy/cam_csiphy_core.c +7 −0 Original line number Diff line number Diff line Loading @@ -613,6 +613,13 @@ int32_t cam_csiphy_core_cfg(void *phy_dev, if (csiphy_dev->acquire_count == 0) csiphy_dev->csiphy_state = CAM_CSIPHY_INIT; if (csiphy_dev->config_count == 0) { CAM_DBG(CAM_CSIPHY, "reset csiphy_info"); csiphy_dev->csiphy_info.lane_mask = 0; csiphy_dev->csiphy_info.lane_cnt = 0; csiphy_dev->csiphy_info.combo_mode = 0; } } break; case CAM_CONFIG_DEV: { Loading