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

Commit 2af0ff09 authored by E V Ravi's avatar E V Ravi Committed by Gerrit - the friendly Code Review server
Browse files

msm: ais: Fix powerup sequence in cam driver



Fix ensures powerup sequence of Platform/soc
resources happens before cam_cpas_start().

Change-Id: Ib6e9b6ad2d4ac00765bbcd9398e5fdccb23d7d4d
Signed-off-by: default avatarE V Ravi <evenka@codeaurora.org>
parent 40eac2bf
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -277,6 +277,19 @@ int cam_cdm_stream_ops_internal(void *hw_priv,
			struct cam_ahb_vote ahb_vote;
			struct cam_axi_vote axi_vote;

			if (core->id != CAM_CDM_VIRTUAL) {
				rc = cam_soc_util_enable_platform_resource(
						&cdm_hw->soc_info, true,
						CAM_SVS_VOTE, true);
				if (rc) {
					CAM_ERR(CAM_CDM,
						"Enable platform failed");
					goto end;
				}
			}

			CAM_DBG(CAM_CDM, "Enable soc done");

			ahb_vote.type = CAM_VOTE_ABSOLUTE;
			ahb_vote.vote.level = CAM_SVS_VOTE;
			axi_vote.compressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
@@ -287,7 +300,7 @@ int cam_cdm_stream_ops_internal(void *hw_priv,
				&ahb_vote, &axi_vote);
			if (rc != 0) {
				CAM_ERR(CAM_CDM, "CPAS start failed");
				goto end;
				goto disable_platform_resource;
			}
			CAM_DBG(CAM_CDM, "CDM init first time");
			if (core->id == CAM_CDM_VIRTUAL) {
@@ -367,6 +380,15 @@ int cam_cdm_stream_ops_internal(void *hw_priv,
			rc = -ENXIO;
		}
	}
	goto end;

disable_platform_resource:
	if (core->id != CAM_CDM_VIRTUAL) {
		if (cam_soc_util_disable_platform_resource(&cdm_hw->soc_info,
				true, true))
			CAM_ERR(CAM_CDM, "Disable platform resource failed");
	}

end:
	cam_cdm_put_client_refcount(client);
	mutex_unlock(&cdm_hw->hw_mutex);
+17 −13
Original line number Diff line number Diff line
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -794,15 +794,6 @@ int cam_hw_cdm_init(void *hw_priv,
	soc_info = &cdm_hw->soc_info;
	cdm_core = (struct cam_cdm *)cdm_hw->core_info;

	rc = cam_soc_util_enable_platform_resource(soc_info, true,
		CAM_SVS_VOTE, true);
	if (rc) {
		CAM_ERR(CAM_CDM, "Enable platform failed");
		goto end;
	}

	CAM_DBG(CAM_CDM, "Enable soc done");

/* Before triggering the reset to HW, clear the reset complete */
	atomic_set(&cdm_core->error, 0);
	atomic_set(&cdm_core->bl_done, 0);
@@ -982,6 +973,15 @@ int cam_hw_cdm_probe(struct platform_device *pdev)
		cpas_parms.client_handle);
	cdm_core->cpas_handle = cpas_parms.client_handle;

	rc = cam_soc_util_enable_platform_resource(&cdm_hw->soc_info, true,
			CAM_SVS_VOTE, true);
	if (rc) {
		CAM_ERR(CAM_CDM, "Enable platform failed");
		goto cpas_unregister;
	}

	CAM_DBG(CAM_CDM, "Enable soc done");

	ahb_vote.type = CAM_VOTE_ABSOLUTE;
	ahb_vote.vote.level = CAM_SVS_VOTE;
	axi_vote.compressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
@@ -990,7 +990,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev)
	rc = cam_cpas_start(cdm_core->cpas_handle, &ahb_vote, &axi_vote);
	if (rc) {
		CAM_ERR(CAM_CDM, "CPAS start failed");
		goto cpas_unregister;
		goto disable_platform_resource;
	}

	rc = cam_hw_cdm_init(cdm_hw, NULL, 0);
@@ -1038,7 +1038,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev)
	if (rc) {
		CAM_ERR(CAM_CDM, "CPAS stop failed");
		cdm_hw->open_count--;
		goto cpas_unregister;
		goto disable_platform_resource;
	}

	rc = cam_cdm_intf_register_hw_cdm(cdm_hw_intf,
@@ -1046,7 +1046,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev)
	if (rc) {
		CAM_ERR(CAM_CDM, "HW CDM Interface registration failed");
		cdm_hw->open_count--;
		goto cpas_unregister;
		goto disable_platform_resource;
	}
	cdm_hw->open_count--;
	mutex_unlock(&cdm_hw->hw_mutex);
@@ -1063,6 +1063,10 @@ int cam_hw_cdm_probe(struct platform_device *pdev)
cpas_stop:
	if (cam_cpas_stop(cdm_core->cpas_handle))
		CAM_ERR(CAM_CDM, "CPAS stop failed");
disable_platform_resource:
	if (cam_soc_util_disable_platform_resource(&cdm_hw->soc_info,
			true, true))
		CAM_ERR(CAM_CDM, "Disable platform resource failed");
cpas_unregister:
	if (cam_cpas_unregister_client(cdm_core->cpas_handle))
		CAM_ERR(CAM_CDM, "CPAS unregister failed");
+15 −14
Original line number Diff line number Diff line
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -148,6 +148,13 @@ int cam_fd_soc_enable_resources(struct cam_hw_soc_info *soc_info)
	struct cam_axi_vote axi_vote;
	int rc;

	rc = cam_soc_util_enable_platform_resource(soc_info, true,
			CAM_SVS_VOTE, true);
	if (rc) {
		CAM_ERR(CAM_FD, "Error enable platform failed, rc=%d", rc);
		goto end;
	}

	ahb_vote.type = CAM_VOTE_ABSOLUTE;
	ahb_vote.vote.level = CAM_SVS_VOTE;
	axi_vote.compressed_bw = 7200000;
@@ -156,22 +163,16 @@ int cam_fd_soc_enable_resources(struct cam_hw_soc_info *soc_info)
	rc = cam_cpas_start(soc_private->cpas_handle, &ahb_vote, &axi_vote);
	if (rc) {
		CAM_ERR(CAM_FD, "Error in CPAS START, rc=%d", rc);
		return -EFAULT;
	}

	rc = cam_soc_util_enable_platform_resource(soc_info, true, CAM_SVS_VOTE,
		true);
	if (rc) {
		CAM_ERR(CAM_FD, "Error enable platform failed, rc=%d", rc);
		goto stop_cpas;
		rc = -EFAULT;
		goto disable_platform_resource;
	}
	goto end;

	return rc;

stop_cpas:
	if (cam_cpas_stop(soc_private->cpas_handle))
		CAM_ERR(CAM_FD, "Error in CPAS STOP");
disable_platform_resource:
	if (cam_soc_util_disable_platform_resource(soc_info, true, true))
		CAM_ERR(CAM_FD, "Disable platform resource failed");

end:
	return rc;
}

+14 −10
Original line number Diff line number Diff line
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -302,6 +302,12 @@ int cam_a5_init_hw(void *device_priv,
		return -EINVAL;
	}

	rc = cam_a5_enable_soc_resources(soc_info);
	if (rc) {
		CAM_ERR(CAM_ICP, "soc enable is failed: %d", rc);
		goto end;
	}

	cpas_vote.ahb_vote.type = CAM_VOTE_ABSOLUTE;
	cpas_vote.ahb_vote.vote.level = CAM_SVS_VOTE;
	cpas_vote.axi_vote.compressed_bw = CAM_ICP_A5_BW_BYTES_VOTE;
@@ -312,19 +318,17 @@ int cam_a5_init_hw(void *device_priv,
		&cpas_vote.ahb_vote, &cpas_vote.axi_vote);
	if (rc) {
		CAM_ERR(CAM_ICP, "cpass start failed: %d", rc);
		return rc;
		goto disable_soc_resources;
	}
	core_info->cpas_start = true;

	rc = cam_a5_enable_soc_resources(soc_info);
	if (rc) {
		CAM_ERR(CAM_ICP, "soc enable is failed: %d", rc);
		if (cam_cpas_stop(core_info->cpas_handle))
			CAM_ERR(CAM_ICP, "cpas stop is failed");
		else
			core_info->cpas_start = false;
	}
	goto end;

disable_soc_resources:
	if (cam_a5_disable_soc_resources(soc_info))
		CAM_ERR(CAM_ICP, "Disable soc resource failed");

end:
	return rc;
}

+17 −12
Original line number Diff line number Diff line
/* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -77,6 +77,14 @@ int cam_bps_init_hw(void *device_priv,
		return -EINVAL;
	}

	rc = cam_bps_enable_soc_resources(soc_info);
	if (rc) {
		CAM_ERR(CAM_ICP, "soc enable is failed: %d", rc);
		goto end;
	} else {
		core_info->clk_enable = true;
	}

	cpas_vote.ahb_vote.type = CAM_VOTE_ABSOLUTE;
	cpas_vote.ahb_vote.vote.level = CAM_SVS_VOTE;
	cpas_vote.axi_vote.compressed_bw = CAM_CPAS_DEFAULT_AXI_BW;
@@ -86,21 +94,18 @@ int cam_bps_init_hw(void *device_priv,
			&cpas_vote.ahb_vote, &cpas_vote.axi_vote);
	if (rc) {
		CAM_ERR(CAM_ICP, "cpass start failed: %d", rc);
		return rc;
		goto disable_soc_resources;
	}
	core_info->cpas_start = true;

	rc = cam_bps_enable_soc_resources(soc_info);
	if (rc) {
		CAM_ERR(CAM_ICP, "soc enable is failed: %d", rc);
		if (cam_cpas_stop(core_info->cpas_handle))
			CAM_ERR(CAM_ICP, "cpas stop is failed");
		else
			core_info->cpas_start = false;
	} else {
		core_info->clk_enable = true;
	}
	goto end;

disable_soc_resources:
	if (cam_bps_disable_soc_resources(soc_info, true))
		CAM_ERR(CAM_ICP, "Disable soc resource failed");
	core_info->clk_enable = false;

end:
	return rc;
}

Loading