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

Commit cb5e35a9 authored by Taniya Das's avatar Taniya Das
Browse files

clk: qcom: rcg2: handle non-cxo frequency for enable_safe_config



There could be conditions where the RCG is configured and enabled for a
non-cxo frequency previous to HLOS. Check the condition during recalc
and update the current frequency with the actual frequency.

Change-Id: I9539f2bfe16378085ccdb06c32a4ea2c3bdfb456
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent aac560a6
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
	struct clk_rcg2 *rcg = to_clk_rcg2(hw);
	const struct freq_tbl *f_curr;
	u32 cfg, src, hid_div, m = 0, n = 0, mode = 0, mask;
	unsigned long recalc_rate;

	if (rcg->flags & DFS_ENABLE_RCG)
		return rcg->current_freq;
@@ -305,7 +306,17 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
		hid_div &= mask;
	}

	return clk_rcg2_calc_rate(parent_rate, m, n, mode, hid_div);

	recalc_rate = clk_rcg2_calc_rate(parent_rate, m, n, mode, hid_div);

	/*
	 * Check the case when the RCG has been initialized to a non-CXO
	 * frequency.
	 */
	if (rcg->enable_safe_config && !rcg->current_freq)
		rcg->current_freq = recalc_rate;

	return recalc_rate;
}

static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,