Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8eedcc7f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Merge commit 'f4e179e6' into msm-4.9 - PC 180" into msm-4.9

parents 24397e33 88f0566a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -355,7 +355,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;
	}
@@ -384,7 +384,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;
	}
+13 −1
Original line number Diff line number Diff line
@@ -504,6 +504,18 @@ static void __cam_isp_ctx_send_sof_timestamp(

}

static int __cam_isp_ctx_reg_upd_in_epoch_state(
	struct cam_isp_context *ctx_isp, void *evt_data)
{
	if (ctx_isp->frame_id == 1)
		CAM_DBG(CAM_ISP, "Reg update for early PCR");
	else
		CAM_WARN(CAM_ISP,
			"Unexpected reg update in activated substate:%d for frame_id:%lld",
			ctx_isp->substate_activated, ctx_isp->frame_id);
	return 0;
}

static int __cam_isp_ctx_reg_upd_in_activated_state(
	struct cam_isp_context *ctx_isp, void *evt_data)
{
@@ -1119,7 +1131,7 @@ static struct cam_isp_ctx_irq_ops
		.irq_ops = {
			__cam_isp_ctx_handle_error,
			__cam_isp_ctx_sof_in_epoch,
			NULL,
			__cam_isp_ctx_reg_upd_in_epoch_state,
			__cam_isp_ctx_notify_sof_in_actived_state,
			__cam_isp_ctx_notify_eof_in_actived_state,
			__cam_isp_ctx_buf_done_in_epoch,
+19 −0
Original line number Diff line number Diff line
@@ -1367,6 +1367,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...");

@@ -1427,9 +1428,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;
+12 −2
Original line number Diff line number Diff line
@@ -204,6 +204,9 @@ static int cam_vfe_camif_resource_start(
{
	struct cam_vfe_mux_camif_data       *rsrc_data;
	uint32_t                             val = 0;
	uint32_t                             epoch0_irq_mask;
	uint32_t                             epoch1_irq_mask;
	uint32_t                             computed_epoch_line_cfg;

	if (!camif_res) {
		CAM_ERR(CAM_ISP, "Error! Invalid input arguments");
@@ -243,9 +246,16 @@ static int cam_vfe_camif_resource_start(
		rsrc_data->common_reg->module_ctrl[
		CAM_VFE_TOP_VER2_MODULE_STATS]->cgc_ovd);

	/* epoch config with 20 line */
	cam_io_w_mb(rsrc_data->reg_data->epoch_line_cfg,
	/* epoch config */
	epoch0_irq_mask = ((rsrc_data->last_line - rsrc_data->first_line) / 2) +
		rsrc_data->first_line;
	epoch1_irq_mask = rsrc_data->reg_data->epoch_line_cfg & 0xFFFF;
	computed_epoch_line_cfg = (epoch0_irq_mask << 16) | epoch1_irq_mask;
	cam_io_w_mb(computed_epoch_line_cfg,
		rsrc_data->mem_base + rsrc_data->camif_reg->epoch_irq);
	CAM_DBG(CAM_ISP, "first_line:%u last_line:%u epoch_line_cfg: 0x%x",
		rsrc_data->first_line, rsrc_data->last_line,
		computed_epoch_line_cfg);

	camif_res->res_state = CAM_ISP_RESOURCE_STATE_STREAMING;

+48 −57
Original line number Diff line number Diff line
@@ -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];
};
@@ -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;
@@ -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 ==
@@ -163,77 +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;
			top_priv->applied_axi_vote.compressed_bw =
				top_priv->
				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;
@@ -706,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