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

Commit ea0452b9 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: tfe: Reduce stack footprint during bw vote" into camera-kernel.lnx.3.1

parents 11cdc584 ffcd3c71
Loading
Loading
Loading
Loading
+19 −9
Original line number Diff line number Diff line
@@ -961,7 +961,7 @@ static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw,
{
	struct cam_cpas *cpas_core = (struct cam_cpas *) cpas_hw->core_info;
	struct cam_cpas_client *cpas_client = NULL;
	struct cam_axi_vote axi_vote = {0};
	struct cam_axi_vote *axi_vote = NULL;
	uint32_t client_indx = CAM_CPAS_GET_CLIENT_IDX(client_handle);
	int rc = 0;

@@ -971,16 +971,24 @@ static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw,
		return -EINVAL;
	}

	memcpy(&axi_vote, client_axi_vote, sizeof(struct cam_axi_vote));

	if (!CAM_CPAS_CLIENT_VALID(client_indx))
		return -EINVAL;

	cam_cpas_dump_axi_vote_info(cpas_core->cpas_client[client_indx],
		"Incoming Vote", &axi_vote);

	mutex_lock(&cpas_hw->hw_mutex);
	mutex_lock(&cpas_core->client_mutex[client_indx]);

	axi_vote = kmemdup(client_axi_vote, sizeof(struct cam_axi_vote),
		GFP_KERNEL);
	if (!axi_vote) {
		CAM_ERR(CAM_CPAS, "Out of memory");
		mutex_unlock(&cpas_core->client_mutex[client_indx]);
		mutex_unlock(&cpas_hw->hw_mutex);
		return -ENOMEM;
	}

	cam_cpas_dump_axi_vote_info(cpas_core->cpas_client[client_indx],
		"Incoming Vote", axi_vote);

	cpas_client = cpas_core->cpas_client[client_indx];

	if (!CAM_CPAS_CLIENT_STARTED(cpas_core, client_indx)) {
@@ -991,7 +999,7 @@ static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw,
		goto unlock_client;
	}

	rc = cam_cpas_util_translate_client_paths(&axi_vote);
	rc = cam_cpas_util_translate_client_paths(axi_vote);
	if (rc) {
		CAM_ERR(CAM_CPAS,
			"Unable to translate per path votes rc: %d", rc);
@@ -999,12 +1007,14 @@ static int cam_cpas_hw_update_axi_vote(struct cam_hw_info *cpas_hw,
	}

	cam_cpas_dump_axi_vote_info(cpas_core->cpas_client[client_indx],
		"Translated Vote", &axi_vote);
		"Translated Vote", axi_vote);

	rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
		cpas_core->cpas_client[client_indx], &axi_vote);
		cpas_core->cpas_client[client_indx], axi_vote);

unlock_client:
	kzfree(axi_vote);
	axi_vote = NULL;
	mutex_unlock(&cpas_core->client_mutex[client_indx]);
	mutex_unlock(&cpas_hw->hw_mutex);
	return rc;
+16 −7
Original line number Diff line number Diff line
@@ -2309,7 +2309,7 @@ static int cam_isp_tfe_blob_bw_update(
{
	struct cam_isp_hw_mgr_res             *hw_mgr_res;
	struct cam_hw_intf                    *hw_intf;
	struct cam_tfe_bw_update_args          bw_upd_args;
	struct cam_tfe_bw_update_args          *bw_upd_args = NULL;
	int                                    rc = -EINVAL;
	uint32_t                               i, split_idx;
	bool                                   camif_l_bw_updated = false;
@@ -2330,32 +2330,38 @@ static int cam_isp_tfe_blob_bw_update(
			bw_config->axi_path[i].mnoc_ib_bw);
	}

	bw_upd_args = kzalloc(sizeof(struct cam_tfe_bw_update_args),
		GFP_KERNEL);
	if (!bw_upd_args) {
		CAM_ERR(CAM_ISP, "Out of memory");
		return -ENOMEM;
	}
	list_for_each_entry(hw_mgr_res, &ctx->res_list_tfe_in, list) {
		for (split_idx = 0; split_idx < CAM_ISP_HW_SPLIT_MAX;
			split_idx++) {
			if (!hw_mgr_res->hw_res[split_idx])
				continue;

			memset(&bw_upd_args.isp_vote, 0,
			memset(&bw_upd_args->isp_vote, 0,
				sizeof(struct cam_axi_vote));
			rc = cam_tfe_classify_vote_info(hw_mgr_res, bw_config,
				&bw_upd_args.isp_vote, split_idx,
				&bw_upd_args->isp_vote, split_idx,
				&camif_l_bw_updated, &camif_r_bw_updated);
			if (rc)
				return rc;
				goto end;

			if (!bw_upd_args.isp_vote.num_paths)
			if (!bw_upd_args->isp_vote.num_paths)
				continue;

			hw_intf = hw_mgr_res->hw_res[split_idx]->hw_intf;
			if (hw_intf && hw_intf->hw_ops.process_cmd) {
				bw_upd_args.node_res =
				bw_upd_args->node_res =
					hw_mgr_res->hw_res[split_idx];

				rc = hw_intf->hw_ops.process_cmd(
					hw_intf->hw_priv,
					CAM_ISP_HW_CMD_BW_UPDATE_V2,
					&bw_upd_args,
					bw_upd_args,
					sizeof(
					struct cam_tfe_bw_update_args));
				if (rc)
@@ -2367,6 +2373,9 @@ static int cam_isp_tfe_blob_bw_update(
		}
	}

end:
	kzfree(bw_upd_args);
	bw_upd_args = NULL;
	return rc;
}