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

Commit b8e35c33 authored by Karthik Anantha Ram's avatar Karthik Anantha Ram Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: common: Update AHB vote for camera drivers



As part of cpas start, all drivers will now request for
LOW_SVS as opposed to SVS. The drivers also scale the AHB
vote based on the corresponding HW's src clk voltage.

CRs-Fixed: 2507919
Change-Id: I7fd35e9dd298deb1603812f39d50e4e9390b3aac
Signed-off-by: default avatarKarthik Anantha Ram <kartanan@codeaurora.org>
parent 3ef8ba0d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ int cam_cdm_stream_ops_internal(void *hw_priv,
			struct cam_axi_vote axi_vote = {0};

			ahb_vote.type = CAM_VOTE_ABSOLUTE;
			ahb_vote.vote.level = CAM_SVS_VOTE;
			ahb_vote.vote.level = CAM_LOWSVS_VOTE;
			axi_vote.num_paths = 1;
			axi_vote.axi_path[0].path_data_type =
				CAM_AXI_PATH_DATA_ALL;
+1 −1
Original line number Diff line number Diff line
@@ -942,7 +942,7 @@ int cam_hw_cdm_probe(struct platform_device *pdev)
	cdm_core->cpas_handle = cpas_parms.client_handle;

	ahb_vote.type = CAM_VOTE_ABSOLUTE;
	ahb_vote.vote.level = CAM_SVS_VOTE;
	ahb_vote.vote.level = CAM_LOWSVS_VOTE;
	axi_vote.num_paths = 1;
	axi_vote.axi_path[0].path_data_type = CAM_AXI_PATH_DATA_ALL;
	axi_vote.axi_path[0].transac_type = CAM_AXI_TRANSACTION_READ;
+41 −6
Original line number Diff line number Diff line
@@ -932,6 +932,7 @@ static int cam_cpas_util_apply_client_ahb_vote(struct cam_hw_info *cpas_hw,

	CAM_DBG(CAM_CPAS, "Required highest_level[%d]", highest_level);

	if (cpas_core->ahb_bus_scaling_enable) {
		rc = cam_cpas_util_vote_bus_client_level(ahb_bus_client,
			highest_level);
		if (rc) {
@@ -939,6 +940,7 @@ static int cam_cpas_util_apply_client_ahb_vote(struct cam_hw_info *cpas_hw,
				highest_level, rc);
			goto unlock_bus_client;
		}
	}

	rc = cam_soc_util_set_clk_rate_level(&cpas_hw->soc_info, highest_level);
	if (rc) {
@@ -1661,6 +1663,33 @@ static int cam_cpas_util_get_internal_ops(struct platform_device *pdev,
	return rc;
}

static int cam_cpas_util_create_debugfs(
	struct cam_cpas *cpas_core)
{
	int rc = 0;

	cpas_core->dentry = debugfs_create_dir("camera_cpas", NULL);
	if (!cpas_core->dentry)
		return -ENOMEM;

	if (!debugfs_create_bool("ahb_bus_scaling_enable",
		0644,
		cpas_core->dentry,
		&cpas_core->ahb_bus_scaling_enable)) {
		CAM_ERR(CAM_CPAS,
			"failed to create ahb_bus_scaling_enable entry");
		rc = -ENOMEM;
		goto err;
	}

	return 0;

err:
	debugfs_remove_recursive(cpas_core->dentry);
	cpas_core->dentry = NULL;
	return rc;
}

int cam_cpas_hw_probe(struct platform_device *pdev,
	struct cam_hw_intf **hw_intf)
{
@@ -1803,6 +1832,10 @@ int cam_cpas_hw_probe(struct platform_device *pdev,
	if (rc)
		goto axi_cleanup;

	rc  = cam_cpas_util_create_debugfs(cpas_core);
	if (rc)
		CAM_WARN(CAM_CPAS, "Failed to create dentry");

	*hw_intf = cpas_hw_intf;
	return 0;

@@ -1854,6 +1887,8 @@ int cam_cpas_hw_remove(struct cam_hw_intf *cpas_hw_intf)
	cam_cpas_util_unregister_bus_client(&cpas_core->ahb_bus_client);
	cam_cpas_util_client_cleanup(cpas_hw);
	cam_cpas_soc_deinit_resources(&cpas_hw->soc_info);
	debugfs_remove_recursive(cpas_core->dentry);
	cpas_core->dentry = NULL;
	flush_workqueue(cpas_core->work_queue);
	destroy_workqueue(cpas_core->work_queue);
	mutex_destroy(&cpas_hw->hw_mutex);
+6 −1
Original line number Diff line number Diff line
@@ -181,7 +181,10 @@ struct cam_cpas_axi_port {
 * @axi_port: AXI port info for a specific axi index
 * @internal_ops: CPAS HW internal ops
 * @work_queue: Work queue handle
 *
 * @irq_count: atomic irq count
 * @irq_count_wq: wait variable to ensure all irq's are handled
 * @dentry: debugfs file entry
 * @ahb_bus_scaling_enable: ahb scaling based on src clk corner for bus
 */
struct cam_cpas {
	struct cam_cpas_hw_caps hw_caps;
@@ -199,6 +202,8 @@ struct cam_cpas {
	struct workqueue_struct *work_queue;
	atomic_t irq_count;
	wait_queue_head_t irq_count_wq;
	struct dentry *dentry;
	bool ahb_bus_scaling_enable;
};

int cam_camsstop_get_internal_ops(struct cam_cpas_internal_ops *internal_ops);
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ int cam_fd_soc_enable_resources(struct cam_hw_soc_info *soc_info)
	int rc;

	ahb_vote.type = CAM_VOTE_ABSOLUTE;
	ahb_vote.vote.level = CAM_SVS_VOTE;
	ahb_vote.vote.level = CAM_LOWSVS_VOTE;
	axi_vote.num_paths = 2;
	axi_vote.axi_path[0].path_data_type = CAM_AXI_PATH_DATA_ALL;
	axi_vote.axi_path[0].transac_type = CAM_AXI_TRANSACTION_READ;
Loading