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

Commit 4a520b70 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 d88fc1fc
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, 2016-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013, 2016-2018, 2020,
 *
 * The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -248,6 +250,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, hid_div, m = 0, n = 0, mode = 0, mask;
	unsigned long recalc_rate;

	if (rcg->flags & DFS_ENABLE_RCG)
		return rcg->current_freq;
@@ -285,7 +288,16 @@ 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,