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

Commit 9750c9d5 authored by Veera Vegivada's avatar Veera Vegivada
Browse files

clk: qcom: gpucc-sm8150: Add GPU clock driver support for SCSHRIKE



There are a few changes in the frequency plan for Graphics between
SM8150 and SCSHRIKE. Pull those change into the graphics clock
driver and enable support for SCSHRIKE.

Change-Id: I1ddd57fca04207a3c558f15ccc58a9b06a3a6899
Signed-off-by: default avatarVeera Vegivada <vvegivad@codeaurora.org>
parent d7632a64
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -103,6 +103,14 @@ static const struct freq_tbl ftbl_gpu_cc_gmu_clk_src[] = {
	{ }
};

static const struct freq_tbl ftbl_gpu_cc_gmu_clk_src_scshrike[] = {
	F(19200000, P_BI_TCXO, 1, 0, 0),
	F(200000000, P_GPLL0_OUT_MAIN_DIV, 1.5, 0, 0),
	F(400000000, P_GPLL0_OUT_MAIN, 1.5, 0, 0),
	F(500000000, P_GPU_CC_PLL1_OUT_MAIN, 1, 0, 0),
	{ }
};

static struct clk_rcg2 gpu_cc_gmu_clk_src = {
	.cmd_rcgr = 0x1120,
	.mnd_width = 0,
@@ -270,10 +278,33 @@ static const struct qcom_cc_desc gpu_cc_sm8150_desc = {
static const struct of_device_id gpu_cc_sm8150_match_table[] = {
	{ .compatible = "qcom,sm8150-gpucc" },
	{ .compatible = "qcom,sa8155-gpucc" },
	{ .compatible = "qcom,scshrike-gpucc" },
	{ }
};
MODULE_DEVICE_TABLE(of, gpu_cc_sm8150_match_table);

static void gpu_cc_sm8150_fixup_scshrike(void)
{
	gpu_cc_gmu_clk_src.freq_tbl = ftbl_gpu_cc_gmu_clk_src_scshrike;
	gpu_cc_gmu_clk_src.clkr.vdd_data.rate_max[VDD_LOW] = 400000000;
	gpu_cc_gmu_clk_src.clkr.vdd_data.rate_max[VDD_LOW_L1] = 500000000;
}

static int gpu_cc_sm8150_fixup(struct platform_device *pdev)
{
	const char *compat = NULL;
	int compatlen = 0;

	compat = of_get_property(pdev->dev.of_node, "compatible", &compatlen);
	if (!compat || (compatlen <= 0))
		return -EINVAL;

	if (!strcmp(compat, "qcom,gpucc-scshrike"))
		gpu_cc_sm8150_fixup_scshrike();

	return 0;
}

static int gpu_cc_sm8150_probe(struct platform_device *pdev)
{
	struct regmap *regmap;
@@ -297,6 +328,10 @@ static int gpu_cc_sm8150_probe(struct platform_device *pdev)
	if (IS_ERR(regmap))
		return PTR_ERR(regmap);

	ret = gpu_cc_sm8150_fixup(pdev);
	if (ret)
		return ret;

	clk_trion_pll_configure(&gpu_cc_pll1, regmap, gpu_cc_pll1.config);

	ret = qcom_cc_really_probe(pdev, &gpu_cc_sm8150_desc, regmap);