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

Commit 15c48e61 authored by Taniya Das's avatar Taniya Das Committed by Gerrit - the friendly Code Review server
Browse files

clk: qcom: clk-alpha-pll: Add support for Fabia print registers



Fabia PLL print registers are required to get the PLL values
from the debugfs, thus add support for the same.

Change-Id: I24587bdba0445639ebee86c7efee543d3c37ba42
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent 5c7c89b6
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
@@ -1895,6 +1895,60 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate,
	return __clk_alpha_pll_update_latch(pll);
}

static void clk_fabia_pll_list_registers(struct seq_file *f, struct clk_hw *hw)
{
	struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
	int size, i, val;

	static struct clk_register_data data[] = {
		{"PLL_MODE", PLL_OFF_MODE},
		{"PLL_L_VAL", PLL_OFF_L_VAL},
		{"PLL_CAL_L_VAL", PLL_OFF_CAL_L_VAL},
		{"PLL_USER_CTL", PLL_OFF_USER_CTL},
		{"PLL_USER_CTL_U", PLL_OFF_USER_CTL_U},
		{"PLL_CONFIG_CTL", PLL_OFF_CONFIG_CTL},
		{"PLL_CONFIG_CTL_U", PLL_OFF_CONFIG_CTL_U},
		{"PLL_TEST_CTL", PLL_OFF_TEST_CTL},
		{"PLL_TEST_CTL_U", PLL_OFF_TEST_CTL_U},
		{"PLL_STATUS", PLL_OFF_STATUS},
		{"PLL_OPMODE", PLL_OFF_OPMODE},
		{"PLL_FRAC", PLL_OFF_FRAC},
	};

	static struct clk_register_data data1[] = {
		{"APSS_PLL_VOTE", 0x0},
	};

	size = ARRAY_SIZE(data);

	for (i = 0; i < size; i++) {
		regmap_read(pll->clkr.regmap, pll->offset +
					pll->regs[data[i].offset], &val);
		seq_printf(f, "%20s: 0x%.8x\n", data[i].name, val);
	}

	regmap_read(pll->clkr.regmap, pll->offset + pll->regs[data[0].offset],
								&val);

	if (val & PLL_FSM_ENA) {
		regmap_read(pll->clkr.regmap, pll->clkr.enable_reg +
				data1[0].offset, &val);
		seq_printf(f, "%20s: 0x%.8x\n", data1[0].name, val);
	}
}

static struct clk_regmap_ops clk_fabia_pll_regmap_ops = {
	.list_registers = &clk_fabia_pll_list_registers,
};

static void clk_fabia_pll_init(struct clk_hw *hw)
{
	struct clk_regmap *rclk = to_clk_regmap(hw);

	if (!rclk->ops)
		rclk->ops = &clk_fabia_pll_regmap_ops;
}

const struct clk_ops clk_alpha_pll_fabia_ops = {
	.prepare = clk_prepare_regmap,
	.unprepare = clk_unprepare_regmap,
@@ -1906,6 +1960,8 @@ const struct clk_ops clk_alpha_pll_fabia_ops = {
	.set_rate = alpha_pll_fabia_set_rate,
	.recalc_rate = alpha_pll_fabia_recalc_rate,
	.round_rate = clk_alpha_pll_round_rate,
	.debug_init = clk_common_debug_init,
	.init = clk_fabia_pll_init,
#ifdef CONFIG_COMMON_CLK_QCOM_DEBUG
	.list_rate_vdd_level = clk_list_rate_vdd_level,
#endif
@@ -1922,6 +1978,8 @@ const struct clk_ops clk_alpha_pll_fixed_fabia_ops = {
	.is_enabled = clk_alpha_pll_is_enabled,
	.recalc_rate = alpha_pll_fabia_recalc_rate,
	.round_rate = clk_alpha_pll_round_rate,
	.debug_init = clk_common_debug_init,
	.init = clk_fabia_pll_init,
#ifdef CONFIG_COMMON_CLK_QCOM_DEBUG
	.list_rate_vdd_level = clk_list_rate_vdd_level,
#endif