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

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

Merge "msm: camera: cpas: Remove votes on enable_soc failure" into camera-kernel.lnx.3.1

parents 91284fc1 78ee8f12
Loading
Loading
Loading
Loading
+38 −10
Original line number Original line Diff line number Diff line
@@ -1101,6 +1101,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	struct cam_cpas_hw_cmd_start *cmd_hw_start;
	struct cam_cpas_hw_cmd_start *cmd_hw_start;
	struct cam_cpas_client *cpas_client;
	struct cam_cpas_client *cpas_client;
	struct cam_ahb_vote *ahb_vote;
	struct cam_ahb_vote *ahb_vote;
	struct cam_ahb_vote remove_ahb;
	struct cam_axi_vote axi_vote = {0};
	struct cam_axi_vote axi_vote = {0};
	enum cam_vote_level applied_level = CAM_SVS_VOTE;
	enum cam_vote_level applied_level = CAM_SVS_VOTE;
	int rc, i = 0;
	int rc, i = 0;
@@ -1162,7 +1163,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
		CAM_ERR(CAM_CPAS, "client=[%d] is not registered",
		CAM_ERR(CAM_CPAS, "client=[%d] is not registered",
			client_indx);
			client_indx);
		rc = -EPERM;
		rc = -EPERM;
		goto done;
		goto error;
	}
	}


	if (CAM_CPAS_CLIENT_STARTED(cpas_core, client_indx)) {
	if (CAM_CPAS_CLIENT_STARTED(cpas_core, client_indx)) {
@@ -1170,7 +1171,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
			client_indx, cpas_client->data.identifier,
			client_indx, cpas_client->data.identifier,
			cpas_client->data.cell_index);
			cpas_client->data.cell_index);
		rc = -EPERM;
		rc = -EPERM;
		goto done;
		goto error;
	}
	}


	CAM_DBG(CAM_CPAS,
	CAM_DBG(CAM_CPAS,
@@ -1181,7 +1182,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	rc = cam_cpas_util_apply_client_ahb_vote(cpas_hw, cpas_client,
	rc = cam_cpas_util_apply_client_ahb_vote(cpas_hw, cpas_client,
		ahb_vote, &applied_level);
		ahb_vote, &applied_level);
	if (rc)
	if (rc)
		goto done;
		goto error;


	cam_cpas_dump_axi_vote_info(cpas_client, "CPAS Start Vote",
	cam_cpas_dump_axi_vote_info(cpas_client, "CPAS Start Vote",
		&axi_vote);
		&axi_vote);
@@ -1202,7 +1203,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	if (rc) {
	if (rc) {
		CAM_ERR(CAM_CPAS, "Unable to create or translate paths rc: %d",
		CAM_ERR(CAM_CPAS, "Unable to create or translate paths rc: %d",
			rc);
			rc);
		goto done;
		goto remove_ahb_vote;
	}
	}


	cam_cpas_dump_axi_vote_info(cpas_client, "CPAS Start Translated Vote",
	cam_cpas_dump_axi_vote_info(cpas_client, "CPAS Start Translated Vote",
@@ -1211,7 +1212,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
	rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
		cpas_client, &axi_vote);
		cpas_client, &axi_vote);
	if (rc)
	if (rc)
		goto done;
		goto remove_ahb_vote;


	if ((soc_private->cx_ipeak_gpu_limit) &&
	if ((soc_private->cx_ipeak_gpu_limit) &&
		(!cpas_core->streamon_clients)) {
		(!cpas_core->streamon_clients)) {
@@ -1225,7 +1226,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
				kgsl_pwr_limits_del(
				kgsl_pwr_limits_del(
					soc_private->gpu_pwr_limit);
					soc_private->gpu_pwr_limit);
				soc_private->gpu_pwr_limit = NULL;
				soc_private->gpu_pwr_limit = NULL;
				goto done;
				goto remove_axi_vote;
			}
			}
		}
		}
	}
	}
@@ -1233,7 +1234,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	if (cpas_core->streamon_clients == 0) {
	if (cpas_core->streamon_clients == 0) {
		rc = cam_cpas_util_apply_default_axi_vote(cpas_hw, true);
		rc = cam_cpas_util_apply_default_axi_vote(cpas_hw, true);
		if (rc)
		if (rc)
			goto done;
			goto remove_axi_vote;


		atomic_set(&cpas_core->irq_count, 1);
		atomic_set(&cpas_core->irq_count, 1);
		rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info,
		rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info,
@@ -1241,7 +1242,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
		if (rc) {
		if (rc) {
			atomic_set(&cpas_core->irq_count, 0);
			atomic_set(&cpas_core->irq_count, 0);
			CAM_ERR(CAM_CPAS, "enable_resorce failed, rc=%d", rc);
			CAM_ERR(CAM_CPAS, "enable_resorce failed, rc=%d", rc);
			goto done;
			goto remove_axi_vote;
		}
		}


		if (cpas_core->internal_ops.power_on) {
		if (cpas_core->internal_ops.power_on) {
@@ -1253,7 +1254,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
				CAM_ERR(CAM_CPAS,
				CAM_ERR(CAM_CPAS,
					"failed in power_on settings rc=%d",
					"failed in power_on settings rc=%d",
					rc);
					rc);
				goto done;
				goto remove_axi_vote;
			}
			}
		}
		}
		CAM_DBG(CAM_CPAS, "irq_count=%d\n",
		CAM_DBG(CAM_CPAS, "irq_count=%d\n",
@@ -1267,7 +1268,34 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	CAM_DBG(CAM_CPAS, "client=[%d][%s][%d] streamon_clients=%d",
	CAM_DBG(CAM_CPAS, "client=[%d][%s][%d] streamon_clients=%d",
		client_indx, cpas_client->data.identifier,
		client_indx, cpas_client->data.identifier,
		cpas_client->data.cell_index, cpas_core->streamon_clients);
		cpas_client->data.cell_index, cpas_core->streamon_clients);
done:

	mutex_unlock(&cpas_core->client_mutex[client_indx]);
	mutex_unlock(&cpas_hw->hw_mutex);
	return rc;

remove_axi_vote:
	memset(&axi_vote, 0x0, sizeof(struct cam_axi_vote));
	rc = cam_cpas_util_create_vote_all_paths(cpas_client, &axi_vote);
	if (rc)
		CAM_ERR(CAM_CPAS, "Unable to create per path votes rc: %d", rc);

	cam_cpas_dump_axi_vote_info(cpas_client, "CPAS Start fail Vote",
		&axi_vote);

	rc = cam_cpas_util_apply_client_axi_vote(cpas_hw,
		cpas_client, &axi_vote);
	if (rc)
		CAM_ERR(CAM_CPAS, "Unable remove votes rc: %d", rc);

remove_ahb_vote:
	remove_ahb.type = CAM_VOTE_ABSOLUTE;
	remove_ahb.vote.level = CAM_SUSPEND_VOTE;
	rc = cam_cpas_util_apply_client_ahb_vote(cpas_hw, cpas_client,
		&remove_ahb, NULL);
	if (rc)
		CAM_ERR(CAM_CPAS, "Removing AHB vote failed, rc=%d", rc);

error:
	mutex_unlock(&cpas_core->client_mutex[client_indx]);
	mutex_unlock(&cpas_core->client_mutex[client_indx]);
	mutex_unlock(&cpas_hw->hw_mutex);
	mutex_unlock(&cpas_hw->hw_mutex);
	return rc;
	return rc;