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

Commit 4da5609c authored by Jeyaprakash Soundrapandian's avatar Jeyaprakash Soundrapandian Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes I642c69d2,I46dd6fa2 into dev/msm-4.14-camx

* changes:
  msm: camera: smmu: Handle driver probe failure
  msm: camera: vfe: Update logic to set axi bandwidth vote
parents 8d0c29c1 5ab55b35
Loading
Loading
Loading
Loading
+49 −56
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,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;
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -3355,6 +3355,7 @@ static int cam_smmu_probe(struct platform_device *pdev)
		rc = cam_populate_smmu_context_banks(dev, CAM_ARM_SMMU);
		if (rc < 0) {
			CAM_ERR(CAM_SMMU, "Error: populating context banks");
			cam_smmu_release_cb(pdev);
			return -ENOMEM;
		}
		return rc;