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

Commit 24a8e3aa authored by Veera Vegivada's avatar Veera Vegivada
Browse files

clk: qcom: clk-alpha-pll: add support for custom register initialization



Add support for configuring custom target-specific registers
during PLL initialization.

Change-Id: I0b6d3981bc3502141f2796db73015d4656527260
Signed-off-by: default avatarVeera Vegivada <vvegivad@codeaurora.org>
parent 4cd8ff39
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2015, 2018-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015, 2018-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/kernel.h>
@@ -1328,6 +1328,16 @@ const struct clk_ops clk_alpha_pll_postdiv_ro_ops = {
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_ro_ops);

static void clk_alpha_pll_custom_configure(struct clk_alpha_pll *pll,
		struct regmap *regmap, const struct alpha_pll_config *config)
{
	int i;

	for (i = 0; i < config->num_custom_reg; i++)
		regmap_write(regmap, pll->offset + config->custom_reg_offset[i],
				config->custom_reg_val[i]);
}

int clk_fabia_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
			     const struct alpha_pll_config *config)
{
@@ -1379,6 +1389,8 @@ int clk_fabia_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
		regmap_update_bits(regmap, PLL_USER_CTL(pll), mask, val);
	}

	clk_alpha_pll_custom_configure(pll, regmap, config);

	regmap_update_bits(regmap, PLL_MODE(pll), PLL_UPDATE_BYPASS,
							PLL_UPDATE_BYPASS);

@@ -1786,16 +1798,6 @@ static int lucid_pll_is_enabled(struct clk_alpha_pll *pll,
		(mode_regval & PLL_OUTCTRL));
}

static void clk_alpha_pll_custom_configure(struct clk_alpha_pll *pll,
		struct regmap *regmap, const struct alpha_pll_config *config)
{
	int i;

	for (i = 0; i < config->num_custom_reg; i++)
		regmap_write(regmap, pll->offset + config->custom_reg_offset[i],
				config->custom_reg_val[i]);
}

void clk_lucid_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
				const struct alpha_pll_config *config)
{