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

Commit dfd9e6e6 authored by Deepak Katragadda's avatar Deepak Katragadda
Browse files

clk: qcom: clk-rcg2: Correct the erroneous RCG configuration during enable



If the RCG frequency table does not have CXO as one of its supported
frequencies, and if a client calls clk_enable on it prior to setting
its rate, the current RCG code would configure it to the lowest
supported frequency instead which would then lead the subsequent
call to update the configuration to fail because the parent PLLs are
not active. Correct this behavior.

CRs-Fixed: 1112062
Change-Id: Ib2c09f9f503724bafd32b963b5b0ea84da7c4b7b
Signed-off-by: default avatarDeepak Katragadda <dkatraga@codeaurora.org>
parent 53c1534d
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, 2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013, 2016-2017, 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
@@ -411,6 +411,15 @@ static int clk_rcg2_enable(struct clk_hw *hw)
	if (!f)
		return -EINVAL;

	/*
	 * If CXO is not listed as a supported frequency in the frequency
	 * table, the above API would return the lowest supported frequency
	 * instead. This will lead to incorrect configuration of the RCG.
	 * Check if the RCG rate is CXO and configure it accordingly.
	 */
	if (rate == cxo_f.freq)
		f = &cxo_f;

	clk_rcg2_set_force_enable(hw);
	clk_rcg2_configure(rcg, f);
	clk_rcg2_clear_force_enable(hw);