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

Commit 7d0cb128 authored by Vishalsingh Hajeri's avatar Vishalsingh Hajeri Committed by Pavan Kumar Chilamkurthi
Browse files

msm: camera: icp: cap clock rate to turbo



In case the incoming clock rate is greater then
turbo clock rate, set the clock rate to turbo. While
snapshot use cases icp driver calculates required
clock rate which can be greater than max clock freq
supported. In such cases, cap the clk frequency to
turbo while setting to clock driver.

Change-Id: Idf349e12477a6206cd332a0c26ad156df9784364
Signed-off-by: default avatarvhajeri <vhajeri@codeaurora.org>
Signed-off-by: default avatarPavan Kumar Chilamkurthi <pchilamk@codeaurora.org>
parent c092e59f
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 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
@@ -138,9 +138,22 @@ int cam_bps_get_gdsc_control(struct cam_hw_soc_info *soc_info)
int cam_bps_update_clk_rate(struct cam_hw_soc_info *soc_info,
	uint32_t clk_rate)
{
	int32_t src_clk_idx;

	if (!soc_info)
		return -EINVAL;

	src_clk_idx = soc_info->src_clk_idx;

	if ((soc_info->clk_level_valid[CAM_TURBO_VOTE] == true) &&
		(soc_info->clk_rate[CAM_TURBO_VOTE][src_clk_idx] != 0) &&
		(clk_rate > soc_info->clk_rate[CAM_TURBO_VOTE][src_clk_idx])) {
		CAM_DBG(CAM_ICP, "clk_rate %d greater than max, reset to %d",
			clk_rate,
			soc_info->clk_rate[CAM_TURBO_VOTE][src_clk_idx]);
		clk_rate = soc_info->clk_rate[CAM_TURBO_VOTE][src_clk_idx];
	}

	return cam_soc_util_set_clk_rate(soc_info->clk[soc_info->src_clk_idx],
		soc_info->clk_name[soc_info->src_clk_idx], clk_rate);
}
+14 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 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
@@ -141,9 +141,22 @@ int cam_ipe_disable_soc_resources(struct cam_hw_soc_info *soc_info,
int cam_ipe_update_clk_rate(struct cam_hw_soc_info *soc_info,
	uint32_t clk_rate)
{
	int32_t src_clk_idx;

	if (!soc_info)
		return -EINVAL;

	src_clk_idx = soc_info->src_clk_idx;

	if ((soc_info->clk_level_valid[CAM_TURBO_VOTE] == true) &&
		(soc_info->clk_rate[CAM_TURBO_VOTE][src_clk_idx] != 0) &&
		(clk_rate > soc_info->clk_rate[CAM_TURBO_VOTE][src_clk_idx])) {
		CAM_DBG(CAM_ICP, "clk_rate %d greater than max, reset to %d",
			clk_rate,
			soc_info->clk_rate[CAM_TURBO_VOTE][src_clk_idx]);
		clk_rate = soc_info->clk_rate[CAM_TURBO_VOTE][src_clk_idx];
	}

	return cam_soc_util_set_clk_rate(soc_info->clk[soc_info->src_clk_idx],
		soc_info->clk_name[soc_info->src_clk_idx], clk_rate);
}