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

Commit 766488ad authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: isp: add validation of CSID clk rate"

parents 0876b933 49f68e13
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1052,7 +1052,7 @@ static int cam_ife_csid_enable_hw(struct cam_ife_csid_hw *csid_hw)
	CAM_DBG(CAM_ISP, "CSID:%d init CSID HW",
		csid_hw->hw_intf->hw_idx);

	clk_lvl = cam_ife_csid_get_vote_level(soc_info, csid_hw->clk_rate);
	clk_lvl = cam_soc_util_get_vote_level(soc_info, csid_hw->clk_rate);
	CAM_DBG(CAM_ISP, "CSID clock lvl %u", clk_lvl);

	rc = cam_ife_csid_enable_soc_resources(soc_info, clk_lvl);
+3 −24
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */
#include <linux/slab.h>
#include "cam_ife_csid_soc.h"
@@ -110,7 +110,7 @@ int cam_ife_csid_deinit_soc_resources(
}

int cam_ife_csid_enable_soc_resources(
	struct cam_hw_soc_info *soc_info, uint32_t clk_lvl)
	struct cam_hw_soc_info *soc_info, enum cam_vote_level clk_level)
{
	int rc = 0;
	struct cam_csid_soc_private       *soc_private;
@@ -135,7 +135,7 @@ int cam_ife_csid_enable_soc_resources(
	}

	rc = cam_soc_util_enable_platform_resource(soc_info, true,
		clk_lvl, true);
		clk_level, true);
	if (rc) {
		CAM_ERR(CAM_ISP, "enable platform failed");
		goto stop_cpas;
@@ -228,24 +228,3 @@ int cam_ife_csid_disable_ife_force_clock_on(struct cam_hw_soc_info *soc_info,

	return rc;
}

uint32_t cam_ife_csid_get_vote_level(struct cam_hw_soc_info *soc_info,
	uint64_t clock_rate)
{
	int i = 0;

	if (!clock_rate)
		return CAM_SVS_VOTE;

	for (i = 0; i < CAM_MAX_VOTE; i++) {
		if (soc_info->clk_rate[i][soc_info->num_clk - 1] >=
			clock_rate) {
			CAM_DBG(CAM_ISP,
				"Clock rate %lld, selected clock level %d",
				clock_rate, i);
			return i;
		}
	}

	return CAM_TURBO_VOTE;
}
+22 −0
Original line number Diff line number Diff line
@@ -1718,3 +1718,25 @@ int cam_soc_util_reg_dump(struct cam_hw_soc_info *soc_info,

	return 0;
}

uint32_t cam_soc_util_get_vote_level(struct cam_hw_soc_info *soc_info,
	uint64_t clock_rate)
{
	int i = 0;

	if (!clock_rate)
		return CAM_SVS_VOTE;

	for (i = 0; i < CAM_MAX_VOTE; i++) {
		if (soc_info->clk_level_valid[i] &&
			soc_info->clk_rate[i][soc_info->src_clk_idx] >=
			clock_rate) {
			CAM_DBG(CAM_UTIL,
				"Clock rate %lld, selected clock level %d",
				clock_rate, i);
			return i;
		}
	}

	return CAM_TURBO_VOTE;
}
+3 −0
Original line number Diff line number Diff line
@@ -633,4 +633,7 @@ void cam_soc_util_clk_disable_default(struct cam_hw_soc_info *soc_info);
int cam_soc_util_clk_enable_default(struct cam_hw_soc_info *soc_info,
	enum cam_vote_level clk_level);

uint32_t cam_soc_util_get_vote_level(struct cam_hw_soc_info *soc_info,
	uint64_t clock_rate);

#endif /* _CAM_SOC_UTIL_H_ */