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

Commit 911cdb13 authored by Alok Kediya's avatar Alok Kediya Committed by Shubhraprakash Das
Browse files

msm: camera: isp: Set the clock rate for camss vfe clock



Make sure rate for camss vfe clock is set before enabling it.
Also, reuse existing variables for the vfe src clk.

CRs-Fixed: 2013802
Change-Id: Ic4acd4c8330b9300ea6bb84eb99a120453841f7a
Signed-off-by: default avatarAlok Kediya <kediya@codeaurora.org>
parent 928cd386
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -802,7 +802,6 @@ struct vfe_device {

	/* State variables */
	uint32_t vfe_hw_version;
	int vfe_clk_idx;
	uint32_t vfe_open_cnt;
	uint8_t vt_enable;
	uint32_t vfe_ub_policy;
@@ -819,7 +818,6 @@ struct vfe_device {
	struct msm_isp_statistics *stats;
	uint64_t msm_isp_last_overflow_ab;
	uint64_t msm_isp_last_overflow_ib;
	uint32_t msm_isp_vfe_clk_rate;
	struct msm_isp_ub_info *ub_info;
	uint32_t isp_sof_debug;
	uint32_t isp_raw0_debug;
+11 −7
Original line number Diff line number Diff line
@@ -281,9 +281,11 @@ int msm_isp47_ahb_clk_cfg(struct vfe_device *vfe_dev,

	vfe_dev->hw_info->vfe_ops.platform_ops.get_clk_rates(vfe_dev,
							&clk_rates);
	if (vfe_dev->msm_isp_vfe_clk_rate <= clk_rates.svs_rate)
	if (vfe_dev->vfe_clk_info[vfe_dev->hw_info->vfe_clk_idx].clk_rate <=
		clk_rates.svs_rate)
		src_clk_vote = CAM_AHB_SVS_VOTE;
	else if (vfe_dev->msm_isp_vfe_clk_rate <= clk_rates.nominal_rate)
	else if (vfe_dev->vfe_clk_info[vfe_dev->hw_info->vfe_clk_idx].clk_rate
		<= clk_rates.nominal_rate)
		src_clk_vote = CAM_AHB_NOMINAL_VOTE;
	else
		src_clk_vote = CAM_AHB_TURBO_VOTE;
@@ -2595,17 +2597,19 @@ int msm_vfe47_set_clk_rate(struct vfe_device *vfe_dev, long *rate)
	long clk_rate, prev_clk_rate;

	clk_rate = clk_round_rate(vfe_dev->vfe_clk[clk_idx], *rate);
	if (vfe_dev->msm_isp_vfe_clk_rate == clk_rate)
	if (vfe_dev->vfe_clk_info[clk_idx].clk_rate == clk_rate)
		return rc;

	prev_clk_rate = vfe_dev->msm_isp_vfe_clk_rate;
	vfe_dev->msm_isp_vfe_clk_rate = clk_rate;
	prev_clk_rate =
		vfe_dev->vfe_clk_info[clk_idx].clk_rate;
	vfe_dev->vfe_clk_info[clk_idx].clk_rate =
		clk_rate;
	/*
	 * if cx_ipeak is supported vote first so that dsp throttling is
	 * reduced before we go to turbo
	 */
	if ((vfe_dev->vfe_cx_ipeak) &&
		(vfe_dev->msm_isp_vfe_clk_rate >=
		(vfe_dev->vfe_clk_info[clk_idx].clk_rate >=
		vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_NOMINAL]
		[vfe_dev->hw_info->vfe_clk_idx]) &&
		prev_clk_rate <
@@ -2628,7 +2632,7 @@ int msm_vfe47_set_clk_rate(struct vfe_device *vfe_dev, long *rate)
	 * if voting done earlier
	 */
	if ((vfe_dev->vfe_cx_ipeak) &&
		(vfe_dev->msm_isp_vfe_clk_rate <
		(vfe_dev->vfe_clk_info[clk_idx].clk_rate <
		vfe_dev->vfe_clk_rates[MSM_VFE_CLK_RATE_NOMINAL]
		[vfe_dev->hw_info->vfe_clk_idx]) &&
		prev_clk_rate >=
+5 −2
Original line number Diff line number Diff line
@@ -1136,7 +1136,8 @@ static void msm_isp_calculate_bandwidth(
		axi_data = &vfe_dev->axi_data;
		if (stream_info->stream_src < RDI_INTF_0) {
			stream_info->bandwidth[i] =
				(vfe_dev->msm_isp_vfe_clk_rate /
				(vfe_dev->vfe_clk_info[
				vfe_dev->hw_info->vfe_clk_idx].clk_rate /
				axi_data->src_info[VFE_PIX_0].width) *
				stream_info->max_width[i];
			stream_info->bandwidth[i] =
@@ -1149,7 +1150,9 @@ static void msm_isp_calculate_bandwidth(
					stream_info->output_format);
			if (rdi < VFE_SRC_MAX) {
				stream_info->bandwidth[i] =
				(vfe_dev->msm_isp_vfe_clk_rate / 8) * bpp;
				(vfe_dev->vfe_clk_info[
				vfe_dev->hw_info->vfe_clk_idx].clk_rate /
				8) * bpp;
			} else {
				pr_err("%s: Invalid rdi interface\n", __func__);
			}
+4 −2
Original line number Diff line number Diff line
@@ -166,7 +166,8 @@ void msm_isp_util_get_bandwidth_stats(struct vfe_device *vfe_dev,
	stats->isp_cpp_ib = isp_bandwidth_mgr.client_info[ISP_CPP].ib;
	stats->last_overflow_ab = vfe_dev->msm_isp_last_overflow_ab;
	stats->last_overflow_ib = vfe_dev->msm_isp_last_overflow_ib;
	stats->vfe_clk_rate = vfe_dev->msm_isp_vfe_clk_rate;
	stats->vfe_clk_rate = vfe_dev->vfe_clk_info[
				vfe_dev->hw_info->vfe_clk_idx].clk_rate;
	stats->cpp_clk_rate = msm_isp_cpp_clk_rate;
}

@@ -538,7 +539,8 @@ int msm_isp_cfg_input(struct vfe_device *vfe_dev, void *arg)
	 * Only set rate to higher, do not lower higher
	 * rate needed by another input
	 */
	if (pixel_clock > vfe_dev->msm_isp_vfe_clk_rate) {
	if (pixel_clock > vfe_dev->vfe_clk_info[
				vfe_dev->hw_info->vfe_clk_idx].clk_rate) {
		rc = vfe_dev->hw_info->vfe_ops.platform_ops.set_clk_rate(
			vfe_dev,
			&pixel_clock);